]>
Commit | Line | Data |
---|---|---|
83fb2915 ER |
1 | --- drupal-4.6.5/update.php 2005-12-20 17:30:16.000000000 +0200 |
2 | +++ drupal-4.6.5/update.php 2005-12-20 18:26:23.000000000 +0200 | |
ec9d41fb | 3 | @@ -206,6 +206,65 @@ |
83fb2915 ER |
4 | print update_page_footer(); |
5 | } | |
6 | ||
7 | +if (php_sapi_name() == 'cli') { | |
ec9d41fb ER |
8 | + $_SERVER['REMOTE_ADDR'] = '0.0.0.0'; |
9 | + | |
10 | + include_once "includes/bootstrap.inc"; | |
11 | + include_once "includes/common.inc"; | |
12 | + | |
13 | + function get_update_index($date) { | |
14 | + global $sql_updates; | |
15 | + | |
16 | + $hash = array_flip(array_keys($sql_updates)); | |
17 | + if (!isset($hash[$date])) { | |
18 | + return null; | |
19 | + } | |
20 | + return $hash[$date]; | |
83fb2915 | 21 | + } |
ec9d41fb ER |
22 | + |
23 | + if (isset($argv[2])) { | |
24 | + # user specified the date | |
25 | + $start = get_update_index($argv[2]); | |
26 | + if (is_null($start)) { | |
27 | + die("Can't find requested update: $argv[2]\n"); | |
28 | + } | |
29 | + | |
30 | + } else { | |
31 | + # lookup update date from database | |
32 | + $date = variable_get("update_start", 0); | |
33 | + | |
34 | + $start = get_update_index($date); | |
35 | + if (is_null($start)) { | |
36 | + die("No updates available\n"); | |
37 | + } | |
38 | + # but we need next entry instead | |
39 | + $start++; | |
40 | + } | |
41 | + | |
83fb2915 | 42 | + # "0" reserved for "All" |
ec9d41fb | 43 | + $start++; |
83fb2915 ER |
44 | + |
45 | + $_POST['op'] = $argv[1]; | |
46 | + $_POST['edit'] = array( | |
47 | + 'start' => $start, | |
48 | + ); | |
83fb2915 ER |
49 | + |
50 | + ob_start(); | |
ec9d41fb | 51 | + update_page(); |
83fb2915 ER |
52 | + $page = ob_get_contents(); |
53 | + ob_end_clean(); | |
54 | + | |
55 | + # primitive html renderer ;) | |
56 | + if (preg_match('#<body>(.+)</body>#s', $page, $m)) { | |
57 | + $page = $m[1]; | |
58 | + $page = preg_replace('#<div id="logo">(.*?)</div>#s', '', $page); | |
59 | + $page = preg_replace('#<div id="update">(.*?)</div>#s', '', $page); | |
60 | + } | |
61 | + | |
62 | + echo strip_tags($page), "\n"; | |
63 | + exit; | |
64 | +} | |
65 | + | |
66 | if (isset($_GET["op"])) { | |
67 | include_once "includes/bootstrap.inc"; | |
68 | include_once "includes/common.inc"; | |
950cb897 ER |
69 | --- drupal-4.6.5/update.php~ 2006-01-11 21:39:09.000000000 +0200 |
70 | +++ drupal-4.6.5/update.php 2006-01-11 21:39:11.000000000 +0200 | |
71 | @@ -12,6 +12,13 @@ | |
72 | * check statement below. Change the TRUE into a FALSE to disable the access | |
73 | * check. After finishing the upgrade, be sure to open this file and change the | |
74 | * FALSE back into a TRUE! | |
75 | + * | |
76 | + * PLD Linux notes: | |
77 | + * You will need to copy this file to htdocs dir to run it from web and add | |
78 | + * chdir('..'); before first include_once statement. | |
79 | + * | |
80 | + * You can also run this script from CLI (which is preffered way in PLD Linux): | |
81 | + * # php update.php | |
82 | */ | |
83 | ||
84 | // Disable access checking? |