| 1 |
<? |
<? |
| 2 |
if (!isset($_SERVER["argc"])) |
if (!isset($_SERVER["argc"])) |
| 3 |
$_SERVER["argc"] = 0; |
{ |
| 4 |
|
echo ("Invalid usage"); |
| 5 |
|
exit(); |
| 6 |
|
} |
| 7 |
|
|
| 8 |
if (isset($_SERVER["argv"][0])) |
chdir(substr($_SERVER["argv"][0], 0, strrpos($_SERVER["argv"][0], "/"))); |
|
chdir(substr($_SERVER["argv"][0],0,strrpos($_SERVER["argv"][0],"/"))); |
|
|
|
|
|
require_once "./session_init.inc.php"; |
|
|
|
|
|
//Set data for session |
|
|
$_SESSION["MNG_uid"]=-1; |
|
|
$_SESSION["MNG_priv"]["gen_ex"]=1; |
|
|
|
|
|
$new = false; |
|
|
|
|
|
$db_conn_shell=include "./db_open.inc.php"; |
|
|
|
|
|
$rs_shell=mysql_query("select section_config.SID,section_config.title as s_title,". |
|
|
"section_config.ex_gen_tm,section_config.ex_update,". |
|
|
"section_class.title as c_title from section_config inner join section_class on". |
|
|
" section_config.CID=section_class.CID where section_config.enable". |
|
|
" and section_class.enable and ex_update=1 order by". |
|
|
" section_class.sort_order,section_config.sort_order") |
|
|
or die("Query section error!"); |
|
| 9 |
|
|
| 10 |
while($row_shell=mysql_fetch_array($rs_shell)) |
require_once "../lib/common.inc.php"; |
| 11 |
{ |
|
| 12 |
echo ("更新 [".$row_shell["s_title"]."] 中...\n"); |
$db_conn = include "./db_open.inc.php"; |
| 13 |
$_GET["sid"] = $row_shell["SID"]; |
|
| 14 |
include "./gen_ex_section.php"; |
$sql = "SELECT section_config.SID, section_config.title AS s_title FROM section_config |
| 15 |
$new = true; |
INNER JOIN section_class ON section_config.CID = section_class.CID |
| 16 |
} |
WHERE section_config.enable AND section_class.enable AND ex_update |
| 17 |
|
ORDER BY section_class.sort_order, section_config.sort_order"; |
| 18 |
|
|
| 19 |
|
$rs = mysqli_query($db_conn, $sql); |
| 20 |
|
if ($rs == false) |
| 21 |
|
{ |
| 22 |
|
echo ("Query section error: " . mysqli_error($db_conn)); |
| 23 |
|
exit(); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
$new = false; |
| 27 |
|
|
| 28 |
mysql_free_result($rs_shell); |
while ($row = mysqli_fetch_array($rs)) |
| 29 |
|
{ |
| 30 |
|
echo ("更新 [".$row["s_title"]."] 中...\n"); |
| 31 |
|
|
| 32 |
if ($new) |
$buffer = shell_exec($PHP_bin . " ./gen_ex_section.php " . $row["SID"]); |
| 33 |
|
echo ($buffer . "\n"); |
| 34 |
|
|
| 35 |
|
$new = true; |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
mysqli_free_result($rs); |
| 39 |
|
mysqli_close($db_conn); |
| 40 |
|
|
| 41 |
|
if ($new) |
| 42 |
|
{ |
| 43 |
|
echo ("生成目录中...\n"); |
| 44 |
|
|
| 45 |
|
$buffer = shell_exec($PHP_bin . " gen_ex_index.php"); |
| 46 |
|
if (!$buffer || file_put_contents("../gen_ex/index.html", $buffer) == false) |
| 47 |
{ |
{ |
| 48 |
echo ("生成目录中...\n"); |
echo ("Open output error!"); |
| 49 |
include "./gen_ex_context.php"; |
exit(); |
| 50 |
} |
} |
| 51 |
|
} |
|
session_unset(); |
|
|
session_destroy(); |
|
| 52 |
?> |
?> |