Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/116115

Change subject: Add index on revision user data
......................................................................

Add index on revision user data

It's part of Special:Contributions' WHERE-clause

Change-Id: Icedaf6b164f920160e6c9b886eb1c32ef0ad802e
---
M Hooks.php
A db_patches/patch-revision_user_idx.sql
M flow.sql
M includes/Formatter/ContributionsQuery.php
4 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/15/116115/1

diff --git a/Hooks.php b/Hooks.php
index 83a7a42..961395b 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -66,6 +66,7 @@
                $updater->modifyExtensionField( 'recentchanges', 'rc_source', 
"$dir/db_patches/patch-rc_source.sql" );
                $updater->modifyExtensionField( 'flow_revision', 
'rev_change_type', "$dir/db_patches/patch-censor_to_suppress.sql" );
                $updater->addExtensionField( 'flow_workflow', 
'workflow_user_ip', "$dir/db_patches/patch-remove_usernames.sql" );
+               $updater->addExtensionIndex( 'flow_revision', 
'flow_revision_user', "$dir/db_patches/patch-revision_user_idx.sql" );
 
                require_once 
__DIR__.'/maintenance/FlowInsertDefaultDefinitions.php';
                $updater->addPostDatabaseUpdateMaintenance( 
'FlowInsertDefaultDefinitions' );
diff --git a/db_patches/patch-revision_user_idx.sql 
b/db_patches/patch-revision_user_idx.sql
new file mode 100644
index 0000000..ee15e5d
--- /dev/null
+++ b/db_patches/patch-revision_user_idx.sql
@@ -0,0 +1,2 @@
+-- Special:Contributions can do queries based on user id/ip
+CREATE INDEX /*i*/flow_revision_user ON /*_*/flow_revision (rev_user_id, 
rev_user_ip);
diff --git a/flow.sql b/flow.sql
index 1832689..b6e4095 100644
--- a/flow.sql
+++ b/flow.sql
@@ -132,6 +132,10 @@
 CREATE UNIQUE INDEX /*i*/flow_revision_unique_parent ON
        /*_*/flow_revision (rev_parent_id);
 
+-- Special:Contributions can do queries based on user id/ip
+CREATE INDEX /*i*/flow_revision_user ON
+       /*_*/flow_revision (rev_user_id, rev_user_ip);
+
 -- Closure table implementation of tree storage in sql
 -- We may be able to go simpler than this
 CREATE TABLE /*_*/flow_tree_node (
diff --git a/includes/Formatter/ContributionsQuery.php 
b/includes/Formatter/ContributionsQuery.php
index 4cb28c2..11f7989 100644
--- a/includes/Formatter/ContributionsQuery.php
+++ b/includes/Formatter/ContributionsQuery.php
@@ -195,6 +195,7 @@
                        if ( $uid ) {
                                $conditions['rev_user_id'] = $uid;
                        } else {
+                               $conditions['rev_user_id'] = 0;
                                $conditions['rev_user_ip'] = $pager->target;
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/116115
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icedaf6b164f920160e6c9b886eb1c32ef0ad802e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to