Fix issue #65 : création d'un vrai script de mise à jour permettant de mettre tous les flux à jour via CRON

pull/136/head
Marien Fressinaud 12 years ago
parent 1c202b9364
commit 5963221249
  1. 9
      README
  2. 45
      actualize_script.php
  3. 4
      app/controllers/feedController.php

@ -49,9 +49,12 @@ SÉCURITÉ ET CONSEILS
3. Le fichier `/public/index.php` défini les chemins d'accès aux 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 répertoires clés de l'application. Si vous les bougez, tout se passe
ici. ici.
4. Vous pouvez ajouter une tâche CRON sur l'url de mise à jour des flux 4. Vous pouvez ajouter une tâche CRON sur le script d'actualisation des
(clic droit sur le bouton d'actualisation puis "Copier l'adresse du flux. Il s'agit d'un script PHP à exécuter avec la commande `php`.
lien") pour que celle-ci se fasse de manière transparente 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 CHANGELOG
========= =========

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

@ -118,6 +118,7 @@ class feedController extends ActionController {
$entryDAO = new EntryDAO (); $entryDAO = new EntryDAO ();
$id = Request::param ('id'); $id = Request::param ('id');
$force = Request::param ('force', false);
// on créé la liste des flux à mettre à actualiser // on créé la liste des flux à mettre à actualiser
// si on veut mettre un flux à jour spécifiquement, on le met // 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 // On arrête à 10 flux pour ne pas surcharger le serveur
// sauf si le paramètre $force est à vrai
$i++; $i++;
if ($i >= 10) { if ($i >= 10 && !$force) {
break; break;
} }
} }

Loading…
Cancel
Save