global $wgOut;
$oldid = $this->getOldID();
- $useParserCache = $this->useParserCache( $oldid );
$parserOptions = $this->getParserOptions();
# Render printable version, use printable version cache
# Extract fields from DB into the function scope (rc_xxxx variables)
// FIXME: Would be good to replace this extract() call with something
// that explicitly initializes variables.
- $classes = array(); // TODO implement
+ // TODO implement
extract( $rcObj->mAttribs );
$query['curid'] = $rc_cur_id;
switch ( $state ) {
case 'file':
- $token = $this->expect( T_OPEN_TAG );
+ $this->expect( T_OPEN_TAG );
$token = $this->skipSpace();
if ( $token->isEnd() ) {
break 2;
$script = '';
foreach ( $toolarray as $tool ) {
- if ( !$tool ) continue;
+ if ( !$tool ) {
+ continue;
+ }
$params = array(
$image = $wgStylePath . '/common/images/' . $tool['image'],
$rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
}
}
- if( $del ) $s .= " $del ";
+ if( $del ) {
+ $s .= " $del ";
+ }
$s .= " $link";
$s .= " <span class='history-user'>" .
$height_orig = $this->displayImg->getHeight( $page );
$height = $height_orig;
- $showLink = false;
- $linkAttribs = array( 'href' => $full_url );
$longDesc = $this->displayImg->getLongDesc();
wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$wgOut ) );
}
$row .= '</td>';
+ $rowClass = null;
wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
$classAttr = $rowClass ? " class='$rowClass'" : "";
$m = trim( $m );
$m = strtolower( $m );
- if ( strpos( $m, 'unknown' ) !== false ) {
+ if ( strpos( $m, 'unknown' ) === false ) {
$m = null;
} else {
wfDebug( __METHOD__.": magic mime type of $file: $m\n" );
$nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $name ) );
$this->mPagetitle = $nameWithTags;
- $taction = $this->getPageTitleActionText();
- if( !empty( $taction ) ) {
- $name .= ' - '.$taction;
- }
-
# change "<i>foo&bar</i>" to "foo&bar"
$this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
}
if( $wgPageShowWatchingUsers ) {
$dbr = wfGetDB( DB_SLAVE );
- $watchlist = $dbr->tableName( 'watchlist' );
$res = $dbr->select( 'watchlist',
array( 'COUNT(*) AS n' ),
array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
# Truncate for whole multibyte characters. +5 bytes for ellipsis
$comment = $wgContLang->truncate( $comment, 250 );
- $newid = $nt->getArticleID();
$oldid = $this->getArticleID();
$latest = $this->getLatestRevId();
*/
private function showNormalForm( $output, $user ) {
global $wgUser;
- if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) {
+ $count = $this->showItemCount( $output, $user );
+ if( $count > 0 ) {
$self = SpecialPage::getTitleFor( 'Watchlist' );
$form = Xml::openElement( 'form', array( 'method' => 'post',
'action' => $self->getLocalUrl( array( 'action' => 'edit' ) ) ) );
$join_conds );
// We must adjust for offset
- if ( isset( $options['LIMIT'] ) ) {
- if ( isset ( $options['OFFSET'] ) ) {
- $limit = $options['LIMIT'];
- $offset = $options['OFFSET'];
- }
+ if ( isset( $options['LIMIT'] ) && isset ( $options['OFFSET'] ) ) {
+ $limit = $options['LIMIT'];
+ $offset = $options['OFFSET'];
}
// DB2 does not have a proper num_rows() function yet, so we must emulate
*/
function nextSequenceValue( $seqName ) {
if ( !$this->tableExists( 'sequence_' . $seqName ) ) {
- $ret = sqlsrv_query( $this->mConn, "CREATE TABLE [sequence_$seqName] (id INT NOT NULL IDENTITY PRIMARY KEY, junk varchar(10) NULL)" );
+ sqlsrv_query( $this->mConn, "CREATE TABLE [sequence_$seqName] (id INT NOT NULL IDENTITY PRIMARY KEY, junk varchar(10) NULL)" );
}
- $ret = sqlsrv_query( $this->mConn, "INSERT INTO [sequence_$seqName] (junk) VALUES ('')" );
+ sqlsrv_query( $this->mConn, "INSERT INTO [sequence_$seqName] (junk) VALUES ('')" );
$ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" );
$row = sqlsrv_fetch_array( $ret, SQLSRV_FETCH_ASSOC );// KEEP ASSOC THERE, weird weird bug dealing with the return value if you don't
return true;
}
return false;
-
}
/**
}
$matches = $ymatches[$line];
reset($matches);
- while ( list( $junk, $y ) = each( $matches ) ) {
+ while ( list( , $y ) = each( $matches ) ) {
if ( empty( $this->in_seq[$y] ) ) {
$k = $this->_lcs_pos( $y );
assert( $k > 0 );
break;
}
}
- while (list ( /* $junk */, $y) = each($matches)) {
+ while (list ( , $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
assert($y < $this->seq[$k]);
// Optimization: this is a common case:
* Set this to false to show a creation checkbox.
*/
public function getWebUserBox( $noCreateMsg = false ) {
- $name = $this->getName();
$s = Html::openElement( 'fieldset' ) .
Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
$this->getCheckBox(
if ( !$create ) {
// Test the web account
try {
- $webConn = new Database(
+ new Database(
$this->getVar( 'wgDBserver' ),
$this->getVar( 'wgDBuser' ),
$this->getVar( 'wgDBpassword' ),
$prev_namespace = $row->cur_namespace;
}
$sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
- $rows = $this->db->query( $sql, __METHOD__ );
+ $this->db->query( $sql, __METHOD__ );
$this->output( wfTimestamp( TS_DB ) );
$this->output( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" );
}
}
public function getWebUserBox( $noCreateMsg = false ) {
- $name = $this->getName();
$this->parent->setVar( '_SameAccount', false );
$this->parent->setVar( '_CreateDBAccount', true );
$this->parent->setVar( 'wgDBname', '' );
}
function getMetadata( $file, $filename ) {
- $metadata = array();
try {
$metadata = SVGMetadataExtractor::getMetadata( $filename );
} catch( Exception $e ) {
$current = null;
foreach ( $this->internals as $ns => $entries ) {
foreach ( $entries as $index => $entry ) {
- $key = "$ns:$index";
$title = $entry['title'];
$pdbk = $entry['pdbk'];
wfProfileIn( __METHOD__ );
$lines = StringUtils::explode( "\n", $text );
- $text = null;
$out = '';
$td_history = array(); # Is currently a td tag open?
$last_tag_history = array(); # Save history of last lag activated (td, th or caption)
// another heading. Infinite loops are avoided because the next iteration MUST
// hit the heading open case above, which unconditionally increments the
// input pointer.
- }
-
- elseif ( $found == 'open' ) {
+ } elseif ( $found == 'open' ) {
# count opening brace characters
$count = strspn( $text, $curChar, $i );
$accum .= htmlspecialchars( str_repeat( $curChar, $count ) );
}
$i += $count;
- }
-
- elseif ( $found == 'close' ) {
+ } elseif ( $found == 'close' ) {
$piece = $stack->top;
# lets check if there are enough characters for closing brace
$maxCount = $piece->count;
$iteratorStack[$level] = false;
}
- if ( $contextNode instanceof PPNode_DOM ) $contextNode = $contextNode->node;
+ if ( $contextNode instanceof PPNode_DOM ) {
+ $contextNode = $contextNode->node;
+ }
$newIterator = false;
$this->form();
if( $this->opts->getValue( 'rev1' ) && $this->opts->getValue( 'rev2' ) ) {
- $title = Title::newFromText( $this->opts->getValue( 'page2' ) );
$de = new DifferenceEngine( null,
$this->opts->getValue( 'rev1' ),
$this->opts->getValue( 'rev2' ),
global $wgOut;
// Figure out the active search profile header
$nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
- if( $this->searchAdvanced )
+ if( $this->searchAdvanced ) {
$this->active = 'advanced';
- else {
+ } else {
$profiles = $this->getSearchProfiles();
foreach( $profiles as $key => $data ) {
if( !is_null($infoLine) ) {
$out .= "\n<!-- {$infoLine} -->\n";
}
- $off = $this->offset + 1;
$out .= "<ul class='mw-search-results'>\n";
while( $result = $matches->next() ) {
$out .= $this->showHit( $result, $terms );
$out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".
wfMsg('search-interwiki-caption')."</div>\n";
- $off = $this->offset + 1;
$out .= "<ul class='mw-search-iwresults'>\n";
// work out custom project captions
$wgOut->addWikiMsg( 'accmailtext', $u->getName(), $u->getEmail() );
$wgOut->returnToMain( false );
}
- $u = 0;
}
/**
}
wfDebug( __METHOD__ . ": creating account\n" );
- $user = $this->initUser( $user, true );
+ $this->initUser( $user, true );
return self::SUCCESS;
}
protected function verifyFile() {
# get the title, even though we are doing nothing with it, because
# we need to populate mFinalExtension
- $nt = $this->getTitle();
+ $this->getTitle();
$this->mFileProps = File::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
$this->checkMacBinary();
while ( true ) {
try {
$text = $this->getTextDb( $id );
- $ex = new MWException( "Graceful storage failure" );
} catch ( DBQueryError $ex ) {
$text = false;
}
$dbw = wfGetDB( DB_MASTER );
$page = $dbw->tableName( 'page' );
$revision = $dbw->tableName( 'revision' );
- $text = $dbw->tableName( 'text' );
if ( $fix ) {
$dbw->lockTables( $dbw, 'text', __METHOD__ );
$maxlag = intval( $maxlag );
$throttle = intval( $throttle );
- $force = (bool)$force;
if ( $begin !== '' ) {
$where = 'cl_to > ' . $dbw->addQuotes( $begin );
} else {
# Update recent changes if required
if ( $rc ) {
$this->output( "Updating recent changes..." );
- $res = $dbw->update( 'recentchanges', $this->userSpecification( $to, 'rc_user', 'rc_user_text' ), $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
+ $dbw->update( 'recentchanges', $this->userSpecification( $to, 'rc_user', 'rc_user_text' ), $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
$this->output( "done.\n" );
}
}
$this->assertTrue( $exception, "Got exception" );
self::$user->addGroup( 'sysop' );
- $exception = false;
$data = $this->doApiRequest( array(
'action' => 'upload',
'url' => 'http://bits.wikimedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png',
global $wgUser;
$wgUser = self::$users['uploader']->user;
- $extension = 'png';
$mimeType = 'image/png';
$filePath = tempnam( wfTempDir(), "" );
$hash = File::sha1Base36( $filePath );
$dupes = RepoGroup::singleton()->findBySha1( $hash );
$success = true;
- foreach ( $dupes as $key => $dupe ) {
+ foreach ( $dupes as $dupe ) {
$success &= $this->deleteFileByTitle( $dupe->getTitle() );
}
return $success;
$args[] = $filename;
$command = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " . implode( " ", $args );
+ $retval = null;
$output = wfShellExec( $command, $retval );
return ( $retval === 0 );
}