aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-02 10:18:48 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-02 10:18:48 +0200
commit5963221249cfa9ebce3e788cb1a78a15e50ac4c6 (patch)
tree46b9440554c0cc2c200e3e46110a94cdce17e193
parent1c202b9364c766d1bd28a22a04b3f70077f23e84 (diff)
Fix issue #65 : création d'un vrai script de mise à jour permettant de mettre tous les flux à jour via CRON
-rw-r--r--README9
-rwxr-xr-xactualize_script.php45
-rwxr-xr-xapp/controllers/feedController.php4
3 files changed, 54 insertions, 4 deletions
diff --git a/README b/README
index 0136016a1..30cd56226 100644
--- a/README
+++ b/README
@@ -49,9 +49,12 @@ SÉCURITÉ ET CONSEILS
3. Le fichier `/public/index.php` défini les chemins d'accès aux
répertoires clés de l'application. Si vous les bougez, tout se passe
ici.
- 4. Vous pouvez ajouter une tâche CRON sur l'url de mise à jour des flux
- (clic droit sur le bouton d'actualisation puis "Copier l'adresse du
- lien") pour que celle-ci se fasse de manière transparente
+ 4. Vous pouvez ajouter une tâche CRON sur le script d'actualisation des
+ flux. Il s'agit d'un script PHP à exécuter avec la commande `php`.
+ Par exemple, pour exécuter le script toutes les heures :
+ 0 * * * * php /chemin/vers/freshrss/actualize_script.php >/dev/null 2>&1
+ Veuillez cependant vérifier que le fichier PUBLIC_PATH/data/Configuration.array.php
+ soit accessible en lecture / écriture par l'exécuteur du script
CHANGELOG
=========
diff --git a/actualize_script.php b/actualize_script.php
new file mode 100755
index 000000000..cb4cbf351
--- /dev/null
+++ b/actualize_script.php
@@ -0,0 +1,45 @@
+<?php
+# ***** BEGIN LICENSE BLOCK *****
+# MINZ - A free PHP framework
+# Copyright (C) 2011 Marien Fressinaud
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# ***** END LICENSE BLOCK *****
+
+// Constantes de chemins
+define ('PUBLIC_PATH', realpath (dirname (__FILE__) . '/public'));
+define ('LIB_PATH', realpath (PUBLIC_PATH . '/../lib'));
+define ('APP_PATH', realpath (PUBLIC_PATH . '/../app'));
+define ('LOG_PATH', realpath (PUBLIC_PATH . '/../log'));
+define ('CACHE_PATH', realpath (PUBLIC_PATH . '/../cache'));
+
+$_GET['c'] = 'feed';
+$_GET['a'] = 'actualize';
+$_GET['force'] = true;
+$_SERVER['HTTP_HOST'] = '';
+
+set_include_path (get_include_path ()
+ . PATH_SEPARATOR
+ . LIB_PATH
+ . PATH_SEPARATOR
+ . LIB_PATH . '/minz'
+ . PATH_SEPARATOR
+ . APP_PATH);
+
+require (APP_PATH . '/App_FrontController.php');
+
+$front_controller = new App_FrontController ();
+$front_controller->init ();
+$front_controller->run ();
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
index 5173c3a2d..77f1787d0 100755
--- a/app/controllers/feedController.php
+++ b/app/controllers/feedController.php
@@ -118,6 +118,7 @@ class feedController extends ActionController {
$entryDAO = new EntryDAO ();
$id = Request::param ('id');
+ $force = Request::param ('force', false);
// on créé la liste des flux à mettre à actualiser
// si on veut mettre un flux à jour spécifiquement, on le met
@@ -163,8 +164,9 @@ class feedController extends ActionController {
}
// On arrête à 10 flux pour ne pas surcharger le serveur
+ // sauf si le paramètre $force est à vrai
$i++;
- if ($i >= 10) {
+ if ($i >= 10 && !$force) {
break;
}
}