| @@ -9,6 +9,10 @@ | |||||
| * @license https://www.dedebiz.com/license | * @license https://www.dedebiz.com/license | ||||
| * @link https://www.dedebiz.com | * @link https://www.dedebiz.com | ||||
| */ | */ | ||||
| define('DEDE_ENVIRONMENT', 'production'); | |||||
| define('DEBUG_LEVEL', FALSE); //如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 | |||||
| //切换工作目录到./public | //切换工作目录到./public | ||||
| $workDir = dirname(__FILE__) . "/src"; | $workDir = dirname(__FILE__) . "/src"; | ||||
| @@ -113,7 +117,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||||
| $id = $row->id; | $id = $row->id; | ||||
| $ac = new Archives($id); | $ac = new Archives($id); | ||||
| $rurl = $ac->MakeHtml(0); | $rurl = $ac->MakeHtml(0); | ||||
| DedeCli::showProgress(ceil(($i / $total) * 100), 100); | |||||
| DedeCli::showProgress(ceil(($i / $total) * 100), 100, $i, $total); | |||||
| $i++; | $i++; | ||||
| } | } | ||||
| DedeCli::write("Make archive html successfull"); | DedeCli::write("Make archive html successfull"); | ||||
| @@ -16,7 +16,7 @@ function __autoload($classname) | |||||
| return TRUE; | return TRUE; | ||||
| } | } | ||||
| if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | ||||
| $classname = "arc.".$classname; | |||||
| $classname = "archive/".$classname; | |||||
| } | } | ||||
| $libclassfile = $classname.'.class.php'; | $libclassfile = $classname.'.class.php'; | ||||
| if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | ||||
| @@ -16,7 +16,7 @@ function dede_autoloader($classname) | |||||
| return TRUE; | return TRUE; | ||||
| } | } | ||||
| if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | ||||
| $classname = "arc.".$classname; | |||||
| $classname = "archive/".$classname; | |||||
| } | } | ||||
| $libclassfile = $classname.'.class.php'; | $libclassfile = $classname.'.class.php'; | ||||
| if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | ||||
| @@ -7,7 +7,15 @@ | |||||
| * @link https://www.dedebiz.com | * @link https://www.dedebiz.com | ||||
| */ | */ | ||||
| //生产环境使用production,如果采用dev模式,会有一些php的报错信息提示,便于开发调试 | //生产环境使用production,如果采用dev模式,会有一些php的报错信息提示,便于开发调试 | ||||
| define('DEDE_ENVIRONMENT', 'production'); | |||||
| if (!defined('DEDE_ENVIRONMENT')) { | |||||
| define('DEDE_ENVIRONMENT', 'production'); | |||||
| } | |||||
| if (!defined('DEBUG_LEVEL')) { | |||||
| define('DEBUG_LEVEL', FALSE);//如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 | |||||
| } | |||||
| if (DEDE_ENVIRONMENT == 'production') { | if (DEDE_ENVIRONMENT == 'production') { | ||||
| ini_set('display_errors', 0); | ini_set('display_errors', 0); | ||||
| if (version_compare(PHP_VERSION, '5.3', '>=')) | if (version_compare(PHP_VERSION, '5.3', '>=')) | ||||
| @@ -22,7 +30,7 @@ if (DEDE_ENVIRONMENT == 'production') { | |||||
| error_reporting(-1); | error_reporting(-1); | ||||
| ini_set('display_errors', 1); | ini_set('display_errors', 1); | ||||
| } | } | ||||
| define('DEBUG_LEVEL', FALSE);//如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 | |||||
| define('DEDEINC', str_replace("\\", '/', dirname(__FILE__))); | define('DEDEINC', str_replace("\\", '/', dirname(__FILE__))); | ||||
| define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC, 0, -6))); // 站点根目录 | define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC, 0, -6))); // 站点根目录 | ||||
| define('DEDEDATA', substr(DEDEINC, 0, -6).'data'); | define('DEDEDATA', substr(DEDEINC, 0, -6).'data'); | ||||
| @@ -175,7 +175,7 @@ class DedeCli | |||||
| } | } | ||||
| return (int)shell_exec('tput lines'); | return (int)shell_exec('tput lines'); | ||||
| } | } | ||||
| public static function showProgress($thisStep = 1, int $totalSteps = 10) | |||||
| public static function showProgress($thisStep = 1, int $totalSteps = 10, int $pos = 0,int $total = 0) | |||||
| { | { | ||||
| static $inProgress = false; | static $inProgress = false; | ||||
| if ($inProgress !== false && $inProgress <= $thisStep) | if ($inProgress !== false && $inProgress <= $thisStep) | ||||
| @@ -190,7 +190,11 @@ class DedeCli | |||||
| $percent = intval(($thisStep / $totalSteps) * 100); | $percent = intval(($thisStep / $totalSteps) * 100); | ||||
| $step = (int)round($percent / 10); | $step = (int)round($percent / 10); | ||||
| fwrite(STDOUT, "[\033[32m".str_repeat('#', $step).str_repeat('.', 10 - $step)."\033[0m]"); | fwrite(STDOUT, "[\033[32m".str_repeat('#', $step).str_repeat('.', 10 - $step)."\033[0m]"); | ||||
| fwrite(STDOUT, sprintf(" %3d%% Complete", $percent).PHP_EOL); | |||||
| $addstr = ""; | |||||
| if ($pos > 0 && $total > 0) { | |||||
| $addstr .= " Pos:{$pos},Total:{$total}"; | |||||
| } | |||||
| fwrite(STDOUT, sprintf(" %3d%% Complete{$addstr}", $percent).PHP_EOL); | |||||
| } else { | } else { | ||||
| fwrite(STDOUT, "\007"); | fwrite(STDOUT, "\007"); | ||||
| } | } | ||||