Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -462,24 +462,8 @@ |
463 | 463 | * @return String |
464 | 464 | */ |
465 | 465 | protected function revisionDeleteLink( $rev ) { |
466 | | - $link = ''; |
467 | | - $user = $this->getUser(); |
468 | | - $canHide = $user->isAllowed( 'deleterevision' ); |
469 | | - // Show del/undel link if: |
470 | | - // (a) the user can delete revisions, or |
471 | | - // (b) the user can view deleted revision *and* this one is deleted |
472 | | - if ( $canHide || ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) { |
473 | | - if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) { |
474 | | - $link = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
475 | | - } else { |
476 | | - $query = array( |
477 | | - 'type' => 'revision', |
478 | | - 'target' => $rev->getTitle()->getPrefixedDBkey(), |
479 | | - 'ids' => $rev->getId() |
480 | | - ); |
481 | | - $link = Linker::revDeleteLink( $query, |
482 | | - $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide ); |
483 | | - } |
| 466 | + $link = Linker::getRevDeleteLink( $this->getUser(), $rev, $rev->getTitle() ); |
| 467 | + if ( $link !== '' ) { |
484 | 468 | $link = '   ' . $link . ' '; |
485 | 469 | } |
486 | 470 | return $link; |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1147,21 +1147,8 @@ |
1148 | 1148 | array( 'known', 'noclasses' ) |
1149 | 1149 | ); |
1150 | 1150 | |
1151 | | - $cdel = ''; |
1152 | | - |
1153 | | - // User can delete revisions or view deleted revisions... |
1154 | | - $canHide = $wgUser->isAllowed( 'deleterevision' ); |
1155 | | - if ( $canHide || ( $revision->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { |
1156 | | - if ( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) { |
1157 | | - $cdel = Linker::revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops |
1158 | | - } else { |
1159 | | - $query = array( |
1160 | | - 'type' => 'revision', |
1161 | | - 'target' => $this->getTitle()->getPrefixedDbkey(), |
1162 | | - 'ids' => $oldid |
1163 | | - ); |
1164 | | - $cdel = Linker::revDeleteLink( $query, $revision->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
1165 | | - } |
| 1151 | + $cdel = Linker::getRevDeleteLink( $wgUser, $revision, $this->getTitle() ); |
| 1152 | + if ( $cdel !== '' ) { |
1166 | 1153 | $cdel .= ' '; |
1167 | 1154 | } |
1168 | 1155 | |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1803,32 +1803,33 @@ |
1804 | 1804 | */ |
1805 | 1805 | public static function getRevDeleteLink( User $user, Revision $rev, Title $title ) { |
1806 | 1806 | $canHide = $user->isAllowed( 'deleterevision' ); |
1807 | | - if ( $canHide || ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) { |
1808 | | - if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
1809 | | - $revdlink = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 1807 | + if ( !$canHide && !( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) { |
| 1808 | + return ''; |
| 1809 | + } |
| 1810 | + |
| 1811 | + if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) { |
| 1812 | + return Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 1813 | + } else { |
| 1814 | + if ( $rev->getId() ) { |
| 1815 | + // RevDelete links using revision ID are stable across |
| 1816 | + // page deletion and undeletion; use when possible. |
| 1817 | + $query = array( |
| 1818 | + 'type' => 'revision', |
| 1819 | + 'target' => $title->getPrefixedDBkey(), |
| 1820 | + 'ids' => $rev->getId() |
| 1821 | + ); |
1810 | 1822 | } else { |
1811 | | - if ( $rev->getId() ) { |
1812 | | - // RevDelete links using revision ID are stable across |
1813 | | - // page deletion and undeletion; use when possible. |
1814 | | - $query = array( |
1815 | | - 'type' => 'revision', |
1816 | | - 'target' => $title->getPrefixedDBkey(), |
1817 | | - 'ids' => $rev->getId() |
1818 | | - ); |
1819 | | - } else { |
1820 | | - // Older deleted entries didn't save a revision ID. |
1821 | | - // We have to refer to these by timestamp, ick! |
1822 | | - $query = array( |
1823 | | - 'type' => 'archive', |
1824 | | - 'target' => $title->getPrefixedDBkey(), |
1825 | | - 'ids' => $rev->getTimestamp() |
1826 | | - ); |
1827 | | - } |
1828 | | - return Linker::revDeleteLink( $query, |
1829 | | - $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
| 1823 | + // Older deleted entries didn't save a revision ID. |
| 1824 | + // We have to refer to these by timestamp, ick! |
| 1825 | + $query = array( |
| 1826 | + 'type' => 'archive', |
| 1827 | + 'target' => $title->getPrefixedDBkey(), |
| 1828 | + 'ids' => $rev->getTimestamp() |
| 1829 | + ); |
1830 | 1830 | } |
| 1831 | + return Linker::revDeleteLink( $query, |
| 1832 | + $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide ); |
1831 | 1833 | } |
1832 | | - return ''; |
1833 | 1834 | } |
1834 | 1835 | |
1835 | 1836 | /** |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -833,23 +833,9 @@ |
834 | 834 | $mflag = ''; |
835 | 835 | } |
836 | 836 | |
837 | | - // Don't show useless link to people who cannot hide revisions |
838 | | - $canHide = $user->isAllowed( 'deleterevision' ); |
839 | | - if ( $canHide || ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) { |
840 | | - if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) { |
841 | | - $del = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
842 | | - } else { |
843 | | - $query = array( |
844 | | - 'type' => 'revision', |
845 | | - 'target' => $page->getPrefixedDbkey(), |
846 | | - 'ids' => $rev->getId() |
847 | | - ); |
848 | | - $del = Linker::revDeleteLink( $query, |
849 | | - $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide ); |
850 | | - } |
| 837 | + $del = Linker::getRevDeleteLink( $user, $rev, $page ); |
| 838 | + if ( $del !== '' ) { |
851 | 839 | $del .= ' '; |
852 | | - } else { |
853 | | - $del = ''; |
854 | 840 | } |
855 | 841 | |
856 | 842 | $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; |