diff options
| author | 2014-09-08 19:52:21 +0200 | |
|---|---|---|
| committer | 2014-09-08 19:52:21 +0200 | |
| commit | 48f91da2e5d7da4d8a4f11987116bfc8cbf049ca (patch) | |
| tree | 44d6e70103ded84e56e99c89153c013c815a1629 /app | |
| parent | ef1b35fc4385c99c4d38e3f87e8126d0dbe21519 (diff) | |
Check FRESHRSS_PATH is writable.
FRESHRSS_PATH needs to be writable before performing update.
Diffstat (limited to 'app')
| -rw-r--r-- | app/Controllers/updateController.php | 41 | ||||
| -rw-r--r-- | app/i18n/en.php | 2 | ||||
| -rw-r--r-- | app/i18n/fr.php | 2 |
3 files changed, 18 insertions, 27 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 857d975b2..5d5ec3586 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -15,15 +15,19 @@ class FreshRSS_update_Controller extends Minz_ActionController { } public function indexAction() { - if (file_exists(UPDATE_FILENAME)) { + if (file_exists(UPDATE_FILENAME) && !is_writable(FRESHRSS_PATH)) { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('damn'), + 'body' => _t('file_is_nok', FRESHRSS_PATH) + ); + } elseif (file_exists(UPDATE_FILENAME)) { // There is an update file to apply! $this->view->message = array( 'status' => 'good', 'title' => _t('ok'), 'body' => _t('update_can_apply', _url('update', 'apply')) ); - - return; } } @@ -33,11 +37,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { if (file_exists(UPDATE_FILENAME)) { // There is already an update file to apply: we don't need to check // the webserver! - $this->view->message = array( - 'status' => 'good', - 'title' => _t('ok'), - 'body' => _t('update_can_apply', _url('update', 'apply')) - ); + Minz_Request::forward(array('c' => 'update')); return; } @@ -73,11 +73,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { $script = $res_array[1]; if (file_put_contents(UPDATE_FILENAME, $script) !== false) { - $this->view->message = array( - 'status' => 'good', - 'title' => _t('ok'), - 'body' => _t('update_can_apply', _url('update', 'apply')) - ); + Minz_Request::forward(array('c' => 'update')); } else { $this->view->message = array( 'status' => 'bad', @@ -88,7 +84,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { } public function applyAction() { - if (!file_exists(UPDATE_FILENAME)) { + if (!file_exists(UPDATE_FILENAME) || !is_writable(FRESHRSS_PATH)) { Minz_Request::forward(array('c' => 'update'), true); } @@ -104,21 +100,12 @@ class FreshRSS_update_Controller extends Minz_ActionController { if ($res === true) { @unlink(UPDATE_FILENAME); - // TODO: record last update + // TODO: record last update_finished - Minz_Session::_param('notification', array( - 'type' => 'good', - 'content' => Minz_Translate::t('update_finished') - )); - - Minz_Request::forward(array(), true); + Minz_Request::good(_t('update_finished')); } else { - Minz_Session::_param('notification', array( - 'type' => 'bad', - 'content' => Minz_Translate::t('update_problem', $res) - )); - - Minz_Request::forward(array('c' => 'update'), true); + Minz_Request::bad(_t('update_problem', $res), + array('c' => 'update', 'a' => 'index')); } } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 95356af2c..c5911cde7 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -152,6 +152,8 @@ return array ( 'public' => 'Public', 'invalid_login' => 'Login is invalid', + 'file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into.', + // VIEWS 'save' => 'Save', 'delete' => 'Delete', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 8437e872e..789a0bb98 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -152,6 +152,8 @@ return array ( 'public' => 'Public', 'invalid_login' => 'L’identifiant est invalide !', + 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans.', + // VIEWS 'save' => 'Enregistrer', 'delete' => 'Supprimer', |
