Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -565,9 +565,10 @@ |
566 | 566 | $tags = $dbr->selectField('flaggedrevs', 'fr_tags', |
567 | 567 | array('fr_rev_id' => $rev_id ), |
568 | 568 | __METHOD__ ); |
569 | | - $tags = strval($tags); |
| 569 | + if( !$tags ) |
| 570 | + return false; |
570 | 571 | |
571 | | - return self::expandRevisionTags( $tags ); |
| 572 | + return self::expandRevisionTags( strval($tags) ); |
572 | 573 | } |
573 | 574 | |
574 | 575 | /** |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -99,8 +99,10 @@ |
100 | 100 | // We must at least rate each category as 1, the minimum |
101 | 101 | // Exception: we can rate ALL as unapproved to depreciate a revision |
102 | 102 | $valid = true; |
103 | | - if( $this->unapprovedTags && ($this->unapprovedTags < count($wgFlaggedRevTags) || !$this->oflags) ) |
104 | | - $valid = false; |
| 103 | + if( $this->unapprovedTags > 0 ) { |
| 104 | + if( $this->unapprovedTags < count($wgFlaggedRevTags) || !$this->oflags ) |
| 105 | + $valid = false; |
| 106 | + } |
105 | 107 | if( !$wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) ) |
106 | 108 | $valid = false; |
107 | 109 | |
— | — | @@ -270,6 +272,7 @@ |
271 | 273 | $wgOut->showErrorPage( 'internalerror', 'revnotfoundtext' ); |
272 | 274 | return; |
273 | 275 | } |
| 276 | + // We can only unapprove approved revisions... |
274 | 277 | } else { |
275 | 278 | $frev = FlaggedRevs::getFlaggedRev( $this->page, $this->oldid ); |
276 | 279 | // If we can't find this flagged rev, return to page??? |
— | — | @@ -439,11 +442,8 @@ |
440 | 443 | * @param Revision $rev |
441 | 444 | * Removes flagged revision data for this page/id set |
442 | 445 | */ |
443 | | - function unapproveRevision( $row=NULL ) { |
| 446 | + function unapproveRevision( $row ) { |
444 | 447 | global $wgUser, $wgParser, $wgFlaggedRevsWatch; |
445 | | - |
446 | | - if( is_null($row) ) |
447 | | - return false; |
448 | 448 | |
449 | 449 | $user = $wgUser->getId(); |
450 | 450 | |
— | — | @@ -451,8 +451,7 @@ |
452 | 452 | $dbw = wfGetDB( DB_MASTER ); |
453 | 453 | // Delete from flaggedrevs table |
454 | 454 | $dbw->delete( 'flaggedrevs', |
455 | | - array( 'fr_page_id' => $row->fr_page_id, |
456 | | - 'fr_rev_id' => $row->fr_rev_id ) ); |
| 455 | + array( 'fr_page_id' => $this->page->getArticleID(), 'fr_rev_id' => $row->fr_rev_id ) ); |
457 | 456 | // Wipe versioning params |
458 | 457 | $dbw->delete( 'flaggedtemplates', array( 'ft_rev_id' => $row->fr_rev_id ) ); |
459 | 458 | $dbw->delete( 'flaggedimages', array( 'fi_rev_id' => $row->fr_rev_id ) ); |