Legoktm has uploaded a new change for review.

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


Change subject: Show drafts after deletion and undeletion
......................................................................

Show drafts after deletion and undeletion

The page id will change upon deletion, so we need to use
page_title and page_namespace, which requires a new index
to be created.

Bug: 19734
Change-Id: I65ed7a47442828de8129d6372969a3d2d877ce28
---
M Drafts.classes.php
M Drafts.hooks.php
M Drafts.sql
A patch-titlensindex.sql
4 files changed, 5 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Drafts 
refs/changes/57/88257/1

diff --git a/Drafts.classes.php b/Drafts.classes.php
index 0d6e5b0..207e974 100644
--- a/Drafts.classes.php
+++ b/Drafts.classes.php
@@ -130,17 +130,8 @@
                );
                // Checks if specific title was given
                if ( $title !== null ) {
-                       // Get page id from title
-                       $pageId = $title->getArticleID();
-                       // Checks if page id exists
-                       if ( $pageId ) {
-                               // Adds specific page id to conditions
-                               $where['draft_page'] = $pageId;
-                       } else {
-                               // Adds new page information to conditions
-                               $where['draft_namespace'] = 
$title->getNamespace();
-                               $where['draft_title'] = $title->getDBkey();
-                       }
+                       $where['draft_namespace'] = $title->getNamespace();
+                       $where['draft_title'] = $title->getDBkey();
                }
                // Checks if a specific user was given
                if ( $userID !== null ) {
diff --git a/Drafts.hooks.php b/Drafts.hooks.php
index 0a5ef15..f024f9f 100644
--- a/Drafts.hooks.php
+++ b/Drafts.hooks.php
@@ -41,6 +41,7 @@
                        $updater->addExtensionUpdate( array( 'modifyField', 
'drafts', 'draft_token',
                                __DIR__ . '/patch-draft_token.sql', true ) );
                }
+               $updater->addExtensionIndex( 'drafts', 'draft_title', dirname( 
__FILE__ ) . '/patch-titlensindex.sql' );
                return true;
        }
 
diff --git a/Drafts.sql b/Drafts.sql
index c68ea6a..cf5bef6 100644
--- a/Drafts.sql
+++ b/Drafts.sql
@@ -36,3 +36,4 @@
 CREATE INDEX /*i*/draft_user_page_savetime ON /*_*/drafts ( draft_user, 
draft_page, draft_namespace, draft_title, draft_savetime );
 CREATE INDEX /*i*/draft_savetime ON /*_*/drafts (draft_savetime);
 CREATE INDEX /*i*/draft_page ON /*_*/drafts (draft_page);
+CREATE INDEX /*i*/draft_title ON /*_*/drafts (draft_title, draft_namespace);
diff --git a/patch-titlensindex.sql b/patch-titlensindex.sql
new file mode 100644
index 0000000..06da18c
--- /dev/null
+++ b/patch-titlensindex.sql
@@ -0,0 +1 @@
+CREATE INDEX /*i*/draft_title ON /*_*/drafts (draft_title, draft_namespace);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65ed7a47442828de8129d6372969a3d2d877ce28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Drafts
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to