diff options
| author | 2014-09-16 18:30:24 +0200 | |
|---|---|---|
| committer | 2014-09-16 18:30:24 +0200 | |
| commit | a4e43e9c53ac404d16af5d913a56eeb444b1ce10 (patch) | |
| tree | ddd33b85779d86ce78ef8192bb9e707cc32423dc /app/Controllers | |
| parent | c2ca9805fa61d045fa5466a8c3ba88d8a0c5a299 (diff) | |
Message if last update checking is close
last_update.txt is updated even if there is no update
If last_update.txt has been modified during last hour, show a message
See https://github.com/marienfressinaud/FreshRSS/issues/480#issuecomment-55765373
Diffstat (limited to 'app/Controllers')
| -rw-r--r-- | app/Controllers/updateController.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 4c1dd002c..72244e9c7 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -12,9 +12,11 @@ class FreshRSS_update_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('update_system') . ' ยท '); $this->view->last_update_time = 'unknown'; + $this->view->check_last_hour = false; $timestamp = (int)@file_get_contents(DATA_PATH . '/last_update.txt'); if (is_numeric($timestamp) && $timestamp > 0) { $this->view->last_update_time = timestamptodate($timestamp); + $this->view->check_last_hour = (time() - 3600) <= $timestamp; } } @@ -38,13 +40,10 @@ class FreshRSS_update_Controller extends Minz_ActionController { public function checkAction() { $this->view->change_view('update', 'index'); - // 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) { + if (file_exists(UPDATE_FILENAME) || $this->view->check_last_hour) { // There is already an update file to apply: we don't need to check // the webserver! + // Or if already check during the last hour, do nothing. Minz_Request::forward(array('c' => 'update')); return; @@ -81,6 +80,8 @@ class FreshRSS_update_Controller extends Minz_ActionController { 'body' => _t('no_update') ); + @file_put_contents(DATA_PATH . '/last_update.txt', time()); + return; } |
