关于DISCUZ升级程序
DISCUZ版本过低腰升级的话,官方好像也没有升级程序,让DISCUZ提供技术支持,费用太贵,自己处理,以下是核心代码.
注意:cdb_templates 这个表不能导,否则一清空缓存就乱了,切记,花了一天时间才找到.
主程序:
- set_time_limit(9999999);
-
- include "inc/init.php
-
- cls::getDatabase()->start();
类程序:
- class common_database{
-
- private $_needtable = null;
-
- private $_distablearr = array(
- 'cdb_members'=>array('yzlt_common_member','yzlt_ucenter_members'),
- 'cdb_settings'=>'yzlt_ucenter_settings',
-
- ''=>''
- );
-
- private $_disable_table = array('cdb_templates','cdb_buddys','cdb_caches','cdb_favorites','cdb_memberspaces','cdb_mythreads','cdb_myposts','cdb_projects','cdb_stats');
-
-
- public function __construct()
- {
- }
-
-
- public function start(){
-
- $rst = $this->getNeedTable();
- foreach($rst as $tb){
- $this->importTable($tb);
-
- }
-
- $this->endDoing();
- }
-
- private function endDoing(){
-
- $rs = cls::getDB()->getRowsNew("select uid,password from yzlt_ucenter_members");$num = count($rs);
- for($i=0;$i<$num;$i++){
- cls::getDB()->Query("update yzlt_ucenter_members set password='".md5($rs[$i]["password"])."' where uid='".$rs[$i]["uid"]."'");
- }
-
- }
-
- private function getShoulTable($tb){
- $DB1 = cls::getDB(1);
- $sqla = "describe ".$tb."";
- $rsa = $DB1->getRowsNew($sqla);
- $numa = count($rsa);
- $DB = cls::getDB();
- $sql = "show tables";
- $rs = $DB->getRowsNew($sql);$num = count($rs);
- $samenumtj = 0;$mytb='';
- for($i=0;$i<$num;$i++){
- $rscc = $DB->getRowsNew("describe ".$rs[$i][0]);$numcc = count($rscc);
- $samezd = 0;
- for($k1=0;$k1<$numa;$k1++){
- for($k=0;$k<$numcc;$k++){
- if($rsa[$k1][0]==$rscc[$k][0]){
- $samezd++;
- }
- }
- }
-
- 源表:".$tb.",目标表:".$rs[$i][0].",相同字段数:".$samezd."";
- if((int)$samezd>(int)$samenumtj){
-
- $samenumtj = $samezd;$mytb = $rs[$i][0];
- }
-
-
-
-
- ";
-