| 1 |
<? |
<? |
| 2 |
if (!isset($_SERVER["argc"])) |
if (!isset($_SERVER["argc"])) |
| 3 |
{ |
{ |
| 4 |
echo ("Invalid usage"); |
echo ("Invalid usage"); |
| 5 |
exit(); |
exit(); |
| 6 |
} |
} |
| 7 |
|
|
| 8 |
if (strrpos($_SERVER["argv"][0], "/") !== false) |
if (strrpos($_SERVER["argv"][0], "/") !== false) |
| 9 |
{ |
{ |
| 10 |
chdir(substr($_SERVER["argv"][0], 0, strrpos($_SERVER["argv"][0], "/"))); |
chdir(substr($_SERVER["argv"][0], 0, strrpos($_SERVER["argv"][0], "/"))); |
| 11 |
} |
} |
| 12 |
|
|
| 13 |
require_once "../lib/db_open.inc.php"; |
require_once "../lib/db_open.inc.php"; |
| 14 |
require_once "../lib/common.inc.php"; |
require_once "../lib/common.inc.php"; |
| 15 |
|
|
| 16 |
$sql = "SELECT section_config.SID, section_config.title AS s_title FROM section_config |
$sql = "SELECT section_config.SID, section_config.title AS s_title FROM section_config |
| 17 |
INNER JOIN section_class ON section_config.CID = section_class.CID |
INNER JOIN section_class ON section_config.CID = section_class.CID |
| 18 |
WHERE section_config.enable AND section_class.enable AND ex_update |
WHERE section_config.enable AND section_class.enable AND ex_update |
| 19 |
ORDER BY section_class.sort_order, section_config.sort_order"; |
ORDER BY section_class.sort_order, section_config.sort_order"; |
|
|
|
|
$rs = mysqli_query($db_conn, $sql); |
|
|
if ($rs == false) |
|
|
{ |
|
|
echo ("Query section error: " . mysqli_error($db_conn)); |
|
|
exit(); |
|
|
} |
|
|
|
|
|
$new = false; |
|
|
|
|
|
while ($row = mysqli_fetch_array($rs)) |
|
|
{ |
|
|
echo ("更新 [".$row["s_title"]."] 中...\n"); |
|
|
|
|
|
$buffer = shell_exec($PHP_bin . " ./gen_ex_section.php " . $row["SID"]); |
|
|
echo ($buffer . "\n"); |
|
|
|
|
|
$new = true; |
|
|
} |
|
|
|
|
|
mysqli_free_result($rs); |
|
|
mysqli_close($db_conn); |
|
|
|
|
|
if ($new) |
|
|
{ |
|
|
echo ("生成目录中...\n"); |
|
| 20 |
|
|
| 21 |
$buffer = shell_exec($PHP_bin . " gen_ex_index.php"); |
$rs = mysqli_query($db_conn, $sql); |
| 22 |
if (!$buffer || file_put_contents("../gen_ex/index.html", $buffer) == false) |
if ($rs == false) |
| 23 |
{ |
{ |
| 24 |
echo ("Open output error!"); |
echo ("Query section error: " . mysqli_error($db_conn)); |
| 25 |
exit(); |
exit(); |
| 26 |
} |
} |
| 27 |
} |
|
| 28 |
|
$new = false; |
| 29 |
|
|
| 30 |
|
while ($row = mysqli_fetch_array($rs)) |
| 31 |
|
{ |
| 32 |
|
echo ("更新 [".$row["s_title"]."] 中...\n"); |
| 33 |
|
|
| 34 |
|
$buffer = shell_exec($PHP_bin . " ./gen_ex_section.php " . $row["SID"]); |
| 35 |
|
echo ($buffer . "\n"); |
| 36 |
|
|
| 37 |
|
$new = true; |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
mysqli_free_result($rs); |
| 41 |
|
mysqli_close($db_conn); |
| 42 |
|
|
| 43 |
|
if ($new) |
| 44 |
|
{ |
| 45 |
|
echo ("生成目录中...\n"); |
| 46 |
|
|
| 47 |
|
$buffer = shell_exec($PHP_bin . " gen_ex_index.php"); |
| 48 |
|
if (!$buffer || file_put_contents("../gen_ex/index.html", $buffer) == false) |
| 49 |
|
{ |
| 50 |
|
echo ("Open output error!"); |
| 51 |
|
exit(); |
| 52 |
|
} |
| 53 |
|
} |
| 54 |
?> |
?> |