r66910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66909‎ | r66910 | r66911 >
Date:06:49, 26 May 2010
Author:tisane
Status:deferred (Comments)
Tags:
Comment:
=Fix auto-watch bug and make it configurable whether users need to be logged in to blank/unblank pages
Modified paths:
  • /trunk/extensions/PureWikiDeletion/PureWikiDeletion.hooks.php (modified) (history)
  • /trunk/extensions/PureWikiDeletion/PureWikiDeletion.i18n.php (modified) (history)
  • /trunk/extensions/PureWikiDeletion/PureWikiDeletion.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.i18n.php
@@ -22,7 +22,9 @@
2323 'blank-log-link' => '[[Special:Log/blank|blank log]]',
2424 'blanknologin' => 'Not logged in',
2525 'blanknologintext' => 'You must be a registered user and '
26 - . '[[Special:UserLogin|logged in]] to blank or unblank a page.',
 26+ . '[[Special:UserLogin|logged in]] to blank a page.',
 27+ 'unblanknologintext' => 'You must be a registered user and '
 28+ . '[[Special:UserLogin|logged in]] to unblank a page.',
2729 'blankedtext' => '[[$1]] has been blanked. See $2 for a record of recent blankings.'
2830 );
2931
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.php
@@ -31,7 +31,7 @@
3232 'url' => 'http://www.mediawiki.org/wiki/Extension:PureWikiDeletion',
3333 'description' => 'Implements pure wiki deletion',
3434 'descriptionmsg' => 'PureWikiDeletion-desc',
35 - 'version' => '1.0.2',
 35+ 'version' => '1.0.3',
3636 );
3737
3838 $dir = dirname( __FILE__ ) . '/';
@@ -67,6 +67,7 @@
6868 $wgLogHeaders['blank'] = 'blank-log-header';
6969 $wgLogActions['blank/blank'] = 'blank-log-entry-blank';
7070 $wgLogActions['blank/unblank'] = 'blank-log-entry-unblank';
 71+
7172 $wgSpecialPages['RandomExcludeBlank'] = 'RandomExcludeBlank';
7273 $wgSpecialPages['AllPagesExcludeBlank'] = 'AllPagesExcludeBlank';
7374 $wgSpecialPages['PopulateBlankedPagesTable'] = 'PopulateBlankedPagesTable';
@@ -89,9 +90,9 @@
9091
9192 function PureWikiDeletionSaveHook( &$article, &$user, &$text, &$summary,
9293 $minor, $watch, $sectionanchor, &$flags ) {
93 - global $wgOut;
 94+ global $wgOut, $wgPureWikiDeletionLoginRequiredToBlank, $wgPureWikiDeletionLoginRequiredToUnblank;
9495 if ( $text == "" ) {
95 - if ( !( $user->isLoggedIn() ) ) {
 96+ if ( $wgPureWikiDeletionLoginRequiredToBlank && !( $user->isLoggedIn() ) ) {
9697 $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
9798 return false;
9899 }
@@ -105,8 +106,8 @@
106107 $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
107108 , array( "blank_page_id" => $blank_page_id ) );
108109 if ( $result ) {
109 - if ( !( $user->isLoggedIn() ) ) {
110 - $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
 110+ if ( $wgPureWikiDeletionLoginRequiredToUnblank && !( $user->isLoggedIn() ) ) {
 111+ $wgOut->showErrorPage( 'blanknologin', 'unblanknologintext' );
111112 return false;
112113 }
113114 if ( $summary == '' ) {
@@ -136,8 +137,8 @@
137138 }
138139
139140 function PureWikiDeletionAlternateEditHook ( $editPage ) {
140 - global $wgUser, $wgOut;
141 - if ( $wgUser->isLoggedIn() ) {
 141+ global $wgUser, $wgOut, $wgPureWikiDeletionLoginRequiredToUnblank;
 142+ if ( $wgUser->isLoggedIn() || !$wgPureWikiDeletionLoginRequiredToUnblank ) {
142143 return true;
143144 }
144145 $dbr = wfGetDB( DB_SLAVE );
@@ -147,6 +148,6 @@
148149 if ( !$result ) {
149150 return true;
150151 }
151 - $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
 152+ $wgOut->showErrorPage( 'blanknologin', 'unblanknologintext' );
152153 return false;
153154 }
\ No newline at end of file
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.hooks.php
@@ -137,7 +137,7 @@
138138 }
139139
140140 public static function PureWikiDeletionEditHook( &$editPage ) {
141 - global $wgLang;
 141+ global $wgLang, $wgUser;
142142 wfLoadExtensionMessages( 'PureWikiDeletion' );
143143 $dbr = wfGetDB( DB_SLAVE );
144144 $blank_page_id = $editPage->getArticle()->getID();
@@ -170,7 +170,7 @@
171171 , $result->blank_parent_id ) );
172172 $editPage->editFormPageTop .= $html;
173173
174 - if ($blanking_user->getOption( 'watchunblank' )){
 174+ if ($wgUser->getOption( 'watchunblank' )){
175175 $editPage->watchthis = true;
176176 }
177177

Comments

#Comment by Raymond (talk | contribs)   12:24, 26 May 2010

$wgPureWikiDeletionLoginRequiredToBlank, $wgPureWikiDeletionLoginRequiredToUnblank need to be initialized with default values in PureWikiDeletion.php

#Comment by Tisane (talk | contribs)   21:51, 12 June 2010

Fixed in r67288.

Status & tagging log