added update script for v2.4.2

This commit is contained in:
printempw 2016-04-05 14:42:10 +08:00
parent c72793a230
commit d3c027f619
2 changed files with 30 additions and 1 deletions

View File

@ -3,12 +3,13 @@
* @Author: printempw
* @Date: 2016-04-04 08:47:35
* @Last Modified by: printempw
* @Last Modified time: 2016-04-04 08:48:06
* @Last Modified time: 2016-04-05 14:32:42
*/
if (!defined('BASE_DIR')) exit('请运行 /setup/update.php 来升级');
if (Option::get('current_version') == "2.4") {
Option::set('current_version', '2.4.1');
if (Option::get('encryption') == "") Option::set('encryption', 'MD5');
echo "已成功升级至 v2.4.1";
}

View File

@ -0,0 +1,28 @@
<?php
/**
* @Author: printempw
* @Date: 2016-04-05 14:33:00
* @Last Modified by: printempw
* @Last Modified time: 2016-04-05 14:41:27
*/
if (!defined('BASE_DIR')) exit('请运行 /setup/update.php 来升级');
if (Option::get('current_version') == "2.4.1") {
if (Option::get('encryption') == "") Option::set('encryption', 'MD5');
$db = new Database('options');
$table_name = DB_PREFIX."users";
$sqls[0] = "ALTER TABLE `$table_name` CHANGE `hash_steve` `hash_steve` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
$sqls[1] = "ALTER TABLE `$table_name` CHANGE `hash_alex` `hash_alex` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
$sqls[2] = "ALTER TABLE `$table_name` CHANGE `hash_cape` `hash_cape` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
foreach ($sqls as $sql) {
$db->query($sql);
}
Option::set('current_version', '2.4.2');
echo "已成功升级至 v2.4.2";
}