public static function truncateArray( &$arr, $limit ) {
$modified = false;
while ( count( $arr ) > $limit ) {
- $junk = array_pop( $arr );
+ array_pop( $arr );
$modified = true;
}
return $modified;
}
// Move the page
- $hookErr = null;
$retval = $fromTitle->moveTo( $toTitle, true, $params['reason'], !$params['noredirect'] );
if ( $retval !== true ) {
$this->dieUsageMsg( reset( $retval ) );
}
$r = array( 'from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason'] );
- if ( !$params['noredirect'] || !$wgUser->isAllowed( 'suppressredirect' ) )
- {
+ if ( !$params['noredirect'] || !$wgUser->isAllowed( 'suppressredirect' ) ) {
$r['redirectcreated'] = '';
}
// Move the talk page
- if ( $params['movetalk'] && $fromTalk->exists() && !$fromTitle->isTalkPage() )
- {
+ if ( $params['movetalk'] && $fromTalk->exists() && !$fromTitle->isTalkPage() ) {
$retval = $fromTalk->moveTo( $toTalk, true, $params['reason'], !$params['noredirect'] );
if ( $retval === true ) {
$r['talkfrom'] = $fromTalk->getPrefixedText();
$this->dieUsage( 'The page parameter cannot be used together with the text and title parameters', 'params' );
}
$prop = array_flip( $params['prop'] );
- $revid = false;
if ( isset( $params['section'] ) ) {
$this->section = $params['section'];
$res = $this->select( __METHOD__ );
- $data = array();
$count = 0;
$lastUserData = false;
$lastUser = false;
}
// Get all requested messages and print the result
- $messages = array();
$skip = !is_null( $params['from'] );
$result = $this->getResult();
foreach ( $messages_target as $message ) {
* AND pl_title='Foo' AND pl_namespace=0
* LIMIT 11 ORDER BY pl_from
*/
- $db = $this->getDB();
$this->addTables( array( $this->bl_table, 'page' ) );
$this->addWhere( "{$this->bl_from}=page_id" );
if ( is_null( $resultPageSet ) ) {
$this->processContinue();
$this->prepareFirstQuery( $resultPageSet );
- $db = $this->getDB();
$res = $this->select( __METHOD__ . '::firstQuery' );
$count = 0;
$fld_flags = isset( $prop['flags'] );
$result = $this->getResult();
- $pageSet = $this->getPageSet();
- $titles = $pageSet->getTitles();
- $data = array();
$this->addTables( 'ipblocks' );
$this->addFields( 'ipb_auto' );
$this->addOption( 'ORDER BY', "cl_from, cl_to" );
}
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
if ( is_null( $resultPageSet ) ) {
}
$this->addOption( 'ORDER BY', 'cat_title' );
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
$catids = array_flip( $cattitles );
$limit = $params['limit'];
$this->addOption( 'LIMIT', $limit + 1 );
- $db = $this->getDB();
-
- $data = array();
$count = 0;
$lastSortKey = null;
$res = $this->select( __METHOD__ );
$result = $this->getResult();
$pageSet = $this->getPageSet();
$titles = $pageSet->getTitles();
- $data = array();
// This module operates in three modes:
// 'revs': List deleted revs for certain titles
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );
- $db = $this->getDB();
$count = 0;
$titles = array();
foreach ( $res as $row ) {
$this->addOption( 'OFFSET', $params['offset'] );
}
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
$count = 0;
$params = $this->extractRequestParams();
$prop = array_flip( $params['prop'] );
- $fld_id = isset( $prop['id'] );
$fld_sha1 = isset( $prop['sha1'] );
$fld_timestamp = isset( $prop['timestamp'] );
$fld_user = isset( $prop['user'] );
$res = $this->select( __METHOD__ );
- $titles = array();
$count = 0;
$result = $this->getResult();
foreach ( $res as $row ) {
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
$pages = array();
$res = $this->select( __METHOD__ );
$count = 0;
- $db = $this->getDB();
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
if ( is_null( $resultPageSet ) ) {
$this->pageLatest = $pageSet->getCustomField( 'page_latest' );
$this->pageLength = $pageSet->getCustomField( 'page_len' );
- $db = $this->getDB();
// Get protection info if requested
if ( $this->fld_protection ) {
$this->getProtectionInfo();
if ( !count( $pageIds ) ) {
return;
}
-
- $db = $this->getDB();
$this->resetQueryParams();
$this->addTables( 'page_props' );
$res = $this->select( __METHOD__ );
$count = 0;
- $db = $this->getDB();
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
$this->addOption( 'USE INDEX', "{$this->prefix}_from" );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
if ( is_null( $resultPageSet ) ) {
$this->fld_details = isset( $prop['details'] );
$this->fld_tags = isset( $prop['tags'] );
- list( $tbl_logging, $tbl_page, $tbl_user ) = $db->tableNamesN( 'logging', 'page', 'user' );
-
$hideLogs = LogEventsList::getExcludeClause( $db );
if ( $hideLogs !== false ) {
$this->addWhere( $hideLogs );
}
private function run( $resultPageSet = null ) {
- $db = $this->getDB();
$params = $this->extractRequestParams();
$this->addTables( 'protected_titles' );
}
protected function runQuery( &$resultPageSet ) {
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
$count = 0;
foreach ( $res as $row ) {
* AND rc_timestamp < $end AND rc_namespace = $namespace
* AND rc_deleted = '0'
*/
- $db = $this->getDB();
$this->addTables( 'recentchanges' );
$index = array( 'recentchanges' => 'rc_timestamp' ); // May change
$this->addWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
$count = 0;
/* Perform the actual query. */
- $db = $this->getDB();
$res = $this->select( __METHOD__ );
/* Iterate through the rows, adding data extracted from them to our query result. */
$this->addOption( 'LIMIT', $limit + 1 );
$this->addOption( 'USE INDEX', $index );
- $data = array();
$count = 0;
$res = $this->select( __METHOD__ );
$this->addOption( 'ORDER BY', 'iw_prefix' );
- $db = $this->getDB();
- $res = $this->select( __METHOD__ );
+ $res = $this->select( __METHOD__ );
$data = array();
$langNames = Language::getLanguageNames();
$this->limit = $params['limit'];
$this->result = $this->getResult();
- $pageSet = $this->getPageSet();
- $titles = $pageSet->getTitles();
- $data = array();
-
$this->addTables( 'change_tag' );
$this->addFields( 'ct_tag' );
// TODO: if the query is going only against the revision table, should this be done?
$this->selectNamedDB( 'contributions', DB_SLAVE, 'contributions' );
- $db = $this->getDB();
if ( isset( $this->params['userprefix'] ) ) {
$this->prefixMode = true;
public function execute() {
$params = $this->extractRequestParams();
$result = $this->getResult();
- $r = array();
if ( !is_null( $params['prop'] ) ) {
$this->prop = array_flip( $params['prop'] );
}
if ( count( $goodNames ) ) {
- $db = $this->getDb();
$this->addTables( 'user', 'u1' );
$this->addFields( 'u1.*' );
$this->addWhereFld( 'u1.user_name', $goodNames );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );
- $db = $this->getDB();
$titles = array();
$count = 0;
foreach ( $res as $row ) {