Browse Source

Update dedebiz

tags/6.1.9
xushubieli 7 months ago
parent
commit
7f9df752c4
1 changed files with 8 additions and 43 deletions
  1. +8
    -43
      dedebiz

+ 8
- 43
dedebiz View File

@@ -9,19 +9,14 @@
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/

define('DEDE_ENVIRONMENT', 'production');
define('DEBUG_LEVEL', FALSE); //如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试

//切换工作目录到./public
//切换工作目录到/src
$workDir = dirname(__FILE__) . "/src";

chdir($workDir);

if (substr(php_sapi_name(), 0, 3) === 'cgi') {
die("DedeBIZ:needs php-cli to run\n\n");
}

$helpStr = "
NAME:
DedeBIZ Cli Tools
@@ -36,7 +31,6 @@ COMMANDS:
WEBSITE:
https://www.dedebiz.com/help/
";

//将选项转化为SQL IN参数
function Option2SQLin($str = "")
{
@@ -63,7 +57,6 @@ function Option2SQLin($str = "")
}
return implode(",", $strs);
}

function RandEncode($length=26)
{
$chars='abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789';
@@ -75,7 +68,6 @@ function RandEncode($length=26)
}
return $rnd_cookieEncode;
}

if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
//PHP5.4以下不支持内建服务器
//用于开发调试
@@ -90,10 +82,8 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
DedeCli::error("Check your root path is right");
exit;
}

require_once($workDir . "/system/common.inc.php");
require_once(DEDEINC . "/libraries/cli.class.php");

//一个命令行的生成工具
if (count($argv) > 2 && ($argv[2] == "arc" || $argv[2] == "a")) {
//生成文档
@@ -188,7 +178,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
DedeCli::error("start is empty");
exit;
}

//1.生成首页
$pv = new PartView();
$row = $pv->dsql->GetOne("SELECT * FROM `#@__homepageset` ");
@@ -238,7 +227,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
}
DedeCli::write("Make list html successfull");
}

//生成文档
$tt = $dsql->GetOne("SELECT COUNT(id) as dd FROM `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1");
$total = intval($tt['dd']);
@@ -252,7 +240,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$i++;
}
DedeCli::write("Make archives html successfull");
//优化数据
OptimizeData($dsql);
DedeCli::write("Optimize data successfull");
@@ -291,7 +278,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
DedeCli::error("latest version,don't need to update");
exit;
}

$fileHashURL = "https://cdn.dedebiz.com/release/{$cfg_version_detail}.json";
$del = new DedeHttpDown();
$del->OpenUrl($fileHashURL);
@@ -322,9 +308,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$dbpwd = "";
$dbprefix = "dede_";
$dblang = "utf8";

mkdir($workDir.'/data/tplcache', 0777);

//common.inc.php
$configStr1 = str_replace("~dbtype~",$dbtype,$configStr1);
$configStr1 = str_replace("~dbhost~",$dbhost,$configStr1);
@@ -336,14 +320,12 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$fp = fopen($workDir."/data/common.inc.php","w") or die("error,check /data writeable");
fwrite($fp,$configStr1);
fclose($fp);

$cookieencode = RandEncode(26);
$baseurl = "http://127.0.0.1:8088";
$indexUrl = "/";
$cmspath = "";
$webname = "DedeBIZ本地测试开发站点";
$adminmail = "admin@dedebiz.com";

$fp = fopen($workDir."/install/config.cache.inc.php","r");
$configStr2 = fread($fp,filesize($workDir."/install/config.cache.inc.php"));
fclose($fp);
@@ -353,15 +335,12 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$configStr2 = str_replace("~cookieEncode~",$cookieencode,$configStr2);
$configStr2 = str_replace("~webname~",$webname,$configStr2);
$configStr2 = str_replace("~adminmail~",$adminmail,$configStr2);

$fp = fopen($workDir.'/data/config.cache.inc.php','w');
fwrite($fp,$configStr2);
fclose($fp);

$fp = fopen($workDir.'/data/config.cache.bak.php','w');
fwrite($fp,$configStr2);
fclose($fp);

$query = '';
$fp = fopen($workDir.'/install/sql-dftables.txt','r');
while(!feof($fp))
@@ -374,7 +353,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$query = preg_replace('/character set (.*?) /i','',$query);
$query = str_replace('unsigned','',$query);
$query = str_replace('TYPE=MyISAM','',$query);

$query = preg_replace ('/TINYINT\(([\d]+)\)/i','INTEGER',$query);
$query = preg_replace ('/mediumint\(([\d]+)\)/i','INTEGER',$query);
$query = preg_replace ('/smallint\(([\d]+)\)/i','INTEGER',$query);
@@ -399,7 +377,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
}
}
fclose($fp);

//导入默认数据
$query = '';
$fp = fopen($workDir.'/install/sql-dfdata.txt','r');
@@ -422,7 +399,6 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
}
}
fclose($fp);

//更新配置
$cquery = "UPDATE `{$dbprefix}sysconfig` SET value='{$baseurl}' WHERE varname='cfg_basehost';";
$db->exec($cquery);
@@ -436,46 +412,35 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$db->exec($cquery);
$cquery = "UPDATE `{$dbprefix}sysconfig` SET value='{$adminmail}' WHERE varname='cfg_adminemail';";
$db->exec($cquery);

$adminuser = "admin";
$adminpwd = "admin";

//增加管理员帐号
$adminquery = "INSERT INTO `{$dbprefix}admin` VALUES (1, 10, '$adminuser', '".substr(md5($adminpwd),5,20)."', 'admin', '', '', 0, '".time()."', '127.0.0.1');";
$db->exec($adminquery);

DedeCli::write("admin user:admin");
DedeCli::write("admin password:admin");

//关连前台会员帐号
$adminquery = "INSERT INTO `{$dbprefix}member` (`mid`,`mtype`,`userid`,`pwd`,`uname`,`sex`,`rank`,`money`,`email`,
`scores` ,`matt` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )
VALUES ('1','个人','$adminuser','".md5($adminpwd)."','$adminuser','男','100','0','','10000','10','','0','','".time()."','','0',''); ";
$adminquery = "INSERT INTO `{$dbprefix}member` (`mid`,`mtype`,`userid`,`pwd`,`uname`,`sex`,`rank`,`money`,`email`,`scores` ,`matt` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )
VALUES ('1','个人','$adminuser','".md5($adminpwd)."','$adminuser','男','100','0','','10000','10','','0','','".time()."','','0',''); ";
$db->exec($adminquery);

$adminquery = "INSERT INTO `{$dbprefix}member_person` (`mid`,`onlynet`,`sex`,`uname`,`qq`,`msn`,`tel`,`mobile`,`place`,`oldplace`,`birthday`,`star`,
`income` , `education` , `height` , `bodytype` , `blood` , `vocation` , `smoke` , `marital` , `house` ,`drink` , `datingtype` , `language` , `nature` , `lovemsg` , `address`,`uptime`)
VALUES ('1', '1', '男', '{$adminuser}', '', '', '', '', '0', '0','1980-01-01', '1', '0', '0', '160', '0', '0', '0', '0', '0', '0','0', '0', '', '', '', '','0'); ";
$adminquery = "INSERT INTO `{$dbprefix}member_person` (`mid`,`onlynet`,`sex`,`uname`,`qq`,`msn`,`tel`,`mobile`,`place`,`oldplace`,`birthday`,`star`,`income`,`education`,`height`,`bodytype`,`blood`,`vocation`,`smoke`,`marital`,`house` ,`drink`,`datingtype`,`language`,`nature`,`lovemsg`,`address`,`uptime`)
VALUES ('1', '1', '男', '{$adminuser}', '', '', '', '', '0', '0','1980-01-01', '1', '0', '0', '160', '0', '0', '0', '0', '0', '0','0', '0', '', '', '', '','0'); ";
$db->exec($adminquery);

$adminquery = "INSERT INTO `{$dbprefix}member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)
VALUES ('1','0','0','0','0','0','0','0','0'); ";
VALUES ('1','0','0','0','0','0','0','0','0'); ";
$db->exec($adminquery);

$adminquery = "Insert Into `{$dbprefix}member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)
Values('1','10','0','{$adminuser}的空间','','person','',''); ";
Values('1','10','0','{$adminuser}的空间','','person','',''); ";
$db->exec($adminquery);
if (phpversion() < "5.4") {
die("DedeBIZ:command web server not support\n\n");
}

// 写入程序安装锁
file_put_contents($workDir.'/install/install_lock.txt', 'ok');

echo "Start Dev Server For DedeBIZ\n\r";
echo "Open http://localhost:8088\n\r";
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./'));
exit;
} else {
echo $helpStr;
}
}

Loading…
Cancel
Save