r36890 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36889‎ | r36890 | r36891 >
Date:09:29, 2 July 2008
Author:siebrand
Status:old
Tags:
Comment:
* delay message loading
* add descriptionmsg
* remove EOL whitespace
Modified paths:
  • /trunk/extensions/DeleteBatch/DeleteBatch.body.php (modified) (history)
  • /trunk/extensions/DeleteBatch/DeleteBatch.i18n.php (modified) (history)
  • /trunk/extensions/DeleteBatch/DeleteBatch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DeleteBatch/DeleteBatch.body.php
@@ -13,7 +13,6 @@
1414 */
1515 function DeleteBatch() {
1616 SpecialPage::SpecialPage( 'DeleteBatch', 'deletebatch', true, 'execute', false );
17 - wfLoadExtensionMessages('DeleteBatch');
1817 }
1918
2019 /**
@@ -24,12 +23,12 @@
2524 function execute( $par ) {
2625 global $wgOut, $wgUser, $wgRequest;
2726
28 - if ( $wgUser->isBlocked() ) {
 27+ if ( $wgUser->isBlocked() ) {
2928 $wgOut->blockedPage();
3029 return;
31 - }
 30+ }
3231 if ( wfReadOnly() ) {
33 - $wgOut->readOnlyPage();
 32+ $wgOut->readOnlyPage();
3433 return;
3534 }
3635 if ( !$wgUser->isAllowed( 'deletebatch' ) ) {
@@ -37,6 +36,8 @@
3837 return;
3938 }
4039
 40+ wfLoadExtensionMessages('DeleteBatch');
 41+
4142 $wgOut->setPageTitle(wfMsg('deletebatch-title'));
4243 $cSF = new DeleteBatchForm($par);
4344
@@ -60,8 +61,8 @@
6162 function deletebatchForm( $par ) {
6263 global $wgRequest;
6364 $this->mMode = $wgRequest->getVal( 'wpMode' );
64 - $this->mPage = $wgRequest->getVal( 'wpPage' );
65 - $this->mReason = $wgRequest->getVal( 'wpReason' );
 65+ $this->mPage = $wgRequest->getVal( 'wpPage' );
 66+ $this->mReason = $wgRequest->getVal( 'wpReason' );
6667 $this->mFile = $wgRequest->getFileName( 'wpFile' );
6768 $this->mFileTemp = $wgRequest->getFileTempName( 'wpFile' );
6869 }
@@ -202,7 +203,7 @@
203204 // $this->showForm('');
204205 } else {
205206 /* run through text and do all like it should be */
206 - $lines = explode( "\n", $line );
 207+ $lines = explode( "\n", $line );
207208 foreach ($lines as $single_page) {
208209 /* explode and give me a reason */
209210 $page_data = explode("|", trim ($single_page) );
@@ -230,9 +231,9 @@
231232 */
232233 function deletePage($line, $reason = '', &$db, $multi = false, $linenum = 0, $user = null) {
233234 global $wgOut, $wgUser;
234 - $page = Title::newFromText ($line);
 235+ $page = Title::newFromText ($line);
235236 if (is_null($page)) { /* invalid title? */
236 - $wgOut->addWikiText( wfMsg('deletebatch-omitting-invalid', $line) );
 237+ $wgOut->addWikiText( wfMsg('deletebatch-omitting-invalid', $line) );
237238 if (!$multi) {
238239 if (!is_null($user)) {
239240 $wgUser = $user;
@@ -265,7 +266,7 @@
266267 $art = new Article($page);
267268 }
268269
269 - /* what is the generic reason for page deletion?
 270+ /* what is the generic reason for page deletion?
270271 something about the content, I guess...
271272 */
272273 $art->doDelete($reason);
@@ -288,4 +289,4 @@
289290 }
290291 $this->deleteBatch ($this->mUser, $this->mPage, $this->mFileTemp);
291292 }
292 -}
\ No newline at end of file
 293+}
Index: trunk/extensions/DeleteBatch/DeleteBatch.i18n.php
@@ -12,11 +12,14 @@
1313 */
1414 $messages['en'] = array(
1515 'deletebatch' => 'Delete batch of pages',
 16+ 'deletebatch-desc' => '[[Special:DeleteBatch|Delete a batch of pages]]',
1617 'deletebatch-button' => 'DELETE', /* make it an irritably big button, on purpose, of course... */
1718 'deletebatch-here' => '<b>here</b>',
18 - 'deletebatch-help' => 'Delete a batch of pages. You can either perform a single delete, or delete pages listed in a file. Choose a user that will be shown in deletion logs. Uploaded file should contain page name and optional reason separated by | character in each line.',
 19+ 'deletebatch-help' => 'Delete a batch of pages. You can either perform a single delete, or delete pages listed in a file.
 20+Choose a user that will be shown in deletion logs.
 21+Uploaded file should contain page name and optional reason separated by a "|" character in each line.',
1922 'deletebatch-caption' => 'Page list',
20 - 'deletebatch-title' => 'Delete Batch',
 23+ 'deletebatch-title' => 'Delete batch',
2124 'deletebatch-link-back' => 'Go back to the special page ',
2225 'deletebatch-as' => 'Run the script as',
2326 'deletebatch-both-modes' => 'Please choose either one specified page or a given list of pages.',
Index: trunk/extensions/DeleteBatch/DeleteBatch.php
@@ -12,14 +12,15 @@
1313 $wgGroupPermissions['staff']['deletebatch'] = true;
1414
1515 $wgExtensionCredits['specialpage'][] = array(
16 - 'name' => 'Delete Batch',
17 - 'version' => '1.0',
18 - 'author' => 'Bartek Łapiński',
19 - 'url' => 'http://www.mediawiki.org/wiki/Extension:DeleteBatch',
20 - 'description' => 'Deletes a batch of pages'
 16+ 'name' => 'Delete Batch',
 17+ 'version' => '1.0',
 18+ 'author' => 'Bartek Łapiński',
 19+ 'url' => 'http://www.mediawiki.org/wiki/Extension:DeleteBatch',
 20+ 'description' => 'Deletes a batch of pages',
 21+ 'descriptionmsg' => 'deletebatch-msg',
2122 );
2223
2324 $dir = dirname(__FILE__) . '/';
2425 $wgExtensionMessagesFiles['DeleteBatch'] = $dir . 'DeleteBatch.i18n.php';
2526 $wgAutoloadClasses['DeleteBatch'] = $dir. 'DeleteBatch.body.php';
26 -$wgSpecialPages['DeleteBatch'] = 'DeleteBatch';
\ No newline at end of file
 27+$wgSpecialPages['DeleteBatch'] = 'DeleteBatch';

Status & tagging log