Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -560,6 +560,7 @@ |
561 | 561 | 'SpecialExport' => 'includes/specials/SpecialExport.php', |
562 | 562 | 'SpecialImport' => 'includes/specials/SpecialImport.php', |
563 | 563 | 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php', |
| 564 | + 'SpecialMergeHistory' => 'includes/specials/SpecialMergeHistory.php', |
564 | 565 | 'SpecialMostlinkedtemplates' => 'includes/specials/SpecialMostlinkedtemplates.php', |
565 | 566 | 'SpecialPreferences' => 'includes/specials/SpecialPreferences.php', |
566 | 567 | 'SpecialPrefixindex' => 'includes/specials/SpecialPrefixindex.php', |
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php |
— | — | @@ -3,32 +3,18 @@ |
4 | 4 | * Special page allowing users with the appropriate permissions to |
5 | 5 | * merge article histories, with some restrictions |
6 | 6 | * |
7 | | - * @file |
8 | 7 | * @ingroup SpecialPage |
9 | 8 | */ |
10 | | - |
11 | | -/** |
12 | | - * Constructor |
13 | | - */ |
14 | | -function wfSpecialMergehistory( $par ) { |
15 | | - global $wgRequest; |
16 | | - |
17 | | - $form = new MergehistoryForm( $wgRequest, $par ); |
18 | | - $form->execute(); |
19 | | -} |
20 | | - |
21 | | -/** |
22 | | - * The HTML form for Special:MergeHistory, which allows users with the appropriate |
23 | | - * permissions to view and restore deleted content. |
24 | | - * @ingroup SpecialPage |
25 | | - */ |
26 | | -class MergehistoryForm { |
| 9 | +class SpecialMergeHistory extends SpecialPage { |
27 | 10 | var $mAction, $mTarget, $mDest, $mTimestamp, $mTargetID, $mDestID, $mComment; |
28 | 11 | var $mTargetObj, $mDestObj; |
29 | 12 | |
30 | | - function MergehistoryForm( $request, $par = "" ) { |
31 | | - global $wgUser; |
| 13 | + public function __construct() { |
| 14 | + parent::__construct( 'MergeHistory', 'mergehistory' ); |
| 15 | + } |
32 | 16 | |
| 17 | + private function loadRequestParams( $request ) { |
| 18 | + global $wgUser; |
33 | 19 | $this->mAction = $request->getVal( 'action' ); |
34 | 20 | $this->mTarget = $request->getVal( 'target' ); |
35 | 21 | $this->mDest = $request->getVal( 'dest' ); |
— | — | @@ -51,7 +37,6 @@ |
52 | 38 | $this->mTargetObj = null; |
53 | 39 | $this->mDestObj = null; |
54 | 40 | } |
55 | | - |
56 | 41 | $this->preCacheMessages(); |
57 | 42 | } |
58 | 43 | |
— | — | @@ -66,9 +51,16 @@ |
67 | 52 | } |
68 | 53 | } |
69 | 54 | |
70 | | - function execute() { |
71 | | - global $wgOut; |
| 55 | + function execute( $par = '' ) { |
| 56 | + global $wgOut, $wgRequest, $wgUser; |
72 | 57 | |
| 58 | + if( !$wgUser->isAllowed( 'mergehistory' ) ) { |
| 59 | + $wgOut->permissionRequired( 'mergehistory' ); |
| 60 | + return; |
| 61 | + } |
| 62 | + |
| 63 | + $this->loadRequestParams( $wgRequest ); |
| 64 | + |
73 | 65 | $wgOut->setPagetitle( wfMsgHtml( "mergehistory" ) ); |
74 | 66 | |
75 | 67 | if( $this->mTargetID && $this->mDestID && $this->mAction=="submit" && $this->mMerge ) { |
— | — | @@ -122,8 +114,7 @@ |
123 | 115 | '<fieldset>' . |
124 | 116 | Xml::element( 'legend', array(), |
125 | 117 | wfMsg( 'mergehistory-box' ) ) . |
126 | | - Xml::hidden( 'title', |
127 | | - SpecialPage::getTitleFor( 'Mergehistory' )->getPrefixedDbKey() ) . |
| 118 | + Xml::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . |
128 | 119 | Xml::hidden( 'submitted', '1' ) . |
129 | 120 | Xml::hidden( 'mergepoint', $this->mTimestamp ) . |
130 | 121 | Xml::openElement( 'table' ) . |
— | — | @@ -154,7 +145,7 @@ |
155 | 146 | $revisions = new MergeHistoryPager( $this, array(), $this->mTargetObj, $this->mDestObj ); |
156 | 147 | $haveRevisions = $revisions && $revisions->getNumRows() > 0; |
157 | 148 | |
158 | | - $titleObj = SpecialPage::getTitleFor( "Mergehistory" ); |
| 149 | + $titleObj = $this->getTitle(); |
159 | 150 | $action = $titleObj->getLocalURL( array( 'action' => 'submit' ) ); |
160 | 151 | # Start the form here |
161 | 152 | $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'merge' ) ); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | 'Import' => 'SpecialImport', |
170 | 170 | 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ), |
171 | 171 | 'Whatlinkshere' => 'SpecialWhatlinkshere', |
172 | | - 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ), |
| 172 | + 'MergeHistory' => 'SpecialMergeHistory', |
173 | 173 | |
174 | 174 | # Other |
175 | 175 | 'Booksources' => 'SpecialBookSources', |