]> git.mxchange.org Git - friendica.git/commitdiff
refactor chdir() in worker.php
authorArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 11:56:25 +0000 (11:56 +0000)
committerArt4 <art4@wlabs.de>
Thu, 26 Dec 2024 11:56:25 +0000 (11:56 +0000)
bin/worker.php

index 29fd5a4fb7bd1e71d235d24d71e42cca475d93d3..668e99f904d03f46a1fd11bff6abad1c06f1e030 100755 (executable)
@@ -28,16 +28,7 @@ $longopts = ['spawn', 'no_cron'];
 $options = getopt($shortopts, $longopts);
 
 // Ensure that worker.php is executed from the base path of the installation
-if (!file_exists("index.php") && (sizeof($_SERVER["argv"]) != 0)) {
-       $directory = dirname($_SERVER["argv"][0]);
-
-       if (substr($directory, 0, 1) != '/') {
-               $directory = $_SERVER["PWD"] . '/' . $directory;
-       }
-       $directory = realpath($directory . '/..');
-
-       chdir($directory);
-}
+chdir(dirname(__DIR__));
 
 require dirname(__DIR__) . '/vendor/autoload.php';