Browse Source

Merge pull request #4630 from MrPetovan/task/4629-move-executable-to-bin

Move executable scripts to bin/ (part 1)
pull/4653/head
Tobias Diekershoff 4 years ago
committed by GitHub
parent
commit
4d8d5ca6a5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      INSTALL.txt
  2. 6
      bin/auth_ejabberd.php
  3. 0
      bin/composer.phar
  4. 4
      bin/daemon.php
  5. 0
      bin/run_xgettext.sh
  6. 2
      bin/worker.php
  7. 12
      doc/Composer.md
  8. 2
      doc/Developers-Intro.md
  9. 2
      doc/Github.md
  10. 6
      doc/Install.md
  11. 2
      doc/Update.md
  12. 6
      doc/de/Install.md
  13. 6
      doc/install-ejabberd.md
  14. 2
      src/Core/Worker.php
  15. 6
      src/Util/ExAuth.php
  16. 6
      util/README
  17. 2
      util/vagrant_provision.sh

10
INSTALL.txt

@ -66,7 +66,7 @@ OR
git clone https://github.com/friendica/friendica [web server folder]
cd [web server folder]
php util/composer.phar install
php bin/composer.phar install
3. Create an empty database and note the access details (hostname, username,
password, database name).
@ -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.

6
scripts/auth_ejabberd.php → bin/auth_ejabberd.php

@ -13,14 +13,14 @@
* Installation:
*
* - Change it's owner to whichever user is running the server, ie. ejabberd
* $ chown ejabberd:ejabberd /path/to/friendica/scripts/auth_ejabberd.php
* $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php
*
* - Change the access mode so it is readable only to the user ejabberd and has exec
* $ chmod 700 /path/to/friendica/scripts/auth_ejabberd.php
* $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php
*
* - Edit your ejabberd.cfg file, comment out your auth_method and add:
* {auth_method, external}.
* {extauth_program, "/path/to/friendica/script/auth_ejabberd.php"}.
* {extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}.
*
* - Restart your ejabberd service, you should be able to login with your friendica auth info
*

0
util/composer.phar → bin/composer.phar

4
scripts/daemon.php → bin/daemon.php

@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
/**
* @file scripts/daemon.php
* @file bin/daemon.php
* @brief Run the worker from a daemon.
*
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
@ -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;

0
util/run_xgettext.sh → bin/run_xgettext.sh

2
scripts/worker.php → bin/worker.php

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

12
doc/Composer.md

@ -12,7 +12,7 @@ It's a command-line tool that downloads required libraries into the `vendor` fol
## How to use Composer
If you don't have Composer installed on your system, Friendica ships with a copy of it at `util/composer.phar`.
If you don't have Composer installed on your system, Friendica ships with a copy of it at `bin/composer.phar`.
For the purpose of this help, all examples will use this path to run Composer commands, however feel free to replace them with your own way of calling Composer.
Composer requires PHP CLI and the following examples assume it's available system-wide.
@ -30,7 +30,7 @@ Here are the typical commands you will have to run to do so:
````
~> git clone https://github.com/friendica/friendica.git friendica
~/friendica> cd friendica
~/friendica> util/composer.phar install
~/friendica> bin/composer.phar install
````
That's it! Composer will take care of fetching all the required libraries in the `vendor` folder and build the autoloader to make those libraries available to Friendica.
@ -42,7 +42,7 @@ Updating Friendica to the current stable or the latest develop version is easy w
````
~> cd friendica
~/friendica> git pull
~/friendica> util/composer.phar install
~/friendica> bin/composer.phar install
````
And that's it. If any library used by Friendica has been upgraded, Composer will fetch the version currently used by Friendica and refresh the autoloader to ensure the best performances.
@ -87,13 +87,13 @@ Or you can specify the exact version of the library if you code requires it, and
To add a library, just add its Packagist identifier to the `require` list and set a target version string.
Then you should run `util/composer.phar update` to add it to your local `vendor` folder and update the `composer.lock` file that specifies the current versions of the dependencies.
Then you should run `bin/composer.phar update` to add it to your local `vendor` folder and update the `composer.lock` file that specifies the current versions of the dependencies.
#### Updating an existing dependency
If a package needs to be updated, whether to the next minor version or to the next major version provided you changed the adequate code in Friendica, simply edit `composer.json` to update the target version string of the relevant library.
Then you should run `util/composer.phar update` to update it in your local `vendor` folder and update the `composer.lock` file that specifies the current versions of the dependencies.
Then you should run `bin/composer.phar update` to update it in your local `vendor` folder and update the `composer.lock` file that specifies the current versions of the dependencies.
Please note that you should commit both `composer.json` and `composer.lock` with your work every time you make a change to the former.
@ -111,7 +111,7 @@ This is because `sudo` doesn't always change the `HOME` environment variable, wh
However, you can temporarily change environment variable for the execution of a single command.
For Composer, this would be:
````
$> COMPOSER_HOME=/var/tmp/composer sudo -u [web user] util/composer.phar [mode]
$> COMPOSER_HOME=/var/tmp/composer sudo -u [web user] bin/composer.phar [mode]
````
## Related

2
doc/Developers-Intro.md

@ -61,7 +61,7 @@ If you want to have git automatically update the dependencies with composer, you
}
# `composer install` if the `composer.lock` file gets changed
# to update all the php dependencies
check_run composer.lock "util/composer.phar install --no-dev"
check_run composer.lock "bin/composer.phar install --no-dev"
just place it into `.git/hooks/post-merge` and make it executable.

2
doc/Github.md

@ -13,7 +13,7 @@ Introduction to the workflow with our GitHub repository
3. Fork the Friendica repository from [https://github.com/friendica/friendica.git](https://github.com/friendica/friendica.git).
4. Clone your fork from your GitHub account to your machine.
Follow the instructions provided here: [http://help.github.com/fork-a-repo/](http://help.github.com/fork-a-repo/) to create and use your own tracking fork on GitHub
5. Run `util/composer.phar install` in Friendica's folder.
5. Run `bin/composer.phar install` in Friendica's folder.
6. Commit your changes to your fork.
Then go to your GitHub page and create a "Pull request" to notify us to merge your work.

6
doc/Install.md

@ -47,7 +47,7 @@ The Linux commands to clone the repository into a directory "mywebsite" would be
git clone https://github.com/friendica/friendica.git mywebsite
cd mywebsite
util/composer.phar install
bin/composer.phar install
Make sure the folder *view/smarty3* exists and is writable by the webserver user
@ -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.

2
doc/Update.md

@ -21,7 +21,7 @@ You can get the latest changes at any time with
cd path/to/friendica
git pull
util/composer.phar install
bin/composer.phar install
The addon tree has to be updated separately like so:

6
doc/de/Install.md

@ -49,7 +49,7 @@ Wir planen, diese Einschränkung in einer zukünftigen Version zu beheben.
`cd meinewebseite`
`git pull`
`util/composer.phar install`
`bin/composer.phar install`
- Addons installieren
- zunächst solltest du **in** deinem Webseitenordner sein
@ -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.

6
doc/install-ejabberd.md

@ -11,16 +11,16 @@ Installation
- Change it's owner to whichever user is running the server, ie. ejabberd
$ chown ejabberd:ejabberd /path/to/friendica/include/auth_ejabberd.php
$ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php
- Change the access mode so it is readable only to the user ejabberd and has exec
$ chmod 700 /path/to/friendica/include/auth_ejabberd.php
$ chmod 700 /path/to/friendica/bin/auth_ejabberd.php
- Edit your ejabberd.cfg file, comment out your auth_method and add:
{auth_method, external}.
{extauth_program, "/path/to/friendica/include/auth_ejabberd.php"}.
{extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}.
- Disable the module "mod_register" and disable the registration:

2
src/Core/Worker.php

@ -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);
}

6
src/Util/ExAuth.php

@ -13,14 +13,14 @@
* Installation:
*
* - Change it's owner to whichever user is running the server, ie. ejabberd
* $ chown ejabberd:ejabberd /path/to/friendica/scripts/auth_ejabberd.php
* $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php
*
* - Change the access mode so it is readable only to the user ejabberd and has exec
* $ chmod 700 /path/to/friendica/scripts/auth_ejabberd.php
* $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php
*
* - Edit your ejabberd.cfg file, comment out your auth_method and add:
* {auth_method, external}.
* {extauth_program, "/path/to/friendica/script/auth_ejabberd.php"}.
* {extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}.
*
* - Restart your ejabberd service, you should be able to login with your friendica auth info
*

6
util/README

@ -78,11 +78,11 @@ More info at http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
Xgettext and .po workflow
1. Run util/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed)
1. Run bin/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed)
This script runs xgettext on source tree, extracting strings from L10n::t() and L10n::tt()
functions, and creates a util/messages.po file.
$ cd util; ./run_xgettext.sh
$ cd bin; ./run_xgettext.sh
2. copy util/messages.po to view/lang/<language>/messages.po
Replace <language> with the language you are working on - e.g. 'es', 'fr', 'de', etc.
@ -111,7 +111,7 @@ Xgettext and .po workflow
to create the strings.php file
When strings are added or modified in source, you could run
$ cd util; ./run_xgettext.sh ../view/lang/<language>/messages.po
$ cd bin; ./run_xgettext.sh ../view/lang/<language>/messages.po
to extract strings from source files and join them with the existing .po file:
new strings are added, the existing are not overwritten.

2
util/vagrant_provision.sh

@ -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

Loading…
Cancel
Save