Index: trunk/phase3/includes/Article.php |
— | — | @@ -1706,29 +1706,10 @@ |
1707 | 1707 | |
1708 | 1708 | /** |
1709 | 1709 | * Removes trackback record for current article from trackbacks table |
| 1710 | + * @deprecated since 1.19 |
1710 | 1711 | */ |
1711 | 1712 | public function deletetrackback() { |
1712 | | - global $wgRequest, $wgOut; |
1713 | | - |
1714 | | - if ( !$wgOut->getUser()->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { |
1715 | | - $wgOut->addWikiMsg( 'sessionfailure' ); |
1716 | | - |
1717 | | - return; |
1718 | | - } |
1719 | | - |
1720 | | - $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgOut->getUser() ); |
1721 | | - |
1722 | | - if ( count( $permission_errors ) ) { |
1723 | | - $wgOut->showPermissionsErrorPage( $permission_errors ); |
1724 | | - |
1725 | | - return; |
1726 | | - } |
1727 | | - |
1728 | | - $db = wfGetDB( DB_MASTER ); |
1729 | | - $db->delete( 'trackbacks', array( 'tb_id' => $wgRequest->getInt( 'tbid' ) ) ); |
1730 | | - |
1731 | | - $wgOut->addWikiMsg( 'trackbackdeleteok' ); |
1732 | | - $this->mTitle->invalidateCache(); |
| 1713 | + return Action::factory( 'deletetrackback', $this )->show(); |
1733 | 1714 | } |
1734 | 1715 | |
1735 | 1716 | /** |
— | — | @@ -1786,62 +1767,10 @@ |
1787 | 1768 | |
1788 | 1769 | /** |
1789 | 1770 | * Mark this particular edit/page as patrolled |
| 1771 | + * @deprecated since 1.19 |
1790 | 1772 | */ |
1791 | 1773 | public function markpatrolled() { |
1792 | | - global $wgOut, $wgRequest; |
1793 | | - |
1794 | | - $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
1795 | | - |
1796 | | - # If we haven't been given an rc_id value, we can't do anything |
1797 | | - $rcid = (int) $wgRequest->getVal( 'rcid' ); |
1798 | | - |
1799 | | - if ( !$wgOut->getUser()->matchEditToken( $wgRequest->getVal( 'token' ), $rcid ) ) { |
1800 | | - $wgOut->showErrorPage( 'sessionfailure-title', 'sessionfailure' ); |
1801 | | - return; |
1802 | | - } |
1803 | | - |
1804 | | - $rc = RecentChange::newFromId( $rcid ); |
1805 | | - |
1806 | | - if ( is_null( $rc ) ) { |
1807 | | - $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
1808 | | - return; |
1809 | | - } |
1810 | | - |
1811 | | - # It would be nice to see where the user had actually come from, but for now just guess |
1812 | | - $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; |
1813 | | - $return = SpecialPage::getTitleFor( $returnto ); |
1814 | | - |
1815 | | - $errors = $rc->doMarkPatrolled(); |
1816 | | - |
1817 | | - if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { |
1818 | | - $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
1819 | | - |
1820 | | - return; |
1821 | | - } |
1822 | | - |
1823 | | - if ( in_array( array( 'hookaborted' ), $errors ) ) { |
1824 | | - // The hook itself has handled any output |
1825 | | - return; |
1826 | | - } |
1827 | | - |
1828 | | - if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { |
1829 | | - $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
1830 | | - $wgOut->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); |
1831 | | - $wgOut->returnToMain( null, $return ); |
1832 | | - |
1833 | | - return; |
1834 | | - } |
1835 | | - |
1836 | | - if ( !empty( $errors ) ) { |
1837 | | - $wgOut->showPermissionsErrorPage( $errors ); |
1838 | | - |
1839 | | - return; |
1840 | | - } |
1841 | | - |
1842 | | - # Inform the user |
1843 | | - $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
1844 | | - $wgOut->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); |
1845 | | - $wgOut->returnToMain( null, $return ); |
| 1774 | + Action::factory( 'markpatrolled', $this )->show(); |
1846 | 1775 | } |
1847 | 1776 | |
1848 | 1777 | /** |
Index: trunk/phase3/includes/actions/MarkpatrolledAction.php |
— | — | @@ -0,0 +1,86 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Mark a revision as patrolled on a page |
| 5 | + * |
| 6 | + * Copyright © 2011 Alexandre Emsenhuber |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + */ |
| 25 | + |
| 26 | +class MarkpatrolledAction extends FormlessAction { |
| 27 | + |
| 28 | + public function getName() { |
| 29 | + return 'markpatrolled'; |
| 30 | + } |
| 31 | + |
| 32 | + public function getRestriction() { |
| 33 | + return 'read'; |
| 34 | + } |
| 35 | + |
| 36 | + protected function getDescription() { |
| 37 | + return ''; |
| 38 | + } |
| 39 | + |
| 40 | + protected function checkCanExecute( User $user ) { |
| 41 | + if ( !$user->matchEditToken( $this->getRequest()->getVal( 'token' ), $this->getRequest()->getInt( 'rcid' ) ) ) { |
| 42 | + throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); |
| 43 | + } |
| 44 | + |
| 45 | + return parent::checkCanExecute( $user ); |
| 46 | + } |
| 47 | + |
| 48 | + public function onView() { |
| 49 | + $rc = RecentChange::newFromId( $this->getRequest()->getInt( 'rcid' ) ); |
| 50 | + |
| 51 | + if ( is_null( $rc ) ) { |
| 52 | + throw new ErrorPageError( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
| 53 | + } |
| 54 | + |
| 55 | + # It would be nice to see where the user had actually come from, but for now just guess |
| 56 | + $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; |
| 57 | + $return = SpecialPage::getTitleFor( $returnto ); |
| 58 | + |
| 59 | + $errors = $rc->doMarkPatrolled(); |
| 60 | + |
| 61 | + if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { |
| 62 | + throw new ErrorPageError( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
| 63 | + } |
| 64 | + |
| 65 | + if ( in_array( array( 'hookaborted' ), $errors ) ) { |
| 66 | + // The hook itself has handled any output |
| 67 | + return; |
| 68 | + } |
| 69 | + |
| 70 | + if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { |
| 71 | + $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
| 72 | + $this->getOutput()->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); |
| 73 | + $this->getOutput()->returnToMain( null, $return ); |
| 74 | + return; |
| 75 | + } |
| 76 | + |
| 77 | + if ( !empty( $errors ) ) { |
| 78 | + $this->getOutput()->showPermissionsErrorPage( $errors ); |
| 79 | + return; |
| 80 | + } |
| 81 | + |
| 82 | + # Inform the user |
| 83 | + $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
| 84 | + $this->getOutput()->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); |
| 85 | + $this->getOutput()->returnToMain( null, $return ); |
| 86 | + } |
| 87 | +} |
Property changes on: trunk/phase3/includes/actions/MarkpatrolledAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 88 | + native |
Index: trunk/phase3/includes/actions/DeletetrackbackAction.php |
— | — | @@ -0,0 +1,54 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Delete a trackback on a page |
| 5 | + * |
| 6 | + * Copyright © 2011 Alexandre Emsenhuber |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + */ |
| 25 | + |
| 26 | +class DeletetrackbackAction extends FormlessAction { |
| 27 | + |
| 28 | + public function getName() { |
| 29 | + return 'deletetrackback'; |
| 30 | + } |
| 31 | + |
| 32 | + public function getRestriction() { |
| 33 | + return 'delete'; |
| 34 | + } |
| 35 | + |
| 36 | + protected function getDescription() { |
| 37 | + return ''; |
| 38 | + } |
| 39 | + |
| 40 | + protected function checkCanExecute( User $user ) { |
| 41 | + if ( !$user->matchEditToken( $this->getRequest()->getVal( 'token' ) ) ) { |
| 42 | + throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); |
| 43 | + } |
| 44 | + |
| 45 | + return parent::checkCanExecute( $user ); |
| 46 | + } |
| 47 | + |
| 48 | + public function onView() { |
| 49 | + $db = wfGetDB( DB_MASTER ); |
| 50 | + $db->delete( 'trackbacks', array( 'tb_id' => $this->getRequest()->getInt( 'tbid' ) ) ); |
| 51 | + |
| 52 | + $this->getOutput()->addWikiMsg( 'trackbackdeleteok' ); |
| 53 | + $this->getTitle()->invalidateCache(); |
| 54 | + } |
| 55 | +} |
Property changes on: trunk/phase3/includes/actions/DeletetrackbackAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 56 | + native |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -249,6 +249,8 @@ |
250 | 250 | |
251 | 251 | # includes/actions |
252 | 252 | 'CreditsAction' => 'includes/actions/CreditsAction.php', |
| 253 | + 'DeletetrackbackAction' => 'includes/actions/DeletetrackbackAction.php', |
| 254 | + 'MarkpatrolledAction' => 'includes/actions/MarkpatrolledAction.php', |
253 | 255 | 'PurgeAction' => 'includes/actions/PurgeAction.php', |
254 | 256 | 'RevisiondeleteAction' => 'includes/actions/RevisiondeleteAction.php', |
255 | 257 | 'UnwatchAction' => 'includes/actions/WatchAction.php', |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -430,9 +430,7 @@ |
431 | 431 | case 'protect': |
432 | 432 | case 'unprotect': |
433 | 433 | case 'info': |
434 | | - case 'markpatrolled': |
435 | 434 | case 'render': |
436 | | - case 'deletetrackback': |
437 | 435 | $article->$act(); |
438 | 436 | break; |
439 | 437 | case 'submit': |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -5026,8 +5026,10 @@ |
5027 | 5027 | */ |
5028 | 5028 | $wgActions = array( |
5029 | 5029 | 'credits' => true, |
| 5030 | + 'deletetrackback' => true, |
| 5031 | + 'markpatrolled' => true, |
| 5032 | + 'purge' => true, |
5030 | 5033 | 'revisiondelete' => true, |
5031 | | - 'purge' => true, |
5032 | 5034 | 'unwatch' => true, |
5033 | 5035 | 'watch' => true, |
5034 | 5036 | ); |