|
18 | 18 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 | 19 | */
|
20 | 20 |
|
21 |
| -// Change current directory to the directory of current script |
22 | 21 | chdir(__DIR__);
|
23 |
| - |
24 | 22 | require 'app/bootstrap.php';
|
25 | 23 | require 'app/Mage.php';
|
26 | 24 |
|
|
29 | 27 | exit;
|
30 | 28 | }
|
31 | 29 |
|
32 |
| -// Only for urls |
33 |
| -// Don't remove this |
| 30 | +// Only for urls, don't remove this |
34 | 31 | $_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
|
35 | 32 | $_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
|
36 | 33 |
|
|
43 | 40 |
|
44 | 41 | umask(0);
|
45 | 42 |
|
46 |
| -$disabledFuncs = array_map('trim', explode(',', strtolower(ini_get('disable_functions')))); |
47 |
| -$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true; |
48 |
| -$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true; |
| 43 | +$disabledFuncs = array_map('trim', preg_split("/,|\s+/", strtolower(ini_get('disable_functions')))); |
| 44 | +$isShellDisabled = in_array('shell_exec', $disabledFuncs) |
| 45 | + || !str_contains(strtolower(PHP_OS), 'win') |
| 46 | + || !shell_exec('which expr 2>/dev/null') |
| 47 | + || !shell_exec('which ps 2>/dev/null') |
| 48 | + || !shell_exec('which sed 2>/dev/null'); |
49 | 49 |
|
50 | 50 | try {
|
51 | 51 | if (stripos(PHP_OS, 'win') === false) {
|
|
62 | 62 | $fileName = escapeshellarg(basename(__FILE__));
|
63 | 63 | $cronPath = escapeshellarg(__DIR__ . '/cron.sh');
|
64 | 64 |
|
65 |
| - shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1") . " > /dev/null 2>&1 &"); |
66 |
| - shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1") . " > /dev/null 2>&1 &"); |
| 65 | + shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1") . " &"); |
| 66 | + shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1") . " &"); |
67 | 67 | exit;
|
68 | 68 | }
|
69 | 69 | }
|
|
0 commit comments