* fix include path not found in install_plugin.php when running from other directory

This commit is contained in:
slawkens 2019-04-23 23:52:13 +02:00
parent 7b1989cef2
commit 9620ac7d25

View File

@ -1,22 +1,22 @@
<?php <?php
if(php_sapi_name() != "cli") { if(PHP_SAPI !== 'cli') {
die('This script can be run only in command line mode.'); die('This script can be run only in command line mode.');
} }
require_once '../../common.php'; require_once __DIR__ . '/../../common.php';
require_once SYSTEM . 'functions.php'; require_once SYSTEM . 'functions.php';
require_once SYSTEM . 'init.php'; require_once SYSTEM . 'init.php';
require_once SYSTEM . 'hooks.php'; require_once SYSTEM . 'hooks.php';
require_once LIBS . 'plugins.php'; require_once LIBS . 'plugins.php';
if($argc != 2) { if($argc !== 2) {
exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL); exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL);
} }
$path_to_file = $argv[1]; $path_to_file = $argv[1];
$ext = strtolower(pathinfo($path_to_file, PATHINFO_EXTENSION)); $ext = strtolower(pathinfo($path_to_file, PATHINFO_EXTENSION));
if($ext != 'zip') {// check if it is zipped/compressed file if($ext !== 'zip') {// check if it is zipped/compressed file
exit('Please install only .zip files.' . PHP_EOL); exit('Please install only .zip files.' . PHP_EOL);
} }
@ -36,4 +36,3 @@ else
echo 'ERROR: ' . Plugins::getError(); echo 'ERROR: ' . Plugins::getError();
echo PHP_EOL; echo PHP_EOL;
?>