// Verify that the API has not been disabled
if ( !$wgEnableAPI ) {
header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
- echo( 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php'
- . '<pre><b>$wgEnableAPI=true;</b></pre>' );
+ echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php'
+ . '<pre><b>$wgEnableAPI=true;</b></pre>';
die( 1 );
}
if ( defined( 'STDERR' ) ) {
fwrite( STDERR, $message );
} else {
- echo( $message );
+ echo $message;
}
}
$finalOutput = ( $type == 'load.php' ) ? "/* $message */" : $message;
header( "$protocol 500 MediaWiki configuration Error" );
}
- echo( "$finalOutput\n" );
+ echo "$finalOutput\n";
die( 1 );
}
?>
<br />
<small>
-You are looking at the HTML representation of the <?php echo( $this->mFormat ); ?> format.<br />
+You are looking at the HTML representation of the <?php echo $this->mFormat; ?> format.<br />
HTML is good for debugging, but is unsuitable for application use.<br />
Specify the format parameter to change the output format.<br />
-To see the non HTML representation of the <?php echo( $this->mFormat ); ?> format, set format=<?php echo( strtolower( $this->mFormat ) ); ?>.<br />
+To see the non HTML representation of the <?php echo $this->mFormat; ?> format, set format=<?php echo strtolower( $this->mFormat ); ?>.<br />
See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>, or
-<a href='<?php echo( $script ); ?>'>API help</a> for more information.
+<a href='<?php echo $script; ?>'>API help</a> for more information.
</small>
<pre style='white-space: pre-wrap;'>
<?php
<p>
<?php
if ( $installerStarted ) {
- echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> complete the installation</a> and download LocalSettings.php." );
+ echo "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> complete the installation</a> and download LocalSettings.php.";
} else {
- echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first." );
+ echo "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first.";
}
?>
</p>
$factory->commitMasterChanges();
$factory->shutdown();
} catch ( MWException $mwe ) {
- echo( $mwe->getText() );
+ echo $mwe->getText();
exit( 1 );
}
$pages = file( $options['pagelist'] );
chdir( $olddir );
if ( $pages === false ) {
- echo( "Unable to open file {$options['pagelist']}\n" );
+ echo "Unable to open file {$options['pagelist']}\n";
die( 1 );
}
$pages = array_map( 'trim', $pages );
require_once( __DIR__ . '/importImages.inc' );
$processed = $added = $ignored = $skipped = $overwritten = $failed = 0;
-echo( "Import Images\n\n" );
+echo "Import Images\n\n";
# Need a path
if ( count( $args ) == 0 ) {
# Validate a title
$title = Title::makeTitleSafe( NS_FILE, $base );
if ( !is_object( $title ) ) {
- echo( "{$base} could not be imported; a valid title cannot be produced\n" );
+ echo "{$base} could not be imported; a valid title cannot be produced\n";
continue;
}
if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) {
$user->clearInstanceCache( 'name' ); // reload from DB!
if ( $user->isBlocked() ) {
- echo( $user->getName() . " was blocked! Aborting.\n" );
+ echo $user->getName() . " was blocked! Aborting.\n";
break;
}
}
$image = wfLocalFile( $title );
if ( $image->exists() ) {
if ( isset( $options['overwrite'] ) ) {
- echo( "{$base} exists, overwriting..." );
+ echo "{$base} exists, overwriting...";
$svar = 'overwritten';
} else {
- echo( "{$base} exists, skipping\n" );
+ echo "{$base} exists, skipping\n";
$skipped++;
continue;
}
$dupes = $repo->findBySha1( $sha1 );
if ( $dupes ) {
- echo( "{$base} already exists as " . $dupes[0]->getName() . ", skipping\n" );
+ echo "{$base} already exists as " . $dupes[0]->getName() . ", skipping\n";
$skipped++;
continue;
}
}
- echo( "Importing {$base}..." );
+ echo "Importing {$base}...";
$svar = 'added';
}
$wgUser = User::newFromName( $real_user );
if ( $wgUser === false ) {
# user does not exist in target wiki
- echo ( "failed: user '$real_user' does not exist in target wiki." );
+ echo "failed: user '$real_user' does not exist in target wiki.";
continue;
}
}
if ( $commentExt ) {
$f = findAuxFile( $file, $commentExt );
if ( !$f ) {
- echo( " No comment file with extension {$commentExt} found for {$file}, using default comment. " );
+ echo " No comment file with extension {$commentExt} found for {$file}, using default comment. ";
} else {
$commentText = file_get_contents( $f );
if ( !$commentText ) {
- echo( " Failed to load comment file {$f}, using default comment. " );
+ echo " Failed to load comment file {$f}, using default comment. ";
}
}
}
# Import the file
if ( isset( $options['dry'] ) ) {
- echo( " publishing {$file} by '" . $wgUser->getName() . "', comment '$commentText'... " );
+ echo " publishing {$file} by '" . $wgUser->getName() . "', comment '$commentText'... ";
} else {
$props = FSFile::getPropsFromPath( $file );
$flags = 0;
}
$archive = $image->publish( $file, $flags, $options );
if ( !$archive->isGood() ) {
- echo( "failed. (" .
+ echo "failed. (" .
$archive->getWikiText() .
- ")\n" );
+ ")\n";
$failed++;
continue;
}
}
if ( isset( $options['dry'] ) ) {
- echo( "done.\n" );
+ echo "done.\n";
} elseif ( $image->recordUpload2( $archive->value, $summary, $commentText, $props, $timestamp ) ) {
# We're done!
- echo( "done.\n" );
+ echo "done.\n";
$doProtect = false;
sleep( 2.0 ); # Why this sleep?
wfWaitForSlaves();
- echo( "\nSetting image restrictions ... " );
+ echo "\nSetting image restrictions ... ";
$cascade = false;
$restrictions = array();
$page = WikiPage::factory( $title );
$status = $page->doUpdateRestrictions( $restrictions, array(), $cascade, '', $user );
- echo( ( $status->isOK() ? 'done' : 'failed' ) . "\n" );
+ echo ( $status->isOK() ? 'done' : 'failed' ) . "\n";
}
} else {
- echo( "failed. (at recordUpload stage)\n" );
+ echo "failed. (at recordUpload stage)\n";
$svar = 'failed';
}
}
# Print out some statistics
- echo( "\n" );
+ echo "\n";
foreach ( array( 'count' => 'Found', 'limit' => 'Limit', 'ignored' => 'Ignored',
'added' => 'Added', 'skipped' => 'Skipped', 'overwritten' => 'Overwritten',
'failed' => 'Failed' ) as $var => $desc ) {
if ( $$var > 0 ) {
- echo( "{$desc}: {$$var}\n" );
+ echo "{$desc}: {$$var}\n";
}
}
} else {
- echo( "No suitable files could be found for import.\n" );
+ echo "No suitable files could be found for import.\n";
}
exit( 0 );
function showUsage( $reason = false ) {
if ( $reason ) {
- echo( $reason . "\n" );
+ echo $reason . "\n";
}
echo <<<TEXT
$options = array( 'help', 'nooverwrite', 'norc' );
$optionsWithArgs = array( 'title', 'user', 'comment' );
require_once( __DIR__ . '/commandLine.inc' );
-echo( "Import Text File\n\n" );
+echo "Import Text File\n\n";
if ( count( $args ) < 1 || isset( $options['help'] ) ) {
showHelp();
} else {
$filename = $args[0];
- echo( "Using {$filename}..." );
+ echo "Using {$filename}...";
if ( is_file( $filename ) ) {
$title = isset( $options['title'] ) ? $options['title'] : titleFromFilename( $filename );
if ( is_object( $title ) ) {
- echo( "\nUsing title '" . $title->getPrefixedText() . "'..." );
+ echo "\nUsing title '" . $title->getPrefixedText() . "'...";
if ( !$title->exists() || !isset( $options['nooverwrite'] ) ) {
$text = file_get_contents( $filename );
if ( is_object( $user ) ) {
- echo( "\nUsing username '" . $user->getName() . "'..." );
+ echo "\nUsing username '" . $user->getName() . "'...";
$wgUser =& $user;
$comment = isset( $options['comment'] ) ? $options['comment'] : 'Importing text file';
$flags = 0 | ( isset( $options['norc'] ) ? EDIT_SUPPRESS_RC : 0 );
- echo( "\nPerforming edit..." );
+ echo "\nPerforming edit...";
$page = WikiPage::factory( $title );
$content = ContentHandler::makeContent( $text, $title );
$page->doEditContent( $content, $comment, $flags, false, $user );
- echo( "done.\n" );
+ echo "done.\n";
} else {
- echo( "invalid username.\n" );
+ echo "invalid username.\n";
}
} else {
- echo( "page exists.\n" );
+ echo "page exists.\n";
}
} else {
- echo( "invalid title.\n" );
+ echo "invalid title.\n";
}
} else {
- echo( "does not exist.\n" );
+ echo "does not exist.\n";
}
}
if ( file_exists( $dupeMsgSource ) ) {
include( $dupeMsgSource );
if ( !isset( $dupeMessages ) ) {
- echo( "There are no duplicated messages in the source file provided." );
+ echo "There are no duplicated messages in the source file provided.";
exit( 1 );
}
} else {
- echo ( "The specified file $dupeMsgSource cannot be found." );
+ echo "The specified file $dupeMsgSource cannot be found.";
exit( 1 );
}
$newMsgArray = $oldMsgArray;
$tbl_txt = $dbw->tableName( 'text' );
# Get "active" text records from the revisions table
- echo( "Searching for active text records in revisions table..." );
+ echo "Searching for active text records in revisions table...";
$res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" );
foreach ( $res as $row ) {
$cur[] = $row->rev_text_id;
}
- echo( "done.\n" );
+ echo "done.\n";
# Get "active" text records from the archive table
- echo( "Searching for active text records in archive table..." );
+ echo "Searching for active text records in archive table...";
$res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" );
$cur = array();
foreach ( $res as $row ) {
$cur[] = $row->ar_text_id;
}
- echo( "done.\n" );
+ echo "done.\n";
# Get the IDs of all text records not in these sets
- echo( "Searching for inactive text records..." );
+ echo "Searching for inactive text records...";
$set = implode( ', ', $cur );
$res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" );
$old = array();
foreach ( $res as $row ) {
$old[] = $row->old_id;
}
- echo( "done.\n" );
+ echo "done.\n";
# Inform the user of what we're going to do
$count = count( $old );
- echo( "$count inactive items found.\n" );
+ echo "$count inactive items found.\n";
# Delete as appropriate
if ( $delete && $count ) {
- echo( "Deleting..." );
+ echo "Deleting...";
$set = implode( ', ', $old );
$dbw->query( "DELETE FROM $tbl_txt WHERE old_id IN ( $set )" );
- echo( "done.\n" );
+ echo "done.\n";
}
# Done
die( "Unable to start the Selenium Server - " .
"terminating RunSeleniumTests\n" );
case 'running':
- echo ( "Warning: The Selenium Server is " .
- "already running\n" );
+ echo "Warning: The Selenium Server is " .
+ "already running\n";
break;
}
protected function stopServer() {
if ( !isset( $this->serverManager ) ) {
- echo ( "Warning: Request to stop Selenium Server, but it was " .
+ echo "Warning: Request to stop Selenium Server, but it was " .
"not stared by RunSeleniumTests\n" .
"RunSeleniumTests cannot stop a Selenium Server it " .
- "did not start\n" );
+ "did not start\n";
} else {
switch ( $this->serverManager->stop() ) {
case 'stopped':
break;
case 'failed':
- echo ( "unable to stop the Selenium Server\n" );
+ echo "unable to stop the Selenium Server\n";
}
}
return;
# Print out software version to assist with locating regressions
$version = SpecialVersion::getVersion();
-echo( "This is MediaWiki version {$version}.\n\n" );
+echo "This is MediaWiki version {$version}.\n\n";
if ( isset( $options['fuzz'] ) ) {
$tester->fuzzTest( $files );
}
}
wfRestoreWarnings();
- echo ( "Starting Selenium server timed out.\n" );
+ echo "Starting Selenium server timed out.\n";
return 'failed';
} else {
// server already running.