--- drupal-4.6.5/update.php 2005-12-20 17:30:16.000000000 +0200 +++ drupal-4.6.5/update.php 2005-12-20 18:26:23.000000000 +0200 @@ -206,6 +206,65 @@ print update_page_footer(); } +if (php_sapi_name() == 'cli') { + $_SERVER['REMOTE_ADDR'] = '0.0.0.0'; + + include_once "includes/bootstrap.inc"; + include_once "includes/common.inc"; + + function get_update_index($date) { + global $sql_updates; + + $hash = array_flip(array_keys($sql_updates)); + if (!isset($hash[$date])) { + return null; + } + return $hash[$date]; + } + + if (isset($argv[2])) { + # user specified the date + $start = get_update_index($argv[2]); + if (is_null($start)) { + die("Can't find requested update: $argv[2]\n"); + } + + } else { + # lookup update date from database + $date = variable_get("update_start", 0); + + $start = get_update_index($date); + if (is_null($start)) { + die("No updates available\n"); + } + # but we need next entry instead + $start++; + } + + # "0" reserved for "All" + $start++; + + $_POST['op'] = $argv[1]; + $_POST['edit'] = array( + 'start' => $start, + ); + + ob_start(); + update_page(); + $page = ob_get_contents(); + ob_end_clean(); + + # primitive html renderer ;) + if (preg_match('#(.+)#s', $page, $m)) { + $page = $m[1]; + $page = preg_replace('##s', '', $page); + $page = preg_replace('#
(.*?)
#s', '', $page); + } + + echo strip_tags($page), "\n"; + exit; +} + if (isset($_GET["op"])) { include_once "includes/bootstrap.inc"; include_once "includes/common.inc"; --- drupal-4.6.5/update.php~ 2006-01-11 21:39:09.000000000 +0200 +++ drupal-4.6.5/update.php 2006-01-11 21:39:11.000000000 +0200 @@ -12,6 +12,13 @@ * check statement below. Change the TRUE into a FALSE to disable the access * check. After finishing the upgrade, be sure to open this file and change the * FALSE back into a TRUE! + * + * PLD Linux notes: + * You will need to copy this file to htdocs dir to run it from web and add + * chdir('..'); before first include_once statement. + * + * You can also run this script from CLI (which is preffered way in PLD Linux): + * # php update.php */ // Disable access checking?