Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -115,7 +115,9 @@ |
116 | 116 | $options = array(); |
117 | 117 | $row = null; |
118 | 118 | # Short-circuit query |
119 | | - if( !$title->getArticleId() ) { |
| 119 | + $pageId = $title->getArticleID( $flags & FR_FOR_UPDATE ? GAID_FOR_UPDATE : 0 ); |
| 120 | + # Short-circuit query |
| 121 | + if( !$pageId ) { |
120 | 122 | return null; |
121 | 123 | } |
122 | 124 | # User master/slave as appropriate |
— | — | @@ -123,8 +125,8 @@ |
124 | 126 | $dbr = wfGetDB( DB_SLAVE ); |
125 | 127 | $row = $dbr->selectRow( array('flaggedpages','flaggedrevs'), |
126 | 128 | $columns, |
127 | | - array( 'fp_page_id' => $title->getArticleId(), |
128 | | - 'fr_page_id' => $title->getArticleId(), |
| 129 | + array( 'fp_page_id' => $pageId, |
| 130 | + 'fr_page_id = fp_page_id', |
129 | 131 | 'fp_stable = fr_rev_id' ), |
130 | 132 | __METHOD__ ); |
131 | 133 | if( !$row ) |
— | — | @@ -140,7 +142,7 @@ |
141 | 143 | if( FlaggedRevs::pristineVersions() && $config['select'] != FLAGGED_VIS_LATEST ) { |
142 | 144 | $prow = $dbw->selectRow( array('flaggedrevs','revision'), |
143 | 145 | $columns, |
144 | | - array( 'fr_page_id' => $title->getArticleID(), |
| 146 | + array( 'fr_page_id' => $pageId, |
145 | 147 | 'fr_quality = 2', |
146 | 148 | 'rev_id = fr_rev_id', |
147 | 149 | 'rev_page = fr_page_id', |
— | — | @@ -158,7 +160,7 @@ |
159 | 161 | "fr_rev_id > {$row->fr_rev_id}" : "1 = 1"; |
160 | 162 | $qrow = $dbw->selectRow( array('flaggedrevs','revision'), |
161 | 163 | $columns, |
162 | | - array( 'fr_page_id' => $title->getArticleID(), |
| 164 | + array( 'fr_page_id' => $pageId, |
163 | 165 | 'fr_quality = 1', |
164 | 166 | $newerClause, |
165 | 167 | 'rev_id = fr_rev_id', |
— | — | @@ -172,7 +174,7 @@ |
173 | 175 | if( !$row ) { |
174 | 176 | $row = $dbw->selectRow( array('flaggedrevs','revision'), |
175 | 177 | $columns, |
176 | | - array( 'fr_page_id' => $title->getArticleID(), |
| 178 | + array( 'fr_page_id' => $pageId, |
177 | 179 | 'rev_id = fr_rev_id', |
178 | 180 | 'rev_page = fr_page_id', |
179 | 181 | 'rev_deleted & '.Revision::DELETED_TEXT => 0), |