# Get keys from $wgAllMessagesEn, which is more complete than the local language
$first = true;
if ( $messageArray ) {
- $sortedArray = $wgAllMessagesEn;
+ $sortedArray = $messageArray;
} else {
$sortedArray = $wgAllMessagesEn;
}
}
}
-function loadArrayFromFile( $filename )
+function loadLanguageFile( $filename )
{
$contents = file_get_contents( $filename );
+ # Remove header line
+ $p = strpos( $contents, "\n" ) + 1;
+ $contents = substr( $contents, $p );
+ # Unserialize
return unserialize( $contents );
}
<?php
-if ( strpos( "wikimedia.org", `hostname -a` ) !== false ) {
+if ( strpos( `hostname -a`, "wikimedia.org" ) !== false ) {
require_once( "liveCmdLine.inc" );
} else {
+ # Turn off output buffering if it's on
+ @ob_end_flush();
+
if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
print "This script must be run from the command line\n";
exit();
$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
if ( @$argv[1] && @$argv[1] != "-" ) {
- $lang = $argv[1];
+ $self = array_shift( $argv );
+ $lang = array_shift( $argv );
putenv( "wikilang=$lang");
$settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
$newpath = "/apache/common/php$sep";
$wgUsePHPTal = false;
define("MEDIAWIKI",true);
include_once( "Setup.php" );
- include_once( "./InitialiseMessages.inc" );
include_once( "../install-utils.inc" );
- $wgTitle = Title::newFromText( "Rebuild messages script" );
+ $wgTitle = Title::newFromText( "Command line script" );
$wgCommandLineMode = true;
set_time_limit(0);
}
}
$wgCommandLineMode = true;
+$self = array_shift( $argv );
+# Turn off output buffering if it's on
+@ob_end_flush();
-if ( isset( $argv[1] ) ) {
- $lang = $argv[1];
+if ( isset( $argv[0] ) ) {
+ $lang = array_shift( $argv );
} else {
$lang = "aa";
}
-if ( isset( $argv[2] ) ) {
- $site = $argv[2];
+if ( isset( $argv[0] ) ) {
+ $site = array_shift( $argv );
} else {
$site = "wikipedia";
}
$wgUsePHPTal = false;
define("MEDIAWIKI",true);
-include_once( "Setup.php" );
+require_once( "Setup.php" );
+require_once( "../install-utils.inc" );
$wgTitle = Title::newFromText( "Command line script" );
$wgCommandLineMode = true;
set_time_limit(0);
<?php
-$wgCommandLineMode = true;
-# Turn off output buffering if it's on
-@ob_end_flush();
-
-$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-if ( isset($argv[1]) && $argv[1] ) {
- $lang = $argv[1];
- putenv( "wikilang=$lang");
- $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
- $newpath = "/apache/common/php$sep";
-} else {
- $settingsFile = "../LocalSettings.php";
- $newpath = "";
-}
+require_once( "commandLine.inc" );
+include_once( "./InitialiseMessages.inc" );
+
+$wgTitle = Title::newFromText( "Rebuild messages script" );
-if ( isset($argv[2]) && $argv[2] == "update" ) {
- $response = 1;
-} elseif ( isset($argv[2]) && $argv[2] == "reinitialise" ) {
- $response = 2;
+if ( isset( $argv[0] ) ) {
+ $response = array_shift( $argv );
+ if ( $response == "update" ) {
+ $response = 1;
+ } elseif ( $response == "rebuild" ) {
+ $response = 2;
+ }
} else {
$response = 0;
}
-
-if ( ! is_readable( $settingsFile ) ) {
- print "A copy of your installation's LocalSettings.php\n" .
- "must exist in the source directory.\n";
- exit();
-}
-
-ini_set( "include_path", "../includes$sep../languages$sep$newpath$IP$sep$include_path" );
-
-$wgCommandLineMode = true;
-$DP = "../includes";
-require_once( $settingsFile );
-
-require_once( "Setup.php" );
-require_once( "./InitialiseMessages.inc" );
-require_once( "../install-utils.inc" );
-$wgTitle = Title::newFromText( "Rebuild messages script" );
-$wgCommandLineMode = true;
-set_time_limit(0);
-
-if ( isset($argv) && count( $argv ) >= 3 ) {
- $messages = loadArrayFromFile( $argv[3] );
+if ( isset( $argv[0] ) ) {
+ $messages = loadLanguageFile( array_shift( $argv ) );
} else {
$messages = false;
}