Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -540,6 +540,7 @@ |
541 | 541 | 'noarticletext-nopermission', |
542 | 542 | 'noarticletextanon', |
543 | 543 | 'userpage-userdoesnotexist', |
| 544 | + 'userpage-userdoesnotexist-view', |
544 | 545 | 'clearyourcache', |
545 | 546 | 'usercssyoucanpreview', |
546 | 547 | 'userjsyoucanpreview', |
— | — | @@ -588,6 +589,7 @@ |
589 | 590 | 'permissionserrorstext-withaction', |
590 | 591 | 'recreate-moveddeleted-warn', |
591 | 592 | 'moveddeleted-notice', |
| 593 | + 'renamed-notice', |
592 | 594 | 'log-fulllog', |
593 | 595 | 'edit-hook-aborted', |
594 | 596 | 'edit-gone-missing', |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1200,8 +1200,23 @@ |
1201 | 1201 | */ |
1202 | 1202 | public function showMissingArticle() { |
1203 | 1203 | global $wgOut, $wgRequest, $wgUser; |
| 1204 | + |
| 1205 | + # Show info in user (talk) namespace. Does the user exist and if not, has he been renamed. |
| 1206 | + if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) { |
| 1207 | + $id = User::idFromName( $this->mTitle->getBaseText() ); |
| 1208 | + $ip = User::isIP( $this->mTitle->getBaseText() ); |
| 1209 | + if ( $id == 0 && !$ip ) { # User does not exist |
| 1210 | + $wgOut->wrapWikiMsg( '<div class="mw-userpage-userdoesnotexist error">$1</div>', |
| 1211 | + array( 'userpage-userdoesnotexist-view', $this->mTitle->getBaseText() ) ); |
| 1212 | + |
| 1213 | + # Show rename log because user does not exist. |
| 1214 | + $parent = $this->mTitle->getNsText() . ":" . $this->mTitle->getBaseText(); |
| 1215 | + $wgOut->showLogs( $parent, '', array( 'renameuser' ), 'renamed-notice' ); |
| 1216 | + } |
| 1217 | + |
| 1218 | + } |
1204 | 1219 | # Show delete and move logs |
1205 | | - $this->showLogs(); |
| 1220 | + $wgOut->showLogs( $this->mTitle->getPrefixedText(), '', array( 'delete', 'move' ), 'moveddeleted-notice' ); |
1206 | 1221 | |
1207 | 1222 | # Show error message |
1208 | 1223 | $oldid = $this->getOldID(); |
— | — | @@ -1266,36 +1281,6 @@ |
1267 | 1282 | } |
1268 | 1283 | } |
1269 | 1284 | |
1270 | | - /** |
1271 | | - * Show an excerpt from the deletion and move logs. To be called from the |
1272 | | - * header section on page views of missing pages. |
1273 | | - */ |
1274 | | - public function showLogs() { |
1275 | | - global $wgUser, $wgOut; |
1276 | | - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut ); |
1277 | | - $pager = new LogPager( $loglist, array('move', 'delete'), false, |
1278 | | - $this->mTitle->getPrefixedText(), '', array( "log_action != 'revision'" ) ); |
1279 | | - if( $pager->getNumRows() > 0 ) { |
1280 | | - $pager->mLimit = 10; |
1281 | | - $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' ); |
1282 | | - $wgOut->addWikiMsg( 'moveddeleted-notice' ); |
1283 | | - $wgOut->addHTML( |
1284 | | - $loglist->beginLogEventsList() . |
1285 | | - $pager->getBody() . |
1286 | | - $loglist->endLogEventsList() |
1287 | | - ); |
1288 | | - if( $pager->getNumRows() > 10 ) { |
1289 | | - $wgOut->addHTML( $wgUser->getSkin()->link( |
1290 | | - SpecialPage::getTitleFor( 'Log' ), |
1291 | | - wfMsgHtml( 'log-fulllog' ), |
1292 | | - array(), |
1293 | | - array( 'page' => $this->mTitle->getPrefixedText() ) |
1294 | | - ) ); |
1295 | | - } |
1296 | | - $wgOut->addHTML( '</div>' ); |
1297 | | - } |
1298 | | - } |
1299 | | - |
1300 | 1285 | /* |
1301 | 1286 | * Should the parser cache be used? |
1302 | 1287 | */ |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -730,7 +730,7 @@ |
731 | 731 | } |
732 | 732 | # Give a notice if the user is editing a deleted/moved page... |
733 | 733 | if ( !$this->mTitle->exists() ) { |
734 | | - $this->showLogs( $wgOut ); |
| 734 | + $wgOut->showLogs( $this->mTitle->getPrefixedText(), '', array( 'delete', 'move' ), 'recreate-moveddeleted-warn' ); |
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
— | — | @@ -2482,42 +2482,6 @@ |
2483 | 2483 | } |
2484 | 2484 | |
2485 | 2485 | /** |
2486 | | - * If there are rows in the deletion/move log for this page, show them, |
2487 | | - * along with a nice little note for the user |
2488 | | - * |
2489 | | - * @param OutputPage $out |
2490 | | - */ |
2491 | | - protected function showLogs( $out ) { |
2492 | | - global $wgUser; |
2493 | | - $loglist = new LogEventsList( $wgUser->getSkin(), $out ); |
2494 | | - $pager = new LogPager( $loglist, array('move', 'delete'), false, |
2495 | | - $this->mTitle->getPrefixedText(), '', array( "log_action != 'revision'" ) ); |
2496 | | - |
2497 | | - $count = $pager->getNumRows(); |
2498 | | - if ( $count > 0 ) { |
2499 | | - $pager->mLimit = 10; |
2500 | | - $out->addHTML( '<div class="mw-warning-with-logexcerpt">' ); |
2501 | | - $out->addWikiMsg( 'recreate-moveddeleted-warn' ); |
2502 | | - $out->addHTML( |
2503 | | - $loglist->beginLogEventsList() . |
2504 | | - $pager->getBody() . |
2505 | | - $loglist->endLogEventsList() |
2506 | | - ); |
2507 | | - if($count > 10){ |
2508 | | - $out->addHTML( $wgUser->getSkin()->link( |
2509 | | - SpecialPage::getTitleFor( 'Log' ), |
2510 | | - wfMsgHtml( 'log-fulllog' ), |
2511 | | - array(), |
2512 | | - array( 'page' => $this->mTitle->getPrefixedText() ) ) ); |
2513 | | - } |
2514 | | - $out->addHTML( '</div>' ); |
2515 | | - return true; |
2516 | | - } |
2517 | | - |
2518 | | - return false; |
2519 | | - } |
2520 | | - |
2521 | | - /** |
2522 | 2486 | * Attempt submission |
2523 | 2487 | * @return bool false if output is done, true if the rest of the form should be displayed |
2524 | 2488 | */ |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2115,4 +2115,55 @@ |
2116 | 2116 | } |
2117 | 2117 | $this->addHTML( $this->parse( $s, /*linestart*/true, /*uilang*/true ) ); |
2118 | 2118 | } |
| 2119 | + /* |
| 2120 | + * Show log excerpt. All parameters are optional |
| 2121 | + * (but it makes sense to define at least $page OR $user) |
| 2122 | + * @param String $page Page title for filtering the log |
| 2123 | + * @param String $user Username for filtering the log |
| 2124 | + * @param String $logtypes Log types, like delete, move, etc. |
| 2125 | + * May be a single log type or an array of log types |
| 2126 | + * @param int $numEntries Number of log entries to show at maximum (default: 10) |
| 2127 | + * If there are too many entries, a "View full log" link is displayed |
| 2128 | + * @return boolean Returns true if there was something in the log |
| 2129 | + */ |
| 2130 | + public function showLogs( $page = '', $user = '', $logtypes = array(), $msgKey = '' , $numEntries = 10 ) { |
| 2131 | + global $wgUser, $wgOut; |
| 2132 | + $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut ); |
| 2133 | + $pager = new LogPager( $loglist, $logtypes, $user, $page); |
| 2134 | + if( $pager->getNumRows() > 0 ) { |
| 2135 | + $pager->mLimit = $numEntries; |
| 2136 | + $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' ); |
| 2137 | + if ( $msgKey ) |
| 2138 | + $wgOut->addWikiMsg( $msgKey ); |
| 2139 | + $wgOut->addHTML( |
| 2140 | + $loglist->beginLogEventsList() . |
| 2141 | + $pager->getBody() . |
| 2142 | + $loglist->endLogEventsList() |
| 2143 | + ); |
| 2144 | + if( $pager->getNumRows() > $numEntries ) { # Show "Full log" link |
| 2145 | + $urlParam = array(); |
| 2146 | + if ( $page != '') |
| 2147 | + $urlParam['page'] = $page; |
| 2148 | + if ( $user != '') |
| 2149 | + $urlParam['user'] = $user; |
| 2150 | + if ( !is_array( $logtypes ) ) # Make it an array, if it isn't |
| 2151 | + $logtypes = array( $logtypes ); |
| 2152 | + # If there is exactly one log type, we can link to Special:Log/type |
| 2153 | + if ( count( $logtypes ) == 1 ) |
| 2154 | + $urlParam['type'] = $logtypes[0]; |
| 2155 | + $wgOut->addHTML( $wgUser->getSkin()->link( |
| 2156 | + SpecialPage::getTitleFor( 'Log' ), |
| 2157 | + wfMsgHtml( 'log-fulllog' ), |
| 2158 | + array(), |
| 2159 | + $urlParam |
| 2160 | + ) ); |
| 2161 | + |
| 2162 | + } |
| 2163 | + $wgOut->addHTML( '</div>' ); |
| 2164 | + return true; |
| 2165 | + } |
| 2166 | + return false; |
| 2167 | + } |
| 2168 | + |
| 2169 | + |
2119 | 2170 | } |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | * @return String: appropriately-escaped HTML to be output literally |
149 | 149 | */ |
150 | 150 | protected function contributionsSub( $nt, $id ) { |
151 | | - global $wgSysopUserBans, $wgLang, $wgUser; |
| 151 | + global $wgSysopUserBans, $wgLang, $wgUser, $wgOut; |
152 | 152 | |
153 | 153 | $sk = $wgUser->getSkin(); |
154 | 154 | |
— | — | @@ -223,7 +223,11 @@ |
224 | 224 | wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); |
225 | 225 | |
226 | 226 | $links = $wgLang->pipeList( $tools ); |
227 | | - $this->showBlock( $nt, $id ); |
| 227 | + |
| 228 | + // Show a note if the user is blocked and display the last block log entry. |
| 229 | + if ( User::newFromID( $id )->isBlocked() ) |
| 230 | + $wgOut->showLogs( $nt->getPrefixedText(), '', array( 'block' ), |
| 231 | + 'sp-contributions-blocked-notice', 1 ); |
228 | 232 | } |
229 | 233 | |
230 | 234 | // Old message 'contribsub' had one parameter, but that doesn't work for |
— | — | @@ -238,40 +242,6 @@ |
239 | 243 | } |
240 | 244 | |
241 | 245 | /** |
242 | | - * Show a note if the user is blocked and display the last block log entry. |
243 | | - * @param Title $title Title object for the target |
244 | | - * @param $userId ID of the user |
245 | | - */ |
246 | | - protected function showBlock( $title, $userId ) { |
247 | | - global $wgUser, $wgOut; |
248 | | - if ( !User::newFromID( $userId )->isBlocked() ) |
249 | | - return; # User is not blocked, nothing to do here |
250 | | - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut ); |
251 | | - $pager = new LogPager( $loglist, 'block', false, $title->getPrefixedText() ); |
252 | | - // Check if there is something in the block log. |
253 | | - // If this is not the case, either the user is not blocked, |
254 | | - // or the account has been hidden via hideuser. |
255 | | - if( $pager->getNumRows() > 0 ) { |
256 | | - $pager->mLimit = 1; # Show only latest log entry. |
257 | | - $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' ); |
258 | | - $wgOut->addWikiMsg( 'sp-contributions-blocked-notice' ); |
259 | | - $wgOut->addHTML( |
260 | | - $loglist->beginLogEventsList() . |
261 | | - $pager->getBody() . |
262 | | - $loglist->endLogEventsList() |
263 | | - ); |
264 | | - if( $pager->getNumRows() > $pager->mLimit ) { |
265 | | - $wgOut->addHTML( $wgUser->getSkin()->link( |
266 | | - SpecialPage::getTitleFor( 'Log', 'block' ), |
267 | | - wfMsgHtml( 'log-fulllog' ), |
268 | | - array(), |
269 | | - array( 'page' => $title->getPrefixedText() ) |
270 | | - ) ); |
271 | | - } |
272 | | - $wgOut->addHTML( '</div>' ); |
273 | | - } |
274 | | - } |
275 | | - /** |
276 | 246 | * Generates the namespace selector form with hidden attributes. |
277 | 247 | * @param $this->opts Array: the options to be included. |
278 | 248 | */ |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1253,6 +1253,7 @@ |
1254 | 1254 | 'noarticletextanon' => '{{int:noarticletext}}', # do not translate or duplicate this message to other languages |
1255 | 1255 | 'userpage-userdoesnotexist' => 'User account "$1" is not registered. |
1256 | 1256 | Please check if you want to create/edit this page.', |
| 1257 | +'userpage-userdoesnotexist-view' => 'User account "$1" is not registered.', |
1257 | 1258 | 'clearyourcache' => "'''Note - After saving, you may have to bypass your browser's cache to see the changes.''' |
1258 | 1259 | '''Mozilla / Firefox / Safari:''' hold ''Shift'' while clicking ''Reload'', or press either ''Ctrl-F5'' or ''Ctrl-R'' (''Command-R'' on a Macintosh); |
1259 | 1260 | '''Konqueror: '''click ''Reload'' or press ''F5''; |
— | — | @@ -1341,6 +1342,8 @@ |
1342 | 1343 | The deletion and move log for this page are provided here for convenience:", |
1343 | 1344 | 'moveddeleted-notice' => 'This page has been deleted. |
1344 | 1345 | The deletion and move log for the page are provided below for reference.', |
| 1346 | +'renamed-notice' => 'This user has been renamed. |
| 1347 | +The rename log is provided below for reference.', |
1345 | 1348 | 'log-fulllog' => 'View full log', |
1346 | 1349 | 'edit-hook-aborted' => 'Edit aborted by hook. |
1347 | 1350 | It gave no explanation.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -222,6 +222,8 @@ |
223 | 223 | excerpt from the block log. |
224 | 224 | * (bug 19646) New hook: ImgAuthBeforeStream for tests and functionality before |
225 | 225 | file is streamed to user, but only when using img_auth |
| 226 | +* Note on non-existing user and user talk pages if user does not exist and show |
| 227 | + renameuser log if the user has been renamed |
226 | 228 | |
227 | 229 | === Bug fixes in 1.16 === |
228 | 230 | |