Page MenuHomePhabricator

change-tags-fix.patch

Authored By
bzimport
Nov 21 2014, 10:53 PM
Size
5 KB
Referenced Files
None
Subscribers
None

change-tags-fix.patch

Index: includes/api/ApiQueryLogEvents.php
===================================================================
--- includes/api/ApiQueryLogEvents.php (revision 61453)
+++ includes/api/ApiQueryLogEvents.php (working copy)
@@ -68,7 +68,7 @@
'page' => array( 'LEFT JOIN',
array( 'log_namespace=page_namespace',
'log_title=page_title' ) ) ) );
- $index = 'times'; // default, may change
+ $index['logging'] = 'times'; // default, may change
$this->addFields( array (
'log_type',
@@ -96,11 +96,12 @@
$this->addTables( 'change_tag' );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'log_id=ct_log_id' ) ) ) );
$this->addWhereFld( 'ct_tag', $params['tag'] );
+ $index['change_tag'] = 'change_tag_tag_id';
}
if ( !is_null( $params['type'] ) ) {
$this->addWhereFld( 'log_type', $params['type'] );
- $index = 'type_time';
+ $index['logging'] = 'type_time';
}
$this->addWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] );
@@ -114,7 +115,7 @@
if ( !$userid )
$this->dieUsage( "User name $user not found", 'param_user' );
$this->addWhereFld( 'log_user', $userid );
- $index = 'user_time';
+ $index['logging'] = 'user_time';
}
$title = $params['title'];
@@ -126,10 +127,10 @@
$this->addWhereFld( 'log_title', $titleObj->getDBkey() );
// Use the title index in preference to the user index if there is a conflict
- $index = is_null( $user ) ? 'page_time' : array( 'page_time', 'user_time' );
+ $index['logging'] = is_null( $user ) ? 'page_time' : array( 'page_time', 'user_time' );
}
- $this->addOption( 'USE INDEX', array( 'logging' => $index ) );
+ $this->addOption( 'USE INDEX', $index );
// Paranoia: avoid brute force searches (bug 17342)
if ( !is_null( $title ) ) {
Index: includes/api/ApiQueryRecentChanges.php
===================================================================
--- includes/api/ApiQueryRecentChanges.php (revision 61453)
+++ includes/api/ApiQueryRecentChanges.php (working copy)
@@ -113,7 +113,7 @@
*/
$db = $this->getDB();
$this->addTables( 'recentchanges' );
- $index = 'rc_timestamp'; // May change
+ $index['recentchanges'] = 'rc_timestamp'; // May change
$this->addWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
$this->addWhereFld( 'rc_namespace', $params['namespace'] );
$this->addWhereFld( 'rc_deleted', 0 );
@@ -160,7 +160,7 @@
if ( !is_null( $params['user'] ) )
{
$this->addWhereFld( 'rc_user_text', $params['user'] );
- $index = 'rc_user_text';
+ $index['recentchanges'] = 'rc_user_text';
}
if ( !is_null( $params['excludeuser'] ) )
@@ -226,10 +226,12 @@
$this->addTables( 'change_tag' );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rc_id=ct_rc_id' ) ) ) );
$this->addWhereFld( 'ct_tag' , $params['tag'] );
+ $index['change_tag'] = 'change_tag_tag_id';
}
+
$this->token = $params['token'];
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- $this->addOption( 'USE INDEX', array( 'recentchanges' => $index ) );
+ $this->addOption( 'USE INDEX', $index );
$count = 0;
/* Perform the actual query. */
Index: includes/api/ApiQueryRevisions.php
===================================================================
--- includes/api/ApiQueryRevisions.php (revision 61453)
+++ includes/api/ApiQueryRevisions.php (working copy)
@@ -156,6 +156,7 @@
$this->addTables( 'change_tag' );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
$this->addWhereFld( 'ct_tag' , $params['tag'] );
+ $index['change_tag'] = 'change_tag_tag_id';
}
if ( isset( $prop['content'] ) || !is_null( $this->difftotext ) ) {
@@ -294,6 +295,7 @@
ApiBase :: dieDebug( __METHOD__, 'param validation?' );
$this->addOption( 'LIMIT', $limit + 1 );
+ $this->addOption( 'USE INDEX', $index );
$data = array ();
$count = 0;
Index: includes/api/ApiQueryUserContributions.php
===================================================================
--- includes/api/ApiQueryUserContributions.php (revision 61453)
+++ includes/api/ApiQueryUserContributions.php (working copy)
@@ -237,7 +237,6 @@
}
$this->addTables( $tables );
- $this->addOption( 'USE INDEX', $index );
$this->addFieldsIf( 'rev_page', $this->fld_ids );
$this->addFieldsIf( 'rev_id', $this->fld_ids || $this->fld_flags );
$this->addFieldsIf( 'page_latest', $this->fld_flags );
@@ -259,7 +258,10 @@
$this->addTables( 'change_tag' );
$this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
$this->addWhereFld( 'ct_tag', $this->params['tag'] );
+ $index['change_tag'] = 'change_tag_tag_id';
}
+
+ $this->addOption( 'USE INDEX', $index );
}
/**
@@ -380,6 +382,7 @@
'!patrolled',
)
),
+ 'tag' => null,
);
}
@@ -396,6 +399,7 @@
'prop' => 'Include additional pieces of information',
'show' => array( 'Show only items that meet this criteria, e.g. non minor edits only: show=!minor',
'NOTE: if show=patrolled or show=!patrolled is set, revisions older than $wgRCMaxAge won\'t be shown', ),
+ 'tag' => 'Only list revisions tagged with this tag',
);
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5787
Default Alt Text
change-tags-fix.patch (5 KB)

Event Timeline