Example #1
0
/**
 * 检查模型状态
 */
function checkmodel($name)
{
    $state = checkfdperm('./model/data/' . $name, 0);
    $tmpdelarr = array('items', 'message');
    foreach ($tmpdelarr as $tmpkey => $tmpvalue) {
        if (!($tableinfo = loadtable($name . $tmpvalue))) {
            $state = false;
            break;
        }
    }
    return $state;
}
Example #2
0
<?php

require dirname(__FILE__).'/data/config.inc.php';
require dirname(__FILE__).'/lib/db.class.php';

$db = new ucserver_db();
$db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE);

$nomatch = true;

$applist = $db->fetch_all("SELECT appid, name FROM ".UC_DBTABLEPRE."applications");
$table_columns = loadtable('notelist');
foreach($applist as $app) {
	$appid = $app['appid'];
	if(empty($appid)) continue;
	if(!isset($table_columns['app'.$appid])) {
		$nomatch = false;
		if($db->query("ALTER TABLE ".UC_DBTABLEPRE."notelist ADD COLUMN app$appid tinyint NOT NULL")) {
			echo "补充notelist表字段成功: $appid <br />";
		} else {
			echo "补充notelist表字段失败,请刷新重试<br />";
		}
		
	}
}

if($nomatch) {
	echo '没有需要补充的字段<br />';
}

if(!unlink(__FILE__)) {
Example #3
0
 flush();
 if ($step == 1) {
     $sql = file_get_contents($sqlfile);
     $sql = str_replace("\r\n", "\n", $sql);
     runquery($sql);
     echo "第 {$step} 步转换成功<br /><br />";
     redirect("?action=upgrade&step=" . ($step + 1));
 } elseif ($step == 2) {
     $db->query("REPLACE INTO `tipask_setting` SET `k`='site_url',`v`='" . $site_url . "'");
     $db->query("REPLACE INTO `tipask_setting` SET `k`='auth_key',`v`='" . generate_key() . "'");
     echo "第 {$step} 步转换成功<br /><br />";
     redirect("?action=upgrade&step=" . ($step + 1));
 } elseif ($step == 3) {
     $intables = array('sort', 'member', 'question', 'answer', 'notice', 'set', 'vote');
     if (isset($intables[$start])) {
         if ($tableinfo = loadtable($intables[$start])) {
             echo "导入数据表 [ {$start} ] {$tablepre}{$intables[$start]}:";
             $func = 'import_' . $intables[$start];
             $func();
         } else {
             echo "忽略数据表 [ {$start} ] {$tablepre}{$intables[$start]}:";
         }
         $start++;
         redirect("?action=upgrade&step={$step}&start={$start}");
     }
     echo "第 {$step} 步转换成功<br /><br />";
     redirect("?action=upgrade&step=" . ($step + 1));
 } elseif ($step == 4) {
     config_edit();
     //生成Tipask的配置文件
     @mkdir(TIPASK_ROOT . "/data/backup", 0777);