'GROUP BY' => array( 'rev_user', 'rev_user_text' ),
'ORDER BY' => 'timestamp DESC',
);
-
+
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $jconds );
return new UserArrayFromResult( $res );
}
if ( $wgOut->isPrintable() ) {
$parserOptions->setIsPrintable( true );
$parserOptions->setEditSection( false );
- } else if ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
+ } elseif ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
$parserOptions->setEditSection( false );
}
return;
# Try file cache
- } else if ( $wgUseFileCache && $this->tryFileCache() ) {
+ } elseif ( $wgUseFileCache && $this->tryFileCache() ) {
wfDebug( __METHOD__ . ": done file cache\n" );
# tell wgOut that output is taken care of
$wgOut->disable();
if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
$wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
array( 'userpage-userdoesnotexist-view', $rootPart ) );
- } else if ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
+ } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$wgOut,
'block',
return false;
// If the user needs to confirm that they want to see it...
- } else if ( $wgRequest->getInt( 'unhide' ) != 1 ) {
+ } elseif ( $wgRequest->getInt( 'unhide' ) != 1 ) {
# Give explanation and add a link to view the revision...
$oldid = intval( $this->getOldID() );
$link = $this->mTitle->getFullUrl( "oldid={$oldid}&unhide=1" );
if ( $s === false ) {
# No one else ever edited this page
return array( array( 'cantrollback' ) );
- } else if ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
+ } elseif ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
# Only admins can see this text
return array( array( 'notvisiblerev' ) );
}
# Diff link
if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
- } else if( !self::userCan($rc,Revision::DELETED_TEXT) ) {
+ } elseif( !self::userCan($rc,Revision::DELETED_TEXT) ) {
$diffLink = $this->message['diff'];
} else {
$query = array(
array(), array( 'redirect' => 'no' ) ),
$this->skin->linkKnown( $rc->getMovedToTitle() ) );
// New unpatrolled pages
- } else if( $rc->unpatrolled && $type == RC_NEW ) {
+ } elseif( $rc->unpatrolled && $type == RC_NEW ) {
$clink = $this->skin->linkKnown( $rc->getTitle(), null, array(),
array( 'rcid' => $rc->mAttribs['rc_id'] ) );
// Log entries
- } else if( $type == RC_LOG ) {
+ } elseif( $type == RC_LOG ) {
if( $logType ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
$clink = '(' . $this->skin->linkKnown( $logtitle,
if( !$showdifflinks ) {
$curLink = $this->message['cur'];
$diffLink = $this->message['diff'];
- } else if( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+ } elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
if ( $type != RC_NEW ) {
$curLink = $this->message['cur'];
} else {
# Make "last" link
if( !$showdifflinks || !$lastOldid ) {
$lastLink = $this->message['last'];
- } else if( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+ } elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
$lastLink = $this->message['last'];
} else {
$lastLink = $this->skin->linkKnown( $rc->getTitle(), $this->message['last'],
# Article link
if( $namehidden ) {
$r .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
- } else if( $allLogs ) {
+ } elseif( $allLogs ) {
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
$r .= '(';
if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT ) ) {
$r .= $nchanges[$n];
- } else if( $isnew ) {
+ } elseif( $isnew ) {
$r .= $nchanges[$n];
} else {
$params = $queryParams;
# History
if( $allLogs ) {
// don't show history link for logs
- } else if( $namehidden || !$block[0]->getTitle()->exists() ) {
+ } elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
$r .= $this->message['pipe-separator'] . $this->message['hist'] . ')';
} else {
$params = $queryParams;
if( $type == RC_LOG ) {
$link = $rcObj->timestamp;
# Revision link
- } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
+ } elseif( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
$link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
} else {
if ( $rcObj->unpatrolled && $type == RC_NEW) {
// was created, or we may simply have got bogus input.
$this->editFormPageTop .= $wgOut->parse( '<div class="error mw-undo-norev">' . wfMsgNoTrans( 'undo-norev' ) . '</div>' );
}
- } else if ( $section != '' ) {
+ } elseif ( $section != '' ) {
if ( $section == 'new' ) {
$text = $this->getPreloadedText( $preload );
} else {
} else {
if ( $this->save ) {
$this->formtype = 'save';
- } else if ( $this->preview ) {
+ } elseif ( $this->preview ) {
$this->formtype = 'preview';
- } else if ( $this->diff ) {
+ } elseif ( $this->diff ) {
$this->formtype = 'diff';
} else { # First time through
$this->firsttime = true;
} elseif ( $wgRequest->getVal( 'preview' ) == 'no' ) {
// Explicit override from request
return false;
- } elseif ( $this->section == 'new' ) {
+ } elseif ( $this->section == 'new' ) {
// Nothing *to* preview for new sections
return false;
} elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
# The unmarked state will be assumed to be a save,
# if the form seems otherwise complete.
wfDebug( __METHOD__ . ": Passed token check.\n" );
- } else if ( $this->diff ) {
+ } elseif ( $this->diff ) {
# Failed token check, but only requested "Show Changes".
wfDebug( __METHOD__ . ": Failed token check; Show Changes requested.\n" );
} else {
if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
$wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
array( 'userpage-userdoesnotexist', $username ) );
- } else if ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
+ } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$wgOut,
'block',
}
$text = $this->textbox1;
- if ( $this->section == 'new' && $this->summary != '' ) {
+ if ( $this->section == 'new' && $this->summary != '' ) {
$text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text;
}
wfDebug( __METHOD__ . ": activating conflict; section replace failed.\n" );
$this->isConflict = true;
$text = $this->textbox1; // do not try to merge here!
- } else if ( $this->isConflict ) {
+ } elseif ( $this->isConflict ) {
# Attempt merge
if ( $this->mergeChangesInto( $text ) ) {
// Successful merge! Maybe we should tell the user the good news?
}
# Handle the user preference to force summaries here, but not for null edits
- if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text )
+ if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text )
&& !Title::newFromRedirect( $text ) ) # check if it's not a redirect
{
if ( md5( $this->summary ) == $this->autoSumm ) {
}
# And a similar thing for new sections
- if ( $this->section == 'new' && !$this->allowBlankSummary ) {
+ if ( $this->section == 'new' && !$this->allowBlankSummary ) {
if ( trim( $this->summary ) == '' ) {
$this->missingSummary = true;
wfProfileOut( __METHOD__ );
# All's well
wfProfileIn( __METHOD__ . '-sectionanchor' );
$sectionanchor = '';
- if ( $this->section == 'new' ) {
+ if ( $this->section == 'new' ) {
if ( $this->textbox1 == '' ) {
$this->missingComment = true;
wfProfileOut( __METHOD__ . '-sectionanchor' );
}
$wgOut->addHTML( $this->editFormTextBeforeContent );
-
+
$wgOut->addHTML( $toolbar );
if ( $this->isConflict ) {
if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) {
$wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' );
- } else if ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
+ } elseif ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
$wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' );
}
} else {
$note = wfMsg( 'session_fail_preview' );
}
- } else if ( $this->incompleteForm ) {
+ } elseif ( $this->incompleteForm ) {
$note = wfMsg( 'edit_form_incomplete' );
} else {
$note = wfMsg( 'previewnote' );
array( 'name' => 'ids[' . $rev->getId() . ']' ) );
}
// User can only view deleted revisions...
- } else if ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
+ } elseif ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
// If revision was hidden from sysops, disable the link
if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
$cdel = $this->getSkin()->revDeleteLinkDisabled( false );
if ( !$rev->userCan( Revision::DELETED_TEXT ) ) {
$radio['disabled'] = 'disabled';
$checkmark = array(); // We will check the next possible one
- } else if ( !$this->oldIdChecked ) {
+ } elseif ( !$this->oldIdChecked ) {
$checkmark = array( 'checked' => 'checked' );
$this->oldIdChecked = $id;
} else {
'should return true to continue hook processing or false to abort.'
);
}
- } else if ( !$retval ) {
+ } elseif ( !$retval ) {
return false;
}
}
}
if ( $level == count( $levels ) ) {
$levels[$level - 1] = $line;
- } else if ( $level > count( $levels ) ) {
+ } elseif ( $level > count( $levels ) ) {
$levels[] = $line;
}
}
* @param $target Title
* @param $attribs
* @param $options
- *
+ *
* @return array
*/
private static function linkAttribs( $target, $attribs, $options ) {
// we don't want it to be limited by its "normal" width.
global $wgSVGMaxSize;
$hp['width'] = $wgSVGMaxSize;
- } else {
+ } else {
$hp['width'] = $file->getWidth( $page );
}
static function revUserLink( $rev, $isPublic = false ) {
if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
$link = wfMsgHtml( 'rev-deleted-user' );
- } else if ( $rev->userCan( Revision::DELETED_USER ) ) {
+ } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
$link = self::userLink( $rev->getUser( Revision::FOR_THIS_USER ),
$rev->getUserText( Revision::FOR_THIS_USER ) );
} else {
static function revUserTools( $rev, $isPublic = false ) {
if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
$link = wfMsgHtml( 'rev-deleted-user' );
- } else if ( $rev->userCan( Revision::DELETED_USER ) ) {
+ } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
$userId = $rev->getUser( Revision::FOR_THIS_USER );
$userText = $rev->getUserText( Revision::FOR_THIS_USER );
$link = self::userLink( $userId, $userText ) .
}
if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
$block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
- } else if ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
+ } elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
$block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
$rev->getTitle(), $local );
} else {
foreach ( $tree as $section ) {
if ( $section['toclevel'] > $lastLevel )
$toc .= self::tocIndent();
- else if ( $section['toclevel'] < $lastLevel )
+ elseif ( $section['toclevel'] < $lastLevel )
$toc .= self::tocUnindent(
$lastLevel - $section['toclevel'] );
else
* @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 Xml::tags( 'li', array( "class" => implode( ' ', $classes ) ),
$del . "$time $userLink $action $comment $revert $tagDisplay" ) . "\n";
}
-
+
private function logTimestamp( $row ) {
global $wgLang;
$time = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->log_timestamp ), true );
}
return $action;
}
-
+
private function logComment( $row ) {
global $wgContLang;
if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
) . ')';
}
// Show undelete link
- } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
+ } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
if( !$wgUser->isAllowed( 'undelete' ) ) {
$viewdeleted = $this->message['undeleteviewlink'];
} else {
array( 'known', 'noclasses' )
) . ')';
// Show unblock/change block link
- } else if( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
+ } elseif( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
$revert = '(' .
$this->skin->link(
SpecialPage::getTitleFor( 'Unblock', $row->log_title ),
) .
')';
// Show change protection link
- } else if( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
+ } elseif( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
$revert .= ' (' .
$this->skin->link( $title,
$this->message['hist'],
}
$revert .= ')';
// Show unmerge link
- } else if( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
+ } elseif( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
$revert = '(' . $this->skin->link(
SpecialPage::getTitleFor( 'MergeHistory' ),
$this->message['revertmerge'],
array( 'known', 'noclasses' )
) . ')';
// If an edit was hidden from a page give a review link to the history
- } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
+ } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
$revert = RevisionDeleter::getLogLinks( $title, $paramArray,
$this->skin, $this->message );
// Hidden log items, give review link
- } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
+ } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
if( count($paramArray) >= 1 ) {
$revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
// $paramArray[1] is a CSV of the IDs
// Link to each hidden object ID, $paramArray[1] is the url param
$revert = '(' . $this->skin->link(
$revdel,
- $this->message['revdel-restore'],
+ $this->message['revdel-restore'],
array(),
array(
'target' => $title->getPrefixedText(),
) . ')';
}
// Self-created users
- } else if( self::typeAction( $row, 'newusers', 'create2' ) ) {
+ } elseif( self::typeAction( $row, 'newusers', 'create2' ) ) {
if( isset( $paramArray[0] ) ) {
$revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true );
} else {
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
- } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+ } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
$this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
' != ' . LogPage::SUPPRESSED_USER;
}
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $db->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0';
- } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+ } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
$this->mConds[] = $db->bitAnd('log_deleted', LogPage::SUPPRESSED_ACTION) .
' != ' . LogPage::SUPPRESSED_ACTION;
}
# Avoid usage of the wrong index by limiting
# the choices of available indexes. This mainly
# avoids site-breaking filesorts.
- } else if( $this->title || $this->pattern || $this->user ) {
+ } elseif( $this->title || $this->pattern || $this->user ) {
$index['logging'] = array( 'page_time', 'user_time' );
if( count($this->types) == 1 ) {
$index['logging'][] = 'log_user_type_time';
}
- } else if( count($this->types) == 1 ) {
+ } elseif( count($this->types) == 1 ) {
$index['logging'] = 'type_time';
} else {
$index['logging'] = 'times';
if ( $deprecated && $value !== false ) {
$this->setWarning( "The $encParamName parameter has been deprecated." );
}
- } else if ( $required ) {
+ } elseif ( $required ) {
$this->dieUsageMsg( array( 'missingparam', $paramName ) );
}
'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ),
'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ),
'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ),
-
+
'filename-tooshort' => array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ),
'illegal-filename' => array( 'code' => 'illegal-filename', 'info' => 'The filename is not allowed' ),
'filetype-missing' => array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ),
wfMsgReplaceArgs( self::$messageMap[$key]['info'], $error )
);
}
-
+
// If the key isn't present, throw an "unknown error"
return $this->parseMsg( array( 'unknownerror', $key ) );
}
'minor' => 'Minor edit',
'notminor' => 'Non-minor edit',
'bot' => 'Mark this edit as bot',
- 'basetimestamp' => array( 'Timestamp of the base revision (gotten through prop=revisions&rvprop=timestamp).',
+ 'basetimestamp' => array( 'Timestamp of the base revision (obtained through prop=revisions&rvprop=timestamp).',
'Used to detect edit conflicts; leave unset to ignore conflicts.'
),
'starttimestamp' => array( 'Timestamp when you obtained the edit token.',
$skip = true;
}
$messages_filtered[] = $message;
- } else if ( $skip ) {
+ } elseif ( $skip ) {
break;
}
}
$h = $image->getHandler();
if ( !$h ) {
- $this->setWarning( 'Could not create thumbnail because ' .
+ $this->setWarning( 'Could not create thumbnail because ' .
$image->getName() . ' does not have an associated image handler' );
return $thumbParams;
}
}
if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
- list( $ext, $mime ) = $file->getHandler()->getThumbType(
- substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
+ list( $ext, $mime ) = $file->getHandler()->getThumbType(
+ substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
$file->getMimeType(), $thumbParams );
$vals['thumbmime'] = $mime;
}
- } else if ( $mto && $mto->isError() ) {
+ } elseif ( $mto && $mto->isError() ) {
$vals['thumberror'] = $mto->toText();
}
}
/**
* Returns the descriptions for the properties provided by getPropertyNames()
- *
+ *
* @param array $filter List of properties to filter out
*
* @return array
'limit' => 'How many image revisions to return',
'start' => 'Timestamp to start listing from',
'end' => 'Timestamp to stop listing at',
- 'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
+ 'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
"Defaults to '1' for backwards compatibility" ),
'continue' => 'If the query response includes a continue value, use it here to get another page of results'
);
array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
array( 'code' => 'urlparam_urlwidth_mismatch', 'info' => "The width set in {$p}urlparm doesnt't " .
- "match the one in {$p}urlwidth" ),
+ "match the one in {$p}urlwidth" ),
) );
}
);
if ( $this->getModuleName() == self::LINKS ) {
$arr[$this->titlesParam] = 'Only list links to these titles. Useful for checking whether a certain page links to a certain title.';
- } else if ( $this->getModuleName() == self::TEMPLATES ) {
+ } elseif ( $this->getModuleName() == self::TEMPLATES ) {
$arr[$this->titlesParam] = 'Only list these templates. Useful for checking whether a certain page uses a certain template.';
}
return $arr;
list( $type, $action ) = explode( '/', $params['action'] );
$this->addWhereFld( 'log_type', $type );
$this->addWhereFld( 'log_action', $action );
- } else if ( !is_null( $params['type'] ) ) {
+ } elseif ( !is_null( $params['type'] ) ) {
$this->addWhereFld( 'log_type', $params['type'] );
$index['logging'] = 'type_time';
}
public function fileCacheTime() {
return wfTimestamp( TS_MW, filemtime( $this->fileCacheName() ) );
}
-
+
/**
* Check if pages can be cached for this request/user
* @return bool
}
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
- else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
+ elseif( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
continue;
- } else if( $query == 'usemsgcache' && $val == 'yes' ) {
+ } elseif( $query == 'usemsgcache' && $val == 'yes' ) {
continue;
}
// Below are header setting params
- else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
+ elseif( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
continue;
} else {
return false;
$retJOIN[] = $tableClause;
// Is there an INDEX clause?
- } else if ( isset( $use_index_safe[$alias] ) ) {
+ } elseif ( isset( $use_index_safe[$alias] ) ) {
$tableClause = $this->tableNameWithAlias( $table, $alias );
$tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$alias] ) );
$ret[] = $tableClause;
// Is there a JOIN clause?
- } else if ( isset( $join_conds_safe[$alias] ) ) {
+ } elseif ( isset( $join_conds_safe[$alias] ) ) {
$tableClause = $join_conds_safe[$alias][0] . ' ' . $this->tableNameWithAlias( $table, $alias );
$on = $this->makeList( (array)$join_conds_safe[$alias][1], LIST_AND );
if ( $on != '' ) {
$dollarquote = true;
}
}
- else if ( !$dollarquote ) {
+ elseif ( !$dollarquote ) {
if ( ';' == $line { $sl } && ( $sl < 2 || ';' != $line { $sl - 1 } ) ) {
$done = true;
$line = substr( $line, 0, $sl );
$row->Column_name = trim( $col );
$result[] = clone $row;
}
- } else if ( $index == 'PRIMARY' && stristr( $row->index_description, 'PRIMARY' ) ) {
+ } elseif ( $index == 'PRIMARY' && stristr( $row->index_description, 'PRIMARY' ) ) {
$row->Non_unique = 0;
$cols = explode( ", ", $row->index_keys );
foreach ( $cols as $col ) {
$tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
$retJOIN[] = $tableClause;
// Is there an INDEX clause?
- } else if ( isset( $use_index_safe[$table] ) ) {
+ } elseif ( isset( $use_index_safe[$table] ) ) {
$tableClause = $this->tableName( $table );
$tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$table] ) );
$ret[] = $tableClause;
// Is there a JOIN clause?
- } else if ( isset( $join_conds_safe[$table] ) ) {
+ } elseif ( isset( $join_conds_safe[$table] ) ) {
$tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table );
$tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
$retJOIN[] = $tableClause;
private $rows;
private $cursor;
private $nrows;
-
+
private $columns = array();
private function array_unique_md( $array_in ) {
$this->mServer = $server;
if ( !$dbName ) {
$this->mDBname = $user;
- } else {
+ } else {
$this->mDBname = $dbName;
}
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
-
+
$res->free();
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
-
+
return $res->fetchObject();
}
if ( is_numeric( $col ) ) {
$bind = $val;
$val = null;
- return $bind;
- } else if ( $includeCol ) {
+ return $bind;
+ } elseif ( $includeCol ) {
$bind = "$col = ";
}
-
+
if ( $val == '' && $val !== 0 && $col_type != 'BLOB' && $col_type != 'CLOB' ) {
$val = null;
}
} else {
$bind .= ':' . $col;
}
-
+
return $bind;
}
} else {
$first = false;
}
-
+
$sql .= $this->fieldBindStatement( $table, $col, $val );
}
$sql .= ')';
$this->delete( $table, $deleteConds, $fname );
}
-
+
if ( $sequenceData !== false && !isset( $row[$sequenceData['column']] ) ) {
$row[$sequenceData['column']] = $this->nextSequenceValue( $sequenceData['sequence'] );
}
if (!empty($prefix)) {
$listWhere = ' AND table_name LIKE \''.strtoupper($prefix).'%\'';
}
-
+
$owner = strtoupper( $this->mDBname );
$result = $this->doQuery( "SELECT table_name FROM all_tables WHERE owner='$owner' AND table_name NOT LIKE '%!_IDX\$_' ESCAPE '!' $listWhere" );
if( !$this->tableExists( $tableName ) ) {
return false;
}
-
+
return $this->doQuery( "DROP TABLE $tableName CASCADE CONSTRAINTS PURGE" );
}
$rset = $this->doQuery( 'SELECT version FROM product_component_version WHERE UPPER(product) LIKE \'ORACLE DATABASE%\'' );
if ( !( $row = $rset->fetchRow() ) ) {
return oci_server_version( $this->mConn );
- }
+ }
return $row['version'];
}
private function wrapFieldForWhere( $table, &$col, &$val ) {
global $wgContLang;
-
+
$col_info = $this->fieldInfoMulti( $table, $col );
$col_type = $col_info != false ? $col_info->type() : 'CONSTANT';
if ( $col_type == 'CLOB' ) {
function update( $table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array() ) {
global $wgContLang;
-
+
$table = $this->tableName( $table );
$opts = $this->makeUpdateOptions( $options );
$sql = "UPDATE $opts $table SET ";
-
+
$first = true;
foreach ( $values as $col => &$val ) {
$sqlSet = $this->fieldBindStatement( $table, $col, $val, true );
-
+
if ( !$first ) {
$sqlSet = ', ' . $sqlSet;
} else {
throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
}
- if ( $col_type == 'BLOB' ) {
- $lob[$col]->writeTemporary( $val );
+ if ( $col_type == 'BLOB' ) {
+ $lob[$col]->writeTemporary( $val );
oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, SQLT_BLOB );
} else {
$lob[$col]->writeTemporary( $val );
$this->in_seq[$this->seq[$k]] = false;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
- } else if ( empty( $this->in_seq[$y] ) ) {
+ } elseif ( empty( $this->in_seq[$y] ) ) {
$k = $this->_lcs_pos( $y );
assert( $k > 0 );
$ymids[$k] = $ymids[$k -1];
wfDl( 'php_wikidiff' );
wfProfileOut( __METHOD__ . '-php_wikidiff.so' );
}
- else if ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) {
+ elseif ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) {
wfProfileIn( __METHOD__ . '-php_wikidiff2.so' );
wfDl( 'wikidiff2' );
wfProfileOut( __METHOD__ . '-php_wikidiff2.so' );
}
if ( !$this->mNewRev->userCan( Revision::DELETED_TEXT ) ) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
- } else if ( $this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
+ } elseif ( $this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mNewtitle}</span>";
}
if ( !$this->mOldRev->userCan( Revision::DELETED_TEXT ) ) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldPagetitle . '</span>';
- } else if ( $this->mOldRev->isDeleted( Revision::DELETED_TEXT ) ) {
+ } elseif ( $this->mOldRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>';
}
}
$starty - 1, $V, $snake )
+ $this->lcs_rec( $startx + $len, $topl1, $starty + $len,
$topl2, $V, $snake );
- } else if ( $d == 1 ) {
+ } elseif ( $d == 1 ) {
/*
* In this case the sequences differ by exactly 1 line. We have
* already saved all the lines after the difference in the for loop
// check to see if we can cut down the diagonal range
if ( $x >= $N && $end_forward > $k - 1 ) {
$end_forward = $k - 1;
- } else if ( $absy - $bottoml2 >= $M ) {
+ } elseif ( $absy - $bottoml2 >= $M ) {
$start_forward = $k + 1;
$value_to_add_forward = 0;
}
if ( $x <= 0 ) {
$start_backward = $k + 1;
$value_to_add_backward = 0;
- } else if ( $y <= 0 && $end_backward > $k - 1 ) {
+ } elseif ( $y <= 0 && $end_backward > $k - 1 ) {
$end_backward = $k - 1;
}
}
// check to see if we can cut down the diagonal range
if ( $x >= $N && $end_forward > $k - 1 ) {
$end_forward = $k - 1;
- } else if ( $absy -$bottoml2 >= $M ) {
+ } elseif ( $absy -$bottoml2 >= $M ) {
$start_forward = $k + 1;
$value_to_add_forward = 0;
}
if ( $x <= 0 ) {
$start_backward = $k + 1;
$value_to_add_backward = 0;
- } else if ( $y <= 0 && $end_backward > $k - 1 ) {
+ } elseif ( $y <= 0 && $end_backward > $k - 1 ) {
$end_backward = $k - 1;
}
}
$max_progress[0][0] = $x;
$max_progress[0][1] = $y;
$max_progress[0][2] = $progress;
- } else if ( $progress == $max_progress[0][2] ) {
+ } elseif ( $progress == $max_progress[0][2] ) {
++$num_progress;
$max_progress[$num_progress][0] = $x;
$max_progress[$num_progress][1] = $y;
$max_progress[0][0] = $x;
$max_progress[0][1] = $y;
$max_progress[0][2] = $progress;
- } else if ( $progress == $max_progress[0][2] && !$max_progress_forward ) {
+ } elseif ( $progress == $max_progress[0][2] && !$max_progress_forward ) {
++$num_progress;
$max_progress[$num_progress][0] = $x;
$max_progress[$num_progress][1] = $y;
$this->initialCapital = MWNamespace::isCapitalized( NS_FILE );
foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
- 'descriptionCacheExpiry', 'hashLevels', 'url', 'thumbUrl', 'scriptExtension' )
+ 'descriptionCacheExpiry', 'hashLevels', 'url', 'thumbUrl', 'scriptExtension' )
as $var )
{
if ( isset( $info[$var] ) ) {
if ( $img && $img->exists() ) {
if ( !$img->isDeleted(File::DELETED_FILE) ) {
return $img;
- } else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
+ } elseif ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
return $img;
}
}
if ( $img && $img->exists() ) {
if ( !$img->isDeleted(File::DELETED_FILE) ) {
return $img;
- } else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
+ } elseif ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
return $img;
}
}
function getName() {
return $this->name;
}
-
+
/**
* Make an url to this repo
- *
+ *
* @param $query mixed Query string to append
* @param $entry string Entry point; defaults to index
* @return string
*/
function makeUrl( $query = '', $entry = 'index' ) {
$ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
- return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
- }
+ return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
+ }
/**
* Get the URL of an image description page. May return false if it is
$query .= '&uselang=' . $lang;
}
if ( isset( $this->scriptDirUrl ) ) {
- return $this->makeUrl(
+ return $this->makeUrl(
'title=' .
wfUrlencode( 'Image:' . $name ) .
"&$query" );
}
}
}
-
+
/**
* Get the URL of the stylesheet to apply to description pages
* @return string
array_unshift( $args, 'filerepo', $this->getName() );
return call_user_func_array( 'wfMemcKey', $args );
}
-
+
/**
* Get an UploadStash associated with this repo.
*
$c = hexdec($c);
if ($c <= 0x7F) {
return chr($c);
- } else if ($c <= 0x7FF) {
+ } elseif ($c <= 0x7FF) {
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
- } else if ($c <= 0xFFFF) {
+ } elseif ($c <= 0xFFFF) {
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
- } else if ($c <= 0x10FFFF) {
+ } elseif ($c <= 0x10FFFF) {
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
<?php
/*
* Copyright 2010 Wikimedia Foundation
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * specific language governing permissions and limitations under the License.
*/
/**
* Transforms CSS data
- *
+ *
* This class provides minification, URL remapping, URL extracting, and data-URL embedding.
- *
+ *
* @file
* @version 0.1.1 -- 2010-09-11
* @author Trevor Parscal <tparscal@wikimedia.org>
* @license http://www.apache.org/licenses/LICENSE-2.0
*/
class CSSMin {
-
+
/* Constants */
-
+
/**
* Maximum file size to still qualify for in-line embedding as a data-URI
*
*/
const EMBED_SIZE_LIMIT = 24576;
const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)(?P<query>\??[^\)\'"]*)[\'"]?\s*\)';
-
+
/* Protected Static Members */
-
+
/** @var array List of common image files extensions and mime-types */
protected static $mimeTypes = array(
'gif' => 'image/gif',
'tiff' => 'image/tiff',
'xbm' => 'image/x-xbitmap',
);
-
+
/* Static Methods */
-
+
/**
* Gets a list of local file paths which are referenced in a CSS style sheet
*
}
return $files;
}
-
+
protected static function getMimeType( $file ) {
$realpath = realpath( $file );
// Try a couple of different ways to get the mime-type of a file, in order of
// As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo
// PECL extension
return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
- } else if ( function_exists( 'mime_content_type' ) ) {
+ } elseif ( function_exists( 'mime_content_type' ) ) {
// Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file
return mime_content_type( $file );
} else {
}
return false;
}
-
+
/**
* Remaps CSS URL paths and automatically embeds data URIs for URL rules
* preceded by an /* @embed * / comment
}
if ( $replacement === false ) {
// Assume that all paths are relative to $remote, and make them absolute
- $replacement = "{$embed}{$pre}url({$url}){$post};";
+ $replacement = "{$embed}{$pre}url({$url}){$post};";
}
- } else if ( $local === false ) {
+ } elseif ( $local === false ) {
// Assume that all paths are relative to $remote, and make them absolute
$replacement = "{$embed}{$pre}url({$url}{$query}){$post};";
}
* @file
* @ingroup Media
*/
-
+
/**
* Handler for DjVu images
*
$image->djvuTextTree = false;
$tree = new SimpleXMLElement( $metadata );
if( $tree->getName() == 'mw-djvu' ) {
- foreach($tree->children() as $b){
+ foreach($tree->children() as $b){
if( $b->getName() == 'DjVuTxt' ) {
$image->djvuTextTree = $b;
}
- else if ( $b->getName() == 'DjVuXML' ) {
+ elseif ( $b->getName() == 'DjVuXML' ) {
$image->dejaMetaTree = $b;
}
}