aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/updateController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-12 21:07:53 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-12 21:07:53 +0200
commit213bc2b9ddef88fd9e3cb50ac0893742f5fdd101 (patch)
tree65ae193b887c4f4b064865fdacec3e3859474aa0 /app/Controllers/updateController.php
parent4989302447b23d76429ad98d93900e3e1350bb06 (diff)
Check if update has been done during last minute
Cancel check action if update has been done during last hour.
Diffstat (limited to 'app/Controllers/updateController.php')
-rw-r--r--app/Controllers/updateController.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index 5424792f4..ec6778d51 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -38,7 +38,11 @@ class FreshRSS_update_Controller extends Minz_ActionController {
public function checkAction() {
$this->view->change_view('update', 'index');
- if (file_exists(UPDATE_FILENAME)) {
+ // Get the last update. If already check during the last hour, do nothing.
+ $last_update = (int)@file_get_contents(DATA_PATH . '/last_update.txt');
+ $check_last_hour = (time() - 3600) <= $last_update;
+
+ if (file_exists(UPDATE_FILENAME) || $check_last_hour) {
// There is already an update file to apply: we don't need to check
// the webserver!
Minz_Request::forward(array('c' => 'update'));