if( $n > 0 &&
$obj->rc_type == RC_EDIT &&
$obj->rc_namespace >= 0 &&
- $obj->rc_cur_id == $sorted[$n-1]->rc_cur_id &&
- $obj->rc_user_text == $sorted[$n-1]->rc_user_text ) {
- $sorted[$n-1]->rc_last_oldid = $obj->rc_last_oldid;
+ $obj->rc_cur_id == $sorted[$n - 1]->rc_cur_id &&
+ $obj->rc_user_text == $sorted[$n - 1]->rc_user_text ) {
+ $sorted[$n - 1]->rc_last_oldid = $obj->rc_last_oldid;
} else {
$sorted[$n] = $obj;
$n++;
'user_text' => $rc->mAttribs['rc_user_text'],
'deleted' => $rc->mAttribs['rc_deleted']
) );
- $s .= ' '.Linker::generateRollback( $rev, $this->getContext() );
+ $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
}
}
}
if( $chardiff == '' ) {
$r .= ' ';
} else {
- $r .= ' ' . $chardiff. ' <span class="mw-changeslist-separator">. .</span> ';
+ $r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
}
}
}
// If all else fails...
- throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" );
+ throw new MWException( __METHOD__ . ": unknown collation type \"$collationName\"" );
}
}
*/
function getIndent( $pos, $key = false, $arrowPos = false ) {
$arrowIndent = ' ';
- if ( $pos == 0 || $this->text[$pos-1] == "\n" ) {
+ if ( $pos == 0 || $this->text[$pos - 1] == "\n" ) {
$indentLength = strspn( $this->text, " \t", $pos );
$indent = substr( $this->text, $pos, $indentLength );
} else {
$lines = StringUtils::explode( "\n", $text );
foreach ( $lines as $lineNum => $line ) {
if ( $lineNum == $this->lineNum - 1 ) {
- return "$line\n" .str_repeat( ' ', $this->colNum - 1 ) . "^\n";
+ return "$line\n" . str_repeat( ' ', $this->colNum - 1 ) . "^\n";
}
}
return '';
/**
* Unicode and normalisation related
*/
-require_once __DIR__.'/normal/UtfNormalDefines.php';
+require_once __DIR__ . '/normal/UtfNormalDefines.php';
/**@{
* Hook support constants
$content = htmlspecialchars( $this->content );
}
- return "<!DOCTYPE html>\n".
+ return "<!DOCTYPE html>\n" .
"<html><head><title>$header</title></head>\n" .
"<body><h1>$header</h1><p>$content</p></body></html>\n";
}
}
if( $oldid ) {
- wfProfileIn( __METHOD__."-dodiff" );
+ wfProfileIn( __METHOD__ . "-dodiff" );
#$diffText = $de->getDiff( wfMessage( 'revisionasof',
# $wgLang->timeanddate( $timestamp ),
$diffText = UtfNormal::cleanUp( $diffText );
$diffText = self::applyDiffStyle( $diffText );
}
- wfProfileOut( __METHOD__."-dodiff" );
+ wfProfileOut( __METHOD__ . "-dodiff" );
} else {
$rev = Revision::newFromId( $newid );
if( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
* @throws MWException if $data not long enough, or if unpack fails
* @return array Associative array of the extracted data
*/
-function wfUnpack( $format, $data, $length=false ) {
+function wfUnpack( $format, $data, $length = false ) {
if ( $length !== false ) {
$realLen = strlen( $data );
if ( $realLen < $length ) {
global $wgStylePath;
if ( $useStylePath ) {
- $icon = $wgStylePath.'/common/images/'.$icon;
+ $icon = $wgStylePath . '/common/images/' . $icon;
}
$s = Html::openElement( 'div', array( 'class' => "mw-infobox $class" ) );
- $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
+ $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ) .
Html::element( 'img',
array(
'src' => $icon,
'alt' => $alt,
)
- ).
+ ) .
Html::closeElement( 'div' );
- $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ).
- $text.
+ $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ) .
+ $text .
Html::closeElement( 'div' );
$s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $img->getLastError() ) . '</div>';
} else {
- $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2;
+ $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) / 2;
$imageParameters = array(
'desc-link' => true,
$lookup[$this->reader->nodeType],
$this->reader->name,
$this->reader->value
- )."\n\n" );
+ ) . "\n\n" );
}
/**
$this->reader->read();
if ( $this->reader->name != 'mediawiki' ) {
- throw new MWException( "Expected <mediawiki> tag, got ".
+ throw new MWException( "Expected <mediawiki> tag, got " .
$this->reader->name );
}
$this->debug( "<mediawiki> tag is correct." );
}
$mime = substr( $s, 0, $i );
- $ext = trim( substr( $s, $i+1 ) );
+ $ext = trim( substr( $s, $i + 1 ) );
if ( empty( $ext ) ) {
continue;
$doctype = strpos( $head, "\x42\x82" );
if ( $doctype ) {
// Next byte is datasize, then data (sizes larger than 1 byte are very stupid muxers)
- $data = substr( $head, $doctype+3, 8 );
+ $data = substr( $head, $doctype + 3, 8 );
if ( strncmp( $data, "matroska", 8 ) == 0 ) {
wfDebug( __METHOD__ . ": recognized file as video/x-matroska\n" );
return "video/x-matroska";
$m = finfo_file( $mime_magic_resource, $file );
finfo_close( $mime_magic_resource );
} else {
- wfDebug( __METHOD__ . ": finfo_open failed on ".FILEINFO_MIME."!\n" );
+ wfDebug( __METHOD__ . ": finfo_open failed on " . FILEINFO_MIME . "!\n" );
}
} elseif ( function_exists( "mime_content_type" ) ) {
SpecialPage::getTitleFor( 'Confirmemail' ),
$context->msg( 'emailconfirmlink' )->escaped()
) . '<br />';
- $emailauthenticationclass="mw-email-not-authenticated";
+ $emailauthenticationclass = "mw-email-not-authenticated";
}
} else {
$disableEmailPrefs = true;
foreach( $this->mRestrictions as $action => $selected ) {
/* Not all languages have V_x <-> N_x relation */
$msg = wfMessage( 'restriction-' . $action );
- $out .= "<tr><td>".
+ $out .= "<tr><td>" .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, $msg->exists() ? $msg->text() : $action ) .
Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) .
}
$pd = $this->getPendingDeltas();
// Piggy-back the async deltas onto those of this stats update....
- $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] );
- $this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] );
+ $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] );
+ $this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] );
$this->articles += ( $pd['ss_good_articles']['+'] - $pd['ss_good_articles']['-'] );
- $this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] );
- $this->users += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] );
- $this->images += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] );
+ $this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] );
+ $this->users += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] );
+ $this->images += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] );
}
// Need a separate transaction because this a global lock
'rc_user != 0',
'rc_bot' => 0,
'rc_log_type != ' . $dbr->addQuotes( 'newusers' ) . ' OR rc_log_type IS NULL',
- 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 ) ),
+ 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays * 24 * 3600 ) ),
),
__METHOD__
);
*
* @param $out OutputPage
*/
- function outputPage( OutputPage $out=null ) {
+ function outputPage( OutputPage $out = null ) {
global $wgContLang;
global $wgScript, $wgStylePath;
global $wgMimeType, $wgJsMimeType;
function makeArticleUrlDetails( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
- $title= $title->getSubjectPage();
+ $title = $title->getSubjectPage();
self::checkTitle( $title, $name );
return array(
'href' => $title->getLocalURL( $urlaction ),
$s = wfMessage( $longContext, "* $s\n" )->plain();
}
} else {
- $s = '* '. implode( "\n* ",
+ $s = '* ' . implode( "\n* ",
$this->getErrorMessageArray( $this->errors ) ) . "\n";
if ( $longContext ) {
$s = wfMessage( $longContext, $s )->plain();
*/
function replace( $subject ) {
if ( function_exists( 'fss_prep_replace' ) ) {
- wfProfileIn( __METHOD__.'-fss' );
+ wfProfileIn( __METHOD__ . '-fss' );
if ( $this->fss === false ) {
$this->fss = fss_prep_replace( $this->data );
}
$result = fss_exec_replace( $this->fss, $subject );
- wfProfileOut( __METHOD__.'-fss' );
+ wfProfileOut( __METHOD__ . '-fss' );
} else {
- wfProfileIn( __METHOD__.'-strtr' );
+ wfProfileIn( __METHOD__ . '-strtr' );
$result = strtr( $subject, $this->data );
- wfProfileOut( __METHOD__.'-strtr' );
+ wfProfileOut( __METHOD__ . '-strtr' );
}
return $result;
}
if ( $ct >= $time ) { // http://php.net/manual/en/language.operators.comparison.php
return $ct; // current timestamp is higher than $time
}
- } while ( ( ( $time[0] - $ct[0] )*1000 + ( $time[1] - $ct[1] ) ) <= 10 );
+ } while ( ( ( $time[0] - $ct[0] ) * 1000 + ( $time[1] - $ct[1] ) ) <= 10 );
return false;
}
$defOpt['variant'] = $wgContLang->getCode();
$defOpt['language'] = $wgContLang->getCode();
foreach( SearchEngine::searchableNamespaces() as $nsnum => $nsname ) {
- $defOpt['searchNs'.$nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] );
+ $defOpt['searchNs' . $nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] );
}
$defOpt['skin'] = $wgDefaultSkin;
}
wfProfileIn( __METHOD__ );
- wfDebug( __METHOD__.": checking...\n" );
+ wfDebug( __METHOD__ . ": checking...\n" );
// Initialize data...
// Otherwise something ends up stomping on $this->mBlockedby when
}
}
if ( !$loaded ) {
- throw new MWException( __METHOD__. ": hit a key conflict attempting " .
+ throw new MWException( __METHOD__ . ": hit a key conflict attempting " .
"to insert a user row, but then it doesn't exist when we select it!" );
}
return Status::newFatal( 'userexists' );
} elseif ( $type == ':B:' ) {
# Salted
list( $salt, $realHash ) = explode( ':', substr( $hash, 3 ), 2 );
- return md5( $salt.'-'.md5( $password ) ) === $realHash;
+ return md5( $salt . '-' . md5( $password ) ) === $realHash;
} else {
# Old-style
return self::oldCrypt( $password, $userId ) === $hash;
* @param string $text link's text; optional, default to "User:$user"
* @return String: HTML link or false if the wiki was not found
*/
- public static function foreignUserLink( $wikiID, $user, $text=null ) {
+ public static function foreignUserLink( $wikiID, $user, $text = null ) {
return self::makeForeignLink( $wikiID, "User:$user", $text );
}
* @param string $text link's text; optional, default to $page
* @return String: HTML link or false if the wiki was not found
*/
- public static function makeForeignLink( $wikiID, $page, $text=null ) {
+ public static function makeForeignLink( $wikiID, $page, $text = null ) {
if ( !$text ) {
$text = $page;
}
public function setCachedLastEditTime( $timestamp ) {
global $wgMemc;
$key = wfMemcKey( 'page-lastedit', md5( $this->mTitle->getPrefixedDBkey() ) );
- $wgMemc->set( $key, wfTimestamp( TS_MW, $timestamp ), 60*15 );
+ $wgMemc->set( $key, wfTimestamp( TS_MW, $timestamp ), 60 * 15 );
}
/**
$encYear = '';
}
$inputAttribs = array( 'id' => 'year', 'maxlength' => 4, 'size' => 7 );
- return self::label( wfMessage( 'year' )->text(), 'year' ) . ' '.
- Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' '.
- self::label( wfMessage( 'month' )->text(), 'month' ) . ' '.
+ return self::label( wfMessage( 'year' )->text(), 'year' ) . ' ' .
+ Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' ' .
+ self::label( wfMessage( 'month' )->text(), 'month' ) . ' ' .
self::monthSelector( $encMonth, -1 );
}
* @param array $attribs other attributes
* @return string HTML
*/
- public static function check( $name, $checked = false, $attribs=array() ) {
+ public static function check( $name, $checked = false, $attribs = array() ) {
return self::element( 'input', array_merge(
array(
'name' => $name,
* @param array $attribs other attributes
* @return string HTML
*/
- public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs = array() ) {
+ public static function inputLabel( $label, $name, $id, $size = false, $value = false, $attribs = array() ) {
list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
return $label . ' ' . $input;
}
* @param array $attribs optional additional HTML attributes
* @return string HTML
*/
- public static function option( $text, $value=null, $selected = false,
+ public static function option( $text, $value = null, $selected = false,
$attribs = array() ) {
if( !is_null( $value ) ) {
$attribs['value'] = $value;
* @param $tabindex Mixed: Value of the tabindex attribute
* @return string
*/
- public static function listDropDown( $name= '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) {
+ public static function listDropDown( $name = '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) {
$optgroup = false;
$options = self::option( $other, 'other', $selected === 'other' );
* namespace, name, and attributes, but not to text contents.
* Filter should return 'true' to toggle on $this->filterMatch
*/
- function __construct( $file, $filterCallback=null ) {
+ function __construct( $file, $filterCallback = null ) {
$this->filterCallback = $filterCallback;
$this->run( $file );
}
|| $this->eocdr['CD entries total'] == 0xffff )
{
$this->error( 'zip-unsupported', 'Central directory header indicates ZIP64, ' .
- 'but we are in legacy mode. Rejecting this upload is necessary to avoid '.
+ 'but we are in legacy mode. Rejecting this upload is necessary to avoid ' .
'opening vulnerabilities on clients using OpenJDK 7 or later.' );
}
wfRunHooks( 'HistoryRevisionTools', array( $rev, &$tools ) );
if ( $tools ) {
- $s2 .= ' '. $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped();
+ $s2 .= ' ' . $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped();
}
# Tags
$name = $titleObj->getPrefixedDBkey();
$model = $contentHandler->getModelID();
- $this->dieUsage( "The requested format $contentFormat is not supported for content model ".
+ $this->dieUsage( "The requested format $contentFormat is not supported for content model " .
" $model used by $name", 'badformat' );
}
' ' . $request->getMethod() .
' ' . wfUrlencode( str_replace( ' ', '_', $this->getUser()->getName() ) ) .
' ' . $request->getIP() .
- ' T=' . $milliseconds .'ms';
+ ' T=' . $milliseconds . 'ms';
foreach ( $this->getParamsUsed() as $name ) {
$value = $request->getVal( $name );
if ( $value === null ) {
if ( !$content->isSupportedFormat( $format ) ) {
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format {$this->contentFormat} is not supported ".
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported " .
"for content model $model used by $name", 'badformat' );
}
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format {$this->contentFormat} is not supported for ".
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported for " .
"content model $model used by $name", 'badformat' );
}
$this->checkCacheDirs(); // build parent dir
if ( !file_put_contents( $this->cachePath(), $text, LOCK_EX ) ) {
- wfDebug( __METHOD__ . "() failed saving ". $this->cachePath() . "\n" );
+ wfDebug( __METHOD__ . "() failed saving " . $this->cachePath() . "\n" );
$this->mCached = null;
return false;
}
*/
protected function __construct( array $options ) {
if ( !extension_loaded( 'redis' ) ) {
- throw new MWException( __CLASS__. ' requires the phpredis extension: ' .
+ throw new MWException( __CLASS__ . ' requires the phpredis extension: ' .
'https://github.com/nicolasff/phpredis' );
}
$this->connectTimeout = $options['connectTimeout'];
// TCP connection
$hostPort = IP::splitHostAndPort( $server );
if ( !$hostPort ) {
- throw new MWException( __CLASS__.": invalid configured server \"$server\"" );
+ throw new MWException( __CLASS__ . ": invalid configured server \"$server\"" );
}
list( $host, $port ) = $hostPort;
if ( $port === false ) {
# Hack: extend the body for error messages
$cache = str_replace( array( '</html>', '</body>' ), '', $cache );
# Add cache notice...
- $cache .= '<div style="color:red;font-size:150%;font-weight:bold;">'.
+ $cache .= '<div style="color:red;font-size:150%;font-weight:bold;">' .
htmlspecialchars( $this->msg( 'dberr-cachederror',
'This is a cached copy of the requested page, and may not be up to date. ' ) ) .
'</div>';
if ( isset( $this->mFieldInfoCache["$table.$field"] ) ) {
return $this->mFieldInfoCache["$table.$field"];
}
- $tableWhere = '= \''.$table.'\'';
+ $tableWhere = '= \'' . $table . '\'';
}
$fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name ' . $tableWhere . ' and column_name = \'' . $field . '\'' );
function hasConstraint( $name ) {
$SQL = "SELECT 1 FROM pg_catalog.pg_constraint c, pg_catalog.pg_namespace n WHERE c.connamespace = n.oid AND conname = '" .
- pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $this->getCoreSchema() ) ."'";
+ pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $this->getCoreSchema() ) . "'";
$res = $this->doQuery( $SQL );
return $this->numRows( $res );
}
}
function indexUnique( $table, $index, $fname = 'DatabasePostgres::indexUnique' ) {
- $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'".
+ $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'" .
" AND indexdef LIKE 'CREATE UNIQUE%(" .
$this->strencode( $this->indexName( $index ) ) .
")'";
FROM pg_class c, pg_attribute a, pg_type t
WHERE relname='$table' AND a.attrelid=c.oid AND
a.atttypid=t.oid and a.attname='$field'";
- $res =$this->query( $sql );
+ $res = $this->query( $sql );
$row = $this->fetchObject( $res );
if ( $row->ftype == 'varchar' ) {
$size = $row->size - 4;
*/
function pg_array_parse( $text, &$output, $limit = false, $offset = 1 ) {
if( false === $limit ) {
- $limit = strlen( $text )-1;
+ $limit = strlen( $text ) - 1;
$output = array();
}
if( '{}' == $text ) {
return $output;
}
} else {
- $offset = $this->pg_array_parse( $text, $output, $limit, $offset+1 );
+ $offset = $this->pg_array_parse( $text, $output, $limit, $offset + 1 );
}
} while ( $limit > $offset );
return $output;
sleep( 1 );
}
}
- wfDebug( __METHOD__." failed to acquire lock\n" );
+ wfDebug( __METHOD__ . " failed to acquire lock\n" );
return false;
}
__METHOD__ );
$id = $dbw->insertId();
if ( !$id ) {
- throw new MWException( __METHOD__.': no insert ID' );
+ throw new MWException( __METHOD__ . ': no insert ID' );
}
if ( $dbw->getFlag( DBO_TRX ) ) {
$dbw->commit( __METHOD__ );
* @param $val mixed Information to cache
*/
final protected function setContainerCache( $container, $val ) {
- $this->memCache->add( $this->containerCacheKey( $container ), $val, 14*86400 );
+ $this->memCache->add( $this->containerCacheKey( $container ), $val, 14 * 86400 );
}
/**
if ( $path === null ) {
return; // invalid storage path
}
- $this->memCache->add( $this->fileCacheKey( $path ), $val, 7*86400 );
+ $this->memCache->add( $this->fileCacheKey( $path ), $val, 7 * 86400 );
}
/**
: false;
$this->swiftCDNExpiry = isset( $config['swiftCDNExpiry'] )
? $config['swiftCDNExpiry']
- : 12*3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org)
+ : 12 * 3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org)
$this->swiftCDNPurgable = isset( $config['swiftCDNPurgable'] )
? $config['swiftCDNPurgable']
: true;
if ( is_array( $creds ) ) { // cache hit
$this->auth->load_cached_credentials(
$creds['auth_token'], $creds['storage_url'], $creds['cdnm_url'] );
- $this->sessionStarted = time() - ceil( $this->authTTL/2 ); // skew for worst case
+ $this->sessionStarted = time() - ceil( $this->authTTL / 2 ); // skew for worst case
} else { // cache miss
try {
$this->auth->authenticate();
$creds = $this->auth->export_credentials();
- $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL/2 ) ); // cache
+ $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL / 2 ) ); // cache
$this->sessionStarted = time();
} catch ( CloudFilesException $e ) {
$this->connException = $e; // don't keep re-trying
if ( isset( $config['lockTTL'] ) ) {
$this->lockTTL = max( 1, $config['lockTTL'] );
} elseif ( PHP_SAPI === 'cli' ) {
- $this->lockTTL = 2*3600;
+ $this->lockTTL = 2 * 3600;
} else {
$met = ini_get( 'max_execution_time' ); // this is 0 in CLI mode
- $this->lockTTL = max( 5*60, 2*(int)$met );
+ $this->lockTTL = max( 5 * 60, 2 * (int)$met );
}
}
foreach ( $paths as $path ) {
$locksKey = $this->recordKeyForPath( $path );
$locksHeld = $lockRecords[$locksKey];
- $ok = $memc->set( $locksKey, $locksHeld, 7*86400 );
+ $ok = $memc->set( $locksKey, $locksHeld, 7 * 86400 );
if ( !$ok ) {
$status->fatal( 'lockmanager-fail-acquirelock', $path );
} else {
$start = microtime( true );
do {
if ( ( ++$rounds % 4 ) == 0 ) {
- usleep( 1000*50 ); // 50 ms
+ usleep( 1000 * 50 ); // 50 ms
}
foreach ( array_diff( $keys, $lockedKeys ) as $key ) {
if ( $memc->add( "$key:mutex", 1, 180 ) ) { // lock record
$yesVotes = 0; // locks made on trustable servers
$votesLeft = count( $this->srvsByBucket[$bucket] ); // remaining peers
- $quorum = floor( $votesLeft/2 + 1 ); // simple majority
+ $quorum = floor( $votesLeft / 2 + 1 ); // simple majority
// Get votes for each peer, in order, until we have enough...
foreach ( $this->srvsByBucket[$bucket] as $lockSrv ) {
if ( !$this->isServerUp( $lockSrv ) ) {
*/
public function resolveVirtualUrl( $url ) {
if ( substr( $url, 0, 9 ) != 'mwrepo://' ) {
- throw new MWException( __METHOD__.': unknown protocol' );
+ throw new MWException( __METHOD__ . ': unknown protocol' );
}
$bits = explode( '/', substr( $url, 9 ), 3 );
if ( count( $bits ) != 3 ) {
- throw new MWException( __METHOD__.": invalid mwrepo URL: $url" );
+ throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" );
}
list( $repo, $zone, $rel ) = $bits;
if ( $repo !== $this->name ) {
- throw new MWException( __METHOD__.": fetching from a foreign repo is not supported" );
+ throw new MWException( __METHOD__ . ": fetching from a foreign repo is not supported" );
}
$base = $this->getZonePath( $zone );
if ( !$base ) {
- throw new MWException( __METHOD__.": invalid zone: $zone" );
+ throw new MWException( __METHOD__ . ": invalid zone: $zone" );
}
return $base . '/' . rawurldecode( $rel );
}
$temp = $this->getVirtualUrl( 'temp' );
if ( substr( $virtualUrl, 0, strlen( $temp ) ) != $temp ) {
- wfDebug( __METHOD__.": Invalid temp virtual URL\n" );
+ wfDebug( __METHOD__ . ": Invalid temp virtual URL\n" );
return false;
}
foreach ( $sourceDestPairs as $pair ) {
list( $srcRel, $archiveRel ) = $pair;
if ( !$this->validateFilename( $srcRel ) ) {
- throw new MWException( __METHOD__.':Validation error in $srcRel' );
+ throw new MWException( __METHOD__ . ':Validation error in $srcRel' );
} elseif ( !$this->validateFilename( $archiveRel ) ) {
- throw new MWException( __METHOD__.':Validation error in $archiveRel' );
+ throw new MWException( __METHOD__ . ':Validation error in $archiveRel' );
}
$publicRoot = $this->getZonePath( 'public' );
} elseif ( isset( $row->oi_name ) ) {
return call_user_func( $this->oldFileFromRowFactory, $row, $this );
} else {
- throw new MWException( __METHOD__.': invalid row' );
+ throw new MWException( __METHOD__ . ': invalid row' );
}
}
return $result;
}
- /**\r
- * Return an array of files where the name starts with $prefix.\r
- *\r
- * @param string $prefix The prefix to search for\r
- * @param int $limit The maximum amount of files to return\r
- * @return array\r
- */\r
+ /**
+ * Return an array of files where the name starts with $prefix.
+ *
+ * @param string $prefix The prefix to search for
+ * @param int $limit The maximum amount of files to return
+ * @return array
+ */
public function findFilesByPrefix( $prefix, $limit ) {
$selectOptions = array( 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) );
- // Query database\r
+ // Query database
$dbr = $this->getSlaveDB();
$res = $dbr->select(
'image',
foreach ( $res as $row ) {
$files[] = $this->newFileFromRow( $row );
}
- return $files;\r
+ return $files;
}
/**
*
* @return array
*/
- function getHistory( $limit = null, $start = null, $end = null, $inc=true ) {
+ function getHistory( $limit = null, $start = null, $end = null, $inc = true ) {
return array();
}
$this->lock(); // begin
- $archiveName = wfTimestamp( TS_MW ) . '!'. $this->getName();
+ $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName();
$archiveRel = 'archive/' . $this->getHashPath() . $archiveName;
$flags = $flags & File::DELETE_SOURCE ? LocalRepo::DELETE_SOURCE : 0;
$status = $this->repo->publish( $srcPath, $dstRel, $archiveRel, $flags, $options );
$type = strtolower( $type );
if ( !isset( $this->dbInstallers[$type] ) ) {
- $class = ucfirst( $type ). 'Installer';
+ $class = ucfirst( $type ) . 'Installer';
$this->dbInstallers[$type] = new $class( $this );
}
$this->getTextBox( '_OracleDefTS', 'config-oracle-def-ts' ) .
$this->getTextBox( '_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox( 'config-db-oracle-help' ) ) .
Html::closeElement( 'fieldset' ) .
- $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ).
- $this->getInstallUserBox().
+ $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ) .
+ $this->getInstallUserBox() .
$this->getWebUserBox();
}
* cascading taken in account in the deleting function
*/
protected function doRecentchangesFK2Cascade() {
- $meta = $this->db->query( 'SELECT 1 FROM all_constraints WHERE owner = \''.strtoupper($this->db->getDBname()).'\' AND constraint_name = \''.$this->db->tablePrefix().'RECENTCHANGES_FK2\' AND delete_rule = \'CASCADE\'' );
+ $meta = $this->db->query( 'SELECT 1 FROM all_constraints WHERE owner = \'' .
+ strtoupper( $this->db->getDBname() ) .
+ '\' AND constraint_name = \'' .
+ $this->db->tablePrefix() .
+ 'RECENTCHANGES_FK2\' AND delete_rule = \'CASCADE\''
+ );
$row = $meta->fetchRow();
if ( $row ) {
return;
protected function doPageRestrictionsPKUKFix() {
$this->output( "Altering PAGE_RESTRICTIONS keys ... " );
- $meta = $this->db->query( 'SELECT column_name FROM all_cons_columns WHERE owner = \''.strtoupper($this->db->getDBname()).'\' AND constraint_name = \'MW_PAGE_RESTRICTIONS_PK\' AND rownum = 1' );
+ $meta = $this->db->query( 'SELECT column_name FROM all_cons_columns WHERE owner = \'' .
+ strtoupper( $this->db->getDBname() ) .
+ '\' AND constraint_name = \'MW_PAGE_RESTRICTIONS_PK\' AND rownum = 1'
+ );
$row = $meta->fetchRow();
if ( $row['column_name'] == 'PR_ID' ) {
$this->output( "seems to be up to date.\n" );
# We can't guarantee that the user will be able to use TRUNCATE,
# but we know that DELETE is available to us
$this->output( "Purging caches..." );
- $this->db->delete( '/*Q*/'.$this->db->tableName( 'objectcache' ), '*', __METHOD__ );
+ $this->db->delete( '/*Q*/' . $this->db->tableName( 'objectcache' ), '*', __METHOD__ );
$this->output( "done.\n" );
}
protected function dropIndex( $table, $index, $patch = '', $fullpath = false ) {
if ( $this->db->indexExists( $table, $index ) ) {
$this->output( "Dropping obsolete index '$index'\n" );
- $this->db->query( "DROP INDEX \"". $index ."\"" );
+ $this->db->query( "DROP INDEX \"" . $index . "\"" );
}
}
$pu = $this->db->indexAttributes( $index );
if ( !empty( $pu ) && $pu != $should_be ) {
$this->output( "Dropping obsolete version of index '$index'\n" );
- $this->db->query( "DROP INDEX \"". $index ."\"" );
+ $this->db->query( "DROP INDEX \"" . $index . "\"" );
$pu = array();
} else {
$this->output( "...no need to drop index '$index'\n" );
*/
public function getInfoBox( $text, $icon = false, $class = false ) {
$text = $this->parse( $text, true );
- $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon;
+ $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/' . $icon;
$alt = wfMessage( 'config-information' )->text();
return Html::infoBox( $text, $icon, $alt, $class, false );
}
$this->parent->request->response()->header( 'X-Frame-Options: DENY' );
}
if ( $this->redirectTarget ) {
- $this->parent->request->response()->header( 'Location: '.$this->redirectTarget );
+ $this->parent->request->response()->header( 'Location: ' . $this->redirectTarget );
return;
}
protected function showKeyForm() {
$this->startForm();
$this->addHTML(
- $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ).
+ $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ) .
'<br />' .
$this->parent->getTextBox( array(
'var' => 'wgUpgradeKey',
// If you change this height, also change it in config.css
$expandJs = str_replace( '$1', '54em', $js );
$reduceJs = str_replace( '$1', '70px', $js );
- return '<p>'.
+ return '<p>' .
Html::element( 'img', array( 'src' => $this->getVar( 'wgRightsIcon' ) ) ) .
'  ' .
htmlspecialchars( $this->getVar( 'wgRightsText' ) ) .
'pendingDBs' => $this->findPendingWikiQueues(),
'timestamp' => time()
);
- for ( $attempts=1; $attempts <= 25; ++$attempts ) {
+ for ( $attempts = 1; $attempts <= 25; ++$attempts ) {
if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
$this->cache->set( $key, $pendingDbInfo );
$this->cache->delete( "$key:lock" ); // unlock
$targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST );
if ( !$targetRev ) {
- wfDebug( __METHOD__.": target redirect already deleted, ignoring\n" );
+ wfDebug( __METHOD__ . ": target redirect already deleted, ignoring\n" );
return true;
}
$content = $targetRev->getContent();
$currentDest = $content ? $content->getRedirectTarget() : null;
if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) {
- wfDebug( __METHOD__.": Redirect has changed since the job was queued\n" );
+ wfDebug( __METHOD__ . ": Redirect has changed since the job was queued\n" );
return true;
}
# Check for a suppression tag (used e.g. in periodically archived discussions)
$mw = MagicWord::get( 'staticredirect' );
if ( $content->matchMagicWord( $mw ) ) {
- wfDebug( __METHOD__.": skipping: suppressed with __STATICREDIRECT__\n" );
+ wfDebug( __METHOD__ . ": skipping: suppressed with __STATICREDIRECT__\n" );
return true;
}
# Find the current final destination
$newTitle = self::getFinalDestination( $this->redirTitle );
if ( !$newTitle ) {
- wfDebug( __METHOD__.": skipping: single redirect, circular redirect or invalid redirect destination\n" );
+ wfDebug( __METHOD__ . ": skipping: single redirect, circular redirect or invalid redirect destination\n" );
return true;
}
if ( $newTitle->equals( $this->redirTitle ) ) {
# The redirect is already right, no need to change it
# This can happen if the page was moved back (say after vandalism)
- wfDebug( __METHOD__.": skipping, already good\n" );
+ wfDebug( __METHOD__ . " : skipping, already good\n" );
}
# Preserve fragment (bug 14904)
# Check if the row count estimate was correct
if ( $titleArray->count() > $this->rowsPerJob * 2 ) {
# Not correct, do accurate partition
- wfDebug( __METHOD__.": row count estimate was incorrect, repartitioning\n" );
+ wfDebug( __METHOD__ . ": row count estimate was incorrect, repartitioning\n" );
$this->insertJobsFromTitles( $titleArray );
} else {
$this->invalidateTitles( $titleArray ); // just do the query
'end' => $this->params['end']
) + $rootJobParams // carry over information for de-duplication
);
- wfDebug( __METHOD__.": repartitioning into " . count( $jobs ) . " jobs\n" );
+ wfDebug( __METHOD__ . ": repartitioning into " . count( $jobs ) . " jobs\n" );
if ( count( $jobs ) < 2 ) {
# I don't think this is possible at present, but handling this case
# makes the code a bit more robust against future code updates and
# avoids a potential infinite loop of repartitioning
- wfDebug( __METHOD__.": repartitioning failed!\n" );
+ wfDebug( __METHOD__ . ": repartitioning failed!\n" );
$this->invalidateTitles( $titleArray );
} else {
JobQueueGroup::singleton()->push( $jobs );
) {
$paramStart = $subtype === 'revision' ? 4 : 3;
- $old = $this->parseBitField( $params[$paramStart+1] );
- $new = $this->parseBitField( $params[$paramStart+2] );
+ $old = $this->parseBitField( $params[$paramStart + 1] );
+ $new = $this->parseBitField( $params[$paramStart + 2] );
list( $hid, $unhid, $extra ) = RevisionDeleter::getChanges( $new, $old );
$changes = array();
foreach ( $hid as $v ) {
* @param $filter: array
* @param $tagFilter: array?
*/
- public function showOptions( $types=array(), $user = '', $page = '', $pattern = '', $year = '',
+ public function showOptions( $types = array(), $user = '', $page = '', $pattern = '', $year = '',
$month = '', $filter = null, $tagFilter = '' ) {
global $wgScript, $wgMiserMode;
* @return Integer Number of total log items (not limited by $lim)
*/
public static function showLogExtract(
- &$out, $types=array(), $page = '', $user = '', $param = array()
+ &$out, $types = array(), $page = '', $user = '', $param = array()
) {
$defaultParameters = array(
'lim' => 25,
// User suppression
if ( preg_match( '/^(block|suppress)\/(block|reblock)$/', $key ) ) {
if ( $skin ) {
- $params[1] = '<span class="blockExpiry" dir="ltr" title="' . htmlspecialchars( $params[1] ). '">' .
+ $params[1] = '<span class="blockExpiry" dir="ltr" title="' . htmlspecialchars( $params[1] ) . '">' .
$wgLang->translateBlockExpiry( $params[1] ) . '</span>';
} else {
$params[1] = $wgContLang->translateBlockExpiry( $params[1] );
}
$cmd .= ' > ' . wfEscapeShellArg( $dstPath ) . ') 2>&1';
wfProfileIn( 'ddjvu' );
- wfDebug( __METHOD__.": $cmd\n" );
+ wfDebug( __METHOD__ . ": $cmd\n" );
$retval = '';
$err = wfShellExec( $cmd, $retval );
wfProfileOut( 'ddjvu' );
return false;
}
- $o = $tree->BODY[0]->OBJECT[$page-1];
+ $o = $tree->BODY[0]->OBJECT[$page - 1];
if ( $o ) {
return array(
'width' => intval( $o['width'] ),
return false;
}
- $o = $tree->BODY[0]->PAGE[$page-1];
+ $o = $tree->BODY[0]->PAGE[$page - 1];
if ( $o ) {
$txt = $o['value'];
return $txt;
$txt = preg_replace_callback( $reg, array( $this, 'pageTextCallback' ), $txt );
$txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";
$xml = preg_replace( "/<DjVuXML>/", "<mw-djvu><DjVuXML>", $xml, 1 );
- $xml = $xml . $txt. '</mw-djvu>';
+ $xml = $xml . $txt . '</mw-djvu>';
}
}
wfProfileOut( __METHOD__ );
$commentCount = count( $comment );
if ( $commentCount === 0
- || $comment[$commentCount-1] !== $data )
+ || $comment[$commentCount - 1] !== $data )
{
// Some applications repeat the same comment on each
// frame of an animated GIF image, so if this comment
return null;
}
- $tz = ( intval( substr( $time, 7, 2 ) ) *60*60 )
+ $tz = ( intval( substr( $time, 7, 2 ) ) * 60 * 60 )
+ ( intval( substr( $time, 9, 2 ) ) * 60 );
if ( substr( $time, 6, 1 ) === '-' ) {
} elseif ( isset( $params['width'] ) ) {
$width = $params['width'];
} else {
- throw new MWException( 'No width specified to '.__METHOD__ );
+ throw new MWException( 'No width specified to ' . __METHOD__ );
}
# Removed for ProofreadPage
#$width = intval( $width );
*/
function toHtml( $options = array() ) {
if ( count( func_get_args() ) == 2 ) {
- throw new MWException( __METHOD__ .' called in the old style' );
+ throw new MWException( __METHOD__ . ' called in the old style' );
}
$alt = empty( $options['alt'] ) ? '' : $options['alt'];
}
if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) {
- throw new MWException( "Expected <svg> tag, got ".
+ throw new MWException( "Expected <svg> tag, got " .
$this->reader->localName . " in NS " . $this->reader->namespaceURI );
}
$this->debug( "<svg> tag is correct." );
* @param string $name of the element that we are reading from
* @param string $metafield that we will fill with the result
*/
- private function readField( $name, $metafield=null ) {
+ private function readField( $name, $metafield = null ) {
$this->debug( "Read field $metafield" );
if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
return;
* @param string $metafield that we will fill with the result
* @throws MWException
*/
- private function readXml( $metafield=null ) {
+ private function readXml( $metafield = null ) {
$this->debug( "Read top level metadata" );
if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
return;
$val, $m )
) {
$coord = intval( $m[1] );
- $coord += intval( $m[2] ) * (1/60);
- $coord += intval( $m[3] ) * (1/3600);
+ $coord += intval( $m[2] ) * ( 1 / 60 );
+ $coord += intval( $m[3] ) * ( 1 / 3600 );
if ( $m[4] === 'S' || $m[4] === 'W' ) {
$coord = -$coord;
}
$val, $m )
) {
$coord = intval( $m[1] );
- $coord += floatval( $m[2] ) * (1/60);
+ $coord += floatval( $m[2] ) * ( 1 / 60 );
if ( $m[3] === 'S' || $m[3] === 'W' ) {
$coord = -$coord;
}
}
$uRTT = ceil( 1e6 * ( microtime( true ) - $timestamp ) ); // estimate RTT (us)
- $sleep = 2*$uRTT; // rough time to do get()+set()
+ $sleep = 2 * $uRTT; // rough time to do get()+set()
$locked = false; // lock acquired
$attempts = 0; // failed attempts
break;
case 'igbinary':
if ( !Memcached::HAVE_IGBINARY ) {
- throw new MWException( __CLASS__.': the igbinary extension is not available ' .
+ throw new MWException( __CLASS__ . ': the igbinary extension is not available ' .
'but igbinary serialization was requested.' );
}
$this->client->setOption( Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY );
break;
default:
- throw new MWException( __CLASS__.': invalid value for serializer parameter' );
+ throw new MWException( __CLASS__ . ': invalid value for serializer parameter' );
}
$servers = array();
foreach ( $params['servers'] as $host ) {
*/
public function __construct( $params ) {
if ( !isset( $params['caches'] ) ) {
- throw new MWException( __METHOD__.': the caches parameter is required' );
+ throw new MWException( __METHOD__ . ': the caches parameter is required' );
}
$this->caches = array();
$key = $this->keys[$this->mSource];
for ( $p = 0; $p < strlen( $key ); $p++ ) {
if ( $key[$p] != ' ' ) {
- $bits[$key[$p]] = $matches[$p+1];
+ $bits[$key[$p]] = $matches[$p + 1];
}
}
*
* @return string
*/
- function recursiveTagParse( $text, $frame=false ) {
+ function recursiveTagParse( $text, $frame = false ) {
wfProfileIn( __METHOD__ );
wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) );
wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
# If there are ever four apostrophes, assume the first is supposed to
# be text, and the remaining three constitute mark-up for bold text.
if ( strlen( $arr[$i] ) == 4 ) {
- $arr[$i-1] .= "'";
+ $arr[$i - 1] .= "'";
$arr[$i] = "'''";
} elseif ( strlen( $arr[$i] ) > 5 ) {
# If there are more than 5 apostrophes in a row, assume they're all
# text except for the last 5.
- $arr[$i-1] .= str_repeat( "'", strlen( $arr[$i] ) - 5 );
+ $arr[$i - 1] .= str_repeat( "'", strlen( $arr[$i] ) - 5 );
$arr[$i] = "'''''";
}
# Count the number of occurrences of bold and italics mark-ups.
$firstspace = -1;
foreach ( $arr as $r ) {
if ( ( $i % 2 == 1 ) and ( strlen( $r ) == 3 ) ) {
- $x1 = substr( $arr[$i-1], -1 );
- $x2 = substr( $arr[$i-1], -2, 1 );
+ $x1 = substr( $arr[$i - 1], -1 );
+ $x2 = substr( $arr[$i - 1], -2, 1 );
if ( $x1 === ' ' ) {
if ( $firstspace == -1 ) {
$firstspace = $i;
# If there is a single-letter word, use it!
if ( $firstsingleletterword > -1 ) {
$arr[$firstsingleletterword] = "''";
- $arr[$firstsingleletterword-1] .= "'";
+ $arr[$firstsingleletterword - 1] .= "'";
} elseif ( $firstmultiletterword > -1 ) {
# If not, but there's a multi-letter word, use that one.
$arr[$firstmultiletterword] = "''";
- $arr[$firstmultiletterword-1] .= "'";
+ $arr[$firstmultiletterword - 1] .= "'";
} elseif ( $firstspace > -1 ) {
# ... otherwise use the first one that has neither.
# (notice that it is possible for all three to be -1 if, for example,
# there is only one pentuple-apostrophe in the line)
$arr[$firstspace] = "''";
- $arr[$firstspace-1] .= "'";
+ $arr[$firstspace - 1] .= "'";
}
}
$s = array_shift( $bits );
$i = 0;
- while ( $i<count( $bits ) ) {
+ while ( $i < count( $bits ) ) {
$url = $bits[$i++];
$i++; // protocol
$text = $bits[$i++];
function closeParagraph() {
$result = '';
if ( $this->mLastSection != '' ) {
- $result = '</' . $this->mLastSection . ">\n";
+ $result = '</' . $this->mLastSection . ">\n";
}
$this->mInPre = false;
$this->mLastSection = '';
# Close all the prefixes which aren't shared.
while ( $commonPrefixLength < $lastPrefixLength ) {
- $output .= $this->closeList( $lastPrefix[$lastPrefixLength-1] );
+ $output .= $this->closeList( $lastPrefix[$lastPrefixLength - 1] );
--$lastPrefixLength;
}
# Continue the current prefix if appropriate.
if ( $prefixLength <= $commonPrefixLength && $commonPrefixLength > 0 ) {
- $output .= $this->nextItem( $prefix[$commonPrefixLength-1] );
+ $output .= $this->nextItem( $prefix[$commonPrefixLength - 1] );
}
# Open prefixes where appropriate.
# XXX: use a stack for nestable elements like span, table and div
$openmatch = preg_match( '/(?:<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
$closematch = preg_match(
- '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'.
- '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
+ '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|' .
+ '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|' . $this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
if ( $openmatch or $closematch ) {
$paragraphStack = false;
# TODO bug 5718: paragraph closed
}
}
while ( $prefixLength ) {
- $output .= $this->closeList( $prefix2[$prefixLength-1] );
+ $output .= $this->closeList( $prefix2[$prefixLength - 1] );
--$prefixLength;
}
if ( $this->mLastSection != '' ) {
if ( $lt === false || $lt > $pos ) {
# Easy; no tag nesting to worry about
$before = substr( $str, 0, $pos );
- $after = substr( $str, $pos+1 );
+ $after = substr( $str, $pos + 1 );
wfProfileOut( __METHOD__ );
return $pos;
}
$assocArgs[$index++] = $arg;
} else {
$name = trim( substr( $arg, 0, $eqpos ) );
- $value = trim( substr( $arg, $eqpos+1 ) );
+ $value = trim( substr( $arg, $eqpos + 1 ) );
if ( $value === false ) {
$value = '';
}
* @return mixed|string
* @private
*/
- function formatHeadings( $text, $origText, $isMain=true ) {
+ function formatHeadings( $text, $origText, $isMain = true ) {
global $wgMaxTocLevel, $wgHtml5, $wgExperimentalHtmlIds;
# Inhibit editsection links if requested in the page
# Get all headlines for numbering them and adding funky stuff like [edit]
# links - this is for later, but we need the number of headlines right now
$matches = array();
- $numMatches = preg_match_all( '/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)\s*(?P<header>[\s\S]*?)\s*<\/H[1-6] *>/i', $text, $matches );
+ $numMatches = preg_match_all( '/<H(?P<level>[1-6])(?P<attrib>.*?' . '>)\s*(?P<header>[\s\S]*?)\s*<\/H[1-6] *>/i', $text, $matches );
# if there are fewer than 4 headlines in the article, do not show TOC
# unless it's been explicitly enabled.
# We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from <span>,
# to allow setting directionality in toc items.
$tocline = preg_replace(
- array( '#<(?!/?(span|sup|sub|i|b)(?: [^>]*)?>).*?'.'>#', '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|i|b))(?: .*?)?'.'>#' ),
+ array( '#<(?!/?(span|sup|sub|i|b)(?: [^>]*)?>).*?' . '>#', '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|i|b))(?: .*?)?' . '>#' ),
array( '', '<$1>' ),
$safeHeadline
);
$tocline = trim( $tocline );
# For the anchor, strip out HTML-y stuff period
- $safeHeadline = preg_replace( '/<.*?'.'>/', '', $safeHeadline );
+ $safeHeadline = preg_replace( '/<.*?' . '>/', '', $safeHeadline );
$safeHeadline = Sanitizer::normalizeSectionNameWhitespace( $safeHeadline );
# Save headline for section edit hint before it's escaped
$xml = "<list>";
foreach ( $values as $k => $val ) {
-
if ( is_int( $k ) ) {
- $xml .= "<part><name index=\"$k\"/><value>" . htmlspecialchars( $val ) ."</value></part>";
+ $xml .= "<part><name index=\"$k\"/><value>" . htmlspecialchars( $val ) . "</value></part>";
} else {
$xml .= "<part><name>" . htmlspecialchars( $k ) . "</name>=<value>" . htmlspecialchars( $val ) . "</value></part>";
}
}
$tagStartPos = $i;
- if ( $text[$tagEndPos-1] == '/' ) {
+ if ( $text[$tagEndPos - 1] == '/' ) {
$attrEnd = $tagEndPos - 1;
$inner = null;
$i = $tagEndPos + 1;
'open' => $curChar,
'close' => $rule['end'],
'count' => $count,
- 'lineStart' => ($i > 0 && $text[$i-1] == "\n"),
+ 'lineStart' => ($i > 0 && $text[$i - 1] == "\n"),
);
$stack->push( $piece );
}
$tagStartPos = $i;
- if ( $text[$tagEndPos-1] == '/' ) {
+ if ( $text[$tagEndPos - 1] == '/' ) {
// Short end tag
$attrEnd = $tagEndPos - 1;
$inner = null;
'open' => $curChar,
'close' => $rule['end'],
'count' => $count,
- 'lineStart' => ($i > 0 && $text[$i-1] == "\n"),
+ 'lineStart' => ($i > 0 && $text[$i - 1] == "\n"),
);
$stack->push( $piece );
$this->mCollated[$functionname] =& $entry;
}
$entry['cpu'] += $elapsedcpu;
- $entry['cpu_sq'] += $elapsedcpu*$elapsedcpu;
+ $entry['cpu_sq'] += $elapsedcpu * $elapsedcpu;
$entry['real'] += $elapsedreal;
- $entry['real_sq'] += $elapsedreal*$elapsedreal;
+ $entry['real_sq'] += $elapsedreal * $elapsedreal;
$entry['count']++;
}
uasort( $this->mCollated, array( 'self', 'sort' ) );
array_walk( $this->mCollated, array( 'self', 'format' ), $totalReal );
if ( PHP_SAPI === 'cli' ) {
- print "<!--\n".self::$out."\n-->\n";
+ print "<!--\n" . self::$out . "\n-->\n";
} elseif ( $this->getContentType() === 'text/html' ) {
if ( $this->visible ) {
- print '<pre>'.self::$out.'</pre>';
+ print '<pre>' . self::$out . '</pre>';
} else {
- print "<!--\n".self::$out."\n-->\n";
+ print "<!--\n" . self::$out . "\n-->\n";
}
} elseif ( $this->getContentType() === 'text/javascript' ) {
- print "\n/*\n".self::$out."*/\n";
+ print "\n/*\n" . self::$out . "*/\n";
} elseif ( $this->getContentType() === 'text/css' ) {
- print "\n/*\n".self::$out."*/\n";
+ print "\n/*\n" . self::$out . "*/\n";
}
}
}
}
static function format( $item, $key, $totalReal ) {
- $perc = $totalReal ? $item['real']/$totalReal*100 : 0;
+ $perc = $totalReal ? $item['real'] / $totalReal * 100 : 0;
self::$out .= sprintf( "%6.2f%% %3.6f %6d - %s\n",
$perc, $item['real'], $item['count'], $key );
}
$this->hasErrors = true;
}
- wfProfileIn( __METHOD__.'-getModifiedTime' );
+ wfProfileIn( __METHOD__ . '-getModifiedTime' );
// To send Last-Modified and support If-Modified-Since, we need to detect
// the last modified time
}
}
- wfProfileOut( __METHOD__.'-getModifiedTime' );
+ wfProfileOut( __METHOD__ . '-getModifiedTime' );
// If there's an If-Modified-Since header, respond with a 304 appropriately
if ( $this->tryRespondLastModified( $context, $mtime ) ) {
' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')';
return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
- $data . ' ' . $this->getComment(). '</li>';
+ $data . ' ' . $this->getComment() . '</li>';
}
}
$len = strlen( $endMatches[2][0] );
$off = $endMatches[2][1];
$this->splitAndAdd( $otherExt, $count,
- substr( $text, $start, $off + $len - $start ) );
+ substr( $text, $start, $off + $len - $start ) );
$start = $off + $len;
$found = true;
break;
* @ingroup Search
*/
class MySQLSearchResultSet extends SqlSearchResultSet {
- function __construct( $resultSet, $terms, $totalHits=null ) {
+ function __construct( $resultSet, $terms, $totalHits = null ) {
parent::__construct( $resultSet, $terms );
$this->mTotalHits = $totalHits;
}
$top = $top[0];
if ( $top === "" ) { ## e.g. if only stopwords are used XXX return something better
- $query = "SELECT page_id, page_namespace, page_title, 0 AS score ".
+ $query = "SELECT page_id, page_namespace, page_title, 0 AS score " .
"FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
"AND r.rev_text_id = c.old_id AND 1=0";
}
}
}
- $query = "SELECT page_id, page_namespace, page_title, ".
- "ts_rank($fulltext, to_tsquery($searchstring), 5) AS score ".
+ $query = "SELECT page_id, page_namespace, page_title, " .
+ "ts_rank($fulltext, to_tsquery($searchstring), 5) AS score " .
"FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
"AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($searchstring)";
}
function update( $pageid, $title, $text ) {
## We don't want to index older revisions
- $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN ".
+ $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " .
"(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) .
" ORDER BY rev_text_id DESC OFFSET 1)";
$this->db->query( $SQL );
* @ingroup Search
*/
class SqliteSearchResultSet extends SqlSearchResultSet {
- function __construct( $resultSet, $terms, $totalHits=null ) {
+ function __construct( $resultSet, $terms, $totalHits = null ) {
parent::__construct( $resultSet, $terms );
$this->mTotalHits = $totalHits;
}
private $namespace;
private $rootpage = '';
private $frompage = '';
- private $logcomment= false;
+ private $logcomment = false;
private $history = true;
private $includeTemplates = false;
private $pageLinkDepth;
if( $user->isAllowed( 'importupload' ) ) {
$out->addHTML(
- Xml::fieldset( $this->msg( 'import-upload' )->text() ).
+ Xml::fieldset( $this->msg( 'import-upload' )->text() ) .
Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post',
'action' => $action, 'id' => 'mw-import-upload-form' ) ) .
$this->msg( 'importtext' )->parseAsBlock() .
Xml::submitButton( $this->msg( 'uploadbtn' )->text() ) .
"</td>
</tr>" .
- Xml::closeElement( 'table' ).
+ Xml::closeElement( 'table' ) .
Html::hidden( 'editToken', $user->getEditToken() ) .
Xml::closeElement( 'form' ) .
Xml::closeElement( 'fieldset' )
Xml::submitButton( $this->msg( 'import-interwiki-submit' )->text(), Linker::tooltipAndAccesskeyAttribs( 'import' ) ) .
"</td>
</tr>" .
- Xml::closeElement( 'table' ).
+ Xml::closeElement( 'table' ) .
Xml::closeElement( 'form' ) .
Xml::closeElement( 'fieldset' )
);
* @ingroup SpecialPage
*/
class ImportReporter extends ContextSource {
- private $reason=false;
+ private $reason = false;
private $mOriginalLogCallback = null;
private $mOriginalPageOutCallback = null;
private $mLogItemCount = 0;
} elseif ( !$pr_sl && $pr_cl ) {
// For protocols without '//' like 'mailto:'
$protocol = substr( $target2, 0, $pr_cl + 1 );
- $target2 = substr( $target2, $pr_cl+1 );
+ $target2 = substr( $target2, $pr_cl + 1 );
} elseif ( $protocol == '' && $target2 != '' ) {
// default
$protocol = 'http://';
) ) {
$conds = array(
'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
- .' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
+ . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
);
$conds['page_namespace'] = array();
if( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
}
$newPageName = preg_replace(
- '#^'.preg_quote( $ot->getDBkey(), '#' ).'#',
+ '#^' . preg_quote( $ot->getDBkey(), '#' ) . '#',
StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
$oldSubpage->getDBkey()
);
$links = array();
foreach ( $filters as $key => $msg ) {
$link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
- array( $key => 1-$options[$key] ), $nondefaults );
+ array( $key => 1 - $options[$key] ), $nondefaults );
$links[] = $this->msg( $msg )->rawParams( $link )->escaped();
}
wfProfileIn( __METHOD__ );
$terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
- $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".
+ $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>" .
$this->msg( 'search-interwiki-caption' )->text() . "</div>\n";
$out .= "<ul class='mw-search-iwresults'>\n";
$out->wrapWikiMsg( "<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h2>\n", "specialpages-group-$group" );
$out->addHTML(
- Html::openElement( 'table', array( 'style' => 'width:100%;', 'class' => 'mw-specialpages-table' ) ) ."\n" .
+ Html::openElement( 'table', array( 'style' => 'width:100%;', 'class' => 'mw-specialpages-table' ) ) . "\n" .
Html::openElement( 'tr' ) . "\n" .
Html::openElement( 'td', array( 'style' => 'width:30%;vertical-align:top' ) ) . "\n" .
Html::openElement( 'ul' ) . "\n"
if( !$wgMemc->get( $key ) ) {
$dbw = wfGetDB( DB_MASTER );
SiteStatsUpdate::cacheUpdate( $dbw );
- $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day
+ $wgMemc->set( $key, '1', 24 * 3600 ); // don't update for 1 day
}
}
$count = count( $list );
if ( $count > 0 ) {
$grouplist = $this->msg( 'userrights-groupsmember', $count, $user->getName() )->parse();
- $grouplist = '<p>' . $grouplist . ' ' . $displayedList . "</p>\n";
+ $grouplist = '<p>' . $grouplist . ' ' . $displayedList . "</p>\n";
}
$count = count( $autoList );
if ( $count > 0 ) {
$autogrouplistintro = $this->msg( 'userrights-groupsmember-auto', $count, $user->getName() )->parse();
- $grouplist .= '<p>' . $autogrouplistintro . ' ' . $displayedAutolist . "</p>\n";
+ $grouplist .= '<p>' . $autogrouplistintro . ' ' . $displayedAutolist . "</p>\n";
}
$userToolLinks = Linker::userToolLinks(
global $wgLang;
if ( defined( 'MEDIAWIKI_INSTALL' ) ) {
- $othersLink = '[http://www.mediawiki.org/wiki/Special:Version/Credits ' . wfMessage( 'version-poweredby-others' )->text() . ']';
+ $othersLink = '[http://www.mediawiki.org/wiki/Special:Version/Credits ' . wfMessage( 'version-poweredby-others' )->text() . ']';
} else {
$othersLink = '[[Special:Version/Credits|' . wfMessage( 'version-poweredby-others' )->text() . ']]';
}
$tags[$i] = "<{$tags[$i]}>";
}
$out .= $this->openExtType( $this->msg( 'version-parser-extensiontags' )->text(), 'parser-tags' );
- $out .= '<tr><td colspan="4">' . $this->listToText( $tags ). "</td></tr>\n";
+ $out .= '<tr><td colspan="4">' . $this->listToText( $tags ) . "</td></tr>\n";
}
$fhooks = $wgParser->getFunctionHooks();
"unrecognized extension '$extension', can't verify\n" );
return true;
} else {
- wfDebug( __METHOD__ . ": rejecting file with unknown detected mime type; ".
+ wfDebug( __METHOD__ . ": rejecting file with unknown detected mime type; " .
"recognized extension '$extension', so probably invalid file\n" );
return false;
}
// Remove additional comments after a prefix
$comment = strpos( $line, '#' );
if ( $comment > 0 ) {
- $line = substr( $line, 0, $comment-1 );
+ $line = substr( $line, 0, $comment - 1 );
}
$blacklist[] = trim( $line );
}
list( $usec, $sec ) = explode( ' ', microtime() );
$usec = substr( $usec, 2 );
$key = wfBaseConvert( $sec . $usec, 10, 36 ) . '.' .
- wfBaseConvert( mt_rand(), 10, 36 ) . '.'.
+ wfBaseConvert( mt_rand(), 10, 36 ) . '.' .
$this->userId . '.' .
$extension;
private static function hebrewYearStart( $year ) {
$a = intval( ( 12 * ( $year - 1 ) + 17 ) % 19 );
$b = intval( ( $year - 1 ) % 4 );
- $m = 32.044093161144 + 1.5542417966212 * $a + $b / 4.0 - 0.0031777940220923 * ( $year - 1 );
+ $m = 32.044093161144 + 1.5542417966212 * $a + $b / 4.0 - 0.0031777940220923 * ( $year - 1 );
if ( $m < 0 ) {
$m--;
}
$sign = "";
if ( intval( $number ) < 0 ) {
// For negative numbers apply the algorithm like positive number and add sign.
- $sign = "-";
+ $sign = "-";
$number = substr( $number, 1 );
}
$integerPart = array();
preg_match( "/\d+/", $number, $integerPart );
preg_match( "/\.\d*/", $number, $decimalPart );
$groupedNumber = ( count( $decimalPart ) > 0 ) ? $decimalPart[0]:"";
- if ( $groupedNumber === $number ) {
+ if ( $groupedNumber === $number ) {
// the string does not have any number part. Eg: .12345
return $sign . $groupedNumber;
}
# däm WikiMaatplaz sing, dä Wikipeedija ier, däm Wikiwööterbooch sing
# dem/em WikiMaatplaz sing, de Wikipeedija ier, dem/em Wikiwööterbooch sing
$word = ( preg_match( '/ b/', $case )
- ? ( $gender=='f' ? 'dä' : 'däm' )
- : ( $gender=='f' ? 'de' : 'dem' )
+ ? ( $gender == 'f' ? 'dä' : 'däm' )
+ : ( $gender == 'f' ? 'de' : 'dem' )
) . ' ' . $word . ' ' .
- ( $gender=='f' ? 'ier' : 'sing' ) .
+ ( $gender == 'f' ? 'ier' : 'sing' ) .
( preg_match( '/ m/', $case ) ? 'e' : ''
);
} elseif ( preg_match( '/ e/', $case ) ) {
# en dämm WikiMaatPlaz, en dä Wikipeedija, en dämm Wikiwööterbooch
# em WikiMaatplaz, en de Wikipeedija, em Wikiwööterbooch
if ( preg_match( '/ b/', $case ) ) {
- $word = 'en '.( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
+ $word = 'en ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
} else {
$word = ( $gender == 'f' ? 'en de' : 'em' ) . ' ' . $word;
}
if ( preg_match( '/ b/', $case ) ) {
$word = 'vun ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
} else {
- $word = ( $gender== 'f' ? 'vun de' : 'vum' ) . ' ' . $word;
+ $word = ( $gender == 'f' ? 'vun de' : 'vum' ) . ' ' . $word;
}
} elseif ( preg_match( '/ [3d]/', $case ) ) {
# dämm WikiMaatPlaz, dä Wikipeedija, dämm Wikiwööterbooch
# dem/em WikiMaatplaz, de Wikipeedija, dem/em Wikiwööterbooch
if ( preg_match( '/ b/', $case ) ) {
- $word = ( $gender == 'f' ? 'dää' : 'dämm' ) .' ' . $word;
+ $word = ( $gender == 'f' ? 'dää' : 'dämm' ) . ' ' . $word;
} else {
$word = ( $gender == 'f' ? 'de' : 'dem' ) . ' ' . $word;
}
$lord = 'et';
}
}
- $word = $lord.' '.$word;
+ $word = $lord . ' ' . $word;
}
return $word;
}
$word = implode( "", $ar[0] ) . "Ñ‚Ñ‹";
} else {
}
- } elseif ( $wordEnding === "л" || $wordEnding === "l" ) {
+ } elseif ( $wordEnding === "л" || $wordEnding === "l" ) {
if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
$word = implode( "", $ar[0] ) . "дү";
} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
$n = substr( $ts, 6, 2 );
if ( $n == 1 ) {
$d = "1î d' " . $this->getMonthName( $m ) .
- " " . substr( $ts, 0, 4 );
+ " " . substr( $ts, 0, 4 );
} elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
$d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
- " " . substr( $ts, 0, 4 );
+ " " . substr( $ts, 0, 4 );
} elseif ( $m == 4 || $m == 8 || $m == 10 ) {
$d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
- " " . substr( $ts, 0, 4 );
+ " " . substr( $ts, 0, 4 );
} else {
$d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
- " " . substr( $ts, 0, 4 );
+ " " . substr( $ts, 0, 4 );
}
return $d;
}
return false; // last call should be to this function
}
$includeFuncs = array( 'require_once', 'require', 'include', 'include_once' );
- for( $i=1; $i < $count; $i++ ) {
+ for( $i = 1; $i < $count; $i++ ) {
if ( !in_array( $bt[$i]['function'], $includeFuncs ) ) {
return false; // previous calls should all be "requires"
}
}
function checkIfTimeExceeded() {
- if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) {
+ if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) {
return true;
}
return false;
foreach( $benchs as $bench ) {
// handle empty args
- if(!array_key_exists( 'args', $bench )) {
+ if( !array_key_exists( 'args', $bench ) ) {
$bench['args'] = array();
}
$bench_number++;
$start = microtime( true );
- for( $i=0; $i<$count; $i++ ) {
+ for( $i = 0; $i < $count; $i++ ) {
call_user_func_array( $bench['function'], $bench['args'] );
}
$delta = microtime( true ) - $start;
// function passed as a callback
if( is_array( $bench['function'] ) ) {
- $ret = get_class( $bench['function'][0] ). '->' . $bench['function'][1];
+ $ret = get_class( $bench['function'][0] ) . '->' . $bench['function'][1];
$bench['function'] = $ret;
}
join( ', ', $res['arguments'] )
);
$ret .= sprintf( " %6.2fms (%6.2fms each)\n",
- $res['delta'] * 1000,
+ $res['delta'] * 1000,
$res['average'] * 1000
);
}
}
public function execute() {
- if (! ( $this->hasOption('file') ^ $this->hasOption('dump') ) ) {
+ if ( !( $this->hasOption('file') ^ $this->hasOption('dump') ) ) {
$this->error("You must provide a file or dump", true);
}
if ( $this->getDbType() == Maintenance::DB_NONE ) {
global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks;
$wgUseDatabaseMessages = false;
- $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
+ $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
$wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis';
}
}
* @ingroup Maintenance
*/
-require_once( __DIR__ .'/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
/**
* Maintenance script that formats RELEASE-NOTE file to wiki text or HTML markup.
$importer->setNoUpdates( true );
}
$importer->setPageCallback( array( &$this, 'reportPage' ) );
- $this->importCallback = $importer->setRevisionCallback(
+ $this->importCallback = $importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
$this->uploadCallback = $importer->setUploadCallback(
array( &$this, 'handleUpload' ) );
$comment = 'Importing image file';
if ( isset( $options['comment-file'] ) ) {
- $comment = file_get_contents( $options['comment-file'] );
+ $comment = file_get_contents( $options['comment-file'] );
if ( $comment === false || $comment === null ) {
die( "failed to read comment file: {$options['comment-file']}\n" );
}
} elseif ( isset( $options['comment'] ) ) {
- $comment = $options['comment'];
+ $comment = $options['comment'];
}
$commentExt = isset( $options['comment-ext'] ) ? $options['comment-ext'] : false;
define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
define( 'MEDIAWIKI_INSTALL', true );
-require_once( dirname( __DIR__ )."/maintenance/Maintenance.php" );
+require_once( dirname( __DIR__ ) . "/maintenance/Maintenance.php" );
/**
* Maintenance script to install and configure MediaWiki
* @ingroup MaintenanceLanguage
*/
class CheckLanguageCLI {
- protected $code = null;
+ protected $code = null;
protected $level = 2;
protected $doLinks = false;
protected $linksPrefix = '';
* @ingroup MaintenanceLanguage
*/
-require_once( __DIR__ .'/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
/**
* Generate first letter data files for Collation.php
$error .= "You are using outdated version of ICU ($icuVersion), intended for "
. ( $unicodeVersion ? "Unicode $unicodeVersion" : "an unknown version of Unicode" )
. "; this file might not be avalaible for it, and it's not supported by MediaWiki. "
- ." You are on your own; consider upgrading PHP's intl extension or try "
+ . " You are on your own; consider upgrading PHP's intl extension or try "
. "one of the files available at:";
} elseif ( version_compare( $icuVersion, "51.0", ">=" ) ) {
// Extra recent version
$this->xml = new XMLReader;
$this->xml->open( $this->fileName );
if ( !$this->xml ) {
- throw new MWException( __METHOD__.": unable to open {$this->fileName}" );
+ throw new MWException( __METHOD__ . ": unable to open {$this->fileName}" );
}
while ( $this->xml->name !== 'ucd' && $this->xml->read() );
$this->xml->read();
if( strpos( $value, $single ) === false ) {
# Nothing ugly, just use '
- $blockText .= $single.$value.$single;
+ $blockText .= $single . $value . $single;
} elseif( strpos( $value, $double ) === false && !preg_match('/\$[a-zA-Z_\x7f-\xff]/', $value) ) {
# No "-quotes, no variables that need quoting, use "
- $blockText .= $double.$value.$double;
+ $blockText .= $double . $value . $double;
} else {
# Something needs quoting, pick the quote which causes less quoting
$quote = substr_count( $value, $double ) + substr_count( $value, '$' ) >= substr_count( $value, $single ) ? $single : $double;
if( $input_file === $php_stdin ) {
$ctrl = wfIsWindows() ? 'CTRL+Z' : 'CTRL+D';
- $this->error( basename(__FILE__) .": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" );
+ $this->error( basename(__FILE__) . ": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" );
}
return file_get_contents( $input_file );
}
}
}
- $this->output( "Purging " . count( $urls ). " urls\n" );
+ $this->output( "Purging " . count( $urls ) . " urls\n" );
$this->sendPurgeRequest( $urls );
}
$this->output( '$wgRCMaxAge=' . $wgRCMaxAge );
$days = $wgRCMaxAge / 24 / 3600;
if ( intval( $days ) == $days ) {
- $this->output( " (" . $days . " days)\n" );
+ $this->output( " (" . $days . " days)\n" );
} else {
- $this->output( " (approx. " . intval( $days ) . " days)\n" );
+ $this->output( " (approx. " . intval( $days ) . " days)\n" );
}
$cutoff = time() - $wgRCMaxAge;
}
# Store External Storage URLs instead of Stub placeholders
foreach ($stubs as $stub) {
- if ($stub===false)
+ if ( $stub === false )
continue;
# $stored should provide base path to a BLOB
- $url = $stored."/".$stub->getHash();
+ $url = $stored . "/" . $stub->getHash();
$dbw->update( 'text',
array( /* SET */
'old_text' => $url,
*
* @return string
*/
- function processBottomLink( $key, $navlink, $message=null ) {
+ function processBottomLink( $key, $navlink, $message = null ) {
if ( !$navlink ) {
// Empty navlinks might be passed.
return null;
* @param $navlink array Navigational link generated by SkinTemplate
* @param $idPrefix mixed Prefix to add to id of this navlink. If false, id is removed entirely. Default is 'cb-'.
*/
- function processNavlinkForDocument( $navlink, $idPrefix='cb-' ) {
+ function processNavlinkForDocument( $navlink, $idPrefix = 'cb-' ) {
if ( $navlink['id'] ) {
$navlink['single-id'] = $navlink['id']; // to allow for tooltip generation
$navlink['tooltiponly'] = true; // but no accesskeys
if ( $idPrefix === false ) {
unset( $navlink['id'] );
} else {
- $navlink['id'] = $idPrefix . $navlink['id'];
+ $navlink['id'] = $idPrefix . $navlink['id'];
}
}
$blockList = array(
array( 'target' => '70.2.0.0/16',
- 'type' => Block::TYPE_RANGE,
+ 'type' => Block::TYPE_RANGE,
'desc' => 'Range Hardblock',
'ACDisable' => false,
'isHardblock' => true,
'isAutoBlocking' => false,
),
array( 'target' => '2001:4860:4001::/48',
- 'type' => Block::TYPE_RANGE,
+ 'type' => Block::TYPE_RANGE,
'desc' => 'Range6 Hardblock',
'ACDisable' => false,
'isHardblock' => true,
'isAutoBlocking' => false,
),
array( 'target' => '60.2.0.0/16',
- 'type' => Block::TYPE_RANGE,
+ 'type' => Block::TYPE_RANGE,
'desc' => 'Range Softblock with AC Disabled',
'ACDisable' => true,
'isHardblock' => false,
'isAutoBlocking' => false,
),
array( 'target' => '50.2.0.0/16',
- 'type' => Block::TYPE_RANGE,
+ 'type' => Block::TYPE_RANGE,
'desc' => 'Range Softblock',
'ACDisable' => false,
'isHardblock' => false,
'isAutoBlocking' => false,
),
array( 'target' => '50.1.1.1',
- 'type' => Block::TYPE_IP,
+ 'type' => Block::TYPE_IP,
'desc' => 'Exact Softblock',
'ACDisable' => false,
'isHardblock' => false,