diff --git a/app/controllers/upgrade_controller.php b/app/controllers/upgrade_controller.php index 5bb384bd9..0ce2719cc 100644 --- a/app/controllers/upgrade_controller.php +++ b/app/controllers/upgrade_controller.php @@ -63,7 +63,7 @@ function index() $dbv = $this->SysParameter->get('database.version'); // workaround for a mistake in a sql templates in v3.0.x where // we forgot to add the system.version entry into sys_parameters - if (empty($sysv) && $dbv == 4) { + if (empty($sysv) && $dbv == 4 && $this->SysParameter->get('display.vocabulary.department')) { // upgrading from iPeer v3.0 $sysv = '3.0.x'; $dbv = 5; diff --git a/app/libs/upgrade_scripts/upgrade_300.php b/app/libs/upgrade_scripts/upgrade_300.php index 2d75ab43c..30621ddac 100644 --- a/app/libs/upgrade_scripts/upgrade_300.php +++ b/app/libs/upgrade_scripts/upgrade_300.php @@ -36,12 +36,12 @@ public function isUpgradable() $dbv = $sysparameter->get('database.version'); $sysv = $sysparameter->get('system.version'); - // If system.version doesn't exist, but we get a database version of 4, - // then that means we're upgrading from a prior iPeer v3 installation + // If system.version doesn't exist, but we get a database version of 4, + // then that means we're upgrading from a prior iPeer v3 installation // and don't need to run this upgrader. - if (empty($sysv) && $dbv == 4) { - return false; - } +# if (empty($sysv) && $dbv == 4) { +# return false; +# } return parent::isUpgradable(); } @@ -69,7 +69,7 @@ public function up() // when upgrading from v2, will run through all the delta_*.sql files // up to $this->dbVersion because the database version wasn't stored in // the database, so PHP get a null value back, which is then treated - // as if we're starting from version 0 + // as if we're starting from version 0 $sysparameter = ClassRegistry::init('SysParameter'); $dbv = $sysparameter->getDatabaseVersion(); $ret = $this->patchDb($dbv, $this->dbVersion); diff --git a/app/libs/upgrade_scripts/upgrade_base.php b/app/libs/upgrade_scripts/upgrade_base.php index ac5b2cff1..1e6c70c7b 100644 --- a/app/libs/upgrade_scripts/upgrade_base.php +++ b/app/libs/upgrade_scripts/upgrade_base.php @@ -8,6 +8,15 @@ * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} * @version Release: 3.0 */ + +// mysql_set_charset is only available PHP 5 >= 5.2.3 +if (!function_exists('mysql_set_charset')) { + function mysql_set_charset($charset,$dbh) + { + return mysql_query("set names $charset",$dbh); + } +} + class UpgradeBase { public $errors = array(); @@ -136,6 +145,8 @@ protected function connectDb() return 'Could not connect to database!'; } + mysql_set_charset('utf8', $mysql); + //Open the database $mysqldb = mysql_select_db($dbConfig['database']); if (!$mysqldb) {