diff --git a/dedebiz b/dedebiz index bc7df73c..e0db3505 100755 --- a/dedebiz +++ b/dedebiz @@ -9,6 +9,10 @@ * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ + +define('DEDE_ENVIRONMENT', 'production'); +define('DEBUG_LEVEL', FALSE); //如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 + //切换工作目录到./public $workDir = dirname(__FILE__) . "/src"; @@ -113,7 +117,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { $id = $row->id; $ac = new Archives($id); $rurl = $ac->MakeHtml(0); - DedeCli::showProgress(ceil(($i / $total) * 100), 100); + DedeCli::showProgress(ceil(($i / $total) * 100), 100, $i, $total); $i++; } DedeCli::write("Make archive html successfull"); diff --git a/src/system/autoload.inc.php b/src/system/autoload.inc.php index fe99f023..526217e7 100755 --- a/src/system/autoload.inc.php +++ b/src/system/autoload.inc.php @@ -16,7 +16,7 @@ function __autoload($classname) return TRUE; } 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'; if ( is_file ( DEDEINC.'/'.$libclassfile ) ) diff --git a/src/system/autoload7.inc.php b/src/system/autoload7.inc.php index 187484bb..e4225eea 100755 --- a/src/system/autoload7.inc.php +++ b/src/system/autoload7.inc.php @@ -16,7 +16,7 @@ function dede_autoloader($classname) return TRUE; } 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'; if ( is_file ( DEDEINC.'/'.$libclassfile ) ) diff --git a/src/system/common.inc.php b/src/system/common.inc.php index 4767500d..02115e9b 100755 --- a/src/system/common.inc.php +++ b/src/system/common.inc.php @@ -7,7 +7,15 @@ * @link https://www.dedebiz.com */ //生产环境使用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') { ini_set('display_errors', 0); if (version_compare(PHP_VERSION, '5.3', '>=')) @@ -22,7 +30,7 @@ if (DEDE_ENVIRONMENT == 'production') { error_reporting(-1); ini_set('display_errors', 1); } -define('DEBUG_LEVEL', FALSE);//如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 + define('DEDEINC', str_replace("\\", '/', dirname(__FILE__))); define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC, 0, -6))); // 站点根目录 define('DEDEDATA', substr(DEDEINC, 0, -6).'data'); diff --git a/src/system/libraries/cli.class.php b/src/system/libraries/cli.class.php index fd416c51..d3a11fde 100644 --- a/src/system/libraries/cli.class.php +++ b/src/system/libraries/cli.class.php @@ -175,7 +175,7 @@ class DedeCli } 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; if ($inProgress !== false && $inProgress <= $thisStep) @@ -190,7 +190,11 @@ class DedeCli $percent = intval(($thisStep / $totalSteps) * 100); $step = (int)round($percent / 10); 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 { fwrite(STDOUT, "\007"); }