r49591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49590‎ | r49591 | r49592 >
Date:05:27, 17 April 2009
Author:aaron
Status:deferred
Tags:
Comment:
* Made num() more consistent with get()
* Improved index usage of num() slightly
Modified paths:
  • /trunk/extensions/Drafts/Drafts.classes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Drafts/Drafts.classes.php
@@ -36,9 +36,18 @@
3737 );
3838 // Checks if a specific title was given
3939 if ( $title !== null ) {
40 - // Adds specific title to conditions
41 - $where['draft_namespace'] = $title->getNamespace();
42 - $where['draft_title'] = $title->getDBKey();
 40+ // Get page id from title
 41+ $pageId = $title->getArticleId();
 42+ // Checks if page id exists
 43+ if ( $pageId ) {
 44+ // Adds specific page id to conditions
 45+ $where['draft_page'] = $pageId;
 46+ } else {
 47+ // Adds new page information to conditions
 48+ $where['draft_page'] = 0; // page not created yet
 49+ $where['draft_namespace'] = $title->getNamespace();
 50+ $where['draft_title'] = $title->getDBKey();
 51+ }
4352 }
4453 // Checks if specific user was given
4554 if ( $userID !== null ) {
@@ -122,7 +131,7 @@
123132 );
124133 // Checks if specific title was given
125134 if ( $title !== null ) {
126 - // Gets page id from title
 135+ // Get page id from title
127136 $pageId = $title->getArticleId();
128137 // Checks if page id exists
129138 if ( $pageId ) {
@@ -672,9 +681,9 @@
673682 // Gets a draft token exists for the current user and article
674683 $existingRow = $dbw->selectField( 'drafts', 'draft_token',
675684 array(
 685+ 'draft_user' => $data['draft_user'],
676686 'draft_namespace' => $data['draft_namespace'],
677687 'draft_title' => $data['draft_title'],
678 - 'draft_user' => $data['draft_user'],
679688 'draft_token' => $data['draft_token']
680689 ),
681690 __METHOD__

Status & tagging log