]> git.mxchange.org Git - friendica.git/commitdiff
Move scripts/worker.php to bin/
authorHypolite Petovan <mrpetovan@gmail.com>
Mon, 19 Mar 2018 03:25:21 +0000 (23:25 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Mon, 19 Mar 2018 03:25:21 +0000 (23:25 -0400)
INSTALL.txt
bin/daemon.php
bin/worker.php [new file with mode: 0644]
doc/Install.md
doc/de/Install.md
scripts/worker.php [deleted file]
src/Core/Worker.php
util/vagrant_provision.sh

index ee3779bc9d10e1cf5da2db128d2cea531f9d78c3..2a95822a2e3a626a0802e75afcb373d9f21e64de 100644 (file)
@@ -113,14 +113,14 @@ tables, so that you can start fresh.
 8. Set up a cron job or scheduled task to run the worker once every 5-10
 minutes to pick up the recent "public" postings of your friends. Example:
 
-       cd /base/directory; /path/to/php scripts/worker.php
+       cd /base/directory; /path/to/php bin/worker.php
 
 Change "/base/directory", and "/path/to/php" as appropriate for your situation.
 
 If you are using a Linux server, run "crontab -e" and add a line like the
 one shown, substituting for your unique paths and settings:
 
-*/10 * * * *   cd /home/myname/mywebsite; /usr/bin/php scripts/worker.php
+*/10 * * * *   cd /home/myname/mywebsite; /usr/bin/php bin/worker.php
 
 You can generally find the location of PHP by executing "which php". If you
 have troubles with this section please contact your hosting provider for
@@ -293,14 +293,14 @@ cron by using something like
 
  */10 * * * * cd /var/www/friendica/friendica/ && sudo -u www-data /usr/bin/php
 -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none
--f scripts/worker.php
+-f bin/worker.php
 
 This worked well for simple test cases, but the friendica-cron still failed with
 a fatal error:
 suhosin[22962]: ALERT - function within blacklist called: proc_open() (attacker
 'REMOTE_ADDR not set', file '/var/www/friendica/friendica/boot.php', line 1341)
 
-After a while I noticed, that scripts/worker.php calls further php script via
+After a while I noticed, that bin/worker.php calls further php script via
 proc_open. These scripts themselves also use proc_open and fail, because they
 are NOT called with -d suhosin.executor.func.blacklist=none.
 
index b53a69e1b9370a94ec0ee3d0e0a7f054cfb86706..6b0e377a3a1bfa0126c8a4bfe9b5d25efebd603c 100644 (file)
@@ -104,7 +104,7 @@ while (true) {
        set_time_limit(0);
 
        // Call the worker
-       $cmdline = $php.' scripts/worker.php';
+       $cmdline = $php.' bin/worker.php';
 
        $executed = false;
 
diff --git a/bin/worker.php b/bin/worker.php
new file mode 100644 (file)
index 0000000..67f9fed
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/env php
+<?php
+/**
+ * @file bin/worker.php
+ * @brief Starts the background processing
+ */
+
+use Friendica\App;
+use Friendica\BaseObject;
+use Friendica\Core\Addon;
+use Friendica\Core\Config;
+use Friendica\Core\Worker;
+
+// Ensure that worker.php is executed from the base path of the installation
+if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
+       $directory = dirname($_SERVER["argv"][0]);
+
+       if (substr($directory, 0, 1) != "/") {
+               $directory = $_SERVER["PWD"]."/".$directory;
+       }
+       $directory = realpath($directory."/..");
+
+       chdir($directory);
+}
+
+require_once "boot.php";
+require_once "include/dba.php";
+
+$a = new App(dirname(__DIR__));
+BaseObject::setApp($a);
+
+require_once ".htconfig.php";
+dba::connect($db_host, $db_user, $db_pass, $db_data);
+unset($db_host, $db_user, $db_pass, $db_data);
+
+Config::load();
+
+// Check the database structure and possibly fixes it
+check_db(true);
+
+// Quit when in maintenance
+if (Config::get('system', 'maintenance', true)) {
+       return;
+}
+
+$a->set_baseurl(Config::get('system', 'url'));
+
+Addon::loadHooks();
+
+$spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
+
+if ($spawn) {
+       Worker::spawnWorker();
+       killme();
+}
+
+$run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
+
+Worker::processQueue($run_cron);
+
+Worker::unclaimProcess();
+
+Worker::endProcess();
+
+killme();
+
index 23232347ede9f26ef9cf46f046f5c7d18c9e096d..4c37ed76d1e162b3cfa5c6feb9438d48558f4d02 100644 (file)
@@ -101,14 +101,14 @@ You might wish to move/rename .htconfig.php to another name and empty (called 'd
 Set up a cron job or scheduled task to run the worker once every 5-10 minutes in order to perform background processing.
 Example:
 
-    cd /base/directory; /path/to/php scripts/worker.php
+    cd /base/directory; /path/to/php bin/worker.php
 
 Change "/base/directory", and "/path/to/php" as appropriate for your situation.
 
 If you are using a Linux server, run "crontab -e" and add a line like the
 one shown, substituting for your unique paths and settings:
 
-    */10 * * * * cd /home/myname/mywebsite; /usr/bin/php scripts/worker.php
+    */10 * * * * cd /home/myname/mywebsite; /usr/bin/php bin/worker.php
 
 You can generally find the location of PHP by executing "which php".
 If you run into trouble with this section please contact your hosting provider for assistance.
index 916c131d61d578cbfe84a5be7024a684be41699d..c718804174ad4b15fa0e5fe4a26543c71a6c48c5 100644 (file)
@@ -86,13 +86,13 @@ Wenn du irgendwelche **kritischen** Fehler zu diesen Zeitpunkt erhalten solltest
 
 7. Erstelle einen Cron job oder einen regelmäßigen Task, um den Poller alle 5-10 Minuten im Hintergrund ablaufen zu lassen. Beispiel:
 
-    `cd /base/directory; /path/to/php scripts/worker.php`
+    `cd /base/directory; /path/to/php bin/worker.php`
 
 Ändere "/base/directory" und "/path/to/php" auf deine Systemvorgaben.
 
 Wenn du einen Linux-Server nutzt, benutze den Befehl "crontab -e" und ergänze eine Zeile wie die Folgende; angepasst an dein System
 
-`*/10 * * * * cd /home/myname/mywebsite; /usr/bin/php scripts/worker.php`
+`*/10 * * * * cd /home/myname/mywebsite; /usr/bin/php bin/worker.php`
 
 Du kannst den PHP-Pfad finden, indem du den Befehl „which php“ ausführst.
 Wenn du Schwierigkeiten mit diesem Schritt hast, kannst du deinen Hosting-Anbieter kontaktieren.
diff --git a/scripts/worker.php b/scripts/worker.php
deleted file mode 100755 (executable)
index 1980a21..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env php
-<?php
-/**
- * @file scripts/worker.php
- * @brief Starts the background processing
- */
-
-use Friendica\App;
-use Friendica\BaseObject;
-use Friendica\Core\Addon;
-use Friendica\Core\Config;
-use Friendica\Core\Worker;
-
-// Ensure that worker.php is executed from the base path of the installation
-if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
-       $directory = dirname($_SERVER["argv"][0]);
-
-       if (substr($directory, 0, 1) != "/") {
-               $directory = $_SERVER["PWD"]."/".$directory;
-       }
-       $directory = realpath($directory."/..");
-
-       chdir($directory);
-}
-
-require_once "boot.php";
-require_once "include/dba.php";
-
-$a = new App(dirname(__DIR__));
-BaseObject::setApp($a);
-
-require_once ".htconfig.php";
-dba::connect($db_host, $db_user, $db_pass, $db_data);
-unset($db_host, $db_user, $db_pass, $db_data);
-
-Config::load();
-
-// Check the database structure and possibly fixes it
-check_db(true);
-
-// Quit when in maintenance
-if (Config::get('system', 'maintenance', true)) {
-       return;
-}
-
-$a->set_baseurl(Config::get('system', 'url'));
-
-Addon::loadHooks();
-
-$spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
-
-if ($spawn) {
-       Worker::spawnWorker();
-       killme();
-}
-
-$run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
-
-Worker::processQueue($run_cron);
-
-Worker::unclaimProcess();
-
-Worker::endProcess();
-
-killme();
-
index 525287dd0d605488bccdb9aa747da04f4bbdf326..9d5b75f45c4467bd7b1b6fdb5b28dcc7cb792ade 100644 (file)
@@ -1003,7 +1003,7 @@ class Worker
         */
        public static function spawnWorker()
        {
-               $args = ["scripts/worker.php", "no_cron"];
+               $args = ["bin/worker.php", "no_cron"];
                get_app()->proc_run($args);
        }
 
index 7ca5a1f4e3d33e7f1ec327249e66160ee01ae7df..eab125b0d845f2de95cfd7cc36e828d3e49b7bd2 100755 (executable)
@@ -88,7 +88,7 @@ echo "create database friendica DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_ge
 $MYSQL -uroot -proot friendica < /vagrant/friendica_test_data.sql
 
 # create cronjob - activate if you have enough memory in you dev VM
-echo "*/10 * * * * cd /vagrant; /usr/bin/php scripts/worker.php" >> friendicacron
+echo "*/10 * * * * cd /vagrant; /usr/bin/php bin/worker.php" >> friendicacron
 sudo crontab friendicacron
 sudo rm friendicacron