From bf0a2a34de1caeb5b7ca7d9e95a9dee283aca22c Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Sun, 6 Apr 2014 16:52:58 +0200 Subject: [PATCH] bug in upgrade script causing it not to ask for new user; makefile: execute lint check on target folder instead of source; redirect user to install if no installation is found --- .gitignore | 1 + Makefile | 7 +++---- src/bootstrap.php | 3 ++- .../Module/Install/Controller/InstallController.class.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 20ce922a..c2ef912f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/* /nbproject /config.php +/build diff --git a/Makefile b/Makefile index 0f0b85a8..9151ea34 100755 --- a/Makefile +++ b/Makefile @@ -6,11 +6,10 @@ help: export: @echo 'Building release for tag $(tag) ' - @echo 'Testing on syntax errors (thats all the automated testing your are going to get for now..) ' - find . -name "*.php" | xargs -I file php -l file - rm -rf ./build - mkdir ./build ./build/phpservermon + mkdir -p ./build ./build/phpservermon git archive $(tag) | tar -xf - -C ./build/phpservermon/ + @echo 'Testing on syntax errors (thats all the automated testing your are going to get for now..) ' + find ./build/phpservermon -name "*.php" | xargs -I file php -l file find ./build/phpservermon -name "*.php" -exec sed -i "" "s/@package_version@/$(tag)/" {} \; find ./build/phpservermon -type f | xargs chmod 0644 find ./build/phpservermon -type d | xargs chmod 0755 diff --git a/src/bootstrap.php b/src/bootstrap.php index 540c3526..49675eb9 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -109,7 +109,8 @@ if(defined('PSM_INSTALL') && PSM_INSTALL) { // attempt to load configuration from database if(!psm_load_conf()) { // unable to load from config table - die('We were unable to find an existing installation. Please click here to install PHP Server Monitor.'); + header('Location: install.php'); + die(); } // config load OK, make sure database version is up to date $version_db = psm_get_conf('version'); diff --git a/src/psm/Module/Install/Controller/InstallController.class.php b/src/psm/Module/Install/Controller/InstallController.class.php index f561df6a..8deaec84 100644 --- a/src/psm/Module/Install/Controller/InstallController.class.php +++ b/src/psm/Module/Install/Controller/InstallController.class.php @@ -182,7 +182,7 @@ class InstallController extends AbstractController { if($this->db->status()) { if($this->isUpgrade()) { // upgrade - if(version_compare(PSM_VERSION, '3.0.0', '<')) { + if(version_compare($this->getPreviousVersion(), '3.0.0', '<')) { // upgrade from before 3.0, does not have passwords yet.. create new user first $this->addMessage('Your current version does not have an authentication system, but since v3.0 access to the monitor is restricted by user accounts. Please set up a new account to be able to login after the upgrade, and which you can use to change the passwords for your other accounts.', 'info'); $this->setTemplateId('install_config_new_user', 'install/install.tpl.html');