From 544fcc4500df0808aba190f26d7b185ffe1f0f53 Mon Sep 17 00:00:00 2001 From: Sandro Date: Fri, 16 Aug 2019 08:18:34 +0200 Subject: Docker readme cleanups (#2483) * Don't manually pull the base image * Remove sudo before each docker cause the user is usually added to the docker group If not you can read it up here: https://docs.docker.com/install/linux/linux-postinstall/ * Simplify cd --- Docker/README.md | 57 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'Docker') diff --git a/Docker/README.md b/Docker/README.md index c93178ff7..527a0e83b 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -17,7 +17,7 @@ sh get-docker.sh ## Create an isolated network ```sh -sudo docker network create freshrss-network +docker network create freshrss-network ``` ## Recommended: use [Træfik](https://traefik.io/) reverse proxy @@ -25,11 +25,11 @@ It is a good idea to use a reverse proxy on your host server, providing HTTPS. Here is the recommended configuration using automatic [Let’s Encrypt](https://letsencrypt.org/) HTTPS certificates and with a redirection from HTTP to HTTPS. See further below for alternatives. ```sh -sudo docker volume create traefik-letsencrypt -sudo docker volume create traefik-tmp +docker volume create traefik-letsencrypt +docker volume create traefik-tmp # Just change your e-mail address in the command below: -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v traefik-letsencrypt:/etc/traefik/acme \ -v traefik-tmp:/tmp \ -v /var/run/docker.sock:/var/run/docker.sock:ro \ @@ -55,10 +55,10 @@ You must first chose a domain (DNS) or sub-domain, e.g. `freshrss.example.net`. > **N.B.:** Default images are for x64 (Intel, AMD) platforms. For ARM (e.g. Raspberry Pi), use the `*-arm` tags. For other platforms, see the section *Build Docker image* further below. ```sh -sudo docker volume create freshrss-data +docker volume create freshrss-data # Remember to replace freshrss.example.net by your server address in the command below: -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v freshrss-data:/var/www/FreshRSS/data \ -e 'CRON_MIN=4,34' \ -e TZ=Europe/Paris \ @@ -82,11 +82,11 @@ This already works with a built-in **SQLite** database (easiest), but more power ### [MySQL](https://hub.docker.com/_/mysql/) ```sh # If you already have a MySQL instance running, just attach it to the FreshRSS network: -sudo docker network connect freshrss-network mysql +docker network connect freshrss-network mysql # Otherwise, start a new MySQL instance, remembering to change the passwords: -sudo docker volume create mysql-data -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker volume create mysql-data +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v mysql-data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_DATABASE=freshrss \ @@ -99,11 +99,11 @@ sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ ### [PostgreSQL](https://hub.docker.com/_/postgres/) ```sh # If you already have a PostgreSQL instance running, just attach it to the FreshRSS network: -sudo docker network connect freshrss-network postgres +docker network connect freshrss-network postgres # Otherwise, start a new PostgreSQL instance, remembering to change the passwords: -sudo docker volume create pgsql-data -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker volume create pgsql-data +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v pgsql-data:/var/lib/postgresql/data \ -e POSTGRES_DB=freshrss \ -e POSTGRES_USER=freshrss \ @@ -121,14 +121,14 @@ or use the command line described below. ```sh # Rebuild an image (see build section above) or get a new online version: -sudo docker pull freshrss/freshrss +docker pull freshrss/freshrss # And then -sudo docker stop freshrss -sudo docker rename freshrss freshrss_old +docker stop freshrss +docker rename freshrss freshrss_old # See the run section above for the full command -sudo docker run ... --name freshrss freshrss/freshrss +docker run ... --name freshrss freshrss/freshrss # If everything is working, delete the old container -sudo docker rm freshrss_old +docker rm freshrss_old ``` @@ -153,17 +153,16 @@ Note that prebuilt images are less recent and only available for x64 (Intel, AMD # First time only git clone https://github.com/FreshRSS/FreshRSS.git -cd ./FreshRSS/ +cd FreshRSS/ git pull -sudo docker pull ubuntu:18.10 -sudo docker build --tag freshrss/freshrss -f Docker/Dockerfile . +docker build --pull --tag freshrss/freshrss -f Docker/Dockerfile . ``` ## Command line ```sh -sudo docker exec --user apache -it freshrss php ./cli/list-users.php +docker exec --user apache -it freshrss php ./cli/list-users.php ``` See the [CLI documentation](../cli/) for all the other commands. @@ -173,14 +172,14 @@ See the [CLI documentation](../cli/) for all the other commands. ```sh # See FreshRSS data if you use Docker volume -sudo docker volume inspect freshrss-data +docker volume inspect freshrss-data sudo ls /var/lib/docker/volumes/freshrss-data/_data/ # See Web server logs -sudo docker logs -f freshrss +docker logs -f freshrss # Enter inside FreshRSS docker container -sudo docker exec -it freshrss sh +docker exec -it freshrss sh ## See FreshRSS root inside the container ls /var/www/FreshRSS/ ``` @@ -198,7 +197,7 @@ containing a valid cron minute definition such as `'13,43'` (recommended) or `'* Not passing the `CRON_MIN` environment variable – or setting it to empty string – will disable the cron daemon. ```sh -sudo docker run ... \ +docker run ... \ -e 'CRON_MIN=13,43' \ --name freshrss freshrss/freshrss ``` @@ -221,7 +220,7 @@ See cron option 1 for customising the cron schedule. #### For the Ubuntu image (default) ```sh -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v freshrss-data:/var/www/FreshRSS/data \ -e 'CRON_MIN=17,47' \ --net freshrss-network \ @@ -231,7 +230,7 @@ sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ #### For the Alpine image ```sh -sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ +docker run -d --restart unless-stopped --log-opt max-size=10m \ -v freshrss-data:/var/www/FreshRSS/data \ -e 'CRON_MIN=27,57' \ --net freshrss-network \ @@ -248,7 +247,7 @@ Changes in Apache `.htaccess` files are applied when restarting the container. In particular, if you want FreshRSS to use HTTP-based login (instead of the easier Web form login), you can mount your own `./FreshRSS/p/i/.htaccess`: ``` -sudo docker run ... +docker run ... -v /your/.htaccess:/var/www/FreshRSS/p/i/.htaccess \ -v /your/.htpasswd:/var/www/FreshRSS/data/.htpasswd \ ... @@ -276,7 +275,7 @@ A [docker-compose.yml](docker-compose.yml) file is given as an example, using Po You can then launch the stack (FreshRSS + PostgreSQL) with: ```sh -sudo docker-compose up -d +docker-compose up -d ``` ### Alternative reverse proxy using [nginx](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) -- cgit v1.2.3 From 38a4b22f7bb2eb51c5224d2a340e199d6a280797 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 17 Aug 2019 13:07:30 +0200 Subject: Doc MariaDB (#2494) --- CONTRIBUTING.md | 2 +- Docker/README.md | 6 +++--- README.fr.md | 2 +- README.md | 2 +- docs/en/contributing.md | 2 +- docs/fr/developers/02_Github.md | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Docker') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df56fad76..ef00fb310 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ If you have to create a new ticket, try to apply the following advices: - We also need some information: + Your FreshRSS version (on about page or `constants.php` file) + Your server configuration: type of hosting, PHP version - + Your storage system (MySQL / MariaDB or SQLite) + + Your storage system (SQLite, MySQL, MariaDB, PostgreSQL) + If possible, the related logs (PHP logs and FreshRSS logs under `data/users/your_user/log.txt`) ## Fix a bug diff --git a/Docker/README.md b/Docker/README.md index 527a0e83b..32024c829 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -79,16 +79,16 @@ docker run -d --restart unless-stopped --log-opt max-size=10m \ This already works with a built-in **SQLite** database (easiest), but more powerful databases are supported: -### [MySQL](https://hub.docker.com/_/mysql/) +### [MySQL](https://hub.docker.com/_/mysql/) or [MariaDB](https://hub.docker.com/_/mariadb) ```sh -# If you already have a MySQL instance running, just attach it to the FreshRSS network: +# If you already have a MySQL or MariaDB instance running, just attach it to the FreshRSS network: docker network connect freshrss-network mysql # Otherwise, start a new MySQL instance, remembering to change the passwords: docker volume create mysql-data docker run -d --restart unless-stopped --log-opt max-size=10m \ -v mysql-data:/var/lib/mysql \ - -e MYSQL_ROOT_PASSWORD=rootpass + -e MYSQL_ROOT_PASSWORD=rootpass \ -e MYSQL_DATABASE=freshrss \ -e MYSQL_USER=freshrss \ -e MYSQL_PASSWORD=pass \ diff --git a/README.fr.md b/README.fr.md index f2e13e0f9..d9b145fc4 100644 --- a/README.fr.md +++ b/README.fr.md @@ -46,7 +46,7 @@ FreshRSS n’est fourni avec aucune garantie. * PHP 5.3.8+ (PHP 5.4+ recommandé, et PHP 5.5+ pour les performances, ou PHP 7+ pour d’encore meilleures performances) * Requis : [cURL](https://secure.php.net/curl), [DOM](https://secure.php.net/dom), [XML](https://secure.php.net/xml), [session](https://secure.php.net/session), [ctype](https://secure.php.net/ctype), et [PDO_MySQL](https://secure.php.net/pdo-mysql) ou [PDO_SQLite](https://secure.php.net/pdo-sqlite) ou [PDO_PGSQL](https://secure.php.net/pdo-pgsql) * Recommandés : [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](https://secure.php.net/intl.idn) (pour les noms de domaines internationalisés), [mbstring](https://secure.php.net/mbstring) (pour le texte Unicode), [iconv](https://secure.php.net/iconv) (pour conversion d’encodages), [ZIP](https://secure.php.net/zip) (pour import/export), [zlib](https://secure.php.net/zlib) (pour les flux compressés) -* MySQL 5.5.3+ (recommandé), ou SQLite 3.7.4+, ou PostgreSQL 9.2+ +* MySQL 5.5.3+ (recommandé) ou équivalent MariaDB, ou SQLite 3.7.4+, ou PostgreSQL 9.2+ # Téléchargement diff --git a/README.md b/README.md index e0f5d6519..e1660a9d1 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ FreshRSS comes with absolutely no warranty. * PHP 5.3.8+ (PHP 5.4+ recommended, and PHP 5.5+ for performance, or PHP 7 for even higher performance) * Required extensions: [cURL](https://secure.php.net/curl), [DOM](https://secure.php.net/dom), [XML](https://secure.php.net/xml), [session](https://secure.php.net/session), [ctype](https://secure.php.net/ctype), and [PDO_MySQL](https://secure.php.net/pdo-mysql) or [PDO_SQLite](https://secure.php.net/pdo-sqlite) or [PDO_PGSQL](https://secure.php.net/pdo-pgsql) * Recommended extensions: [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (for API access on 32-bit platforms), [IDN](https://secure.php.net/intl.idn) (for Internationalized Domain Names), [mbstring](https://secure.php.net/mbstring) (for Unicode strings), [iconv](https://secure.php.net/iconv) (for charset conversion), [ZIP](https://secure.php.net/zip) (for import/export), [zlib](https://secure.php.net/zlib) (for compressed feeds) -* MySQL 5.5.3+ (recommended), or SQLite 3.7.4+, or PostgreSQL 9.2+ +* MySQL 5.5.3+ (recommended) or MariaDB equivalent, or SQLite 3.7.4+, or PostgreSQL 9.2+ # Releases diff --git a/docs/en/contributing.md b/docs/en/contributing.md index 19f9cb9b1..45c1650fb 100644 --- a/docs/en/contributing.md +++ b/docs/en/contributing.md @@ -20,7 +20,7 @@ If you have to create a new ticket, try to apply the following advices: - We also need some information: + Your FreshRSS version (on about page or `constants.php` file) + Your server configuration: type of hosting, PHP version - + Your storage system (MySQL / MariaDB / PostgreSQL or SQLite) + + Your storage system (SQLite, MySQL, MariaDB, PostgreSQL) + If possible, the related logs (PHP logs and FreshRSS logs under `data/users/your_user/log.txt`) ## Fix a bug diff --git a/docs/fr/developers/02_Github.md b/docs/fr/developers/02_Github.md index b4fa7b301..686b69ec4 100644 --- a/docs/fr/developers/02_Github.md +++ b/docs/fr/developers/02_Github.md @@ -63,7 +63,7 @@ Pensez à donner les informations suivantes si vous les connaissez : 1. Quel navigateur ? Quelle version ? 2. Quel serveur : Apache, Nginx ? Quelle version ? 3. Quelle version de PHP ? - 4. MySQL ou SQLite ? Quelle version ? + 4. Quelle base de données : SQLite, MySQL, MariaDB, PostgreSQL ? Quelle version ? 5. Quelle distribution sur le serveur ? Et… quelle version ? ---- -- cgit v1.2.3 From d09826c145bd6276f8a0e85a87dccefb55227ca1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 20 Aug 2019 15:48:54 +0200 Subject: Docker Alpine opcache (#2498) https://github.com/FreshRSS/FreshRSS/pull/2495#discussion_r315662184 https://php.net/ref.opcache We need to retest the performances https://github.com/FreshRSS/FreshRSS/pull/2205 --- Docker/Dockerfile-Alpine | 2 +- docs/en/admins/02_Installation.md | 2 +- docs/fr/users/01_Installation.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Docker') diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpine index ac5d74a43..b8ef72988 100644 --- a/Docker/Dockerfile-Alpine +++ b/Docker/Dockerfile-Alpine @@ -5,7 +5,7 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"] RUN apk add --no-cache \ apache2 php7-apache2 \ php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \ - php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-session php7-simplexml php7-xmlreader php7-zlib \ + php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-opcache php7-session php7-simplexml php7-xmlreader php7-zlib \ php7-pdo_sqlite php7-pdo_mysql php7-pdo_pgsql RUN mkdir -p /var/www/FreshRSS /run/apache2/ diff --git a/docs/en/admins/02_Installation.md b/docs/en/admins/02_Installation.md index 7606ce7b2..375b68044 100644 --- a/docs/en/admins/02_Installation.md +++ b/docs/en/admins/02_Installation.md @@ -8,7 +8,7 @@ You need to verify that your server can run FreshRSS before installing it. If yo | ----------- | ---------------- | ----------------------------- | | Web server | **Apache 2** | Nginx | | PHP | **PHP 7+** | PHP 5.5+ | -| PHP modules | Required: libxml, cURL, PDO_MySQL, PCRE and ctype.
Required (32-bit only): GMP
Recommanded: JSON, Zlib, mbstring, iconv, ZipArchive
*For the whole modules list see [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/744a9e8cf00aef7dec0acfa5f90f0dcfa2ef8837/Docker/Dockerfile-Alpine#L7-L9)* | | +| PHP modules | Required: libxml, cURL, PDO_MySQL, PCRE and ctype.
Required (32-bit only): GMP
Recommanded: JSON, Zlib, mbstring, iconv, ZipArchive
*For the whole modules list see [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/master/Docker/Dockerfile-Alpine#L7-L9)* | | | Database | **MySQL 5.5.3+** | SQLite 3.7.4+ | | Browser | **Firefox** | Chrome, Opera, Safari, or IE11+ | diff --git a/docs/fr/users/01_Installation.md b/docs/fr/users/01_Installation.md index cc1f543f1..f90d52c54 100644 --- a/docs/fr/users/01_Installation.md +++ b/docs/fr/users/01_Installation.md @@ -8,7 +8,7 @@ Il est toutefois de votre responsabilité de vérifier que votre hébergement pe | -------- | ----------- | --------------------- | | Serveur web | **Apache 2** | Nginx | | PHP | **PHP 7+** | PHP 5.5+ | - | Modules PHP | Requis : libxml, cURL, PDO_MySQL, PCRE et ctype
Requis (32 bits seulement) : GMP
Recommandé : JSON, Zlib, mbstring et iconv, ZipArchive
*Pour une liste complète des modules nécessaires voir le [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/744a9e8cf00aef7dec0acfa5f90f0dcfa2ef8837/Docker/Dockerfile-Alpine#L7-L9)* | | + | Modules PHP | Requis : libxml, cURL, PDO_MySQL, PCRE et ctype
Requis (32 bits seulement) : GMP
Recommandé : JSON, Zlib, mbstring et iconv, ZipArchive
*Pour une liste complète des modules nécessaires voir le [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/master/Docker/Dockerfile-Alpine#L7-L9)* | | | Base de données | **MySQL 5.5.3+** | SQLite 3.7.4+ | | Navigateur | **Firefox** | Chrome, Opera, Safari, or IE 11+ | -- cgit v1.2.3 From 6cedeeeae51f5e5220d7f786fb801951811bb743 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 22 Aug 2019 20:04:26 +0200 Subject: Minz: New environment variable to control development mode (#2508) * New environment variable to control development mode Suggestion of new enviromnent variable, as discussed https://github.com/FreshRSS/FreshRSS/pull/2492#issuecomment-523613920 * Update Docker/README.md Co-Authored-By: Frans de Jonge * Update Docker/README.md Co-Authored-By: Frans de Jonge * Update Docker/README.md Co-Authored-By: Frans de Jonge * Declare ENV in Dockerfile Tested --- Docker/Dockerfile | 2 ++ Docker/Dockerfile-Alpine | 2 ++ Docker/Dockerfile-QEMU-ARM | 2 ++ Docker/README.md | 16 ++++++++++++++++ app/install.php | 2 +- lib/Minz/FrontController.php | 35 ++++++++++++++++++++--------------- 6 files changed, 43 insertions(+), 16 deletions(-) (limited to 'Docker') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 8693bb0f7..1d2ead96e 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -49,6 +49,8 @@ RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.co ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' +ENV FRESHRSS_ENV '' + ENTRYPOINT ["./Docker/entrypoint.sh"] EXPOSE 80 diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpine index b8ef72988..3b1f1a394 100644 --- a/Docker/Dockerfile-Alpine +++ b/Docker/Dockerfile-Alpine @@ -45,6 +45,8 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' +ENV FRESHRSS_ENV '' + ENTRYPOINT ["./Docker/entrypoint.sh"] EXPOSE 80 diff --git a/Docker/Dockerfile-QEMU-ARM b/Docker/Dockerfile-QEMU-ARM index 4d81a23f0..ea1f98798 100644 --- a/Docker/Dockerfile-QEMU-ARM +++ b/Docker/Dockerfile-QEMU-ARM @@ -61,6 +61,8 @@ RUN rm /usr/bin/qemu-* /var/www/FreshRSS/Docker/qemu-* ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' +ENV FRESHRSS_ENV '' + ENTRYPOINT ["./Docker/entrypoint.sh"] EXPOSE 80 diff --git a/Docker/README.md b/Docker/README.md index 32024c829..9de1d5033 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -238,6 +238,22 @@ docker run -d --restart unless-stopped --log-opt max-size=10m \ crond -f -d 6 ``` +## Development mode + +To contribute to FreshRSS development, you can use one of the Docker images to run and serve the PHP code, +while reading the source code from your local (git) directory, like the following example: + +```sh +cd /path-to-local/FreshRSS/ +docker run --rm -p 8080:80 -e TZ=Europe/Paris -e FRESHRSS_ENV=development \ + -v $(pwd):/var/www/FreshRSS \ + freshrss/freshrss:dev +``` + +This will start a server on port 8080, based on your local PHP code, which will show the logs directly in your terminal. +Press Control+c to exit. + +The `FRESHRSS_ENV=development` environment variable increases the level of logging and ensures that errors are displayed. ## More deployment options diff --git a/app/install.php b/app/install.php index 8e14d14c0..a4d1d0af9 100644 --- a/app/install.php +++ b/app/install.php @@ -61,7 +61,7 @@ function initTranslate() { } function get_best_language() { - $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $accept = empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? '' : $_SERVER['HTTP_ACCEPT_LANGUAGE']; return strtolower(substr($accept, 0, 2)); } diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index 066278b7c..e09b022fc 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -115,21 +115,26 @@ class Minz_FrontController { } private function setReporting() { - $conf = Minz_Configuration::get('system'); - switch($conf->environment) { - case 'production': - error_reporting(E_ALL); - ini_set('display_errors', 'Off'); - ini_set('log_errors', 'On'); - break; - case 'development': - error_reporting(E_ALL); - ini_set('display_errors', 'On'); - ini_set('log_errors', 'On'); - break; - case 'silent': - error_reporting(0); - break; + $envType = getenv('FRESHRSS_ENV'); + if ($envType == '') { + $conf = Minz_Configuration::get('system'); + $envType = $conf->environment; + } + switch ($envType) { + case 'development': + error_reporting(E_ALL); + ini_set('display_errors', 'On'); + ini_set('log_errors', 'On'); + break; + case 'silent': + error_reporting(0); + break; + case 'production': + default: + error_reporting(E_ALL); + ini_set('display_errors', 'Off'); + ini_set('log_errors', 'On'); + break; } } } -- cgit v1.2.3 From 891e8ef7829a2760df794ad1d4e3c664fade3cca Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 25 Sep 2019 07:51:10 +0200 Subject: Explicit Traefik 1.7 (#2533) Traefik 2.0 has some breaking changes. Making the use of version 1.7 explicit while waiting for upgrading to 2.0 https://community.containo.us/t/traefik-release-v2-0-0/1628 --- Docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Docker') diff --git a/Docker/README.md b/Docker/README.md index 9de1d5033..4146a57dd 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -36,7 +36,7 @@ docker run -d --restart unless-stopped --log-opt max-size=10m \ --net freshrss-network \ -p 80:80 \ -p 443:443 \ - --name traefik traefik --docker \ + --name traefik traefik:1.7 --docker \ --loglevel=info \ --entryPoints='Name:http Address::80 Compress:true Redirect.EntryPoint:https' \ --entryPoints='Name:https Address::443 Compress:true TLS TLS.MinVersion:VersionTLS12 TLS.SniStrict:true TLS.CipherSuites:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA' \ -- cgit v1.2.3 From 37b52b7361d3ac15273ca19a0b96ef74299e759e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 1 Oct 2019 18:12:21 +0200 Subject: Trim whitespace (#2544) --- CHANGELOG.md | 4 +- Docker/README.md | 2 +- app/shares.php | 10 +- app/views/helpers/index/normal/entry_header.phtml | 29 +++--- app/views/index/tos.phtml | 20 ++-- app/views/user/profile.phtml | 6 +- app/views/user/validateEmail.phtml | 34 +++---- cli/README.md | 2 +- docs/en/admins/02_Installation.md | 2 +- docs/en/admins/03_Updating.md | 4 +- docs/en/contributing.md | 2 +- docs/en/developers/01_First_steps.md | 42 ++++----- docs/en/developers/03_Backend/05_Extensions.md | 110 +++++++++++----------- docs/en/users/03_Main_view.md | 16 ++-- docs/en/users/05_Configuration.md | 2 +- docs/en/users/07_Frequently_Asked_Questions.md | 2 +- docs/fr/developers/01_First_steps.md | 40 ++++---- docs/fr/developers/03_Backend/05_Extensions.md | 78 +++++++-------- docs/fr/users/06_Mobile_access.md | 4 +- docs/fr/users/07_Frequently_Asked_Questions.md | 4 +- lib/Minz/ModelPdo.php | 6 +- 21 files changed, 209 insertions(+), 210 deletions(-) (limited to 'Docker') diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aa49aafe..e68c9a2fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -522,7 +522,7 @@ * Simplified Chinese [#1541](https://github.com/FreshRSS/FreshRSS/pull/1541) * Improve English [#1465](https://github.com/FreshRSS/FreshRSS/pull/1465) * Improve Dutch [#1559](https://github.com/FreshRSS/FreshRSS/pull/1559) - * Added Spanish language [#1631] (https://github.com/FreshRSS/FreshRSS/pull/1631/) + * Added Spanish language [#1631] (https://github.com/FreshRSS/FreshRSS/pull/1631/) * Security * Do not require write access to check availability of new versions [#1450](https://github.com/FreshRSS/FreshRSS/issues/1450) * Misc. @@ -548,7 +548,7 @@ * New command `./cli/reconfigure.php` to update an existing installation [#1439](https://github.com/FreshRSS/FreshRSS/pull/1439) * Many CLI improvements [#1447](https://github.com/FreshRSS/FreshRSS/pull/1447) * More information (number of feeds, articles, etc.) in `./cli/user-info.php` - * Better idempotency of `./cli/do-install.php` and language parameter [#1449](https://github.com/FreshRSS/FreshRSS/issues/1449) + * Better idempotency of `./cli/do-install.php` and language parameter [#1449](https://github.com/FreshRSS/FreshRSS/issues/1449) * Bug fixing * Fix several CLI issues [#1445](https://github.com/FreshRSS/FreshRSS/issues/1445) * Fix CLI install bugs with SQLite [#1443](https://github.com/FreshRSS/FreshRSS/issues/1443), [#1448](https://github.com/FreshRSS/FreshRSS/issues/1448) diff --git a/Docker/README.md b/Docker/README.md index 4146a57dd..13988a316 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -48,7 +48,7 @@ docker run -d --restart unless-stopped --log-opt max-size=10m \ See [more information about Docker and Let’s Encrypt in Træfik](https://docs.traefik.io/user-guide/docker-and-lets-encrypt/). -## Run FreshRSS +## Run FreshRSS Example using the built-in refresh cron job (see further below for alternatives). You must first chose a domain (DNS) or sub-domain, e.g. `freshrss.example.net`. diff --git a/app/shares.php b/app/shares.php index 71860c9e3..9df83617a 100644 --- a/app/shares.php +++ b/app/shares.php @@ -139,9 +139,9 @@ return array( 'method' => 'GET', ), 'lemmy' => array( - 'url' => '~URL~/create_post?url=~LINK~&name=~TITLE~', - 'transform' => array('rawurlencode'), - 'form' => 'advanced', - 'method' => 'GET', - ), + 'url' => '~URL~/create_post?url=~LINK~&name=~TITLE~', + 'transform' => array('rawurlencode'), + 'form' => 'advanced', + 'method' => 'GET', + ), ); diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml index 7873b16e4..82c209bb2 100644 --- a/app/views/helpers/index/normal/entry_header.phtml +++ b/app/views/helpers/index/normal/entry_header.phtml @@ -28,21 +28,20 @@ } } ?>
  • ✇ feed->name(); ?>
  • -
  • entry->title(); ?>
    - entry->authors(); - if (is_array($authors)): - $first = true; - foreach ($authors as $author): - echo $first ? $author : ', ' . $author; - $first = false; - endforeach; - endif; - ?>
  • +
  • entry->title(); ?>
    entry->authors(); + if (is_array($authors)) { + $first = true; + foreach ($authors as $author) { + echo $first ? $author : ', ' . $author; + $first = false; + } + } + ?>
  • entry->date(); ?> 
  • diff --git a/app/views/index/tos.phtml b/app/views/index/tos.phtml index 79c597244..1b3498134 100644 --- a/app/views/index/tos.phtml +++ b/app/views/index/tos.phtml @@ -1,13 +1,13 @@
    - can_register) { ?> - - - - - - - - + can_register) { ?> + + + + + + + + - terms_of_service; ?> + terms_of_service; ?>
    diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index df43642dd..de717b36e 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -1,7 +1,7 @@ disable_aside) { - $this->partial('aside_configure'); - } + if (!$this->disable_aside) { + $this->partial('aside_configure'); + } ?>
    diff --git a/app/views/user/validateEmail.phtml b/app/views/user/validateEmail.phtml index a246c222e..51517f5eb 100644 --- a/app/views/user/validateEmail.phtml +++ b/app/views/user/validateEmail.phtml @@ -1,22 +1,22 @@
    -

    - title); ?> -

    +

    + title); ?> +

    -

    - mail_login); ?> -

    +

    + mail_login); ?> +

    -
    - - -
    +
    + + +
    -

    - - - -

    +

    + + + +

    diff --git a/cli/README.md b/cli/README.md index 35c9bad9b..89b440a39 100644 --- a/cli/README.md +++ b/cli/README.md @@ -128,4 +128,4 @@ Example to get the number of feeds of a given user: # Install and updates If you want to administrate FreshRSS using git, please read our [installation docs](https://freshrss.github.io/FreshRSS/en/admins/02_Installation.html) -and [update guidelines](https://freshrss.github.io/FreshRSS/en/admins/03_Updating.html). +and [update guidelines](https://freshrss.github.io/FreshRSS/en/admins/03_Updating.html). diff --git a/docs/en/admins/02_Installation.md b/docs/en/admins/02_Installation.md index 446ef0dcf..7bba647ec 100644 --- a/docs/en/admins/02_Installation.md +++ b/docs/en/admins/02_Installation.md @@ -137,7 +137,7 @@ A step-by-step tutorial is available [in French](http://www.pihomeserver.fr/2013 # Security -Make sure to expose only the `./p/` folder on the web, the other directories contain personal and sensitive data. +Make sure to expose only the `./p/` folder on the web, the other directories contain personal and sensitive data. See the Apache and nginx config examples above. **TODO** diff --git a/docs/en/admins/03_Updating.md b/docs/en/admins/03_Updating.md index 4e1fdfa5d..461366049 100644 --- a/docs/en/admins/03_Updating.md +++ b/docs/en/admins/03_Updating.md @@ -15,7 +15,7 @@ The update process depends on your installation type, see below: Change to your installation at http://localhost/FreshRSS/p/i/?c=update and hit the "Check for new updates" button. -If there is a new version you will be prompted again. +If there is a new version you will be prompted again. ## Using git @@ -72,7 +72,7 @@ cd /usr/share/FreshRSS ``` Commands intended to be executed in order (you can c/p the whole block if desired): - + ```sh wget https://github.com/FreshRSS/FreshRSS/archive/master.zip unzip master.zip diff --git a/docs/en/contributing.md b/docs/en/contributing.md index 45c1650fb..870e0c14f 100644 --- a/docs/en/contributing.md +++ b/docs/en/contributing.md @@ -52,5 +52,5 @@ We are working on a better way to handle internationalization but don't hesitate ## Contribute to documentation -The documentation needs a lot of improvements in order to be more useful to new contributors and we are working on it. +The documentation needs a lot of improvements in order to be more useful to new contributors and we are working on it. If you want to give some help, meet us in the main repositories [docs directory](https://github.com/FreshRSS/FreshRSS/tree/master/docs)! diff --git a/docs/en/developers/01_First_steps.md b/docs/en/developers/01_First_steps.md index 6b7f437a7..28c249be4 100644 --- a/docs/en/developers/01_First_steps.md +++ b/docs/en/developers/01_First_steps.md @@ -61,7 +61,7 @@ The `TAG` variable can be anything (e.g. `dev-local`). You can target a specific # Extensions -If you want to create your own FreshRSS extension, take a look at the [extension documentation](03_Backend/05_Extensions.md). +If you want to create your own FreshRSS extension, take a look at the [extension documentation](03_Backend/05_Extensions.md). # Coding style @@ -110,7 +110,7 @@ There is a space before and after every operator. ```php if ($a == 10) { - // do something + // do something } echo $a ? 1 : 0; @@ -122,11 +122,11 @@ There is no spaces in the brackets. There is no space before the opening bracket ```php if ($a == 10) { - // do something + // do something } if ((int)$a == 10) { - // do something + // do something } ``` @@ -137,16 +137,16 @@ It happens most of the time in Javascript files. When there is chained functions ```javascript // First instruction shortcut.add(shortcuts.mark_read, function () { - //... - }, { - 'disable_in_input': true - }); + //... + }, { + 'disable_in_input': true + }); // Second instruction shortcut.add("shift+" + shortcuts.mark_read, function () { - //... - }, { - 'disable_in_input': true - }); + //... + }, { + 'disable_in_input': true + }); ``` ## Line length @@ -158,7 +158,7 @@ With functions, parameters can be declared on different lines. ```php function my_function($param_1, $param_2, $param_3, $param_4) { - // do something + // do something } ``` @@ -173,7 +173,7 @@ They must follow the "snake case" convention. ```php // a function function function_name() { - // do something + // do something } // a variable $variable_name; @@ -185,7 +185,7 @@ They must follow the "lower camel case" convention. ```php private function methodName() { - // do something + // do something } ``` @@ -213,7 +213,7 @@ They must be at the end of the line if a condition runs on more than one line. ```php if ($a == 10 || $a == 20) { - // do something + // do something } ``` @@ -226,9 +226,9 @@ If the file contains only PHP code, the PHP closing tag must be omitted. If an array declaration runs on more than one line, each element must be followed by a comma even the last one. ```php -$variable = array( - "value 1", - "value 2", - "value 3", -); +$variable = [ + "value 1", + "value 2", + "value 3", +]; ``` diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md index 7c1f8c046..0cfa5c8b7 100644 --- a/docs/en/developers/03_Backend/05_Extensions.md +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -48,13 +48,13 @@ Code example: view->a_variable = 'FooBar'; - } + public function indexAction() { + $this->view->a_variable = 'FooBar'; + } - public function worldAction() { - $this->view->a_variable = 'Hello World!'; - } + public function worldAction() { + $this->view->a_variable = 'Hello World!'; + } } ?> @@ -74,7 +74,7 @@ As explained above, the views consist of HTML mixed with PHP. Code example: ```html

    - This is a parameter passed from the controller: a_variable; ?> + This is a parameter passed from the controller: a_variable; ?>

    ``` @@ -119,7 +119,7 @@ To take full advantage of the Minz routing system, it is strongly discouraged to ```html

    - Go to page Hello world! + Go to page Hello world!

    ``` @@ -130,13 +130,13 @@ So use the `Minz_Url` class and its `display()` method instead. `Minz_Url::displ ```php 'hello', - 'a' => 'world', - 'params' => array( - 'foo' => 'bar', - ) -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', + 'params' => [ + 'foo' => 'bar', + ], +]; // Show something like .?c=hello&a=world&foo=bar echo Minz_Url::display($url_array); @@ -166,10 +166,10 @@ Code example: ```php 'hello', - 'a' => 'world' -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', +]; // Tells Minz to redirect the user to the hello / world page. // Note that this is a redirection in the Minz sense of the term, not a redirection that the browser will have to manage (HTTP code 301 or 302) @@ -188,10 +188,10 @@ It is very common to want display a message to the user while performing a redir ```php 'hello', - 'a' => 'world' -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', +]; $feedback_good = 'Tout s\'est bien passé !'; $feedback_bad = 'Oups, quelque chose n\'a pas marché.'; @@ -226,18 +226,18 @@ The translation files are quite simple: it is only a matter of returning a PHP t array( - 'actualize' => 'Actualiser', - 'back_to_rss_feeds' => '← Retour à vos flux RSS', - 'cancel' => 'Annuler', - 'create' => 'Créer', - 'disable' => 'Désactiver', - ), - 'freshrss' => array( - '_' => 'FreshRSS', - 'about' => 'À propos de FreshRSS', - ), -); + 'action' => [ + 'actualize' => 'Actualiser', + 'back_to_rss_feeds' => '← Retour à vos flux RSS', + 'cancel' => 'Annuler', + 'create' => 'Créer', + 'disable' => 'Désactiver', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'À propos de FreshRSS', + ), +]; ?> ``` @@ -247,9 +247,9 @@ Code example: ```html

    - - - + + +

    ``` @@ -267,8 +267,8 @@ An extension allows you to add functionality easily to FreshRSS without having t ### Basic files and folders -The first thing to note is that **all** extensions **must** be located in the `extensions` directory, at the base of the FreshRSS tree. -An extension is a directory containing a set of mandatory (and optional) files and subdirectories. +The first thing to note is that **all** extensions **must** be located in the `extensions` directory, at the base of the FreshRSS tree. +An extension is a directory containing a set of mandatory (and optional) files and subdirectories. The convention requires that the main directory name be preceded by an "x" to indicate that it is not an extension included by default in FreshRSS. The main directory of an extension must contain at least two **mandatory** files: @@ -276,16 +276,16 @@ The main directory of an extension must contain at least two **mandatory** files - A `metadata.json` file that contains a description of the extension. This file is written in JSON. - An `extension.php` file containing the entry point of the extension (which is a class that inherits Minz_Extension). -Please note that there is a not a required link between the directory name of the extension and the name of the class inside `extension.php`, -but you should follow our best practice: +Please note that there is a not a required link between the directory name of the extension and the name of the class inside `extension.php`, +but you should follow our best practice: If you want to write a `HelloWorld` extension, the directory name should be `xExtension-HelloWorld` and the base class name `HelloWorldExtension`. In the file `freshrss/extensions/xExtension-HelloWorld/extension.php` you need the structure: ```html class HelloWorldExtension extends Minz_Extension { - public function init() { - // your code here - } + public function init() { + // your code here + } } ``` There is an example HelloWorld extension that you can download from [our GitHub repo](https://github.com/FreshRSS/xExtension-HelloWorld). @@ -315,14 +315,14 @@ Only the `name` and` entrypoint` fields are required. ### Choose between « system » or « user » -A __user__ extension can be enabled by some users and not by others (typically for user preferences). +A __user__ extension can be enabled by some users and not by others (typically for user preferences). A __system__ extension in comparison is enabled for every account. ### Writing your own extension.php -This file is the entry point of your extension. It must contain a specific class to function. -As mentioned above, the name of the class must be your `entrypoint` suffixed by` Extension` (`HelloWorldExtension` for example). +This file is the entry point of your extension. It must contain a specific class to function. +As mentioned above, the name of the class must be your `entrypoint` suffixed by` Extension` (`HelloWorldExtension` for example). In addition, this class must be inherited from the `Minz_Extension` class to benefit from extensions-specific methods. Your class will benefit from four methods to redefine: @@ -351,13 +351,13 @@ You can register at the FreshRSS event system in an extensions `init()` method, ```html class HelloWorldExtension extends Minz_Extension { - public function init() { - $this->registerHook('entry_before_display', array($this, 'renderEntry')); - } - public function renderEntry($entry) { - $entry->_content('

    Hello World

    ' . $entry->content()); - return $entry; - } + public function init() { + $this->registerHook('entry_before_display', array($this, 'renderEntry')); + } + public function renderEntry($entry) { + $entry->_content('

    Hello World

    ' . $entry->content()); + return $entry; + } } ``` diff --git a/docs/en/users/03_Main_view.md b/docs/en/users/03_Main_view.md index 59d051e7e..c6c3e3b50 100644 --- a/docs/en/users/03_Main_view.md +++ b/docs/en/users/03_Main_view.md @@ -32,20 +32,20 @@ Here is an example to trigger article update every hour. Special parameters to configure the script - all parameters can be combined: -- Parameter "force" -https://freshrss.example.net/i/?c=feed&a=actualize&force=1 +- Parameter "force" +https://freshrss.example.net/i/?c=feed&a=actualize&force=1 If *force* is set to 1 all feeds will be refreshed at once. -- Parameter "ajax" -https://freshrss.example.net/i/?c=feed&a=actualize&ajax=1 +- Parameter "ajax" +https://freshrss.example.net/i/?c=feed&a=actualize&ajax=1 Only a status site is returned and not a complete website. Example: "OK" -- Parameter "maxFeeds" -https://freshrss.example.net/i/?c=feed&a=actualize&maxFeeds=30 +- Parameter "maxFeeds" +https://freshrss.example.net/i/?c=feed&a=actualize&maxFeeds=30 If *maxFeeds* is set the configured amount of feeds is refreshed at once. The default setting is "10". -- Parameter "token" -https://freshrss.example.net/i/?c=feed&a=actualize&token=542345872345734 +- Parameter "token" +https://freshrss.example.net/i/?c=feed&a=actualize&token=542345872345734 Security parameter to prevent unauthorized refreshes. For detailed Documentation see "Form authentication". ### Online cron diff --git a/docs/en/users/05_Configuration.md b/docs/en/users/05_Configuration.md index 225c1e5f9..f635f9d5e 100644 --- a/docs/en/users/05_Configuration.md +++ b/docs/en/users/05_Configuration.md @@ -9,7 +9,7 @@ the missing bits or add a new language, please check how you can [contribute to There are parts of FreshRSS that are not translated and are not intended to be translated. For now, the logs visible in the application as well as the one generated by automatic update scripts are part of it. -Available languages are: cz, de, en, es, fr, he, it, kr, nl, oc, pt-br, ru, tr, zh-cn. +Available languages are: cz, de, en, es, fr, he, it, kr, nl, oc, pt-br, ru, tr, zh-cn. ## Theme diff --git a/docs/en/users/07_Frequently_Asked_Questions.md b/docs/en/users/07_Frequently_Asked_Questions.md index 42156b1a9..fd3db4bea 100644 --- a/docs/en/users/07_Frequently_Asked_Questions.md +++ b/docs/en/users/07_Frequently_Asked_Questions.md @@ -47,7 +47,7 @@ For more information on that matter, there is a [dedicated documentation](../../ ## Permissions under SELinux -Some Linux distribution like Fedora or RedHat Enterprise Linux have SELinux system enabled. This acts like a firewall application, so all applications cannot write/modify files under certain conditions. While installing FreshRSS, step 2 can fail if the httpd process cannot write to some data sub-directories, the following command should be executed as root : +Some Linux distribution like Fedora or RedHat Enterprise Linux have SELinux system enabled. This acts like a firewall application, so all applications cannot write/modify files under certain conditions. While installing FreshRSS, step 2 can fail if the httpd process cannot write to some data sub-directories, the following command should be executed as root : ```sh semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/FreshRSS/data(/.*)?' restorecon -Rv /usr/share/FreshRSS/data diff --git a/docs/fr/developers/01_First_steps.md b/docs/fr/developers/01_First_steps.md index dd38bcb3f..df3fa65f2 100644 --- a/docs/fr/developers/01_First_steps.md +++ b/docs/fr/developers/01_First_steps.md @@ -57,7 +57,7 @@ Chaque opérateur est entouré d'espaces. ```php if ($a == 10) { - // faire quelque chose + // faire quelque chose } echo $a ? 1 : 0; @@ -69,11 +69,11 @@ Il n'y a pas d'espaces entre des parenthèses. Il n'y a pas d'espaces avant une ```php if ($a == 10) { - // faire quelque chose + // faire quelque chose } if ((int)$a == 10) { - // faire quelque chose + // faire quelque chose } ``` @@ -84,16 +84,16 @@ Ce cas se présente le plus souvent en Javascript. Quand on a des fonctions chai ```javascript // Première instruction shortcut.add(shortcuts.mark_read, function () { - //... - }, { - 'disable_in_input': true - }); + //... + }, { + 'disable_in_input': true + }); // Deuxième instruction shortcut.add("shift+" + shortcuts.mark_read, function () { - //... - }, { - 'disable_in_input': true - }); + //... + }, { + 'disable_in_input': true + }); ``` ## Longueur des lignes @@ -105,7 +105,7 @@ Dans le cas des fonctions, les paramètres peuvent être déclarés sur plusieur ```php function ma_fonction($param_1, $param_2, $param_3, $param_4) { - // faire quelque chose + // faire quelque chose } ``` @@ -120,7 +120,7 @@ Les fonctions et les variables doivent suivre la convention "snake case". ```php // une fontion function nom_de_la_fontion() { - // faire quelque chose + // faire quelque chose } // une variable $nom_de_la_variable; @@ -132,7 +132,7 @@ Les méthodes doivent suivre la convention "lower camel case". ```php private function nomDeLaMethode() { - // faire quelque chose + // faire quelque chose } ``` @@ -160,7 +160,7 @@ Les opérateurs doivent être en fin de ligne dans le cas de conditions sur plus ```php if ($a == 10 || $a == 20) { - // faire quelque chose + // faire quelque chose } ``` @@ -173,9 +173,9 @@ Si le fichier ne contient que du PHP, il ne doit pas comporter de balise fermant Lors de l'écriture de tableaux sur plusieurs lignes, tous les éléments doivent être suivis d'une virgule (même le dernier). ```php -$variable = array( - "valeur 1", - "valeur 2", - "valeur 3", -); +$variable = [ + "valeur 1", + "valeur 2", + "valeur 3", +]; ``` diff --git a/docs/fr/developers/03_Backend/05_Extensions.md b/docs/fr/developers/03_Backend/05_Extensions.md index 2ee81b781..3a23e0c5a 100644 --- a/docs/fr/developers/03_Backend/05_Extensions.md +++ b/docs/fr/developers/03_Backend/05_Extensions.md @@ -49,13 +49,13 @@ Exemple de code : view->a_variable = 'FooBar'; - } + public function indexAction() { + $this->view->a_variable = 'FooBar'; + } - public function worldAction() { - $this->view->a_variable = 'Hello World!'; - } + public function worldAction() { + $this->view->a_variable = 'Hello World!'; + } } ?> @@ -75,7 +75,7 @@ Comme expliqué plus haut, les vues sont du code HTML mixé à du PHP. Exemple d ```html

    - Phrase passée en paramètre : a_variable; ?> + Phrase passée en paramètre : a_variable; ?>

    ``` @@ -119,7 +119,7 @@ Pour profiter pleinement du système de routage de Minz, il est fortement décon ```html

    - Accéder à la page Hello world! + Accéder à la page Hello world!

    ``` @@ -130,13 +130,13 @@ Préférez donc l'utilisation de la classe `Minz_Url` et de sa méthode `display ```php 'hello', - 'a' => 'world', - 'params' => array( - 'foo' => 'bar', - ) -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', + 'params' => [ + 'foo' => 'bar', + ], +]; // Affichera quelque chose comme .?c=hello&a=world&foo=bar echo Minz_Url::display($url_array); @@ -166,10 +166,10 @@ Exemple de code : ```php 'hello', - 'a' => 'world' -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', +]; // Indique à Minz de rediriger l'utilisateur vers la page hello/world. // Notez qu'il s'agit d'une redirection au sens Minz du terme, pas d'une redirection que le navigateur va avoir à gérer (code HTTP 301 ou 302) @@ -188,10 +188,10 @@ Il est très fréquent de vouloir effectuer une redirection tout en affichant un ```php 'hello', - 'a' => 'world' -); +$url_array = [ + 'c' => 'hello', + 'a' => 'world', +]; $feedback_good = 'Tout s\'est bien passé !'; $feedback_bad = 'Oups, quelque chose n\'a pas marché.'; @@ -225,19 +225,19 @@ Les fichiers de traduction sont assez simples : il s'agit seulement de retourne ```php array( - 'actualize' => 'Actualiser', - 'back_to_rss_feeds' => '← Retour à vos flux RSS', - 'cancel' => 'Annuler', - 'create' => 'Créer', - 'disable' => 'Désactiver', - ), - 'freshrss' => array( - '_' => 'FreshRSS', - 'about' => 'À propos de FreshRSS', - ), -); +return [ + 'action' => [ + 'actualize' => 'Actualiser', + 'back_to_rss_feeds' => '← Retour à vos flux RSS', + 'cancel' => 'Annuler', + 'create' => 'Créer', + 'disable' => 'Désactiver', + ], + 'freshrss' => [ + '_' => 'FreshRSS', + 'about' => 'À propos de FreshRSS', + ], +]; ?> ``` @@ -246,9 +246,9 @@ Pour accéder à ces traductions, `Minz_Translate` va nous aider à l'aide de sa ```html

    - - - + + +

    ``` diff --git a/docs/fr/users/06_Mobile_access.md b/docs/fr/users/06_Mobile_access.md index 9f8c64f5c..f637ccf5b 100644 --- a/docs/fr/users/06_Mobile_access.md +++ b/docs/fr/users/06_Mobile_access.md @@ -45,7 +45,7 @@ Voir la [page sur l’API compatible Fever](06_Fever_API.md) pour une autre poss 6. Vous pouvez maintenant tester sur une application mobile (News+, FeedMe, ou EasyRSS sur Android) * en utilisant comme adresse https://rss.example.net/api/greader.php ou http://example.net/FreshRSS/p/api/greader.php selon la configuration de votre site Web. - * ⚠️ attention aux majuscules et aux espaces en tapant l’adresse avec le clavier du mobile ⚠️ + * ⚠️ attention aux majuscules et aux espaces en tapant l’adresse avec le clavier du mobile ⚠️ * avec votre nom d’utilisateur et le mot de passe enregistré au point 2 (mot de passe API). @@ -53,7 +53,7 @@ Voir la [page sur l’API compatible Fever](06_Fever_API.md) pour une autre poss * Vous pouvez voir les logs API dans `./FreshRSS/data/users/_/log_api.txt` * Si vous avez une erreur 404 (fichier non trouvé) lors de l’étape de test, et que vous êtes sous Apache, - voir http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes pour utiliser News+ + voir http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes pour utiliser News+ (facultatif pour EasyRSS et FeedMe qui devraient fonctionner dès lors que vous obtenez un PASS au test *Check partial server configuration*). diff --git a/docs/fr/users/07_Frequently_Asked_Questions.md b/docs/fr/users/07_Frequently_Asked_Questions.md index 2dc2cae97..87ff8631a 100644 --- a/docs/fr/users/07_Frequently_Asked_Questions.md +++ b/docs/fr/users/07_Frequently_Asked_Questions.md @@ -19,9 +19,9 @@ L'explication est la même pour les fichiers ```favicon.ico``` et ```.htaccess`` ## Pourquoi j'ai des erreurs quand j'essaye d'enregistrer un flux ? -Il peut y avoir différentes origines à ce problème. +Il peut y avoir différentes origines à ce problème. Le flux peut avoir une syntaxe invalide, il peut ne pas être reconnu par la bibliothèque SimplePie, l'hébergement peut avoir des problèmes, FreshRSS peut être boggué. -Il faut dans un premier temps déterminer la cause du problème. +Il faut dans un premier temps déterminer la cause du problème. Voici la liste des étapes à suivre pour la déterminer : 1. __Vérifier la validité du flux__ grâce à l'[outil en ligne du W3C](http://validator.w3.org/feed/ "Validateur en ligne de flux RSS et Atom"). Si ça ne fonctionne pas, nous ne pouvons rien faire. diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 3fabb73c8..873fa21ff 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -117,7 +117,7 @@ abstract class MinzPDO extends PDO { public function __construct($dsn, $username = null, $passwd = null, $options = null) { parent::__construct($dsn, $username, $passwd, $options); $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - } + } abstract public function dbType(); @@ -178,7 +178,7 @@ class MinzPDOSQLite extends MinzPDO { public function __construct($dsn, $username = null, $passwd = null, $options = null) { parent::__construct($dsn, $username, $passwd, $options); $this->exec('PRAGMA foreign_keys = ON;'); - } + } public function dbType() { return 'sqlite'; @@ -193,7 +193,7 @@ class MinzPDOPGSQL extends MinzPDO { public function __construct($dsn, $username = null, $passwd = null, $options = null) { parent::__construct($dsn, $username, $passwd, $options); $this->exec("SET NAMES 'UTF8';"); - } + } public function dbType() { return 'pgsql'; -- cgit v1.2.3 From 0d5c80b69894c94d66747f7e1f8ae9b46818963f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 5 Oct 2019 15:48:38 +0200 Subject: Example Docker Compose v3 (#2553) Fix https://github.com/FreshRSS/FreshRSS/issues/2547 --- Docker/docker-compose.yml | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'Docker') diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml index 8a8ad270b..1c0a79ab8 100644 --- a/Docker/docker-compose.yml +++ b/Docker/docker-compose.yml @@ -1,38 +1,31 @@ -version: '2.3' +version: "3" services: - postgresql: - image: postgres:latest + freshrss_postgresql: + image: postgres restart: unless-stopped volumes: - - '/path/to/pgsql-data:/var/lib/postgresql/data' + - pgsql_data:/var/lib/postgresql/data environment: - - POSTGRES_USER=freshrss - - POSTGRES_PASSWORD=password - - POSTGRES_DB=freshrss + - POSTGRES_USER=freshrss + - POSTGRES_PASSWORD=freshrss + - POSTGRES_DB=freshrss freshrss: - image: freshrss/freshrss:latest + image: freshrss/freshrss restart: unless-stopped + ports: + - "8080:80" depends_on: - - postgresql - networks: - - web - - default + - freshrss_postgresql volumes: - - '/your/local/directory/data:/var/www/FreshRSS/data' - labels: - - "traefik.backend=freshrss" - - "traefik.docker.network=web" - - "traefik.frontend.rule=Host:rss.example.com" - - "traefik.enable=true" - - "traefik.default.protocol=http" - - "traefik.frontend.entryPoints=http,https" - - "traefik.port=80" + - freshrss_data:/var/www/FreshRSS/data environment: - CRON_MIN=*/20 + - TZ=Europe/Copenhagen + labels: + - "traefik.port=80" -networks: - web: - external: true - +volumes: + pgsql_data: + freshrss_data: -- cgit v1.2.3 From 077e3cff458e4c36b364c065397d524025ee3de1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 8 Oct 2019 20:52:03 +0200 Subject: Increase import size (#2563) * Increase import size This is merely a temporary workaround to allow at least some medium size imports https://framateam.org/freshrss/pl/7wbt4tcyetrfmris9xdcbq7uuw The import module should be rewritten to process files one by one and as data streams instead of loading multiple copies of the whole dataset in memory as is the case now :-( https://github.com/FreshRSS/FreshRSS/issues/1890 Note that the new SQLite export/import is distinct from this case. * Use parameter --- Docker/entrypoint.sh | 2 ++ app/Controllers/importExportController.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'Docker') diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh index bb0e1bde0..dcbd7e231 100755 --- a/Docker/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -6,6 +6,8 @@ chown -R :www-data . chmod -R g+r . && chmod -R g+w ./data/ find /etc/php*/ -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \; +find /etc/php*/ -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \; +find /etc/php*/ -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \; if [ -n "$CRON_MIN" ]; then ( diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 93897dde5..f2ae8238e 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -29,7 +29,25 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('sub.import_export.title') . ' · '); } + private static function megabytes($size_str) { + switch (substr($size_str, -1)) { + case 'M': case 'm': return (int)$size_str; + case 'K': case 'k': return (int)$size_str / 1024; + case 'G': case 'g': return (int)$size_str * 1024; + } + return $size_str; + } + + private static function minimumMemory($mb) { + $mb = (int)$mb; + $ini = self::megabytes(ini_get('memory_limit')); + if ($ini < $mb) { + ini_set('memory_limit', $mb . 'M'); + } + } + public function importFile($name, $path, $username = null) { + self::minimumMemory(256); require_once(LIB_PATH . '/lib_opml.php'); $this->catDAO = new FreshRSS_CategoryDAO($username); -- cgit v1.2.3 From fb3bcc45f35dcace1f820069ba89d2b97078b090 Mon Sep 17 00:00:00 2001 From: Pim Snel Date: Thu, 17 Oct 2019 00:05:04 +0200 Subject: #2573 remove trailing slash to prevent normalizing by nginx (#2574) --- Docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Docker') diff --git a/Docker/README.md b/Docker/README.md index 13988a316..15510a220 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -328,7 +328,7 @@ server { } location /freshrss/ { - proxy_pass http://freshrss/; + proxy_pass http://freshrss; add_header X-Frame-Options SAMEORIGIN; add_header X-XSS-Protection "1; mode=block"; proxy_redirect off; -- cgit v1.2.3 From bc820a151a1f22ab8d2a25c209bb4fc5ccd1b1bd Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 19 Oct 2019 02:39:18 +0200 Subject: Docker update to Ubuntu 19.10 (#2577) Released today with PHP 7.3.8, Apache 2.4.41 http://releases.ubuntu.com/eoan/ --- Docker/Dockerfile | 2 +- Docker/Dockerfile-QEMU-ARM | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Docker') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 1d2ead96e..19923bcf1 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:19.04 +FROM ubuntu:19.10 ENV TZ UTC SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/Docker/Dockerfile-QEMU-ARM b/Docker/Dockerfile-QEMU-ARM index ea1f98798..f7389fcbc 100644 --- a/Docker/Dockerfile-QEMU-ARM +++ b/Docker/Dockerfile-QEMU-ARM @@ -1,7 +1,7 @@ # Only relevant for Docker Hub or QEMU multi-architecture builds. # Prefer the normal `Dockerfile` if you are building manually on the targeted architecture. -FROM arm32v7/ubuntu:19.04 +FROM arm32v7/ubuntu:19.10 # Requires ./hooks/* COPY ./Docker/qemu-arm-* /usr/bin/ -- cgit v1.2.3 From 3c49986ec895595edc632da0f14419199ce47667 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 26 Oct 2019 11:19:42 +0200 Subject: New environment variable COPY_LOG_TO_SYSLOG (#2591) * New environment variable COPY_LOG_TO_SYSLOG False by default. Makes it easy to monitor all logs from Syslog or STDERR (e.g. docker logs). * Suggestion of native constants --- Docker/Dockerfile | 3 ++- Docker/Dockerfile-Alpine | 1 + Docker/Dockerfile-QEMU-ARM | 1 + Docker/entrypoint.sh | 1 + constants.php | 1 + lib/Minz/Log.php | 44 ++++++++++++++++++-------------------------- 6 files changed, 24 insertions(+), 27 deletions(-) (limited to 'Docker') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 19923bcf1..6dbebccb0 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -43,10 +43,11 @@ RUN a2dismod -f alias autoindex negotiation status && \ RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.conf && \ sed -r -i "/^\s*Listen /s/^/#/" /etc/apache2/ports.conf && \ touch /var/www/FreshRSS/Docker/env.txt && \ - echo "17,47 * * * * . /var/www/FreshRSS/Docker/env.txt; \ + echo "7,37 * * * * . /var/www/FreshRSS/Docker/env.txt; \ su www-data -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' \ 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" | crontab - +ENV COPY_LOG_TO_SYSLOG On ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' ENV FRESHRSS_ENV '' diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpine index 3b1f1a394..4afad0949 100644 --- a/Docker/Dockerfile-Alpine +++ b/Docker/Dockerfile-Alpine @@ -43,6 +43,7 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' \ 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" | crontab - +ENV COPY_LOG_TO_SYSLOG On ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' ENV FRESHRSS_ENV '' diff --git a/Docker/Dockerfile-QEMU-ARM b/Docker/Dockerfile-QEMU-ARM index f7389fcbc..30b1e205b 100644 --- a/Docker/Dockerfile-QEMU-ARM +++ b/Docker/Dockerfile-QEMU-ARM @@ -59,6 +59,7 @@ RUN update-ca-certificates -f # Useful with the `--squash` build option RUN rm /usr/bin/qemu-* /var/www/FreshRSS/Docker/qemu-* +ENV COPY_LOG_TO_SYSLOG On ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' ENV FRESHRSS_ENV '' diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh index dcbd7e231..02338c35e 100755 --- a/Docker/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -12,6 +12,7 @@ find /etc/php*/ -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#u if [ -n "$CRON_MIN" ]; then ( echo "export TZ=$TZ" + echo "export COPY_LOG_TO_SYSLOG=$COPY_LOG_TO_SYSLOG" echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR" ) >/var/www/FreshRSS/Docker/env.txt crontab -l | sed -r "\\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" | crontab - diff --git a/constants.php b/constants.php index 76a320616..2ccf91358 100644 --- a/constants.php +++ b/constants.php @@ -32,6 +32,7 @@ safe_define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS // PHP text output compression http://php.net/ob_gzhandler (better to do it at Web server level) safe_define('PHP_COMPRESSION', false); +safe_define('COPY_LOG_TO_STDERR', filter_var(getenv('COPY_LOG_TO_STDERR'), FILTER_VALIDATE_BOOLEAN)); // For cases when syslog is not available safe_define('COPY_SYSLOG_TO_STDERR', filter_var(getenv('COPY_SYSLOG_TO_STDERR'), FILTER_VALIDATE_BOOLEAN)); diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index a8dbf8350..3e6a25f27 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -8,26 +8,14 @@ * La classe Log permet de logger des erreurs */ class Minz_Log { - /** - * Les différents niveau de log - * ERROR erreurs bloquantes de l'application - * WARNING erreurs pouvant géner le bon fonctionnement, mais non bloquantes - * NOTICE erreurs mineures ou messages d'informations - * DEBUG Informations affichées pour le déboggage - */ - const ERROR = 2; - const WARNING = 4; - const NOTICE = 8; - const DEBUG = 16; - /** * Enregistre un message dans un fichier de log spécifique * Message non loggué si * - environment = SILENT - * - level = WARNING et environment = PRODUCTION - * - level = NOTICE et environment = PRODUCTION + * - level = LOG_WARNING et environment = PRODUCTION + * - level = LOG_NOTICE et environment = PRODUCTION * @param $information message d'erreur / information à enregistrer - * @param $level niveau d'erreur + * @param $level niveau d'erreur https://php.net/function.syslog * @param $file_name fichier de log * @throws Minz_PermissionDeniedException */ @@ -41,7 +29,7 @@ class Minz_Log { if (! ($env === 'silent' || ($env === 'production' - && ($level >= Minz_Log::NOTICE)))) { + && ($level >= LOG_NOTICE)))) { if ($file_name === null) { $username = Minz_Session::param('currentUser', ''); if ($username == '') { @@ -51,16 +39,16 @@ class Minz_Log { } switch ($level) { - case Minz_Log::ERROR : + case LOG_ERR : $level_label = 'error'; break; - case Minz_Log::WARNING : + case LOG_WARNING : $level_label = 'warning'; break; - case Minz_Log::NOTICE : + case LOG_NOTICE : $level_label = 'notice'; break; - case Minz_Log::DEBUG : + case LOG_DEBUG : $level_label = 'debug'; break; default : @@ -71,6 +59,10 @@ class Minz_Log { . ' [' . $level_label . ']' . ' --- ' . $information . "\n"; + if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) { + syslog($level, '[' . $username . '] ' . $log); + } + self::ensureMaxLogSize($file_name); if (file_put_contents($file_name, $log, FILE_APPEND | LOCK_EX) === false) { @@ -120,8 +112,8 @@ class Minz_Log { $msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true)); $msg_post = str_replace("\n", '', '$_POST content : ' . print_r($_POST, true)); - self::record($msg_get, Minz_Log::DEBUG, $file_name); - self::record($msg_post, Minz_Log::DEBUG, $file_name); + self::record($msg_get, LOG_DEBUG, $file_name); + self::record($msg_post, LOG_DEBUG, $file_name); } /** @@ -129,15 +121,15 @@ class Minz_Log { * Parameters are the same of those of the record() method. */ public static function debug($msg, $file_name = null) { - self::record($msg, Minz_Log::DEBUG, $file_name); + self::record($msg, LOG_DEBUG, $file_name); } public static function notice($msg, $file_name = null) { - self::record($msg, Minz_Log::NOTICE, $file_name); + self::record($msg, LOG_NOTICE, $file_name); } public static function warning($msg, $file_name = null) { - self::record($msg, Minz_Log::WARNING, $file_name); + self::record($msg, LOG_WARNING, $file_name); } public static function error($msg, $file_name = null) { - self::record($msg, Minz_Log::ERROR, $file_name); + self::record($msg, LOG_ERR, $file_name); } } -- cgit v1.2.3