Move scripts/worker.php to bin/

This commit is contained in:
Hypolite Petovan 2018-03-18 23:25:21 -04:00
parent e7e497e244
commit 1c2deac7e5
7 changed files with 12 additions and 12 deletions

View 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 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: 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. 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 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: 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 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 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 */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 -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 This worked well for simple test cases, but the friendica-cron still failed with
a fatal error: a fatal error:
suhosin[22962]: ALERT - function within blacklist called: proc_open() (attacker suhosin[22962]: ALERT - function within blacklist called: proc_open() (attacker
'REMOTE_ADDR not set', file '/var/www/friendica/friendica/boot.php', line 1341) '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 proc_open. These scripts themselves also use proc_open and fail, because they
are NOT called with -d suhosin.executor.func.blacklist=none. are NOT called with -d suhosin.executor.func.blacklist=none.

View file

@ -104,7 +104,7 @@ while (true) {
set_time_limit(0); set_time_limit(0);
// Call the worker // Call the worker
$cmdline = $php.' scripts/worker.php'; $cmdline = $php.' bin/worker.php';
$executed = false; $executed = false;

2
scripts/worker.php → bin/worker.php Executable file → Normal file
View file

@ -1,7 +1,7 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/** /**
* @file scripts/worker.php * @file bin/worker.php
* @brief Starts the background processing * @brief Starts the background processing
*/ */

View 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. Set up a cron job or scheduled task to run the worker once every 5-10 minutes in order to perform background processing.
Example: 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. 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 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: 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". 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. If you run into trouble with this section please contact your hosting provider for assistance.

View 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: 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. Ä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 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. 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. Wenn du Schwierigkeiten mit diesem Schritt hast, kannst du deinen Hosting-Anbieter kontaktieren.

View file

@ -1003,7 +1003,7 @@ class Worker
*/ */
public static function spawnWorker() public static function spawnWorker()
{ {
$args = ["scripts/worker.php", "no_cron"]; $args = ["bin/worker.php", "no_cron"];
get_app()->proc_run($args); get_app()->proc_run($args);
} }

View file

@ -88,7 +88,7 @@ echo "create database friendica DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_ge
$MYSQL -uroot -proot friendica < /vagrant/friendica_test_data.sql $MYSQL -uroot -proot friendica < /vagrant/friendica_test_data.sql
# create cronjob - activate if you have enough memory in you dev VM # 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 crontab friendicacron
sudo rm friendicacron sudo rm friendicacron