Index: trunk/phase3/includes/api/ApiMove.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | $this->dieUsageMsg(array($retval)); |
88 | 88 | |
89 | 89 | $r = array('from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason']); |
90 | | - if(!$params['noredirect']) |
| 90 | + if(!$params['noredirect'] || !$wgUser->isAllowed('suppressredirect')) |
91 | 91 | $r['redirectcreated'] = ''; |
92 | 92 | |
93 | 93 | if($params['movetalk'] && $fromTalk->exists() && !$fromTitle->isTalkPage()) |
— | — | @@ -106,6 +106,18 @@ |
107 | 107 | $r['talkmove-error-info'] = ApiBase::$messageMap[$retval]['info']; |
108 | 108 | } |
109 | 109 | } |
| 110 | + |
| 111 | + # Watch pages |
| 112 | + if($params['watch'] || $wgUser->getOption('watchmoves')) |
| 113 | + { |
| 114 | + $wgUser->addWatch($fromTitle); |
| 115 | + $wgUser->addWatch($toTitle); |
| 116 | + } |
| 117 | + else if($params['unwatch']) |
| 118 | + { |
| 119 | + $wgUser->removeWatch($fromTitle); |
| 120 | + $wgUser->removeWatch($toTitle); |
| 121 | + } |
110 | 122 | $dbw->commit(); // Make sure all changes are really written to the DB |
111 | 123 | $this->getResult()->addValue(null, $this->getModuleName(), $r); |
112 | 124 | } |
— | — | @@ -119,7 +131,9 @@ |
120 | 132 | 'token' => null, |
121 | 133 | 'reason' => null, |
122 | 134 | 'movetalk' => false, |
123 | | - 'noredirect' => false |
| 135 | + 'noredirect' => false, |
| 136 | + 'watch' => false, |
| 137 | + 'unwatch' => false |
124 | 138 | ); |
125 | 139 | } |
126 | 140 | |
— | — | @@ -130,7 +144,9 @@ |
131 | 145 | 'token' => 'A move token previously retrieved through prop=info', |
132 | 146 | 'reason' => 'Reason for the move (optional).', |
133 | 147 | 'movetalk' => 'Move the talk page, if it exists.', |
134 | | - 'noredirect' => 'Don\'t create a redirect' |
| 148 | + 'noredirect' => 'Don\'t create a redirect', |
| 149 | + 'watch' => 'Add the page and the redirect to your watchlist', |
| 150 | + 'unwatch' => 'Remove the page and the redirect from your watchlist' |
135 | 151 | ); |
136 | 152 | } |
137 | 153 | |
Index: trunk/phase3/includes/api/ApiDelete.php |
— | — | @@ -68,12 +68,16 @@ |
69 | 69 | $reason = (isset($params['reason']) ? $params['reason'] : NULL); |
70 | 70 | $dbw = wfGetDb(DB_MASTER); |
71 | 71 | $dbw->begin(); |
72 | | - $retval = self::delete($articleObj, $params['token'], $reason); |
| 72 | + $retval = self::delete($articleObj, $params['token'], $reason); |
73 | 73 | |
74 | 74 | if(!empty($retval)) |
75 | 75 | // We don't care about multiple errors, just report one of them |
76 | 76 | $this->dieUsageMsg(current($retval)); |
77 | | - |
| 77 | + |
| 78 | + if($params['watch'] || $wgUser->getOption('watchdeletion')) |
| 79 | + $articleObj->doWatch(); |
| 80 | + else if($params['unwatch']) |
| 81 | + $articleObj->doUnwatch(); |
78 | 82 | $dbw->commit(); |
79 | 83 | $r = array('title' => $titleObj->getPrefixedText(), 'reason' => $reason); |
80 | 84 | $this->getResult()->addValue(null, $this->getModuleName(), $r); |
— | — | @@ -125,6 +129,8 @@ |
126 | 130 | 'title' => null, |
127 | 131 | 'token' => null, |
128 | 132 | 'reason' => null, |
| 133 | + 'watch' => false, |
| 134 | + 'unwatch' => false |
129 | 135 | ); |
130 | 136 | } |
131 | 137 | |
— | — | @@ -132,7 +138,9 @@ |
133 | 139 | return array ( |
134 | 140 | 'title' => 'Title of the page you want to delete.', |
135 | 141 | 'token' => 'A delete token previously retrieved through prop=info', |
136 | | - 'reason' => 'Reason for the deletion. If not set, an automatically generated reason will be used.' |
| 142 | + 'reason' => 'Reason for the deletion. If not set, an automatically generated reason will be used.', |
| 143 | + 'watch' => 'Add the page to your watchlist', |
| 144 | + 'unwatch' => 'Remove the page from your watchlist' |
137 | 145 | ); |
138 | 146 | } |
139 | 147 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -72,6 +72,7 @@ |
73 | 73 | * (bug 13157) Added ucuserprefix parameter to list=usercontibs |
74 | 74 | * (bug 12394) Added rctitles parameter to list=recentchanges, making rcid retrieval easier |
75 | 75 | * (bug 13218) Fix inclusion of " character in hyperlinks |
| 76 | +* Added watch and unwatch parameters to action=delete and action=move |
76 | 77 | |
77 | 78 | === Languages updated in 1.13 === |
78 | 79 | |