mirror of
https://github.com/friendica/friendica
synced 2024-11-09 16:22:56 +00:00
Merge pull request #6209 from MrPetovan/task/move-config-to-php-array
Remove util/ folder
This commit is contained in:
commit
7efde8e334
40 changed files with 2611 additions and 4940 deletions
|
@ -3,7 +3,7 @@ host = https://www.transifex.com
|
|||
|
||||
[friendica.messagespo]
|
||||
file_filter = view/lang/<lang>/messages.po
|
||||
source_file = util/messages.po
|
||||
source_file = view/lang/C/messages.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
INPUT = README.md index.php boot.php testargs.php update.php mod/ object/ include/ js/ util/ view/ src/ version.inc
|
||||
INPUT = README.md index.php boot.php update.php bin/ mod/ include/ view/ src/ VERSION
|
||||
RECURSIVE = YES
|
||||
PROJECT_NAME = "Friendica"
|
||||
PROJECT_LOGO = images/friendica-64.jpg
|
||||
EXCLUDE = .htconfig.php config/ library/ doc/ .git/ log/ util/zotsh/easywebdav/ addon/ report/ privacy_image_cache/ photo/ proxy/ local/
|
||||
EXCLUDE_PATTERNS = *smarty3* *strings.php*.log *.out *test*
|
||||
EXCLUDE = .htconfig.php config/ library/ doc/ .git/ log/ addon/ report/ privacy_image_cache/ photo/ proxy/ local/
|
||||
EXCLUDE_PATTERNS = *smarty3* strings.php *.log *.out *test*
|
||||
OUTPUT_DIRECTORY = doc
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html/
|
||||
|
@ -15,7 +15,6 @@ GENERATE_TODOLIST = YES
|
|||
USE_MDFILE_AS_MAINPAGE = README.md
|
||||
REFERENCED_BY_RELATION = YES
|
||||
GENERATE_TREEVIEW = YES
|
||||
HTML_FOOTER = util/Doxygen.footer
|
||||
ALIASES += "license=@par License:\n"
|
||||
ALIASES += "fixme=\xrefitem fixme \"Fixme\" \"Fixme List\""
|
||||
ALIASES += "FIXME=\fixme"
|
347
INSTALL.md
Normal file
347
INSTALL.md
Normal file
|
@ -0,0 +1,347 @@
|
|||
# Friendica Installation
|
||||
|
||||
We've tried very hard to ensure that Friendica will run on commodity hosting
|
||||
platforms - such as those used to host Wordpress blogs and Drupal websites.
|
||||
But be aware that Friendica is more than a simple web application. It is a
|
||||
complex communications system which more closely resembles an email server than
|
||||
a web server. For reliability and performance, messages are delivered in the
|
||||
background and are queued for later delivery when sites are down. This kind of
|
||||
functionality requires a bit more of the host system than the typical blog.
|
||||
Not every PHP/MySQL hosting provider will be able to support Friendica. Many will.
|
||||
But please review the requirements and confirm these with your hosting provider
|
||||
prior to installation.
|
||||
|
||||
Before you begin: Choose a domain name or subdomain name for your server.
|
||||
Put some thought into this - because changing it is currently not-supported.
|
||||
Things will break, and some of your friends may have difficulty communicating with you.
|
||||
We plan to address this limitation in a future release. Also decide if you wish
|
||||
to connect with members of the Diaspora network, as this will impact the
|
||||
installation requirements.
|
||||
|
||||
Decide if you will use SSL and obtain an SSL cert. Communications with the
|
||||
Diaspora network MAY require both SSL AND an SSL cert signed by a CA which is
|
||||
recognized by major browsers. Friendica will work with self-signed certs but
|
||||
Diaspora communication may not. For best results, install your cert PRIOR to
|
||||
installing Friendica and when visiting your site for the initial installation in
|
||||
step 5, please use the https: link. (Use the http: or non-SSL link if your cert
|
||||
is self-signed).
|
||||
|
||||
## 1. Requirements
|
||||
|
||||
- Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
|
||||
- PHP 5.6.1+ (PHP 7 recommended for performance).
|
||||
- PHP *command line* with `register_argc_argv = true` in php.ini
|
||||
- curl, gd (with at least jpeg support), mysql, mbstring, xml, zip and openssl extensions
|
||||
- Some form of email server or email gateway such that PHP mail() works
|
||||
- The POSIX module of PHP needs to be activated (e.g. RHEL, CentOS have disabled it)
|
||||
- Composer for a Git install
|
||||
|
||||
- Mysql 5.5.3+ or an equivalant alternative for MySQL (MariaDB, Percona Server etc.)
|
||||
- Ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows)
|
||||
- Installation into a top-level domain or sub-domain (without a directory/path
|
||||
component in the URL) is preferred. This is REQUIRED if you wish to communicate
|
||||
with the Diaspora network.
|
||||
- For alternative server configurations (such as Nginx server and MariaDB database
|
||||
engine), refer to the [Friendica wiki](https://github.com/friendica/friendica/wiki).
|
||||
|
||||
This guide will walk you through the manual installation process of Friendica.
|
||||
If this is nothing for you, you might be interested in:
|
||||
* the Friendica Docker image (https://github.com/friendica/docker) or
|
||||
* how install Friendica with YunoHost (https://github.com/YunoHost-Apps/friendica_ynh).
|
||||
|
||||
## 2. Install Friendica sources
|
||||
|
||||
Unpack the Friendica files into the root of your web server document area.
|
||||
|
||||
If you copy the directory tree to your webserver, make sure that you also copy
|
||||
`.htaccess-dist` - as "dot" files are often hidden and aren't normally copied.
|
||||
|
||||
OR
|
||||
|
||||
Clone the friendica/friendica GitHub repository and import dependencies
|
||||
|
||||
git clone https://github.com/friendica/friendica -b master [web server folder]
|
||||
cd [web server folder]
|
||||
bin/composer.phar install --no-dev
|
||||
|
||||
Make sure the folder view/smarty3 exists and is writable by the webserver user,
|
||||
in this case `www-data`
|
||||
|
||||
mkdir view/smarty3
|
||||
chown www-data:www-data view/smarty3
|
||||
chmod 775 view/smarty3
|
||||
|
||||
Get the addons by going into your website folder.
|
||||
|
||||
cd mywebsite
|
||||
|
||||
Clone the addon repository (separately):
|
||||
|
||||
git clone https://github.com/friendica/friendica-addons.git -b master addon
|
||||
|
||||
If you want to use the development version of Friendica you can switch to the
|
||||
develop branch in the repository by running
|
||||
|
||||
git checkout develop
|
||||
bin/composer.phar install
|
||||
cd addon
|
||||
git checkout develop
|
||||
|
||||
Please be aware that the develop branch is unstable.
|
||||
Exercise caution when pulling.
|
||||
If you encounter a bug, please let us know.
|
||||
|
||||
Either way, if you use Apache, copy `.htaccess-dist` to `.htaccess` to enable
|
||||
URL rewriting.
|
||||
|
||||
## 3. Database
|
||||
|
||||
Create an empty database and note the access details (hostname, username, password,
|
||||
database name).
|
||||
|
||||
- Friendica needs the permission to create and delete fields and tables in its
|
||||
own database.
|
||||
- Please check the additional notes if running on MySQ 5.7.17 or newer
|
||||
|
||||
## 4. Config
|
||||
|
||||
If you know in advance that it will be impossible for the web server to write or
|
||||
create files in the `config/` directory, please create an empty file called
|
||||
`local.config.php` in it and make it writable by the web server.
|
||||
|
||||
## 5a. Install Wizard
|
||||
|
||||
Visit your website with a web browser and follow the instructions.
|
||||
Please note any error messages and correct these before continuing.
|
||||
|
||||
If you are using SSL with a known signature authority (recommended), use the
|
||||
https: link to your website. If you are using a self-signed cert or no cert,
|
||||
use the http: link.
|
||||
|
||||
If you need to specify a port for the connection to the database, you can do so
|
||||
in the host name setting for the database.
|
||||
|
||||
## 5b. Manual install
|
||||
|
||||
*If* the automated installation fails for any reason, please check the following:
|
||||
|
||||
- `config/local.config.php` exists
|
||||
- If not, copy `config/local-sample.config.php` to `config/local.config.php`
|
||||
and edit it with your settings.
|
||||
- Database is populated.
|
||||
- If not, import the contents of `database.sql` with phpMyAdmin or the mysql
|
||||
command line tool.
|
||||
|
||||
## 6. Register the admin account
|
||||
|
||||
At this point visit your website again, and register your personal account with
|
||||
the same email as in the `config.admin_email` config value.
|
||||
Registration errors should all be recoverable automatically.
|
||||
|
||||
If you get any *critical* failure at this point, it generally indicates the
|
||||
database was not installed correctly. You might wish to delete/rename
|
||||
`config/local.config.php` to another name and drop all the database tables so
|
||||
that you can start fresh.
|
||||
|
||||
## 7. Background tasks (IMPORTANT)
|
||||
|
||||
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 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 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 assistance.
|
||||
Friendica will not work correctly if you cannot perform this step.
|
||||
|
||||
You should also be sure that `config.php_path` is set correctly, it should look
|
||||
like this: (changing it to the correct PHP location)
|
||||
|
||||
'config' => [
|
||||
'php_path' => '/usr/local/php56/bin/php',
|
||||
]
|
||||
|
||||
Alternative: If you cannot use a cron job as described above, you can use the
|
||||
frontend worker and an external cron service to trigger the execution of the worker script.
|
||||
You can enable the frontend worker after the installation from the admin panel
|
||||
of your node and call:
|
||||
|
||||
https://example.com/worker
|
||||
|
||||
with the service of your choice.
|
||||
|
||||
## 8. (Recommended) Set up a backup plan
|
||||
|
||||
Bad things will happen.
|
||||
Let there be a hardware failure, a corrupted database or whatever you can think of.
|
||||
So once the installation of your Friendica node is done, you should make yourself
|
||||
a backup plan.
|
||||
|
||||
The most important file is the `config/local.config.php` file in the base directory.
|
||||
As it stores all your data, you should also have a recent dump of your Friendica
|
||||
database at hand, should you have to recover your node.
|
||||
|
||||
## 9. (Optional) Reverse-proxying and HTTPS
|
||||
|
||||
Friendica looks for some well-known HTTP headers indicating a reverse-proxy
|
||||
terminating an HTTPS connection.
|
||||
While the standard from RFC 7239 specifies the use of the `Forwaded` header.
|
||||
|
||||
Forwarded: for=192.0.2.1; proto=https; by=192.0.2.2
|
||||
|
||||
Friendica also supports a number on non-standard headers in common use.
|
||||
|
||||
X-Forwarded-Proto: https
|
||||
|
||||
Front-End-Https: on
|
||||
|
||||
X-Forwarded-Ssl: on
|
||||
|
||||
It is however preferable to use the standard approach if configuring a new server.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "System is currently unavailable. Please try again later"
|
||||
|
||||
Check your database settings.
|
||||
It usually means your database could not be opened or accessed.
|
||||
If the database resides on the same machine, check that the database server name
|
||||
is "localhost".
|
||||
|
||||
### 500 Internal Error
|
||||
|
||||
This could be the result of one of our Apache directives not being supported by
|
||||
your version of Apache. Examine your apache server logs.
|
||||
You might remove the line "Options -Indexes" from the .htaccess file if you are
|
||||
using a Windows server as this has been known to cause problems.
|
||||
Also check your file permissions. Your website and all contents must generally
|
||||
be world-readable.
|
||||
|
||||
It is likely that your web server reported the source of the problem in its error log files.
|
||||
Please review these system error logs to determine what caused the problem.
|
||||
Often this will need to be resolved with your hosting provider or (if self-hosted)
|
||||
your web server configuration.
|
||||
|
||||
### 400 and 4xx "File not found" errors
|
||||
|
||||
First check your file permissions.
|
||||
Your website and all contents must generally be world-readable.
|
||||
|
||||
Ensure that mod-rewite is installed and working, and that your `.htaccess` file
|
||||
is being used. To verify the latter, create a file `test.out` containing the
|
||||
word "test" in the top directory of Friendica, make it world readable and point
|
||||
your web browser to
|
||||
|
||||
http://yoursitenamehere.com/test.out
|
||||
|
||||
This file should be blocked. You should get a permission denied message.
|
||||
|
||||
If you see the word "test" your Apache configuration is not allowing your
|
||||
`.htaccess` file to be used (there are rules in this file to block access to any
|
||||
file with .out at the end, as these are typically used for system logs).
|
||||
|
||||
Make certain the `.htaccess` file exists and is readable by everybody, then look
|
||||
for the existence of "AllowOverride None" in the Apache server configuration for your site.
|
||||
This will need to be changed to "AllowOverride All".
|
||||
|
||||
If you do not see the word "test", your `.htaccess` is working, but it is likely
|
||||
that mod-rewrite is not installed in your web server or is not working.
|
||||
|
||||
On most Linux flavors:
|
||||
|
||||
% a2enmod rewrite
|
||||
% /etc/init.d/apache2 restart
|
||||
|
||||
Consult your hosting provider, experts on your particular Linux distribution or
|
||||
(if Windows) the provider of your Apache server software if you need to change
|
||||
either of these and can not figure out how. There is a lot of help available on
|
||||
the web. Search "mod-rewrite" along with the name of your operating system
|
||||
distribution or Apache package (if using Windows).
|
||||
|
||||
### Unable to write the file config/local.config.php due to permissions issues
|
||||
|
||||
Create an empty `config/local.config.php`file with that name and give it
|
||||
world-write permission.
|
||||
|
||||
On Linux:
|
||||
|
||||
% touch config/local.config.php
|
||||
% chmod 664 config/local.config.php
|
||||
|
||||
Retry the installation. As soon as the database has been created,
|
||||
|
||||
******* this is important *********
|
||||
|
||||
% chmod 644 config/local.config.php
|
||||
|
||||
### Suhosin issues
|
||||
|
||||
Some configurations with "suhosin" security are configured without an ability to
|
||||
run external processes. Friendica requires this ability. Following are some notes
|
||||
provided by one of our members.
|
||||
|
||||
> On my server I use the php protection system Suhosin [http://www.hardened-php.net/suhosin/].
|
||||
> One of the things it does is to block certain functions like proc_open, as
|
||||
> configured in `/etc/php5/conf.d/suhosin.ini`:
|
||||
>
|
||||
> suhosin.executor.func.blacklist = proc_open, ...
|
||||
>
|
||||
> For those sites like Friendica that really need these functions they can be
|
||||
> enabled, e.g. in `/etc/apache2/sites-available/friendica`:
|
||||
>
|
||||
> <Directory /var/www/friendica/>
|
||||
> php_admin_value suhosin.executor.func.blacklist none
|
||||
> php_admin_value suhosin.executor.eval.blacklist none
|
||||
> </Directory>
|
||||
>
|
||||
> This enables every function for Friendica if accessed via browser, but not for
|
||||
> the cronjob that is called via php command line. I attempted to enable it for
|
||||
> 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 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 `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`.
|
||||
>
|
||||
> So the simple solution is to put the correct parameters into `config/local.config.php`:
|
||||
>
|
||||
> 'config' => [
|
||||
> //Location of PHP command line processor
|
||||
> 'php_path' => '/usr/bin/php -d suhosin.executor.func.blacklist=none \
|
||||
> -d suhosin.executor.eval.blacklist=none',
|
||||
> ],
|
||||
>
|
||||
> This is obvious as soon as you notice that the friendica-cron uses `proc_open`
|
||||
> to execute PHP scripts that also use `proc_open`, but it took me quite some time to find that out.
|
||||
> I hope this saves some time for other people using suhosin with function blacklists.
|
||||
|
||||
### Unable to create all mysql tables on MySQL 5.7.17 or newer
|
||||
|
||||
If the setup fails to create all the database tables and/or manual creation from
|
||||
the command line fails, with this error:
|
||||
|
||||
ERROR 1067 (42000) at line XX: Invalid default value for 'created'
|
||||
|
||||
You need to adjust your my.cnf and add the following setting under the [mysqld]
|
||||
section:
|
||||
|
||||
sql_mode = '';
|
||||
|
||||
After that, restart mysql and try again.
|
365
INSTALL.txt
365
INSTALL.txt
|
@ -1,365 +0,0 @@
|
|||
|
||||
Friendica Installation
|
||||
|
||||
We've tried very hard to ensure that Friendica will run on commodity hosting
|
||||
platforms - such as those used to host Wordpress blogs and Drupal websites.
|
||||
But be aware that Friendica is more than a simple web application. It is a
|
||||
complex communications system which more closely resembles an email server
|
||||
than a web server. For reliability and performance, messages are delivered in
|
||||
the background and are queued for later delivery when sites are down. This
|
||||
kind of functionality requires a bit more of the host system than the typical
|
||||
blog. Not every PHP/MySQL hosting provider will be able to support Friendica.
|
||||
Many will. But please review the requirements and confirm these with your
|
||||
hosting provider prior to installation.
|
||||
|
||||
Before you begin: Choose a domain name or subdomain name for your server.
|
||||
Put some thought into this - because changing it is currently not-supported.
|
||||
Things will break, and some of your friends may have difficulty communicating
|
||||
with you. We plan to address this limitation in a future release. Also decide
|
||||
if you wish to connect with members of the Diaspora network, as this will
|
||||
impact the installation requirements.
|
||||
|
||||
Decide if you will use SSL and obtain an SSL cert. Communications with the
|
||||
Diaspora network MAY require both SSL AND an SSL cert signed by a CA which is
|
||||
recognised by the major browsers. Friendica will work with self-signed certs
|
||||
but Diaspora communication may not. For best results, install your cert PRIOR
|
||||
to installing Friendica and when visiting your site for the initial
|
||||
installation in step 5, please use the https: link. (Use the http: or non-SSL
|
||||
link if your cert is self-signed).
|
||||
|
||||
|
||||
1. Requirements
|
||||
- Apache with mod-rewrite enabled and "Options All" so you can use a
|
||||
local .htaccess file
|
||||
|
||||
- PHP 5.6.1+ (PHP 7 recommended for performance).
|
||||
|
||||
- PHP *command line* access with register_argc_argv set to true in the
|
||||
php.ini file [or see 'poormancron' in section 8]
|
||||
|
||||
- curl, gd (with at least jpeg support), mysql, mbstring, xml, zip and openssl extensions
|
||||
|
||||
- some form of email server or email gateway such that PHP mail() works
|
||||
|
||||
- The POSIX module of PHP needs to be activated (e.g. RHEL, CentOS have disabled it)
|
||||
|
||||
- Mysql 5.5.3+ or an equivalant alternative for MySQL (MariaDB, Percona Server etc.)
|
||||
|
||||
- ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks
|
||||
(Windows) [Note: other options are presented in Section 8 of this document]
|
||||
|
||||
- Installation into a top-level domain or sub-domain (without a
|
||||
directory/path component in the URL) is preferred. This is REQUIRED if
|
||||
you wish to communicate with the Diaspora network.
|
||||
|
||||
|
||||
- For alternative server configurations (such as Nginx server and MariaDB
|
||||
database engine), refer to the wiki at https://github.com/friendica/friendica/wiki
|
||||
|
||||
This guide will walk you through the manual installation process of Friendica.
|
||||
If this is nothing for you, you might be interested in
|
||||
|
||||
* the Friendica Docker image (https://github.com/friendica/docker) or
|
||||
* how install Friendica with YunoHost (https://github.com/YunoHost-Apps/friendica_ynh).
|
||||
|
||||
|
||||
2. Unpack the Friendica files into the root of your web server document area.
|
||||
|
||||
- If you copy the directory tree to your webserver, make sure
|
||||
that you also copy .htaccess - as "dot" files are often hidden
|
||||
and aren't normally copied.
|
||||
|
||||
OR
|
||||
|
||||
2b. Clone the friendica/friendica GitHub repository and import dependencies
|
||||
|
||||
git clone https://github.com/friendica/friendica -b master [web server folder]
|
||||
cd [web server folder]
|
||||
php bin/composer.phar install
|
||||
|
||||
Make sure the folder view/smarty3 exists and is writable by the webserver
|
||||
user, in this case `www-data`
|
||||
|
||||
mkdir view/smarty3
|
||||
chown www-data:www-data view/smarty3
|
||||
chmod 775 view/smarty3
|
||||
|
||||
Get the addons by going into your website folder.
|
||||
|
||||
cd mywebsite
|
||||
|
||||
Clone the addon repository (separately):
|
||||
|
||||
git clone https://github.com/friendica/friendica-addons.git -b master addon
|
||||
|
||||
If you copy the directory tree to your webserver, make sure that you also
|
||||
copy .htaccess - as "dot" files are often hidden and aren't normally copied.
|
||||
|
||||
If you want to use the development version of Friendica you can switch to
|
||||
the devel branch in the repository by running
|
||||
|
||||
git checkout develop
|
||||
bin/composer.phar install
|
||||
cd addon
|
||||
git checkout develop
|
||||
|
||||
please be aware that the develop branch may break your Friendica node at any
|
||||
time. If you encounter a bug, please let us know.
|
||||
|
||||
3. Create an empty database and note the access details (hostname, username,
|
||||
password, database name).
|
||||
|
||||
- Friendica needs the permission to create and delete fields and tables in its own database.
|
||||
- Please check the additional notes if running on MySQ 5.7.17 or newer
|
||||
|
||||
4. If you know in advance that it will be impossible for the web server to
|
||||
write or create files in the config/ subfolder, create an empty file called
|
||||
local.config.php and make it writable by the web server.
|
||||
|
||||
5. Visit your website with a web browser and follow the instructions. Please
|
||||
note any error messages and correct these before continuing.
|
||||
|
||||
If you are using SSL with a known signature authority (recommended), use the
|
||||
https: link to your website. If you are using a self-signed cert or no cert,
|
||||
use the http: link.
|
||||
|
||||
If you need to specify a port for the connection to the database, you can do
|
||||
so in the host name setting for the database.
|
||||
|
||||
6. *If* the automated installation fails for any reason, check the following:
|
||||
|
||||
- "config/local.config.php" exists
|
||||
If not, edit local-sample.config.php and change system settings. Rename
|
||||
to local.config.php
|
||||
- Database is populated.
|
||||
If not, import the contents of "database.sql" with phpmyadmin
|
||||
or mysql command line
|
||||
|
||||
7. At this point visit your website again, and register your personal account.
|
||||
Registration errors should all be recoverable automatically.
|
||||
If you get any *critical* failure at this point, it generally indicates the
|
||||
database was not installed correctly. You might wish to move/rename
|
||||
local.config.php to another name and empty (called 'dropping') the database
|
||||
tables, so that you can start fresh.
|
||||
|
||||
****************************************************************************
|
||||
****************************************************************************
|
||||
******** THIS NEXT STEP IS IMPORTANT!!!! ***********
|
||||
****************************************************************************
|
||||
****************************************************************************
|
||||
|
||||
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 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 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
|
||||
assistance. Friendica will not work correctly if you cannot perform this step.
|
||||
|
||||
You should also be sure that $a->config['php_path'] is set correctly, it should
|
||||
look like (changing it to the correct PHP location)
|
||||
|
||||
$a->config['php_path'] = '/usr/local/php56/bin/php'
|
||||
|
||||
Alternative: If you cannot use a cron job as described above, you can use
|
||||
the frontend worker and an external cron service to trigger the execution
|
||||
of the worker script. You can enable the frontend worker after the installation
|
||||
from the admin panel of your node and call
|
||||
|
||||
https://example.com/worker
|
||||
|
||||
with the service of your choice.
|
||||
|
||||
9. (Recommended) Set up a backup plan
|
||||
|
||||
Bad things will happen. Let there be a hardware failure, a corrupted
|
||||
database or whatever you can think of. So once the installation of your
|
||||
Friendica node is done, you should make yoursef a backup plan.
|
||||
|
||||
The most important file is the `config/local.config.php` file in the base directory.
|
||||
As it stores all your data, you should also have a recent dump of your
|
||||
Friendica database at hand, should you have to recover your node.
|
||||
|
||||
10. (Optional) Reverse-proxying and HTTPS
|
||||
|
||||
Friendica looks for some well-known HTTP headers indicating a reverse-proxy
|
||||
terminating an HTTPS connection. While the standard from RFC 7239 specifies
|
||||
the use of the `Forwaded` header.
|
||||
|
||||
Forwarded: for=192.0.2.1; proto=https; by=192.0.2.2
|
||||
|
||||
Friendica also supports a number on non-standard headers in common use.
|
||||
|
||||
|
||||
X-Forwarded-Proto: https
|
||||
|
||||
Front-End-Https: on
|
||||
|
||||
X-Forwarded-Ssl: on
|
||||
|
||||
It is however preferable to use the standard approach if configuring a new server.
|
||||
|
||||
#####################################################################
|
||||
|
||||
If things don't work...
|
||||
|
||||
#####################################################################
|
||||
|
||||
|
||||
#####################################################################
|
||||
- If you get the message
|
||||
"System is currently unavailable. Please try again later"
|
||||
#####################################################################
|
||||
|
||||
Check your database settings. It usually means your database could not
|
||||
be opened or accessed. If the database resides on the same machine, check that
|
||||
the database server name is "localhost".
|
||||
|
||||
#####################################################################
|
||||
- 500 Internal Error
|
||||
#####################################################################
|
||||
|
||||
This could be the result of one of our Apache directives not being
|
||||
supported by your version of Apache. Examine your apache server logs.
|
||||
You might remove the line "Options -Indexes" from the .htaccess file if
|
||||
you are using a Windows server as this has been known to cause problems.
|
||||
Also check your file permissions. Your website and all contents must generally
|
||||
be world-readable.
|
||||
|
||||
It is likely that your web server reported the source of the problem in
|
||||
its error log files. Please review these system error logs to determine what
|
||||
caused the problem. Often this will need to be resolved with your hosting
|
||||
provider or (if self-hosted) your web server configuration.
|
||||
|
||||
#####################################################################
|
||||
- 400 and 4xx "File not found" errors
|
||||
#####################################################################
|
||||
|
||||
First check your file permissions. Your website and all contents must
|
||||
generally be world-readable.
|
||||
|
||||
Ensure that mod-rewite is installed and working, and that your
|
||||
.htaccess file is being used. To verify the latter, create a file test.out
|
||||
containing the word "test" in the top directory of Friendica, make it world
|
||||
readable and point your web browser to
|
||||
|
||||
http://yoursitenamehere.com/test.out
|
||||
|
||||
This file should be blocked. You should get a permission denied message.
|
||||
|
||||
If you see the word "test" your Apache configuration is not allowing
|
||||
your .htaccess file to be used (there are rules in this file to block access
|
||||
to any file with .out at the end, as these are typically used for system logs).
|
||||
|
||||
Make certain the .htaccess file exists and is readable by everybody, then
|
||||
look for the existence of "AllowOverride None" in the Apache server
|
||||
configuration for your site. This will need to be changed to
|
||||
"AllowOverride All".
|
||||
|
||||
If you do not see the word "test", your .htaccess is working, but it is
|
||||
likely that mod-rewrite is not installed in your web server or is not working.
|
||||
|
||||
On most flavour of Linux,
|
||||
|
||||
% a2enmod rewrite
|
||||
% /etc/init.d/apache2 restart
|
||||
|
||||
Consult your hosting provider, experts on your particular Linux
|
||||
distribution or (if Windows) the provider of your Apache server software if
|
||||
you need to change either of these and can not figure out how. There is
|
||||
a lot of help available on the web. Google "mod-rewrite" along with the
|
||||
name of your operating system distribution or Apache package (if using
|
||||
Windows).
|
||||
|
||||
|
||||
#####################################################################
|
||||
- If you are unable to write the file config/local.config.php during installation
|
||||
due to permissions issues:
|
||||
#####################################################################
|
||||
|
||||
create an empty file with that name and give it world-write permission.
|
||||
For Linux:
|
||||
|
||||
% touch config/local.config.php
|
||||
% chmod 664 config/local.config.php
|
||||
|
||||
Retry the installation. As soon as the database has been created,
|
||||
|
||||
******* this is important *********
|
||||
|
||||
% chmod 644 config/local.config.php
|
||||
|
||||
#####################################################################
|
||||
- Some configurations with "suhosin" security are configured without
|
||||
an ability to run external processes. Friendica requires this ability.
|
||||
Following are some notes provided by one of our members.
|
||||
#####################################################################
|
||||
|
||||
On my server I use the php protection system Suhosin
|
||||
[http://www.hardened-php.net/suhosin/]. One of the things it does is to block
|
||||
certain functions like proc_open, as configured in /etc/php5/conf.d/suhosin.ini:
|
||||
|
||||
suhosin.executor.func.blacklist = proc_open, ...
|
||||
|
||||
For those sites like Friendica that really need these functions they can be
|
||||
enabled, e.g. in /etc/apache2/sites-available/friendica:
|
||||
|
||||
<Directory /var/www/friendica/>
|
||||
php_admin_value suhosin.executor.func.blacklist none
|
||||
php_admin_value suhosin.executor.eval.blacklist none
|
||||
</Directory>
|
||||
|
||||
This enables every function for Friendica if accessed via browser, but not for
|
||||
the cronjob that is called via php command line. I attempted to enable it for
|
||||
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 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 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.
|
||||
|
||||
So the simple solution is to put the correct parameters into config/local.config.php:
|
||||
|
||||
'config' => [
|
||||
//Location of PHP command line processor
|
||||
'php_path' => '/usr/bin/php -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none',
|
||||
],
|
||||
|
||||
This is obvious as soon as you notice that the friendica-cron uses proc_open to
|
||||
execute php-scripts that also use proc_open, but it took me quite some time to
|
||||
find that out. I hope this saves some time for other people using suhosin with
|
||||
function blacklists.
|
||||
|
||||
########################################################################
|
||||
Unable to create all mysql tables on MySQL 5.7.17 or newer
|
||||
#######################################################################
|
||||
|
||||
If the setup fails to create all the database tables and/or manual
|
||||
creation from the command line fails, with this error:
|
||||
|
||||
ERROR 1067 (42000) at line XX: Invalid default value for 'created'
|
||||
|
||||
You need to adjust your my.cnf and add the following setting under
|
||||
the [mysqld] section :
|
||||
|
||||
sql_mode = '';
|
||||
|
||||
After that, restart mysql and try again.
|
||||
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
Friendica translations
|
||||
======================
|
||||
|
||||
Translation Process
|
||||
-------------------
|
||||
|
||||
The strings used in the UI of Friendica is translated at [Transifex] [1] and then included in the git repository at github.
|
||||
If you want to help with translation for any language, be it correcting terms or translating friendica to a currently not supported language, please register an account at transifex.com and contact the friendica translation team there.
|
||||
|
||||
Translating friendica is simple.
|
||||
Just use the online tool at transifex.
|
||||
If you don't want to deal with git & co. that is fine, we check the status of the translations regularly and import them into the source tree at github so that others can use them.
|
||||
|
||||
We do not include every translation from transifex in the source tree to avoid a scattered and disturbed overall experience.
|
||||
As an uneducated guess we have a lower limit of 50% translated strings before we include the language (for the core messages.po file, addont translation will be included once all strings of an addon are translated.
|
||||
This limit is judging only by the amount of translated strings under the assumption that the most prominent strings for the UI will be translated first by a translation team.
|
||||
If you feel your translation useable before this limit, please contact us and we will probably include your teams work in the source tree.
|
||||
|
||||
If you want to help translating, please concentrate on the core messages.po file first.
|
||||
We will only include translations with a sufficient translated messages.po file.
|
||||
Translations of addons will only be included, when the core file is included as well.
|
||||
|
||||
If you want to get your work into the source tree yourself, feel free to do so and contact us with and question that arises.
|
||||
The process is simple and friendica ships with all the tools necessary.
|
||||
|
||||
The location of the translated files in the source tree is
|
||||
/view/lang/LNG-CODE/
|
||||
where LNG-CODE is the language code used, e.g. de for German or fr for French.
|
||||
The translated strings come as a "message.po" file from transifex which needs to be translated into the PHP file friendica uses.
|
||||
To do so, place the file in the directory mentioned above and use the "po2php" command from the console.
|
||||
*Please note that the console tool has to be called from the base directory of your Friendica installation.*
|
||||
|
||||
Assuming you want to convert the German localization which is placed in view/lang/de/message.po you would do the following.
|
||||
|
||||
1. Navigate at the command prompt to the base directory of your
|
||||
friendica installation
|
||||
|
||||
2. Execute the po2php command, which will place the translation
|
||||
in the strings.php file that is used by friendica.
|
||||
|
||||
$> php bin/console.php po2php view/lang/de/messages.po
|
||||
|
||||
The output of the script will be placed at view/lang/de/strings.php where
|
||||
friendica is expecting it, so you can test your translation immediately.
|
||||
|
||||
3. Visit your friendica page to check if it still works in the language you
|
||||
just translated. If not try to find the error, most likely PHP will give
|
||||
you a hint in the log/warnings.about the error.
|
||||
|
||||
For debugging you can also try to "run" the file with PHP. This should
|
||||
not give any output if the file is ok but might give a hint for
|
||||
searching the bug in the file.
|
||||
|
||||
$> php view/lang/de/strings.php
|
||||
|
||||
4. commit the two files with a meaningful commit message to your git
|
||||
repository, push it to your fork of the friendica repository at github and
|
||||
issue a pull request for that commit.
|
||||
|
||||
You should translate the PO files at Transifex.
|
||||
Otherwise your work might get lost, when the translation from Transifex is included to the Friendica repository after it was updated there.
|
||||
|
||||
Utilities
|
||||
---------
|
||||
|
||||
Additional to the po2php command there are some more utilities for translation in the console.
|
||||
If you only want to translate friendica into another language you wont need any of these tools most likely but it gives you an idea how the translation process of friendica works.
|
||||
|
||||
For further information see the utils/README file.
|
||||
|
||||
Transifex-Client
|
||||
----------------
|
||||
|
||||
Transifex has a client program which let you interact with the translation files in a similar way to git.
|
||||
Help for the client can be found at the [Transifex Help Center] [2].
|
||||
Here we will only cover basic usage.
|
||||
|
||||
After installation of the client, you should have a `tx` command available on your system.
|
||||
To use it, first create a configuration file with your credentials.
|
||||
On Linux this file should be placed into your home directory `~/.transifexrc`.
|
||||
The content of the file should be something like the following:
|
||||
|
||||
[https://www.transifex.com]
|
||||
username = user
|
||||
token =
|
||||
password = p@ssw0rd
|
||||
hostname = https://www.transifex.com
|
||||
|
||||
Since Friendica version 3.5.1 we ship configuration files for the Transifex client in the core repository and the addon repository.
|
||||
To update the translation files after you have translated strings of e.g. Esperanto in the web-UI of transifex you can use `tx` to download the file.
|
||||
|
||||
$> tx pull -l eo
|
||||
|
||||
And then use the `po2php` command described above to convert the `messages.po` file to the `strings.php` file Friendica is loading.
|
||||
|
||||
$> php bin/console.php po2php view/lang/eo/messages.po
|
||||
|
||||
Afterwards, just commit the two changed files to a feature branch of your Friendica repository, push the changes to github and open a pull request for your changes.
|
||||
|
||||
[1]: https://www.transifex.com/projects/p/friendica/
|
||||
[2]: https://docs.transifex.com/client/introduction
|
|
@ -1,241 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Script to convert Friendica internal template files into Smarty template files
|
||||
# Copyright 2013 Zach Prezkuta
|
||||
# Licensed under GPL v3
|
||||
|
||||
import os, re, string
|
||||
import sys, getopt
|
||||
|
||||
ldelim = '{{'
|
||||
rdelim = '}}'
|
||||
|
||||
addheader = True
|
||||
|
||||
def fToSmarty(matches):
|
||||
match = matches.group(0)
|
||||
if match == '$j':
|
||||
return match
|
||||
match = string.replace(match, '[', '')
|
||||
match = string.replace(match, ']', '')
|
||||
|
||||
ldel = ldelim
|
||||
rdel = rdelim
|
||||
if match.find("'") > -1:
|
||||
match = string.replace(match, "'", '')
|
||||
ldel = "'" + ldel
|
||||
rdel = rdel + "'"
|
||||
elif match.find('"') > -1:
|
||||
match = string.replace(match, '"', '')
|
||||
ldel = '"' + ldel
|
||||
rdel = rdel + '"'
|
||||
|
||||
return ldel + match + rdel
|
||||
|
||||
|
||||
def fix_element(element):
|
||||
# Much of the positioning here is important, e.g. if you do element.find('if ') before you do
|
||||
# element.find('endif'), then you may get some multiply-replaced delimiters
|
||||
|
||||
if element.find('endif') > -1:
|
||||
element = ldelim + '/if' + rdelim
|
||||
return element
|
||||
|
||||
if element.find('if ') > -1:
|
||||
element = string.replace(element, '{{ if', ldelim + 'if')
|
||||
element = string.replace(element, '{{if', ldelim + 'if')
|
||||
element = string.replace(element, ' }}', rdelim)
|
||||
element = string.replace(element, '}}', rdelim)
|
||||
return element
|
||||
|
||||
if element.find('else') > -1:
|
||||
element = ldelim + 'else' + rdelim
|
||||
return element
|
||||
|
||||
if element.find('endfor') > -1:
|
||||
element = ldelim + '/foreach' + rdelim
|
||||
return element
|
||||
|
||||
if element.find('for ') > -1:
|
||||
element = string.replace(element, '{{ for ', ldelim + 'foreach ')
|
||||
element = string.replace(element, '{{for ', ldelim + 'foreach ')
|
||||
element = string.replace(element, ' }}', rdelim)
|
||||
element = string.replace(element, '}}', rdelim)
|
||||
return element
|
||||
|
||||
if element.find('endinc') > -1:
|
||||
element = ''
|
||||
return element
|
||||
|
||||
if element.find('inc ') > -1:
|
||||
parts = element.split(' ')
|
||||
element = ldelim + 'include file="'
|
||||
|
||||
# We need to find the file name. It'll either be in parts[1] if the element was written as {{ inc file.tpl }}
|
||||
# or it'll be in parts[2] if the element was written as {{inc file.tpl}}
|
||||
if parts[0].find('inc') > -1:
|
||||
first = 0
|
||||
else:
|
||||
first = 1
|
||||
|
||||
if parts[first+1][0] == '$':
|
||||
# This takes care of elements where the filename is a variable, e.g. {{ inc $file }}
|
||||
element += ldelim + parts[first+1].rstrip('}') + rdelim
|
||||
else:
|
||||
# This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }}
|
||||
element += parts[first+1].rstrip('}')
|
||||
|
||||
element += '"'
|
||||
|
||||
if len(parts) > first + 1 and parts[first+2] == 'with':
|
||||
# Take care of variable substitutions, e.g. {{ inc file.tpl with $var=this_var }}
|
||||
element += ' ' + parts[first+3].rstrip('}')[1:]
|
||||
|
||||
element += rdelim
|
||||
return element
|
||||
|
||||
|
||||
def convert(filename, tofilename, php_tpl):
|
||||
if addheader:
|
||||
header = ldelim + "*\n *\tAUTOMATICALLY GENERATED TEMPLATE\n *\tDO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN\n *\n *" + rdelim + "\n"
|
||||
tofilename.write(header)
|
||||
|
||||
for line in filename:
|
||||
newline = ''
|
||||
st_pos = 0
|
||||
brack_pos = line.find('{{')
|
||||
|
||||
if php_tpl:
|
||||
# If php_tpl is True, this script will only convert variables in quotes, like '$variable'
|
||||
# or "$variable". This is for .tpl files that produce PHP scripts, where you don't want
|
||||
# all the PHP variables converted into Smarty variables
|
||||
pattern1 = re.compile(r"""
|
||||
([\'\"]\$\[[a-zA-Z]\w*
|
||||
(\.
|
||||
(\d+|[a-zA-Z][\w-]*)
|
||||
)*
|
||||
(\|[\w\$:\.]*)*
|
||||
\][\'\"])
|
||||
""", re.VERBOSE)
|
||||
pattern2 = re.compile(r"""
|
||||
([\'\"]\$[a-zA-Z]\w*
|
||||
(\.
|
||||
(\d+|[a-zA-Z][\w-]*)
|
||||
)*
|
||||
(\|[\w\$:\.]*)*
|
||||
[\'\"])
|
||||
""", re.VERBOSE)
|
||||
else:
|
||||
# Compile the pattern for bracket-style variables, e.g. $[variable.key|filter:arg1:arg2|filter2:arg1:arg2]
|
||||
# Note that dashes are only allowed in array keys if the key doesn't start
|
||||
# with a number, e.g. $[variable.key-id] is ok but $[variable.12-id] isn't
|
||||
#
|
||||
# Doesn't currently process the argument position key 'x', i.e. filter:arg1:x:arg2 doesn't get
|
||||
# changed to arg1|filter:variable:arg2 like Smarty requires
|
||||
#
|
||||
# Filter arguments can be variables, e.g. $variable, but currently can't have array keys with dashes
|
||||
# like filter:$variable.key-name
|
||||
pattern1 = re.compile(r"""
|
||||
(\$\[[a-zA-Z]\w*
|
||||
(\.
|
||||
(\d+|[a-zA-Z][\w-]*)
|
||||
)*
|
||||
(\|[\w\$:\.]*)*
|
||||
\])
|
||||
""", re.VERBOSE)
|
||||
|
||||
# Compile the pattern for normal style variables, e.g. $variable.key
|
||||
pattern2 = re.compile(r"""
|
||||
(\$[a-zA-Z]\w*
|
||||
(\.
|
||||
(\d+|[a-zA-Z][\w-]*)
|
||||
)*
|
||||
(\|[\w\$:\.]*)*
|
||||
)
|
||||
""", re.VERBOSE)
|
||||
|
||||
while brack_pos > -1:
|
||||
if brack_pos > st_pos:
|
||||
line_segment = line[st_pos:brack_pos]
|
||||
line_segment = pattern2.sub(fToSmarty, line_segment)
|
||||
newline += pattern1.sub(fToSmarty, line_segment)
|
||||
|
||||
end_brack_pos = line.find('}}', brack_pos)
|
||||
if end_brack_pos < 0:
|
||||
print "Error: no matching bracket found"
|
||||
|
||||
newline += fix_element(line[brack_pos:end_brack_pos + 2])
|
||||
st_pos = end_brack_pos + 2
|
||||
|
||||
brack_pos = line.find('{{', st_pos)
|
||||
|
||||
line_segment = line[st_pos:]
|
||||
line_segment = pattern2.sub(fToSmarty, line_segment)
|
||||
newline += pattern1.sub(fToSmarty, line_segment)
|
||||
newline = newline.replace("{#", ldelim + "*")
|
||||
newline = newline.replace("#}", "*" + rdelim)
|
||||
tofilename.write(newline)
|
||||
|
||||
|
||||
def help(pname):
|
||||
print "\nUsage:"
|
||||
print "\t" + pname + " -h\n\n\t\t\tShow this help screen\n"
|
||||
print "\t" + pname + " -p directory\n\n\t\t\tConvert all .tpl files in directory to\n\t\t\tSmarty templates in directory/smarty3/\n"
|
||||
print "\t" + pname + "\n\n\t\t\tInteractive mode\n"
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Main script
|
||||
#
|
||||
|
||||
path = ''
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "hp:", ['no-header'])
|
||||
for opt, arg in opts:
|
||||
if opt == '-h':
|
||||
help(sys.argv[0])
|
||||
sys.exit()
|
||||
elif opt == '-p':
|
||||
path = arg
|
||||
elif opt == '--no-header':
|
||||
addheader = False
|
||||
except getopt.GetoptError:
|
||||
help(sys.argv[0])
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
if path == '':
|
||||
path = raw_input('Path to template folder to convert: ')
|
||||
|
||||
if path[-1:] != '/':
|
||||
path = path + '/'
|
||||
|
||||
outpath = path + 'smarty3/'
|
||||
|
||||
if not os.path.exists(outpath):
|
||||
os.makedirs(outpath)
|
||||
|
||||
files = os.listdir(path)
|
||||
for a_file in files:
|
||||
if a_file == 'local.ini.tpl':
|
||||
php_tpl = True
|
||||
else:
|
||||
php_tpl = False
|
||||
|
||||
filename = os.path.join(path,a_file)
|
||||
ext = a_file.split('.')[-1]
|
||||
if os.path.isfile(filename) and ext == 'tpl':
|
||||
f = open(filename, 'r')
|
||||
|
||||
newfilename = os.path.join(outpath,a_file)
|
||||
outf = open(newfilename, 'w')
|
||||
|
||||
print "Converting " + filename + " to " + newfilename
|
||||
convert(f, outf, php_tpl)
|
||||
|
||||
outf.close()
|
||||
f.close()
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
This script will collect the contributors to friendica and its translations from
|
||||
* the git log of the friendica core and addons repositories
|
||||
* the translated messages.po from core and the addons.
|
||||
The collected names will be saved in /util/credits.txt which is also parsed from
|
||||
The collected names will be saved in CREDITS.txt which is also parsed from
|
||||
yourfriendica.tld/credits.
|
||||
|
||||
The output is not perfect, so remember to open a fresh (re)created credits.txt file
|
||||
|
@ -26,7 +26,7 @@ dontinclude = ['root', 'friendica', 'bavatar', 'tony baldwin', 'Taek', 'silke m'
|
|||
'Michal Supler', 'michal_s', 'Manuel Pérez', 'rabuzarus', 'Alberto Díaz']
|
||||
|
||||
|
||||
# this script is in the /util sub-directory of the friendica installation
|
||||
# this script is in the /bin/dev directory of the friendica installation
|
||||
# so the friendica path is the 0th argument of calling this script but we
|
||||
# need to remove the name of the file and the name of the directory
|
||||
path = os.path.abspath(argv[0].split('bin/dev/make_credits.py')[0])
|
||||
|
@ -101,7 +101,7 @@ print(' > found %d translators' % (n3-n2))
|
|||
print('> found a total of %d contributors and translators' % n3)
|
||||
contributors.sort(key=str.lower)
|
||||
|
||||
f = open(path+'/util/credits.txt', 'w')
|
||||
f = open(path+'/CREDITS.txt', 'w')
|
||||
f.write("\n".join(contributors))
|
||||
f.close()
|
||||
print('> list saved to util/credits.txt')
|
||||
print('> list saved to CREDITS.txt')
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Script to update Smarty template files from all internal templates
|
||||
# Copyright 2013 Zach Prezkuta
|
||||
# Licensed under GPL v3
|
||||
|
||||
|
||||
import os
|
||||
import sys, getopt
|
||||
import subprocess
|
||||
|
||||
|
||||
def help(pname):
|
||||
print "\nUsage:"
|
||||
print "\t" + pname + " -h\n\n\t\t\tShow this help screen\n"
|
||||
print "\t" + pname + " -p directory\n\n\t\t\tConvert all .tpl files in top-level\n\t\t\tFriendica directory to Smarty templates\n"
|
||||
print "\t" + pname + "\n\n\t\t\tInteractive mode\n"
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Main script
|
||||
#
|
||||
|
||||
path = ''
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "hp:")
|
||||
for opt, arg in opts:
|
||||
if opt == '-h':
|
||||
help(sys.argv[0])
|
||||
sys.exit()
|
||||
elif opt == '-p':
|
||||
path = arg
|
||||
except getopt.GetoptError:
|
||||
help(sys.argv[0])
|
||||
sys.exit(2)
|
||||
|
||||
if path == '':
|
||||
path = raw_input('Path to top-level Friendica directory: ')
|
||||
|
||||
if path[-1:] != '/':
|
||||
path = path + '/'
|
||||
|
||||
tplpaths = ['view/']
|
||||
names = os.listdir(path + 'view/')
|
||||
for name in names:
|
||||
if os.path.isdir(path + 'view/' + name):
|
||||
if name != 'smarty3' and name != 'theme':
|
||||
tplpaths.append('view/' + name + '/')
|
||||
|
||||
names = os.listdir(path + 'view/theme/')
|
||||
for name in names:
|
||||
if os.path.isdir(path + 'view/theme/' + name):
|
||||
tplpaths.append('view/theme/' + name + '/')
|
||||
|
||||
fnull = open(os.devnull, "w")
|
||||
|
||||
for tplpath in tplpaths:
|
||||
print "Converting " + path + tplpath
|
||||
subprocess.call(['python', path + 'util/friendica-to-smarty-tpl.py', '-p', path + tplpath], stdout = fnull)
|
||||
|
||||
fnull.close()
|
||||
|
|
@ -86,7 +86,7 @@ cd /var/www
|
|||
php bin/composer.phar install
|
||||
|
||||
# initial config file for friendica in vagrant
|
||||
cp /vagrant/util/local.config.vagrant.php /vagrant/config/local.config.php
|
||||
cp /vagrant/mods/local.config.vagrant.php /vagrant/config/local.config.php
|
||||
|
||||
# copy the .htaccess-dist file to .htaccess so that rewrite rules work
|
||||
cp /vagrant/.htaccess-dist /vagrant/.htaccess
|
||||
|
|
|
@ -45,7 +45,7 @@ case "$MODE" in
|
|||
;;
|
||||
'default')
|
||||
cd "$FULLPATH/.."
|
||||
OUTFILE="$FULLPATH/../util/messages.po"
|
||||
OUTFILE="$FULLPATH/../view/lang/C/messages.po"
|
||||
FINDSTARTDIR="."
|
||||
# skip addon folder
|
||||
FINDOPTS="( -wholename */addon -or -wholename */addons -or -wholename */addons-extra -or -wholename */smarty3 ) -prune -o"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
return [
|
||||
'twitter' => [
|
||||
'consumerkey' => 'localhost',
|
||||
'consumersecret' => 'mysqlusername',
|
||||
'consumerkey' => '1234567890',
|
||||
'consumersecret' => 'ABCDEFGHIJKLMONPQRSTUVWXYZ',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -136,6 +136,16 @@ $a->config["key"] = "value";
|
|||
],
|
||||
</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
$a->config['register_policy'] = REGISTER_CLOSED;
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
'config' => [
|
||||
'register_policty' => REGISTER_CLOSED,
|
||||
],
|
||||
</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
$a->path = "value";
|
||||
|
@ -225,6 +235,17 @@ key = value
|
|||
],
|
||||
</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
[config]
|
||||
register_policty = REGISTER_CLOSED
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
'config' => [
|
||||
'register_policty' => REGISTER_CLOSED,
|
||||
],
|
||||
</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
[section]
|
||||
|
@ -250,7 +271,6 @@ If you need to specify a port to access the database, you can do so by appending
|
|||
|
||||
'database' => [
|
||||
'hostname' => 'your.mysqlhost.com:123456',
|
||||
...
|
||||
]
|
||||
|
||||
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
|
||||
|
|
|
@ -111,10 +111,10 @@ If the command-line tools `diff` and `patch` are unavailabe for you, `phpcbf` ca
|
|||
### Code documentation
|
||||
|
||||
If you are interested in having the documentation of the Friendica code outside of the code files, you can use [Doxygen](http://doxygen.org) to generate it.
|
||||
The configuration file for Doxygen is located in the `util` directory of the project sources.
|
||||
The configuration file for Doxygen is located in the base directory of the project sources.
|
||||
Run
|
||||
|
||||
$> doxygen util/Doxyfile
|
||||
$> doxygen Doxyfile
|
||||
|
||||
to generate the files which will be located in the `doc/html` subdirectory in the Friendica directory.
|
||||
You can browse these files with any browser.
|
||||
|
|
|
@ -2,18 +2,23 @@
|
|||
|
||||
* [Home](help)
|
||||
|
||||
If you are the admin of a Friendica node, you have access to the so called **Admin Panel** where you can configure your Friendica node.
|
||||
If you are the admin of a Friendica node, you have access to the **Admin Panel** where you can configure your Friendica node.
|
||||
|
||||
On the front page of the admin panel you will see a summary of information about your node.
|
||||
These information include the amount of messages currently being processed in the queues.
|
||||
The first number is the number of messages which could not been delivered for various reasons.
|
||||
They will be resend later.
|
||||
You can have a quick glance into that second queues in the "Inspect Queue" section of the admin panel.
|
||||
The second number represents the current number of jobs for the background workers.
|
||||
These worker tasks are prioritised and are done accordingly.
|
||||
## Overview
|
||||
|
||||
In the main page of the admin panel you will see an information summary about your node.
|
||||
|
||||
### Queues
|
||||
|
||||
The three numbers shown are respectively:
|
||||
- The retry queue: These outgoing messages couldn't be received by the remote host, and will be resent at longer intervals before being dropped entirely after 30 days.
|
||||
- The deferred queue: These internal tasks failed and will be retried at most 14 times.
|
||||
- The task queue: These internal tasks are queued for execution during the next background worker run.
|
||||
|
||||
### Additional information
|
||||
|
||||
Then you get an overview of the accounts on your node, which can be moderated in the "Users" section of the panel.
|
||||
As well as an overview of the currently active addons
|
||||
As well as an overview of the currently active addons.
|
||||
The list is linked, so you can have quick access to the Addon settings.
|
||||
And finally you are informed about the version of Friendica you have installed.
|
||||
If you contact the developers with a bug or problem, please also mention the version of your node.
|
||||
|
@ -361,13 +366,13 @@ These are the data base settings, the admin account settings, the path of PHP an
|
|||
|
||||
With the following settings, you specify the data base server, the username and password for Friendica and the database to use.
|
||||
|
||||
'database' => [
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'mysqlusername',
|
||||
'password' => 'mysqlpassword',
|
||||
'database' => 'mysqldatabasename',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
'database' => [
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'mysqlusername',
|
||||
'password' => 'mysqlpassword',
|
||||
'database' => 'mysqldatabasename',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
|
||||
## Admin users
|
||||
|
||||
|
@ -377,17 +382,17 @@ But you can expand the list of email addresses by any used email address you wan
|
|||
Registration of new accounts with a listed email address is not possible.
|
||||
|
||||
'config' => [
|
||||
'admin_email' => 'you@example.com, buddy@example.com',
|
||||
],
|
||||
'admin_email' => 'you@example.com, buddy@example.com',
|
||||
],
|
||||
|
||||
## PHP Path
|
||||
|
||||
Some of Friendica's processes are running in the background.
|
||||
For this you need to specify the path to the PHP binary to be used.
|
||||
|
||||
'config' => [
|
||||
'php_path' => '/usr/bin/php',
|
||||
],
|
||||
'config' => [
|
||||
'php_path' => '/usr/bin/php',
|
||||
],
|
||||
|
||||
## Subdirectory configuration
|
||||
|
||||
|
@ -395,9 +400,9 @@ It is possible to install Friendica into a subdirectory of your web server.
|
|||
We strongly discourage you from doing so, as this will break federation to other networks (e.g. Diaspora, GNU Social, Hubzilla)
|
||||
Say you have a subdirectory for tests and put Friendica into a further subdirectory, the config would be:
|
||||
|
||||
'system' => [
|
||||
'urlpath' => 'tests/friendica',
|
||||
],
|
||||
'system' => [
|
||||
'urlpath' => 'tests/friendica',
|
||||
],
|
||||
|
||||
## Other exceptions
|
||||
|
||||
|
|
|
@ -347,21 +347,21 @@ Dies sind die Datenbank Einstellungen, die Administrator Accounts, der PHP Pfad
|
|||
|
||||
Mit den folgenden Einstellungen kannst du die Zugriffsdaten für den Datenbank Server festlegen.
|
||||
|
||||
'database' => [
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'mysqlusername',
|
||||
'password' => 'mysqlpassword',
|
||||
'database' => 'mysqldatabasename',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
'database' => [
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'mysqlusername',
|
||||
'password' => 'mysqlpassword',
|
||||
'database' => 'mysqldatabasename',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
|
||||
Sollten alle der folgenden Environment-Variablen gesetzt sein, wird Friendica diese anstatt der vorher konfigurierten Werte nutzen.
|
||||
|
||||
MYSQL_HOST
|
||||
MYSQL_PORT
|
||||
MYSQL_USERNAME
|
||||
MYSQL_PASSWORD
|
||||
MYSQL_DATABASE
|
||||
MYSQL_HOST
|
||||
MYSQL_PORT
|
||||
MYSQL_USERNAME
|
||||
MYSQL_PASSWORD
|
||||
MYSQL_DATABASE
|
||||
|
||||
## Administratoren
|
||||
|
||||
|
@ -371,17 +371,17 @@ Die Liste der E-Mail Adressen kann aber einfach erweitert werden.
|
|||
Mit keiner der angegebenen E-Mail Adressen können weitere Accounts registriert werden.
|
||||
|
||||
'config' => [
|
||||
'admin_email' => 'you@example.com, buddy@example.com',
|
||||
],
|
||||
'admin_email' => 'you@example.com, buddy@example.com',
|
||||
],
|
||||
|
||||
## PHP Pfad
|
||||
|
||||
Einige Prozesse von Friendica laufen im Hintergrund.
|
||||
Für diese Prozesse muss der Pfad zu der PHP Version gesetzt sein, die verwendet werden soll.
|
||||
|
||||
'config' => [
|
||||
'php_path' => '/usr/bin/php',
|
||||
],
|
||||
'config' => [
|
||||
'php_path' => '/usr/bin/php',
|
||||
],
|
||||
|
||||
## Unterverzeichnis Konfiguration
|
||||
|
||||
|
@ -389,9 +389,9 @@ Man kann Friendica in ein Unterverzeichnis des Webservers installieren.
|
|||
Wir raten allerdings dringen davon ab, da es die Interoperabilität mit anderen Netzwerken (z.B. Diaspora, GNU Social, Hubzilla) verhindert.
|
||||
Mal angenommen, du hast ein Unterverzeichnis tests und willst Friendica in ein weiteres Unterverzeichnis installieren, dann lautet die Konfiguration hierfür:
|
||||
|
||||
'system' => [
|
||||
'urlpath' => 'tests/friendica',
|
||||
],
|
||||
'system' => [
|
||||
'urlpath' => 'tests/friendica',
|
||||
],
|
||||
|
||||
## Weitere Ausnahmen
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
To get the Doxygen API Documentation you must render it with the program <a href="http://www.doxygen.org">Doxygen</a> (included in most distributions).
|
||||
<pre>
|
||||
$ doxygen util/Doxyfile
|
||||
$ doxygen Doxyfile
|
||||
</pre>
|
||||
<br>
|
||||
<a href="javascript:history.back()">back</a>
|
||||
|
|
|
@ -3,78 +3,52 @@ Friendica translations
|
|||
|
||||
* [Home](help)
|
||||
|
||||
Translation Process
|
||||
-------------------
|
||||
## Overview
|
||||
|
||||
The strings used in the UI of Friendica are translated at [Transifex] [1] and then included in the git repository at github.
|
||||
If you want to help with translation for any language, be it correcting terms or translating friendica to a currently not supported language, please register an account at transifex.com and contact the friendica translation team there.
|
||||
The Friendica translation process is based on `gettext` PO files.
|
||||
|
||||
Translating friendica is simple.
|
||||
Just use the online tool at transifex.
|
||||
If you don't want to deal with git & co. that is fine, we check the status of the translations regularly and import them into the source tree at github so that others can use them.
|
||||
Basic worflow:
|
||||
1. `xgettext` is used to collect translation strings across the project in the master PO file located in `view/lang/C/messages.po`.
|
||||
2. This file makes translations strings available at [the Transifex Friendica page](https://www.transifex.com/Friendica/friendica/dashboard/).
|
||||
3. The translation itself is done at Transifex by volunteers.
|
||||
4. The resulting PO files by languages are manually updated in `view/lang/<language>/messages.po`.
|
||||
5. PO files are converted to PHP arrays in `view/lang/<language>/strings.php` that are ultimately used by Friendica to display the translations.
|
||||
|
||||
We do not include every translation from transifex in the source tree to avoid a scattered and disturbed overall experience.
|
||||
As an uneducated guess we have a lower limit of 50% translated strings before we include the language (for the core messages.po file, addont translation will be included once all strings of an addon are translated.
|
||||
This limit is judging only by the amount of translated strings under the assumption that the most prominent strings for the UI will be translated first by a translation team.
|
||||
If you feel your translation useable before this limit, please contact us and we will probably include your teams work in the source tree.
|
||||
## Translate Friendica in your favorite language
|
||||
|
||||
If you want to help translating, please concentrate on the core messages.po file first.
|
||||
We will only include translations with a sufficient translated messages.po file.
|
||||
Translations of addons will only be included, when the core file is included as well.
|
||||
Thank you for your interest in improving Friendica's translation!
|
||||
Please register a free Transifex account and ask over at [the Transifex Friendica page](https://www.transifex.com/Friendica/friendica/dashboard/) to join the translation team for your favorite language.
|
||||
|
||||
If you want to get your work into the source tree yourself, feel free to do so and contact us with and questions that arise.
|
||||
The process is simple and friendica ships with all the tools necessary.
|
||||
As a rule of thumb, we add support for a language in Friendica when at least 50% of the strings have been translated to avoid a scattered experience.
|
||||
For addons, we add support for a language when all the strings for this addon have been translated and only if we already support the language in Friendica.
|
||||
|
||||
The location of the translated files in the source tree is
|
||||
/view/lang/LNG-CODE/
|
||||
where LNG-CODE is the language code used, e.g. de for German or fr for French.
|
||||
The translated strings come as a "message.po" file from transifex which needs to be translated into the PHP file friendica uses.
|
||||
To do so, place the file in the directory mentioned above and use the "po2php" command from the Friendica Console.
|
||||
## Add new translation strings
|
||||
|
||||
Assuming you want to convert the German localization which is placed in view/lang/de/message.po you would do the following.
|
||||
### Core
|
||||
|
||||
1. Navigate at the command prompt to the base directory of your
|
||||
friendica installation
|
||||
Once you have added new translation strings in your code changes, please run `bin/run_xgettext.sh` from the base Friendica directory and commit the updated `view/lang/C/messages.po` to your branch.
|
||||
|
||||
2. Execute the po2php command, which will place the translation
|
||||
in the strings.php file that is used by friendica.
|
||||
### Addon
|
||||
|
||||
$> php bin/console.php po2php view/lang/de/messages.po
|
||||
If you have the `friendica-addons` repository in the `addon` directory of your Friendica cloned repository, just run `bin/run_xgettext.sh -a <addon_name>` from the base Friendica directory.
|
||||
|
||||
The output of the script will be placed at view/lang/de/strings.php where
|
||||
friendica is expecting it, so you can test your translation immediately.
|
||||
*Please note that the console tool has to be called from the base directory of your Friendica installation.*
|
||||
Otherwise:
|
||||
|
||||
3. Visit your friendica page to check if it still works in the language you
|
||||
just translated. If not try to find the error, most likely PHP will give
|
||||
you a hint in the log/warnings.about the error.
|
||||
cd /path/to/friendica-addons/<addon_name>
|
||||
/path/to/friendica/bin/run_xgettext.sh -s
|
||||
|
||||
For debugging you can also try to "run" the file with PHP. This should
|
||||
not give any output if the file is ok but might give a hint for
|
||||
searching the bug in the file.
|
||||
In either case, you need to commit the updated `<addon_name>/lang/C/messages.po` to your working branch.
|
||||
|
||||
$> php view/lang/de/strings.php
|
||||
## Update translations from Transifex
|
||||
|
||||
4. commit the two files with a meaningful commit message to your git
|
||||
repository, push it to your fork of the friendica repository at github and
|
||||
issue a pull request for that commit.
|
||||
Please download the Transifex file "for use" in `view/lang/<language>/messages.po`.
|
||||
|
||||
You should translate the PO files at Transifex.
|
||||
Otherwise your work might get lost, when the translation from Transifex is included to the Friendica repository after it was updated there.
|
||||
Then run `bin/console po2php view/lang/<language>/messages.po` to update the related `strings.php` file and commit both files to your working branch.
|
||||
|
||||
Utilities
|
||||
---------
|
||||
### Using the Transifex client
|
||||
|
||||
Additional to the po2php command there are some more utilities for translation in the console.
|
||||
If you only want to translate friendica into another language you wont need any of these tools most likely but it gives you an idea how the translation process of friendica works.
|
||||
|
||||
For further information see the utils/README file.
|
||||
|
||||
Transifex-Client
|
||||
----------------
|
||||
|
||||
Transifex has a client program which let you interact with the translation files in a similar way to git.
|
||||
Help for the client can be found at the [Transifex Help Center] [2].
|
||||
Transifex has a client program which allows you to sync files between your cloned Friendica repository and Transifex.
|
||||
Help for the client can be found at the [Transifex Help Center](https://docs.transifex.com/client/introduction).
|
||||
Here we will only cover basic usage.
|
||||
|
||||
After installation of the client, you should have a `tx` command available on your system.
|
||||
|
@ -88,17 +62,25 @@ The content of the file should be something like the following:
|
|||
password = p@ssw0rd
|
||||
hostname = https://www.transifex.com
|
||||
|
||||
Since Friendica version 3.5.1 we ship configuration files for the Transifex client in the core repository and the addon repository.
|
||||
To update the translation files after you have translated strings of e.g. Esperanto in the web-UI of transifex you can use `tx` to download the file.
|
||||
Since Friendica version 3.5.1 we ship configuration files for the Transifex client in the core repository and the addon repository in `.tx/config`.
|
||||
To update the PO files after you have translated strings of e.g. Esperanto on the Transifex website you can use `tx` to download the updated PO file in the right location.
|
||||
|
||||
$> tx pull -l eo
|
||||
|
||||
And then use the `po2php` command described above to convert the `messages.po` file to the `strings.php` file Friendica is loading.
|
||||
Then run `bin/console po2php view/lang/<language>/messages.po` to update the related `strings.php` file and commit both files to your working branch.
|
||||
|
||||
$> php bin/console.php po2php view/lang/eo/messages.po
|
||||
## Translation functions usage
|
||||
|
||||
Afterwards, just commit the two changed files to a feature branch of your Friendica repository, push the changes to github and open a pull request for your changes.
|
||||
### Basic usage
|
||||
|
||||
[1]: https://www.transifex.com/projects/p/friendica/
|
||||
[2]: https://docs.transifex.com/client/introduction
|
||||
- `Friendica\Core\L10n::t('Label')` => `Label`
|
||||
- `Friendica\Core\L10n::t('Label %s', 'test')` => `Label test`
|
||||
|
||||
### Plural
|
||||
|
||||
- `Friendica\Core\L10n::tt('Label', 'Labels', 1)` => `Label`
|
||||
- `Friendica\Core\L10n::tt('Label', 'Labels', 3)` => `Labels`
|
||||
- `Friendica\Core\L10n::tt('%d Label', '%d Labels', 1)` => `1 Label`
|
||||
- `Friendica\Core\L10n::tt('%d Label', '%d Labels', 3)` => `3 Labels`
|
||||
- `Friendica\Core\L10n::tt('%d Label', 'Labels %2%s %3%s', 1, 'test', 'test2')` => `Label test test2`
|
||||
- `Friendica\Core\L10n::tt('%d Label', 'Labels %2%s %3%s', 3, 'test', 'test2')` => `Labels test test2`
|
||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Core\Renderer;
|
|||
function credits_content()
|
||||
{
|
||||
/* fill the page with credits */
|
||||
$credits_string = file_get_contents('util/credits.txt');
|
||||
$credits_string = file_get_contents('CREDITS.txt');
|
||||
$names = explode("\n", $credits_string);
|
||||
$tpl = Renderer::getMarkupTemplate('credits.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
|
|
36
mods/README.md
Normal file
36
mods/README.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
Friendica mods files
|
||||
====================
|
||||
|
||||
## `bookmarklet-share2friendica`
|
||||
|
||||
Browser bookmarklet to share any page with your Friendica account.
|
||||
Please see `bookmarklet-share2friendica/README.md` for detailed instruction.
|
||||
|
||||
## `fpostit`
|
||||
|
||||
Node-agnostic Friendica bookmarklet by Devlon Duthie.
|
||||
Unmaintained and unsupported.
|
||||
|
||||
## `home.css` and `home.html`
|
||||
|
||||
Example files to customize the landing page of your Friendica node.
|
||||
The `home.html` file contains the text of the page, the `home.css` file the style information.
|
||||
The login box will be added according to the other system settings.
|
||||
Both files have to be placed in the base directory of your Friendica installation to be used for the landing page.
|
||||
|
||||
## `local.config.vagrant.php`
|
||||
|
||||
Configuration file used by the Vagrant setup script.
|
||||
|
||||
## `sample-Lighttpd.config` and `sample-nginx.config`
|
||||
|
||||
Sample configuration files to use Friendica with Lighttpd or Nginx.
|
||||
Please check software documentation to know how modify these examples to make them work on your server.
|
||||
|
||||
## `sample-systemd.timer` and `sample-systemd.service`
|
||||
|
||||
Sample systemd unit files to start worker.php periodically.
|
||||
|
||||
Please place them in the correct location for your system, typically this is `/etc/systemd/system/friendicaworker.timer` and `/etc/systemd/system/friendicaworker.service`.
|
||||
Please report problems and improvements to `!helpers@forum.friendi.ca` and `@utzer@social.yl.ms` or open an issue in [the Github Friendica page](https://github.com/friendica/friendica/issues).
|
||||
This is for usage of systemd instead of cron to start the worker periodically, the solution is a work-in-progress and can surely be improved.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
@ -16,9 +16,9 @@
|
|||
return [
|
||||
'database' => [
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'mysqlusername',
|
||||
'password' => 'mysqlpassword',
|
||||
'database' => 'mysqldatabasename',
|
||||
'username' => 'friendica',
|
||||
'password' => 'friendica',
|
||||
'database' => 'friendica',
|
||||
'charset' => 'utf8mb4',
|
||||
],
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
sample-Lighttpd.config
|
||||
sample-nginx.config
|
||||
|
||||
Sample configuration files to use Friendica with Lighttpd
|
||||
or Nginx. Pleas check software documentation to know how modify
|
||||
these examples to make them work on your server.
|
||||
|
||||
|
||||
sample-systemd.timer
|
||||
sample-systemd.service
|
||||
|
||||
Sample systemd unit files to start worker.php periodically.
|
||||
|
||||
Please place them in the correct location for your system,
|
||||
typically this is /etc/systemd/system/friendicaworker.timer
|
||||
and /etc/systemd/system/friendicaworker.service.
|
||||
Please report problems and improvements to
|
||||
!helpers@forum.friendi.ca and @utzer@social.yl.ms or open an
|
||||
issue in Github (https://github.com/friendica/friendica/issues).
|
||||
This is for usage of systemd instead of cron to start the worker.php
|
||||
periodically, the solution is work-in-progress and can surely be improved.
|
||||
|
||||
home.css
|
||||
home.html
|
||||
|
||||
Example files to customize the landing page of your Friendica node.
|
||||
The home.html file contains the text of the page, the home.css file
|
||||
the style information. The login box will be added according to the
|
||||
other system settings.
|
||||
Both files have to be placed in the base directory of your Friendica
|
||||
installation to be used for the landing page.
|
|
@ -18,7 +18,6 @@
|
|||
<directory suffix=".php">library/</directory>
|
||||
<directory suffix=".php">spec/</directory>
|
||||
<directory suffix=".php">tests/</directory>
|
||||
<directory suffix=".php">util/</directory>
|
||||
<directory suffix=".php">view/</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
|
|
|
@ -59,7 +59,6 @@ HELP;
|
|||
throw new \RuntimeException('DocBlox isn\'t available.');
|
||||
}
|
||||
|
||||
//return from util folder to frindica base dir
|
||||
$dir = get_app()->getBasePath();
|
||||
|
||||
//stack for dirs to search
|
||||
|
@ -130,8 +129,6 @@ HELP;
|
|||
/**
|
||||
* This function generates a comma separated list of file names.
|
||||
*
|
||||
* @package util
|
||||
*
|
||||
* @param array $fileset Set of file names
|
||||
*
|
||||
* @return string comma-separated list of the file names
|
||||
|
@ -143,7 +140,6 @@ HELP;
|
|||
|
||||
/**
|
||||
* This functions runs phpdoc on the provided list of files
|
||||
* @package util
|
||||
*
|
||||
* @param array $fileset Set of filenames
|
||||
*
|
||||
|
@ -169,8 +165,6 @@ HELP;
|
|||
*
|
||||
* In that version, it does not necessarily generate the smallest set, because it may not alter the elements order enough.
|
||||
*
|
||||
* @package util
|
||||
*
|
||||
* @param array $fileset set of filenames
|
||||
* @param int $ps number of files in subsets
|
||||
*
|
||||
|
|
|
@ -27,7 +27,7 @@ Description
|
|||
|
||||
Options
|
||||
-p <n> Number of plural forms. Default: 2
|
||||
--base <file> Path to base messages.po file. Default: util/messages.po
|
||||
--base <file> Path to base messages.po file. Default: view/lang/C/messages.po
|
||||
-h|--help|-? Show help information
|
||||
-v Show more debug information.
|
||||
HELP;
|
||||
|
@ -107,7 +107,7 @@ HELP;
|
|||
$out .= sprintf('"Plural-Forms: nplurals=%s; plural=%s;\n"', $lang_pnum, $lang_logic) . "\n";
|
||||
$out .= "\n";
|
||||
|
||||
$base_path = $this->getOption('base', 'util' . DIRECTORY_SEPARATOR . 'messages.po');
|
||||
$base_path = $this->getOption('base', 'view/lang/C/messages.po');
|
||||
|
||||
// load base messages.po and extract msgids
|
||||
$base_msgids = [];
|
||||
|
|
|
@ -61,7 +61,7 @@ HELP;
|
|||
|
||||
$outfile = dirname($pofile) . DIRECTORY_SEPARATOR . 'strings.php';
|
||||
|
||||
if (strstr($outfile, 'util')) {
|
||||
if (basename(dirname($pofile)) == 'C') {
|
||||
$lang = 'en';
|
||||
} else {
|
||||
$lang = str_replace('-', '_', basename(dirname($pofile)));
|
||||
|
|
|
@ -86,8 +86,6 @@ HELP;
|
|||
$this->out('String files');
|
||||
}
|
||||
|
||||
$this->checkFile($php_path, 'util/strings.php');
|
||||
|
||||
$files = glob('view/lang/*/strings.php');
|
||||
$this->checkFiles($php_path, $files);
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ class Installer
|
|||
|
||||
if ($passed2) {
|
||||
$str = Strings::getRandomName(8);
|
||||
$cmd = "$phppath util/testargs.php $str";
|
||||
$cmd = "$phppath bin/testargs.php $str";
|
||||
$result = trim(shell_exec($cmd));
|
||||
$passed3 = $result == $str;
|
||||
$help = "";
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
Options -Indexes
|
||||
|
||||
# Remove the following lines or modify it to run the string translator utility
|
||||
<IfModule authz_host_module>
|
||||
#Apache 2.4
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_host_module>
|
||||
#Apache 2.2
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
120
util/README
120
util/README
|
@ -1,120 +0,0 @@
|
|||
Utilities
|
||||
|
||||
php bin/console.php typo - is a crude syntax checker to avoid checking in files with simple
|
||||
typos. It basically just loads each of our project files at once. Run from
|
||||
cmdline and see if any parsing errors are reported.
|
||||
|
||||
|
||||
|
||||
Internationalisation
|
||||
|
||||
php bin/console.php extract - extracts translatable strings from our project files. It
|
||||
currently doesn't pick up strings in other libraries we might be using such as
|
||||
the HTML parsers.
|
||||
|
||||
In order for extract to do its job, every use of the L10n::t() translation function
|
||||
must be preceded by one space. The string also can not contain parentheses. If
|
||||
parens are required in a string which requires translation, please use hex escapes.
|
||||
|
||||
\x28 = (
|
||||
\x29 = )
|
||||
|
||||
This only applies to English. Other languages may use parens in strings
|
||||
because they don't require extraction.
|
||||
|
||||
strings.php - a recent run of the strings program. This provides output that
|
||||
is suitable for direct inclusion in the program.
|
||||
|
||||
There are also translatable strings in the various files in the view/lang/en
|
||||
directory. By setting $lang = 'something' in .htconfig.php, the application
|
||||
will search for view/lang/something/filename prior to the English version in
|
||||
view/lang/en/filename when loading templates and view files.
|
||||
|
||||
The translated string table should be placed in view/lang/$lang/strings.php for
|
||||
automatic inclusion.
|
||||
|
||||
You are not restricted to using known languages. You may also use this to
|
||||
translate the software into "pirate", "surfer" or merely to replace certain
|
||||
text which you don't care for.
|
||||
|
||||
Note: The view/lang/en directory contains many HTML template files, some of which
|
||||
only have a few words of English text amongst the HTML. Over time we will move
|
||||
the translation to the Renderer::replaceMacros() function which calls these files and
|
||||
then relocate the files to the view directory. The files in the top-level view
|
||||
directory are template files which do not require translation.
|
||||
|
||||
|
||||
Placeholders
|
||||
|
||||
Do not translate placeholders in strings! Things like %s, %d, %1$s and $somename
|
||||
are used to add dynamic content to the string.
|
||||
|
||||
%s represents a dynamic string, like in "Welcome to %s"
|
||||
%d represents a dynamic number, like in "%d new messages"
|
||||
$somename is a variable like in php
|
||||
In %1$s %2$s, the numbers are the position index of multiple dynamic content.
|
||||
You could swap position in string of indexed placeholders.
|
||||
e.g.
|
||||
"%1$s's %2$s" => "John's photo", "John's item"
|
||||
"%2$s di %1$s" => "foto di John", "elemento di John"
|
||||
|
||||
|
||||
Plural
|
||||
|
||||
The L10n::tt() function supports plural form. The extract command writes this in
|
||||
strings.php as an array, one string for every plural form language supports:
|
||||
|
||||
$a->string["%d message sent"] = Array(
|
||||
0 => "%d message sent",
|
||||
1 => "%d messages sent",
|
||||
);
|
||||
|
||||
The function string_plural_select($n) defined in strings.php, return the string
|
||||
index to use, related to the numbers of item (value of $n).
|
||||
|
||||
This is modeled after ngettext function of GNU gettext.
|
||||
More info at http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
|
||||
|
||||
|
||||
Xgettext and .po workflow
|
||||
|
||||
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 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.
|
||||
|
||||
3. open view/lang/<language>/messages.po with a text editor and fill in infos in
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
|
||||
(eg:
|
||||
"Last-Translator: Guybrush Threepwood <gb@host.com>"
|
||||
"Language-Team: Pirate Friendika <pirate-friendika-ml@host.com>\n"
|
||||
"Language: pi\n"
|
||||
)
|
||||
|
||||
For the line
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
read GNU gettext manual at
|
||||
http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
|
||||
|
||||
4. You could then translate the strings in text editor, but I suggest to use one
|
||||
of the many .po editors out there, like QtLinguist
|
||||
|
||||
5. run
|
||||
$ php bin/console.php po2php view/lang/<language>/messages.po
|
||||
to create the strings.php file
|
||||
|
||||
When strings are added or modified in source, you could run
|
||||
$ 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.
|
||||
|
||||
If you already translated Friendica using strings.php, you could import your old
|
||||
translation to messages.po. Run:
|
||||
$ php bin/console.php php2po view/lang/<language>/strings.php
|
1776
util/strings.php
1776
util/strings.php
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue