static function autoload( $className ) {
global $wgAutoloadClasses, $wgAutoloadLocalClasses;
- // Workaround for PHP bug <https://bugs.php.net/bug.php?id=49143> (5.3.2. is broken, it's fixed in 5.3.6).
- // Strip leading backslashes from class names. When namespaces are used, leading backslashes are used to indicate
- // the top-level namespace, e.g. \foo\Bar. When used like this in the code, the leading backslash isn't passed to
- // the auto-loader ($className would be 'foo\Bar'). However, if a class is accessed using a string instead of a
- // class literal (e.g. $class = '\foo\Bar'; new $class()), then some versions of PHP do not strip the leading
- // backlash in this case, causing autoloading to fail.
+ // Workaround for PHP bug <https://bugs.php.net/bug.php?id=49143> (5.3.2. is broken, it's
+ // fixed in 5.3.6). Strip leading backslashes from class names. When namespaces are used,
+ // leading backslashes are used to indicate the top-level namespace, e.g. \foo\Bar. When
+ // used like this in the code, the leading backslash isn't passed to the auto-loader
+ // ($className would be 'foo\Bar'). However, if a class is accessed using a string instead
+ // of a class literal (e.g. $class = '\foo\Bar'; new $class()), then some versions of PHP
+ // do not strip the leading backlash in this case, causing autoloading to fail.
$className = ltrim( $className, '\\' );
if ( isset( $wgAutoloadLocalClasses[$className] ) ) {
return false;
} elseif ( $cond[0] == '^' ) { // XOR (exactly one cond passes)
if ( count( $cond ) > 3 ) {
- wfWarn( 'recCheckCondition() given XOR ("^") condition on three or more conditions. Check your $wgAutopromote and $wgAutopromoteOnce settings.' );
+ wfWarn( 'recCheckCondition() given XOR ("^") condition on three or more conditions.' .
+ ' Check your $wgAutopromote and $wgAutopromoteOnce settings.' );
}
return self::recCheckCondition( $cond[1], $user )
xor self::recCheckCondition( $cond[2], $user );
unset( $reqArray["from"] );
unset( $reqArray["to"] );
- $viewer = new $this->mCategoryViewerClass( $this->getContext()->getTitle(), $this->getContext(), $from, $until, $reqArray );
+ $viewer = new $this->mCategoryViewerClass(
+ $this->getContext()->getTitle(),
+ $this->getContext(),
+ $from,
+ $until,
+ $reqArray
+ );
$this->getContext()->getOutput()->addHTML( $viewer->getHTML() );
}
}
$tags = array_filter( $tags ); // Make sure we're submitting all tags...
if ( !$rc_id && !$rev_id && !$log_id ) {
- throw new MWException( "At least one of: RCID, revision ID, and log ID MUST be specified when adding a tag to a change!" );
+ throw new MWException( 'At least one of: RCID, revision ID, and log ID MUST be ' .
+ 'specified when adding a tag to a change!' );
}
$dbr = wfGetDB( DB_SLAVE );
FeedUtils::formatDiff( $obj ),
$url,
$obj->rc_timestamp,
- ( $obj->rc_deleted & Revision::DELETED_USER ) ? wfMessage( 'rev-deleted-user' )->escaped() : $obj->rc_user_text,
+ ( $obj->rc_deleted & Revision::DELETED_USER )
+ ? wfMessage( 'rev-deleted-user' )->escaped() : $obj->rc_user_text,
$talkpage
);
$feed->outItem( $item );
* http://publicsuffix.org/
*
* @todo fixme fails to detect 3-letter top-level domains
- * @todo fixme fails to detect 2-letter top-level domains for single-domain use (probably not a big problem in practice, but there are test cases)
+ * @todo fixme fails to detect 2-letter top-level domains for single-domain use (probably
+ * not a big problem in practice, but there are test cases)
*
* @param string $domain the domain to validate
* @param string $originDomain (optional) the domain the cookie originates from
/**
* @deprecated since 1.22, please use $wgHTCPRouting instead.
*
- * Whenever this is set and $wgHTCPRouting evaluates to false, $wgHTCPRouting
+ * Whenever this is set and $wgHTCPRouting evaluates to false, $wgHTCPRouting
* will be set to this value.
* This is merely for back compatibility.
*
// message with content equivalent to default (allow empty pages
// in this case to disable messages, see bug 50124)
$defaultMessageText = $this->mTitle->getDefaultMessageText();
- if( $this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false ) {
+ if ( $this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false ) {
$defaultText = $defaultMessageText;
} else {
$defaultText = '';
}
/**
- * Determine whether the client at a given source IP is likely to be able to
- * access the wiki via HTTPS.
+ * Determine whether the client at a given source IP is likely to be able to
+ * access the wiki via HTTPS.
*
* @param string $ip The IPv4/6 address in the normal human-readable form
* @return boolean
if ( !isset( $options['timeout'] ) ) {
$options['timeout'] = 'default';
}
- if( !isset( $options['connectTimeout'] ) ) {
+ if ( !isset( $options['connectTimeout'] ) ) {
$options['connectTimeout'] = 'default';
}
' extensions - Returns extensions installed on the wiki',
' fileextensions - Returns list of file extensions allowed to be uploaded',
' rightsinfo - Returns wiki rights (license) information if available',
- " languages - Returns a list of languages MediaWiki supports".
+ " languages - Returns a list of languages MediaWiki supports" .
"(optionally localised by using {$p}inlanguagecode)",
' skins - Returns a list of all enabled skins',
' extensiontags - Returns a list of parser extension tags',
}
// Normalise title-case input (with some inlining)
- $lckey = strtr( $key, ' ', '_');
+ $lckey = strtr( $key, ' ', '_' );
if ( ord( $key ) < 128 ) {
$lckey[0] = strtolower( $lckey[0] );
$uckey = ucfirst( $lckey );
}
// Post-processing if the message exists
- if( $message !== false ) {
+ if ( $message !== false ) {
// Fix whitespace
$message = str_replace(
array(
continue;
}
- if( isset( $conf['host'] ) && isset( $conf['port'] ) ) {
+ if ( isset( $conf['host'] ) && isset( $conf['port'] ) ) {
// Normalize single entries
$conf = array( $conf );
}
- foreach( $conf as $subconf ) {
+ foreach ( $conf as $subconf ) {
if ( !isset( $subconf['host'] ) || !isset( $subconf['port'] ) ) {
wfProfileOut( __METHOD__ );
throw new MWException( "Invalid HTCP rule for URL $url\n" );
wfDebugLog( 'squid', __METHOD__ .
"Purging URL $url via HTCP\n" );
- foreach( $conf as $subconf ) {
+ foreach ( $conf as $subconf ) {
socket_sendto( $conn, $htcpPacket, $htcpLen, 0,
$subconf['host'], $subconf['port'] );
}
$this->installErrorHandler();
try {
$this->mConn = $this->mysqlConnect( $realServer );
- } catch (Exception $ex) {
+ } catch ( Exception $ex ) {
wfProfileOut( "dbconnect-$server" );
wfProfileOut( __METHOD__ );
throw $ex;
wfSuppressWarnings();
if ( $this->mFlags & DBO_PERSISTENT ) {
$this->mConn = oci_pconnect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
- } else if ( $this->mFlags & DBO_DEFAULT ) {
+ } elseif ( $this->mFlags & DBO_DEFAULT ) {
$this->mConn = oci_new_connect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
} else {
$this->mConn = oci_connect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
) );
$info = $this->getImageInfo( $data );
- if( $data && $info && isset( $info['thumberror'] ) ) {
+ if ( $data && $info && isset( $info['thumberror'] ) ) {
wfDebug( __METHOD__ . " got remote thumb error " . $info['thumberror'] . "\n" );
return new MediaTransformError(
'thumbnail_error_remote',
const SCALE_FACTOR = 1.5;
protected function getVPad( $boxHeight, $thumbHeight ) {
- return ( $this->getThumbPadding() + $boxHeight - $thumbHeight/ self::SCALE_FACTOR ) / 2;
+ return ( $this->getThumbPadding() + $boxHeight - $thumbHeight / self::SCALE_FACTOR ) / 2;
}
protected function getThumbPadding() {
'';
- $galleryText = $textlink . $text . $fileSize;
+ $galleryText = $textlink . $text . $fileSize;
$galleryText = $this->wrapGalleryText( $galleryText, $thumb );
# Weird double wrapping (the extra div inside the li) needed due to FF2 bug
*/
protected function envCheckSuhosinMaxValueLength() {
$maxValueLength = ini_get( 'suhosin.get.max_value_length' );
- if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
+ if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
// Only warn if the value is below the sane 1024
$this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
}
* @return bool Whether the connection string is valid.
*/
public static function checkConnectStringFormat( $connect_string ) {
- $isValid = preg_match( '/^[[:alpha:]][\w\-]*(?:\.[[:alpha:]][\w\-]*){0,2}$/', $connect_string ); // TNS name
+ $isValid = preg_match( '/^[[:alpha:]][\w\-]*(?:\.[[:alpha:]][\w\-]*){0,2}$/', $connect_string ); // TNS name
$isValid |= preg_match( '/^(?:\/\/)?[\w\-\.]+(?::[\d]+)?(?:\/(?:[\w\-\.]+(?::(pooled|dedicated|shared))?)?(?:\/[\w\-\.]+)?)?$/', $connect_string ); // EZConnect
return (bool)$isValid;
}
# Clean up cgroup
cleanup() {
- # First we have to move the current task into a "garbage" group, otherwise
+ # First we have to move the current task into a "garbage" group, otherwise
# the cgroup will not be empty, and attempting to remove it will fail with
# "Device or resource busy"
if [ -w "$MW_CGROUP"/tasks ]; then
updateTaskCount
if [ $NUM_TASKS -gt 1 ]; then
- # Spawn a monitor process which will continue to poll for completion
+ # Spawn a monitor process which will continue to poll for completion
# of all processes in the cgroup after termination of the parent shell
(
while [ $NUM_TASKS -gt 1 ]; do
if ( $this->page && $this->page !== 1 ) {
$query['page'] = $this->page;
}
- if( $this->lang ) {
+ if ( $this->lang ) {
$query['lang'] = $this->lang;
}
if ( $items[5] === false ) {
// decompression failed
- wfDebug( __METHOD__ . ' Error decompressing iTxt chunk - ' . $items[1] . "\n");
+ wfDebug( __METHOD__ . ' Error decompressing iTxt chunk - ' . $items[1] . "\n" );
fseek( $fh, self::$CRC_size, SEEK_CUR );
continue;
}
if ( $content === false ) {
// decompression failed
- wfDebug( __METHOD__ . ' Error decompressing zTXt chunk - ' . $keyword . "\n");
+ wfDebug( __METHOD__ . ' Error decompressing zTXt chunk - ' . $keyword . "\n" );
fseek( $fh, self::$CRC_size, SEEK_CUR );
continue;
}
) . " 2>&1";
$env = array();
- if( $lang !== false ) {
+ if ( $lang !== false ) {
$env['LANG'] = $lang;
}
if ( in_array( $name, array( 'width', 'height' ) ) ) {
// Reject negative heights, widths
return ( $value > 0 );
- } elseif( $name == 'lang' ) {
+ } elseif ( $name == 'lang' ) {
// Validate $code
- if( !Language::isValidBuiltinCode( $value ) ) {
+ if ( !Language::isValidBuiltinCode( $value ) ) {
wfDebug( "Invalid user language code\n" );
return false;
}
*/
function makeParamString( $params ) {
$lang = '';
- if( isset( $params['lang'] ) && $params['lang'] !== 'en' ) {
+ if ( isset( $params['lang'] ) && $params['lang'] !== 'en' ) {
$params['lang'] = mb_strtolower( $params['lang'] );
$lang = "lang{$params['lang']}-";
}
$m = false;
if ( preg_match( '/^lang([a-z]+(?:-[a-z]+)*)-(\d+)px$/', $str, $m ) ) {
return array( 'width' => array_pop( $m ), 'lang' => $m[1] );
- } elseif( preg_match( '/^(\d+)px$/', $str, $m ) ) {
+ } elseif ( preg_match( '/^(\d+)px$/', $str, $m ) ) {
return array( 'width' => $m[1], 'lang' => 'en' );
} else {
return false;
$this->client->setOption( Memcached::OPT_RETRY_TIMEOUT, $params['retry_timeout'] );
}
- if ( isset ( $params['server_failure_limit'] ) ) {
+ if ( isset( $params['server_failure_limit'] ) ) {
$this->client->setOption( Memcached::OPT_SERVER_FAILURE_LIMIT, $params['server_failure_limit'] );
}
// of bold and italics mark-ups.
$numbold = 0;
$numitalics = 0;
- for ( $i = 1; $i < count( $arr ); $i+=2 ) {
+ for ( $i = 1; $i < count( $arr ); $i += 2 ) {
// If there are ever four apostrophes, assume the first is supposed to
// be text, and the remaining three constitute mark-up for bold text.
// (bug 13227: ''''foo'''' turns into ' ''' foo ' ''')
$firstsingleletterword = -1;
$firstmultiletterword = -1;
$firstspace = -1;
- for ( $i = 1; $i < count( $arr ); $i+=2 ) {
+ for ( $i = 1; $i < count( $arr ); $i += 2 ) {
if ( strlen( $arr[$i] ) == 3 ) {
$x1 = substr( $arr[$i - 1], -1 );
$x2 = substr( $arr[$i - 1], -2, 1 );
if ( $magicName ) {
$paramName = $paramMap[$magicName];
- switch( $paramName ) {
+ switch ( $paramName ) {
case 'gallery-internal-alt':
$alt = $this->stripAltText( $match, false );
break;
foreach ( $comments as $j => $com ) {
$startPos = $com[0];
$endPos = $com[1] + 1;
- if ( $j == ( count( $comments ) - 1) ) {
+ if ( $j == ( count( $comments ) - 1 ) ) {
break;
}
- $inner = substr( $text, $startPos, $endPos - $startPos);
+ $inner = substr( $text, $startPos, $endPos - $startPos );
$accum .= '<comment>' . htmlspecialchars( $inner ) . '</comment>';
}
foreach ( $comments as $j => $com ) {
$startPos = $com[0];
$endPos = $com[1] + 1;
- if ( $j == ( count( $comments ) - 1) ) {
+ if ( $j == ( count( $comments ) - 1 ) ) {
break;
}
- $inner = substr( $text, $startPos, $endPos - $startPos);
+ $inner = substr( $text, $startPos, $endPos - $startPos );
$accum->addNodeWithText( 'comment', $inner );
}
if ( $nt ) {
$this->id = $id;
// is_string() check is back-compat for ApprovedRevs
- if( is_string( $c ) ) {
+ if ( is_string( $c ) ) {
$this->content = new TextContent( $c );
} else {
$this->content = $c ?: false;
$newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
if ( !$newSubpage ) {
$oldLink = Linker::linkKnown( $oldSubpage );
- $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink )
+ $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink )
->params( Title::makeName( $newNs, $newPageName ) )->escaped();
continue;
}
if ( !$this->minTimestamp || !$this->maxTimestamp ) {
try {
list( $this->minTimestamp, $this->maxTimestamp ) = $this->getMinAndMaxForCat( $this->category );
- } catch( MWException $e ) {
+ } catch ( MWException $e ) {
// Possibly no entries in category.
return false;
}
}
// Decide if we default stickHTTPS on
- if ( $wgSecureLoginDefaultHTTPS
- && $this->mAction != 'submitlogin'
+ if ( $wgSecureLoginDefaultHTTPS
+ && $this->mAction != 'submitlogin'
&& !$this->mLoginattempt
&& wfCanIPUseHTTPS( $this->getRequest()->getIP() ) )
- {
+ {
$this->mStickHTTPS = true;
}
$res = $this->verifyPartialFile();
$this->mDesiredDestName = $oldDesiredDestName;
$this->mTitle = false;
- if( is_array( $res ) ) {
+ if ( is_array( $res ) ) {
throw new UploadChunkVerificationException( $res[0] );
}
}
<generation date="$Date: 2013-01-03 07:17:41 +0530 (Thu, 03 Jan 2013) $"/>
<plurals>
<!-- if locale is known to have no plurals, there are no rules -->
- <pluralRules locales="az bm bo dz fa id ig ii hu ja jv ka kde kea km kn ko lo ms my sah ses sg th to tr vi wo yo zh"/>
+ <pluralRules locales="az bm bo dz fa id ig ii hu ja jv ka kde kea km kn ko lo ms my sah ses sg th to tr vi wo yo zh"/>
<pluralRules locales="ar">
<pluralRule count="zero">n is 0</pluralRule>
<pluralRule count="one">n is 1</pluralRule>
$revLength = strlen( $text );
if ( $wgContentHandlerUseDB ) {
- $row = $this->db->selectRow( 'revision', array( 'rev_len', 'rev_content_model' ), array( 'rev_id' => $revID ), __METHOD__ );
+ $row = $this->db->selectRow(
+ 'revision',
+ array( 'rev_len', 'rev_content_model' ),
+ array( 'rev_id' => $revID ),
+ __METHOD__
+ );
if ( $row ) {
// only check the length for the wikitext content handler,
// it's a wasted (and failed) check otherwise
}
}
$maxUserId = $row->user_id;
- } while( $res->numRows() );
+ } while ( $res->numRows() );
}
}
* @author Aaron Schulz
*/
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script to delete archived (non-current) files from storage.
}
$maintClass = "EraseArchivedFile";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
$format = strtolower( $this->getOption( 'format', 'PHP' ) );
$validFormat = in_array( $format, self::$outFormats );
- if( ! $validFormat ) {
- $this->error("--format set to an unrecognized format", 0);
+ if ( ! $validFormat ) {
+ $this->error( "--format set to an unrecognized format", 0 );
$error_out = true;
}
- if( $this->getOption( 'regex' ) && $this->getOption( 'iregex' ) ) {
- $this->error("Can only use either --regex or --iregex");
+ if ( $this->getOption( 'regex' ) && $this->getOption( 'iregex' ) ) {
+ $this->error( "Can only use either --regex or --iregex" );
$error_out = true;
}
parent::validateParamsAndArgs();
- if( $error_out ) {
+ if ( $error_out ) {
# Force help and quit
$this->maybeHelp( true );
}
parent::finalSetup();
$this->regex = $this->getOption( 'regex' ) ? : $this->getOption( 'iregex' );
- if( $this->regex ) {
+ if ( $this->regex ) {
$this->regex = '/' . $this->regex . '/';
if ( $this->hasOption( 'iregex' ) ) {
$this->regex .= 'i'; # case insensitive regex
}
}
- if( $this->hasOption( 'settings' ) ) {
+ if ( $this->hasOption( 'settings' ) ) {
$this->settings_list = explode( ' ', $this->getOption( 'settings' ) );
# Values validation
foreach ( $this->settings_list as $name ) {
$res = array();
# Sane default: dump any wg / wmg variable
- if( ! $this->regex && ! $this->getOption( 'settings' ) ) {
+ if ( ! $this->regex && ! $this->getOption( 'settings' ) ) {
$this->regex = '/^wm?g/';
}
# Filter out globals based on the regex
if ( $this->regex ) {
$res = array();
- foreach( $GLOBALS as $name => $value ) {
+ foreach ( $GLOBALS as $name => $value ) {
if ( preg_match( $this->regex, $name ) ) {
$res[$name] = $value;
}
# Explicitly dumps a list of provided global names
if ( $this->settings_list ) {
- foreach( $this->settings_list as $name ) {
+ foreach ( $this->settings_list as $name ) {
$res[$name] = $GLOBALS[$name];
}
}
throw new MWException( "Failed to serialize the requested settings." );
}
- if( $out ) {
+ if ( $out ) {
$this->output( $out . "\n" );
}
}
# Strip comments, discard empty lines, and trim leading and trailing
# whitespace. Comments start with '#' and extend to the end of the line.
- foreach( $lines as $line ) {
+ foreach ( $lines as $line ) {
$line = trim( preg_replace( '/#.*/', '', $line ) );
if ( $line !== '' ) {
$mmfl['setupFiles'][] = $line;
$this->input = '';
$inputs = explode( ',', $this->getOption( 'file', '' ) );
- foreach( $inputs as $input ) {
+ foreach ( $inputs as $input ) {
# Doxygen inputs are space separted and double quoted
$this->input .= " \"$IP/$input\"";
}
$m = array();
if ( preg_match( '!^(\d+)(k|m|g|)$!i', ini_get( 'memory_limit' ), $m ) ) {
list( , $num, $unit ) = $m;
- $conv = array( 'g' => 1024*1024*1024, 'm' => 1024*1024, 'k' => 1024, '' => 1 );
+ $conv = array( 'g' => 1024 * 1024 * 1024, 'm' => 1024 * 1024, 'k' => 1024, '' => 1 );
$maxBytes = $num * $conv[strtolower( $unit )];
} else {
$maxBytes = 0;
}
}
$usedBytes = memory_get_usage();
- if ( $maxBytes && $usedBytes >= .95*$maxBytes ) {
+ if ( $maxBytes && $usedBytes >= 0.95 * $maxBytes ) {
throw new MWException( "Detected excessive memory usage ($usedBytes/$maxBytes)." );
}
}
-- Start and end of an address range, in hexadecimal
-- Size chosen to allow IPv6
-- FIXME: these fields were originally blank for single-IP blocks,
- -- but now they are populated. No migration was ever done. They
+ -- but now they are populated. No migration was ever done. They
-- should be fixed to be blank again for such blocks (bug 49504).
ipb_range_start tinyblob NOT NULL,
ipb_range_end tinyblob NOT NULL,
<?php } ?><?php if ( $this->data['newtalk'] ) { ?>
<div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
<?php } ?>
- <div id="jump-to-nav" class="mw-jump"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a><?php $this->msg( 'comma-separator' ) ?><a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div>
+ <div id="jump-to-nav" class="mw-jump"><?php $this->msg( 'jumpto' ) ?> <a href="#column-one"><?php $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' ) ?><a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a></div>
<!-- start content -->
<?php $this->html( 'bodytext' ) ?>
#sitetitle, #sitesub, #toplinks, #linkcollection {
- margin-top: 0;
- margin-bottom: 0;
+ margin-top: 0;
+ margin-bottom: 0;
}
#sitetitle, #toplinks {
}
#sitetitle a, #toplinks a {
color: white;
- text-decoration: none;
+ text-decoration: none;
}
/* Bring #sitetitle to top. Otherwise #toplinks is overlaid over it, making the link unclickable. */
#sitetitle a {
.find( '.mw-help-field-data' )
.slideToggle( 'fast' );
} );
-
+
// Show/hide code for DB-specific options
// FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
$( '.dbRadio' ).each( function () {
$wrapper.show( 'slow' );
}
} );
-
+
// Scroll to the bottom of upgrade log
$( '#config-live-log' ).children( 'textarea' ).each( function () {
this.scrollTop = this.scrollHeight;
} );
-
+
// Show/hide Creative Commons thingy
$( '.licenseRadio' ).click( function () {
var $wrapper = $( '#config-cc-wrapper' );
$wrapper.hide( 'slow' );
}
} );
-
+
// Show/hide random stuff (email, upload)
$( '.showHideRadio' ).click( function () {
var $wrapper = $( '#' + $(this).attr( 'rel' ) );
$textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
}
} );
-
+
// Synchronize radio button label for sitename with textbox
$label = $( 'label[for=config__NamespaceType_site-name]' );
labelText = $label.text();
var box = document.getElementById( opts.tableId );
if( !box )
return false;
-
+
var boxbody = box.getElementsByTagName('tbody')[0];
var row = document.createElement( 'tr' );
boxbody.insertBefore( row, boxbody.firstChild.nextSibling );
check.checked = !this.areAllTypesMatching();
this.enableUnchainedInputs( check.checked );
}
-
+
$( '#mwProtect-reason' ).byteLimit( 180 );
this.updateCascadeCheckbox();
'iw_wikiid' => '',
'iw_local' => 1 ),
);
- if( array_key_exists( $prefix, $testInterwikis ) ) {
+ if ( array_key_exists( $prefix, $testInterwikis ) ) {
$iwData = $testInterwikis[$prefix];
}
}
}
- protected function handleArguments(array $argv) {
+ protected function handleArguments( array $argv ) {
parent::handleArguments( $argv );
if ( !isset( $this->arguments['listeners'] ) ) {
$this->arguments['listeners'] = array();
}
- foreach ($this->options[0] as $option) {
- switch ($option[0]) {
+ foreach ( $this->options[0] as $option ) {
+ switch ( $option[0] ) {
case '--debug-tests':
$this->arguments['listeners'][] = new MediaWikiPHPUnitTestListener( 'PHPUnitCommand' );
break;
public function endTest( PHPUnit_Framework_Test $test, $time ) {
wfDebugLog( $this->logChannel, 'End test ' . $this->getTestName( $test ) );
}
-}
\ No newline at end of file
+}
"",
"expected registered MediaWiki: page being created even if empty"
)->doDeleteArticleReal( 'EditPageTest_testCreatePage' );
-
+
$this->assertEdit(
'MediaWiki:Ipb-default-expiry',
null,
/** array( shorthand, expected integer ) */
public static function provideShorthand() {
return array(
- # Null, empty ...
+ # Null, empty ...
array( '', -1 ),
array( ' ', -1 ),
array( null, -1 ),
*/
function testTimestampParameter() {
$now = wfTimestamp( TS_UNIX );
- // We check that wfTimestamp doesn't return false (error) and use a LessThan assert
+ // We check that wfTimestamp doesn't return false (error) and use a LessThan assert
// for the cases where the test is run in a second boundary.
$zero = wfTimestamp( TS_UNIX, 0 );
*/
class MWHttpRequestTester extends MWHttpRequest {
- // function derived from the MWHttpRequest factory function but
+ // function derived from the MWHttpRequest factory function but
// returns appropriate tester class here
public static function factory( $url, $options = null ) {
if ( !Http::$httpEngine ) {
*/
public static function provideToUnsigned() {
return array(
- array ( 1, '0.0.0.1' ),
- array ( 16909060, '1.2.3.4' ),
- array ( 2130706433, '127.0.0.1' ),
- array ( '2147483648', '128.0.0.0' ),
- array ( '3735931646', '222.173.202.254' ),
- array ( pow( 2, 32 ) - 1, '255.255.255.255' ),
- array ( false, 'IN.VA.LI.D' ),
- array ( 1, '::1' ),
- array ( '42540766452641154071740215577757643572', '2001:0db8:85a3:0000:0000:8a2e:0370:7334' ),
- array ( '42540766452641154071740215577757643572', '2001:db8:85a3::8a2e:0370:7334' ),
- array ( false, 'IN:VA::LI:D' ),
- array ( false, ':::1' )
+ array( 1, '0.0.0.1' ),
+ array( 16909060, '1.2.3.4' ),
+ array( 2130706433, '127.0.0.1' ),
+ array( '2147483648', '128.0.0.0' ),
+ array( '3735931646', '222.173.202.254' ),
+ array( pow( 2, 32 ) - 1, '255.255.255.255' ),
+ array( false, 'IN.VA.LI.D' ),
+ array( 1, '::1' ),
+ array( '42540766452641154071740215577757643572', '2001:0db8:85a3:0000:0000:8a2e:0370:7334' ),
+ array( '42540766452641154071740215577757643572', '2001:db8:85a3::8a2e:0370:7334' ),
+ array( false, 'IN:VA::LI:D' ),
+ array( false, ':::1' )
);
}
*/
public static function provideToHex() {
return array(
- array ( '00000001', '0.0.0.1' ),
- array ( '01020304', '1.2.3.4' ),
- array ( '7F000001', '127.0.0.1' ),
- array ( '80000000', '128.0.0.0' ),
- array ( 'DEADCAFE', '222.173.202.254' ),
- array ( 'FFFFFFFF', '255.255.255.255' ),
- array ( false, 'IN.VA.LI.D' ),
- array ( 'v6-00000000000000000000000000000001', '::1' ),
- array ( 'v6-20010DB885A3000000008A2E03707334', '2001:0db8:85a3:0000:0000:8a2e:0370:7334' ),
- array ( 'v6-20010DB885A3000000008A2E03707334', '2001:db8:85a3::8a2e:0370:7334' ),
- array ( false, 'IN:VA::LI:D' ),
- array ( false, ':::1' )
+ array( '00000001', '0.0.0.1' ),
+ array( '01020304', '1.2.3.4' ),
+ array( '7F000001', '127.0.0.1' ),
+ array( '80000000', '128.0.0.0' ),
+ array( 'DEADCAFE', '222.173.202.254' ),
+ array( 'FFFFFFFF', '255.255.255.255' ),
+ array( false, 'IN.VA.LI.D' ),
+ array( 'v6-00000000000000000000000000000001', '::1' ),
+ array( 'v6-20010DB885A3000000008A2E03707334', '2001:0db8:85a3:0000:0000:8a2e:0370:7334' ),
+ array( 'v6-20010DB885A3000000008A2E03707334', '2001:db8:85a3::8a2e:0370:7334' ),
+ array( false, 'IN:VA::LI:D' ),
+ array( false, ':::1' )
);
}
$this->assertFalse( $testXML->wellFormed );
}
-}
\ No newline at end of file
+}
$this->assertEquals( 'Success', $re['edit']['result'] );
// Check the page text is correct
$text = WikiPage::factory( Title::newFromText( $name ) )->getContent( Revision::RAW )->getNativeData();
- $this->assertEquals( $text, "== header ==\n\ntest");
+ $this->assertEquals( $text, "== header ==\n\ntest" );
// Now on one that does
$this->assertTrue( Title::newFromText( $name )->exists() );
$this->assertEquals( 'Success', $re2['edit']['result'] );
$text = WikiPage::factory( Title::newFromText( $name ) )->getContent( Revision::RAW )->getNativeData();
- $this->assertEquals( $text, "== header ==\n\ntest\n\n== header ==\n\ntest");
+ $this->assertEquals( $text, "== header ==\n\ntest\n\n== header ==\n\ntest" );
}
function testUndo() {
}
if ( isset( $rights['protect'] ) ) {
- $this->assertArrayHasKey( 'protecttoken', $tokens );
+ $this->assertArrayHasKey( 'protecttoken', $tokens );
}
return $tokens;
}
protected function doLogin( $user = 'sysop' ) {
- if( !array_key_exists( $user, self::$users ) ){
+ if ( !array_key_exists( $user, self::$users ) ) {
throw new MWException( "Can not log in to undefined user $user" );
}
'type' => 'edit|delete|protect|move|block|unblock|watch'
), $session, false, $user->user );
- if( !array_key_exists( 'tokens', $data[0] ) ){
+ if ( !array_key_exists( 'tokens', $data[0] ) ) {
throw new MWException( 'Api failed to return a token list' );
}
$this->deleteFileByFileName( $fileName );
$this->deleteFileByContent( $filePath );
- // Base upload params:
+ // Base upload params:
$params = array(
'action' => 'upload',
'stash' => 1,
// Upload chunks
$chunkSessionKey = false;
$resultOffset = 0;
- // Open the file:
+ // Open the file:
$handle = @fopen( $filePath, "r" );
if ( $handle === false ) {
$this->markTestIncomplete( "could not open file: $filePath" );
} catch ( UsageException $e ) {
$this->markTestIncomplete( $e->getMessage() );
}
- // Make sure we got a valid chunk continue:
+ // Make sure we got a valid chunk continue:
$this->assertTrue( isset( $result['upload'] ) );
$this->assertTrue( isset( $result['upload']['filekey'] ) );
- // If we don't get a session key mark test incomplete.
+ // If we don't get a session key mark test incomplete.
if ( !isset( $result['upload']['filekey'] ) ) {
$this->markTestIncomplete( "no filekey provided" );
}
} catch ( UsageException $e ) {
$this->markTestIncomplete( $e->getMessage() );
}
- // Make sure we got a valid chunk continue:
+ // Make sure we got a valid chunk continue:
$this->assertTrue( isset( $result['upload'] ) );
$this->assertTrue( isset( $result['upload']['filekey'] ) );
- // Check if we were on the last chunk:
+ // Check if we were on the last chunk:
if ( $params['offset'] + $chunkSize >= $fileSize ) {
$this->assertEquals( 'Success', $result['upload']['result'] );
break;
// clean up
$this->deleteFileByFilename( $fileName );
- // don't remove downloaded temporary file for fast subquent tests.
+ // don't remove downloaded temporary file for fast subquent tests.
//unlink( $filePath );
}
}
<?php
-/*
+/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/** Include non core files as set in $wgParserTestFiles */
const NO_CORE = 2;
/** Include anything set via $wgParserTestFiles */
- const WITH_ALL = 3; # CORE_ONLY | NO_CORE
+ const WITH_ALL = 3; # CORE_ONLY | NO_CORE
/** @} */
* @return PHPUnit_Framework_TestSuite
*/
public static function suite( $flags = self::CORE_ONLY ) {
- if( is_string( $flags ) ) {
+ if ( is_string( $flags ) ) {
$flags = self::CORE_ONLY;
}
global $wgParserTestFiles, $IP;
- $mwTestDir = $IP.'/tests/';
+ $mwTestDir = $IP . '/tests/';
# Human friendly helpers
- $wantsCore = ($flags & self::CORE_ONLY);
- $wantsRest = ($flags & self::NO_CORE);
+ $wantsCore = ( $flags & self::CORE_ONLY );
+ $wantsRest = ( $flags & self::NO_CORE );
# Will hold the .txt parser test files we will include
$filesToTest = array();
# Filter out .txt files
- foreach( $wgParserTestFiles as $parserTestFile ) {
+ foreach ( $wgParserTestFiles as $parserTestFile ) {
$isCore = ( 0 === strpos( $parserTestFile, $mwTestDir ) );
- if( $isCore && $wantsCore ) {
+ if ( $isCore && $wantsCore ) {
self::debug( "included core parser tests: $parserTestFile" );
$filesToTest[] = $parserTestFile;
- } elseif( !$isCore && $wantsRest ) {
+ } elseif ( !$isCore && $wantsRest ) {
self::debug( "included non core parser tests: $parserTestFile" );
$filesToTest[] = $parserTestFile;
} else {
}
}
self::debug( 'parser tests files: '
- . implode(' ', $filesToTest) );
+ . implode( ' ', $filesToTest ) );
$suite = new PHPUnit_Framework_TestSuite;
foreach ( $filesToTest as $fileName ) {
$maintClass = 'PHPUnitMaintClass';
require RUN_MAINTENANCE_IF_MAIN;
-if ( !class_exists( 'PHPUnit_Runner_Version') ) {
+if ( !class_exists( 'PHPUnit_Runner_Version' ) ) {
require_once 'PHPUnit/Runner/Version.php';
}