From: Tim Starling Date: Tue, 15 Jun 2004 15:18:50 +0000 (+0000) Subject: * Moved content from liveCmdLine.inc into commandLine.inc, obsoleting the former. X-Git-Tag: 1.5.0alpha1~2841 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=2ba5e0e71834eb363242f73d0d0977ed6537fa9a;p=lhc%2Fweb%2Fwiklou.git * Moved content from liveCmdLine.inc into commandLine.inc, obsoleting the former. * Put some option handling code in commandLine.inc which is untested and unused (for the moment). * Converted all existing command line scripts to use the standard header and argument array. * Did a quick test of compressOld.php, rebuildall.php and rebuildMessages.php to check for breakage. * rebuildall.php was broken due to the unmaintained rebuildlinks.php, so I converted it to use refreshLinks instead. Required splitting into refreshLinks.inc and refreshLinks.php --- diff --git a/maintenance/DiffLanguage.php b/maintenance/DiffLanguage.php index 89955c53c8..0d97d22911 100644 --- a/maintenance/DiffLanguage.php +++ b/maintenance/DiffLanguage.php @@ -40,8 +40,8 @@ require_once( "commandLine.inc" ); $wgLanguageCode = strtoupper(substr($wgLanguageCode,0,1)).strtolower(substr($wgLanguageCode,1)); # read command line argument -if ( isset($argv[1]) ) { - $lang = $argv[1]; +if ( isset($args[0]) ) { + $lang = $args[0]; # or prompt a simple menu } else { diff --git a/maintenance/attribute.php b/maintenance/attribute.php index 56c2d2acb3..a6dcf4a673 100644 --- a/maintenance/attribute.php +++ b/maintenance/attribute.php @@ -1,31 +1,20 @@ \n"; + if ( $wgWikiFarm ) { + print "Usage: php attribute.php \n"; + } else { + print "Usage: php attribute.php \n"; + } exit; } -$lang = $argv[1]; -$source = $argv[2]; -$dest = $argv[3]; - -# Initialisation - -$wgCommandLineMode = true; -$DP = "../includes"; - -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; -ini_set( "include_path", "$IP$sep$include_path" ); - -require_once( "/apache/htdocs/$lang/w/LocalSettings.php" ); -require_once( "Setup.php" ); - -$wgTitle = Title::newFromText( "Changing attribution script" ); -set_time_limit(0); -$wgCommandLineMode = true; +$source = $args[0]; +$dest = $args[1]; $eSource = wfStrencode( $source ); $eDest = wfStrencode( $dest ); diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index b29c43f12c..ee1d78e863 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -1,47 +1,118 @@ diff --git a/maintenance/compressOld.inc b/maintenance/compressOld.inc index ff47e15f96..8da4272571 100644 --- a/maintenance/compressOld.inc +++ b/maintenance/compressOld.inc @@ -1,7 +1,5 @@ m; + + print("Refreshing link table. Starting from cur_id $start of $end.\n"); + + # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) + $wgUser->setOption("math", 3); + + for ($id = $start; $id <= $end; $id++) { + if ( !($id % REPORTING_INTERVAL) ) { + print "$id\n"; + } + + if ( !($id % PAUSE_INTERVAL) ) { + sleep(1); + } + + $wgTitle = Title::newFromID( $id ); + if ( is_null( $wgTitle ) ) { + continue; + } + + $wgArticle = new Article( $wgTitle ); + $text = $wgArticle->getContent( true ); + $wgLinkCache = new LinkCache; + $wgOut->addWikiText( $text ); + + if ( $wgEnablePersistentLC ) { + $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) ); + } + + $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() ); + $linksUpdate->doDumbUpdate(); + $linksUpdate->fixBrokenLinks(); + } +} +?> diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 089e6a70b5..6d6ddc3f04 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -1,8 +1,8 @@ m; - -print("Refreshing link table. Starting from cur_id $start of $end.\n"); - -# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) -$wgUser->setOption("math", 3); - -for ($id = $start; $id <= $end; $id++) { - if ( !($id % REPORTING_INTERVAL) ) { - print "$id\n"; - } - - if ( !($id % PAUSE_INTERVAL) ) { - sleep(1); - } - - $wgTitle = Title::newFromID( $id ); - if ( is_null( $wgTitle ) ) { - continue; - } - - $wgArticle = new Article( $wgTitle ); - $text = $wgArticle->getContent( true ); - $wgLinkCache = new LinkCache; - @$wgOut->addWikiText( $text ); - - if ( $wgEnablePersistentLC ) { - $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) ); - } - - $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() ); - $linksUpdate->doDumbUpdate(); - $linksUpdate->fixBrokenLinks(); -} +refreshLinks( $start ); exit(); diff --git a/maintenance/remove-brokenlinks.php b/maintenance/remove-brokenlinks.php index 89a3003399..7faecef568 100644 --- a/maintenance/remove-brokenlinks.php +++ b/maintenance/remove-brokenlinks.php @@ -1,25 +1,9 @@