/[LeafOK_CVS]/fenglin/manage/gen_ex_daily.php
ViewVC logotype

Annotation of /fenglin/manage/gen_ex_daily.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations)
Fri Apr 25 01:24:26 2025 UTC (10 months, 3 weeks ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -4 lines
Refine chdir for CLI mode

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

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1