aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/updateController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 17:21:20 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 17:21:20 +0100
commit105729639bd06c27536bbdd2968873046278d59f (patch)
tree30dcf7e3ae471b30810fb22ed701e0bb7d034fc8 /app/Controllers/updateController.php
parentcaf98a6468dcea5ae8c38062e4eb527cb3667db9 (diff)
parentee50df518310d3aee5efb5a0c15548b457d10e7e (diff)
Merge branch 'beta' into hotfixes
Diffstat (limited to 'app/Controllers/updateController.php')
-rw-r--r--app/Controllers/updateController.php43
1 files changed, 33 insertions, 10 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index da5bddc65..0896b13ac 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -3,16 +3,12 @@
class FreshRSS_update_Controller extends Minz_ActionController {
public function firstAction() {
$current_user = Minz_Session::param('currentUser', '');
- if (!$this->view->loginOk && Minz_Configuration::isAdmin($current_user)) {
- Minz_Error::error(
- 403,
- array('error' => array(_t('access_denied')))
- );
+ if (!FreshRSS_Auth::hasAccess('admin')) {
+ Minz_Error::error(403);
}
invalidateHttpCache();
- Minz_View::prependTitle(_t('update_system') . ' · ');
$this->view->update_to_apply = false;
$this->view->last_update_time = 'unknown';
$this->view->check_last_hour = false;
@@ -24,6 +20,8 @@ class FreshRSS_update_Controller extends Minz_ActionController {
}
public function indexAction() {
+ Minz_View::prependTitle(_t('update_system') . ' · ');
+
if (file_exists(UPDATE_FILENAME) && !is_writable(FRESHRSS_PATH)) {
$this->view->message = array(
'status' => 'bad',
@@ -108,6 +106,19 @@ class FreshRSS_update_Controller extends Minz_ActionController {
require(UPDATE_FILENAME);
+ if (Minz_Request::param('post_conf', false)) {
+ $res = do_post_update();
+
+ if ($res === true) {
+ @unlink(UPDATE_FILENAME);
+ @file_put_contents(DATA_PATH . '/last_update.txt', time());
+ Minz_Request::good(_t('update_finished'));
+ } else {
+ Minz_Request::bad(_t('update_problem', $res),
+ array('c' => 'update', 'a' => 'index'));
+ }
+ }
+
if (Minz_Request::isPost()) {
save_info_update();
}
@@ -116,14 +127,26 @@ class FreshRSS_update_Controller extends Minz_ActionController {
$res = apply_update();
if ($res === true) {
- @unlink(UPDATE_FILENAME);
- @file_put_contents(DATA_PATH . '/last_update.txt', time());
-
- Minz_Request::good(_t('update_finished'));
+ Minz_Request::forward(array(
+ 'c' => 'update',
+ 'a' => 'apply',
+ 'params' => array('post_conf' => true)
+ ), true);
} else {
Minz_Request::bad(_t('update_problem', $res),
array('c' => 'update', 'a' => 'index'));
}
}
}
+
+ /**
+ * This action displays information about installation.
+ */
+ public function checkInstallAction() {
+ Minz_View::prependTitle(_t('gen.title.check_install') . ' · ');
+
+ $this->view->status_php = check_install_php();
+ $this->view->status_files = check_install_files();
+ $this->view->status_database = check_install_database();
+ }
}