Index: trunk/extensions/Drafts/Drafts.classes.php |
— | — | @@ -36,9 +36,18 @@ |
37 | 37 | ); |
38 | 38 | // Checks if a specific title was given |
39 | 39 | 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 | + } |
43 | 52 | } |
44 | 53 | // Checks if specific user was given |
45 | 54 | if ( $userID !== null ) { |
— | — | @@ -122,7 +131,7 @@ |
123 | 132 | ); |
124 | 133 | // Checks if specific title was given |
125 | 134 | if ( $title !== null ) { |
126 | | - // Gets page id from title |
| 135 | + // Get page id from title |
127 | 136 | $pageId = $title->getArticleId(); |
128 | 137 | // Checks if page id exists |
129 | 138 | if ( $pageId ) { |
— | — | @@ -672,9 +681,9 @@ |
673 | 682 | // Gets a draft token exists for the current user and article |
674 | 683 | $existingRow = $dbw->selectField( 'drafts', 'draft_token', |
675 | 684 | array( |
| 685 | + 'draft_user' => $data['draft_user'], |
676 | 686 | 'draft_namespace' => $data['draft_namespace'], |
677 | 687 | 'draft_title' => $data['draft_title'], |
678 | | - 'draft_user' => $data['draft_user'], |
679 | 688 | 'draft_token' => $data['draft_token'] |
680 | 689 | ), |
681 | 690 | __METHOD__ |