r66884 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66883‎ | r66884 | r66885 >
Date:18:17, 25 May 2010
Author:tisane
Status:deferred
Tags:
Comment:
=Add auto-watchlisting capability and implement more intuitive behavior upon page blanking
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
@@ -2,7 +2,7 @@
33 <?php
44 $messages = array();
55
6 -$messages['en'] = array(
 6+$messages['en'] = array(
77 'purewikideletion' => 'Pure wiki deletion',
88 'randomexcludeblank' => 'Random page (exclude blank)',
99 'populateblankedpagestable' => 'Populate blanked pages table',
@@ -10,21 +10,23 @@
1111 'purewikideletion-pref-watchblank' => 'Add pages I blank to my watchlist',
1212 'purewikideletion-pref-watchunblank' => 'Add pages I unblank to my watchlist',
1313 'purewikideletion-blanked' => "A former version of this page was blanked by [[User:$1|$1]] ([[User talk:$1|talk]]) "
14 - ."([[Special:Contributions/$1|contribs]]) on $2 <br /> The reason given for blanking was: "
15 - ."''<nowiki>$3</nowiki>''.<br /> You may [{{fullurl:{{FULLPAGENAMEE}}|action=history}} view the article's "
16 - ."history], [{{fullurl:{{FULLPAGENAMEE}}|oldid=$4&action=edit}} edit the last version], or type new "
17 - ."page into the white space below.",
18 - 'blank' => 'blank',
 14+ . "([[Special:Contributions/$1|contribs]]) on $2 <br /> The reason given for blanking was: "
 15+ . "''<nowiki>$3</nowiki>''.<br /> You may [{{fullurl:{{FULLPAGENAMEE}}|action=history}} view the article's "
 16+ . "history], [{{fullurl:{{FULLPAGENAMEE}}|oldid=$4&action=edit}} edit the last version], or type new "
 17+ . "page into the white space below.",
 18+ 'blank-log' => 'blank',
1919 'blank-log-name' => 'Blank log',
2020 'blank-log-header' => 'Below is a list of page blankings and unblankings.',
2121 'blank-log-entry-blank' => 'blanked $1',
2222 'blank-log-entry-unblank' => 'unblanked $1',
 23+ 'blank-log-link' => '[[Special:Log/blank|blank log]]',
2324 'blanknologin' => 'Not logged in',
2425 'blanknologintext' => 'You must be a registered user and '
25 - .'[[Special:UserLogin|logged in]] to blank or unblank a page.'
 26+ . '[[Special:UserLogin|logged in]] to blank or unblank a page.',
 27+ 'blankedtext' => '[[$1]] has been blanked. See $2 for a record of recent blankings.'
2628 );
2729
28 -$messages['ar'] = array(
 30+$messages['ar'] = array(
2931 'purewikideletion' => 'حذف الويكي النقي',
3032 'randomexcludeblank' => 'صفحة عشوائية (لا يشمل ذلك الفارغة)',
3133 'populateblankedpagestable' => 'املأ جدول الصفحات الفارغة',
@@ -32,15 +34,15 @@
3335 'purewikideletion-pref-watchblank' => 'أضف الفصفحات التي أفرغها إلى قائمة مراقبتي',
3436 'purewikideletion-pref-watchunblank' => 'أضف الصفحات التي أملؤها إلى قائمة مراقبتي',
3537 'purewikideletion-blanked' => "نسخة سابقة من هذه الصفحة تم إفراغها بواسطة [[User:$1|$1]] ([[User talk:$1|نقاش]]) "
36 - ."([[Special:Contributions/$1|مساهمات]]) في $2 <br /> السبب المعطى للإفراغ كان: "
37 - ."''<nowiki>$3</nowiki>''.<br /> يمكنك [{{fullurl:{{FULLPAGENAMEE}}|action=history}} رؤية تاريخ المقالة "
38 - ."], [{{fullurl:{{FULLPAGENAMEE}}|oldid=$4&action=edit}} تعديل آخر نسخة]، أو كتابة صفحة جديدة في الفراغ الأبيض بالأسفل.",
39 - 'blank' => 'فارغة',
 38+ . "([[Special:Contributions/$1|مساهمات]]) في $2 <br /> السبب المعطى للإفراغ كان: "
 39+ . "''<nowiki>$3</nowiki>''.<br /> يمكنك [{{fullurl:{{FULLPAGENAMEE}}|action=history}} رؤية تاريخ المقالة "
 40+ . "], [{{fullurl:{{FULLPAGENAMEE}}|oldid=$4&action=edit}} تعديل آخر نسخة]، أو كتابة صفحة جديدة في الفراغ الأبيض بالأسفل.",
 41+ 'blank-log' => 'فارغة',
4042 'blank-log-name' => 'سجل الإفراغ',
4143 'blank-log-header' => 'بالأسفل قائمة بعمليات إفراغ وملأ الصفحات.',
4244 'blank-log-entry-blank' => 'أفرغ $1',
4345 'blank-log-entry-unblank' => 'ملأ $1',
4446 'blanknologin' => 'غير مسجل الدخول',
4547 'blanknologintext' => 'يجب أن تكون مستخدما مسجلا و '
46 - .'[[Special:UserLogin|تسجل الدخول]] لإفراغ أو ملأ صفحة.'
 48+ . '[[Special:UserLogin|تسجل الدخول]] لإفراغ أو ملأ صفحة.'
4749 );
\ No newline at end of file
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.php
@@ -17,7 +17,7 @@
1818
1919 # Alert the user that this is not a valid entry point to MediaWiki if they try to access the
2020 # special pages file directly.
21 -if (!defined('MEDIAWIKI')) {
 21+if ( !defined( 'MEDIAWIKI' ) ) {
2222 echo <<<EOT
2323 To install the Pure Wiki Deletion extension, put the following line in LocalSettings.php:
2424 require_once( "\$IP/extensions/PureWikiDeletion/PureWikiDeletion.php" );
@@ -31,10 +31,10 @@
3232 'url' => 'http://www.mediawiki.org/wiki/Extension:PureWikiDeletion',
3333 'description' => 'Implements pure wiki deletion',
3434 'descriptionmsg' => 'PureWikiDeletion-desc',
35 - 'version' => '1.0.1',
 35+ 'version' => '1.0.2',
3636 );
3737
38 -$dir = dirname(__FILE__) . '/';
 38+$dir = dirname( __FILE__ ) . '/';
3939
4040 $wgAutoloadClasses['PureWikiDeletionHooks'] = "$dir/PureWikiDeletion.hooks.php";
4141 $wgAutoloadClasses['RandomExcludeBlank'] = "$dir/SpecialPureWikiDeletion.php";
@@ -75,12 +75,12 @@
7676 wfLoadExtensionMessages( 'PureWikiDeletion' );
7777 }
7878
79 -function wfBlankLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks=false ) {
 79+function wfBlankLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) {
8080 $rv = wfMsgReal( 'blank-log-entry-blank', $params );
8181 return $rv;
8282 }
8383
84 -function wfUnblankLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks=false ) {
 84+function wfUnblankLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) {
8585 $rv = wfMsgReal( 'blank-log-entry-unblank', $params );
8686 return $rv;
8787 }
@@ -88,27 +88,27 @@
8989 function PureWikiDeletionSaveHook( &$article, &$user, &$text, &$summary,
9090 $minor, $watch, $sectionanchor, &$flags ) {
9191 global $wgOut;
92 - if ($text==""){
93 - if (!($user->isLoggedIn())){
94 - $wgOut->showErrorPage( 'blanknologin','blanknologintext');
 92+ if ( $text == "" ) {
 93+ if ( !( $user->isLoggedIn() ) ) {
 94+ $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
9595 return false;
9696 }
97 - if ($summary==wfMsgForContent( 'autosumm-blank')){
 97+ if ( $summary == wfMsgForContent( 'autosumm-blank' ) ) {
9898 $hasHistory = false;
99 - $summary=$article->generateReason($hasHistory);
 99+ $summary = $article->generateReason( $hasHistory );
100100 }
101101 } else {
102102 $dbr = wfGetDB( DB_SLAVE );
103 - $blank_page_id=$article->getID();
104 - $result=$dbr->selectRow('blanked_page','blank_page_id'
105 - ,array("blank_page_id" => $blank_page_id));
106 - if ($result){
107 - if (!($user->isLoggedIn())){
108 - $wgOut->showErrorPage( 'blanknologin','blanknologintext');
 103+ $blank_page_id = $article->getID();
 104+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
 105+ , array( "blank_page_id" => $blank_page_id ) );
 106+ if ( $result ) {
 107+ if ( !( $user->isLoggedIn() ) ) {
 108+ $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
109109 return false;
110110 }
111 - if ($summary==''){
112 - $summary=$article->getAutosummary('',$text,EDIT_NEW);
 111+ if ( $summary == '' ) {
 112+ $summary = $article->getAutosummary( '', $text, EDIT_NEW );
113113 }
114114 }
115115 }
@@ -133,18 +133,18 @@
134134 return true;
135135 }
136136
137 -function PureWikiDeletionAlternateEditHook ($editPage){
138 - global $wgUser,$wgOut;
139 - if ($wgUser->isLoggedIn()){
 137+function PureWikiDeletionAlternateEditHook ( $editPage ) {
 138+ global $wgUser, $wgOut;
 139+ if ( $wgUser->isLoggedIn() ) {
140140 return true;
141141 }
142142 $dbr = wfGetDB( DB_SLAVE );
143 - $blank_page_id=$editPage->getArticle()->getID();
144 - $result=$dbr->selectRow('blanked_page','blank_page_id',array
145 - ("blank_page_id" => $blank_page_id));
146 - if (!$result){
 143+ $blank_page_id = $editPage->getArticle()->getID();
 144+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id', array
 145+ ( "blank_page_id" => $blank_page_id ) );
 146+ if ( !$result ) {
147147 return true;
148148 }
149 - $wgOut->showErrorPage( 'blanknologin','blanknologintext');
 149+ $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' );
150150 return false;
151151 }
\ No newline at end of file
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.hooks.php
@@ -1,5 +1,5 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) {
 3+if ( !defined( 'MEDIAWIKI' ) ) {
44 echo <<<EOT
55 To install the Pure Wiki Deletion extension, put the following line in LocalSettings.php:
66 require_once( "\$IP/extensions/PureWikiDeletion/PureWikiDeletion.php" );
@@ -11,45 +11,48 @@
1212
1313 public static function PureWikiDeletionOutputPageParserOutputHook( &$out, $parseroutput ) {
1414 $dbr = wfGetDB( DB_SLAVE );
15 - $target=$out->getTitle();
16 - $blank_page_id=$target->getArticleID();
17 - if( $target->getNamespace() == NS_SPECIAL
 15+ $target = $out->getTitle();
 16+ $blank_page_id = $target->getArticleID();
 17+ if ( $target->getNamespace() == NS_SPECIAL
1818 || $target->getNamespace() == NS_MEDIA
1919 || $target->getNamespace() == NS_FILE
20 - || $target->isExternal()) {
 20+ || $target->isExternal() ) {
2121 return true;
2222 }
23 - $result=$dbr->selectRow('blanked_page','blank_page_id'
24 - ,array("blank_page_id" => $blank_page_id));
25 - if (!$result){
 23+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
 24+ , array( "blank_page_id" => $blank_page_id ) );
 25+ if ( !$result ) {
2626 return true;
2727 }
28 - $out->setRobotPolicy('noindex,nofollow');
29 - if ($out->getPageTitle()==$target->getPrefixedText()){
30 - $out->redirect($target->getEditURL());
 28+ $out->setRobotPolicy( 'noindex,nofollow' );
 29+ if ( $out->getPageTitle() == $target->getPrefixedText() ) {
 30+ $out->redirect( $target->getEditURL() );
3131 }
3232
33 - $out->setPageTitle($out->getPageTitle());
 33+ $out->setPageTitle( $out->getPageTitle() );
3434 return true;
3535 }
3636
3737 public static function PureWikiDeletionSaveCompleteHook( &$article, &$user, $text, $summary,
38 - $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId ){
39 - if (!isset($revision)){
 38+ $minoredit, &$watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId,
 39+ &$redirect ) {
 40+ global $wgOut;
 41+ wfLoadExtensionMessages( 'PureWikiDeletion' );
 42+ if ( !isset( $revision ) ) {
4043 return true;
4144 }
42 - $mTitle=$article->getTitle();
43 - if ($mTitle->getNamespace() == NS_FILE){
 45+ $mTitle = $article->getTitle();
 46+ if ( $mTitle->getNamespace() == NS_FILE ) {
4447 return true;
4548 }
46 - $blankRevId=$revision->getId();
47 - if ($text==""){
48 - if ($summary==wfMsgForContent( 'autosumm-blank')){
 49+ $blankRevId = $revision->getId();
 50+ if ( $text == "" ) {
 51+ if ( $summary == wfMsgForContent( 'autosumm-blank' ) ) {
4952 $hasHistory = false;
50 - $summary=$article->generateReason($hasHistory);
 53+ $summary = $article->generateReason( $hasHistory );
5154 }
5255 $dbw = wfGetDB( DB_MASTER );
53 - $blank_row=array(
 56+ $blank_row = array(
5457 'blank_page_id' => $article->getID(),
5558 'blank_user_id' => $user->getId(),
5659 'blank_user_name' => $user->getName(),
@@ -57,45 +60,47 @@
5861 'blank_summary' => $summary,
5962 'blank_parent_id' => $revision->getParentId()
6063 );
61 - $dbw->insert('blanked_page',$blank_row);
62 - $log = new LogPage( 'blank');
63 - $log->addEntry( 'blank', $mTitle, $summary, array(), $user);
 64+ $dbw->insert( 'blanked_page', $blank_row );
 65+ $log = new LogPage( 'blank' );
 66+ $log->addEntry( 'blank', $mTitle, $summary, array(), $user );
6467 $dbw->commit();
6568 $dbw->delete( 'recentchanges',
6669 array( 'rc_this_oldid' => $blankRevId
67 - ));
 70+ ) );
6871 Article::onArticleDelete( $mTitle );
6972 $mTitle->resetArticleID( 0 );
70 - if ($user->getOption( 'watchblank' )){
71 - $myWatched=WatchedItem::fromUserTitle($user,$mTitle);
72 - $myWatched->addWatch();
73 - $watchthis=true;
 73+ if ( $user->getOption( 'watchblank' ) ) {
 74+ $watchthis = true;
7475 }
 76+ $redirect = false;
 77+ $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
 78+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 79+ $loglink = wfMsg( 'blank-log-link' );
 80+ $wgOut->addWikiMsg( 'blankedtext', $mTitle->getPrefixedText(), $loglink );
 81+ $wgOut->returnToMain( false );
7582 } else {
7683 $dbr = wfGetDB( DB_SLAVE );
77 - $blank_page_id=$article->getID();
78 - $result=$dbr->selectRow('blanked_page','blank_page_id'
79 - ,array("blank_page_id" => $blank_page_id));
80 - if (!$result){
 84+ $blank_page_id = $article->getID();
 85+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
 86+ , array( "blank_page_id" => $blank_page_id ) );
 87+ if ( !$result ) {
8188 return true;
8289 } else {
83 - if ($summary==''){
84 - $summary=$article->getAutosummary('',$text,EDIT_NEW);
85 - }
86 - $dbw=wfGetDB( DB_MASTER );
87 - $blank_page_id=$article->getID();
88 - $dbw->delete ('blanked_page'
89 - ,array("blank_page_id" => $blank_page_id));
90 - $log = new LogPage( 'blank');
91 - $log->addEntry( 'unblank', $mTitle, $summary, array(), $user);
 90+ if ( $summary == '' ) {
 91+ $summary = $article->getAutosummary( '', $text, EDIT_NEW );
 92+ }
 93+ $dbw = wfGetDB( DB_MASTER );
 94+ $blank_page_id = $article->getID();
 95+ $dbw->delete ( 'blanked_page'
 96+ , array( "blank_page_id" => $blank_page_id ) );
 97+ $log = new LogPage( 'blank' );
 98+ $log->addEntry( 'unblank', $mTitle, $summary, array(), $user );
9299 $dbw->commit();
93100 $dbw->delete( 'recentchanges',
94101 array( 'rc_this_oldid' => $blankRevId
95 - ));
96 - if ($user->getOption( 'watchunblank' )){
97 - $myWatched=WatchedItem::fromUserTitle($user,$mTitle);
98 - $myWatched->addWatch();
99 - $watchthis=true;
 102+ ) );
 103+ if ( $user->getOption( 'watchunblank' ) ) {
 104+ $watchthis = true;
100105 }
101106 $mTitle->touchLinks();
102107 $mTitle->invalidateCache();
@@ -107,28 +112,28 @@
108113
109114
110115 public static function PureWikiDeletionLink( $skin, $target, &$text, &$customAttribs, &$query, &$options
111 - , &$ret){
 116+ , &$ret ) {
112117 global $wgPureWikiDeletionBlankLinkStyle;
113118 // If it's on the local wiki, then see if it's blanked
114119 if ( in_array( 'known', $options ) ) {
115120 $dbr = wfGetDB( DB_SLAVE );
116 - $blank_page_id=$target->getArticleID();
117 - if( $target->getNamespace() == NS_SPECIAL
 121+ $blank_page_id = $target->getArticleID();
 122+ if ( $target->getNamespace() == NS_SPECIAL
118123 || $target->getNamespace() == NS_MEDIA
119124 || $target->getNamespace() == NS_FILE
120 - || $target->isExternal()) {
 125+ || $target->isExternal() ) {
121126 return true;
122127 }
123 - $result=$dbr->selectRow('blanked_page','blank_page_id'
124 - ,array("blank_page_id" => $blank_page_id));
125 - if (!$result){
 128+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
 129+ , array( "blank_page_id" => $blank_page_id ) );
 130+ if ( !$result ) {
126131 return true;
127 - } elseif (!isset($query['action'])
128 - && !isset($query['curid'])
129 - && !isset($query['oldid'])){
130 - $query['action']="edit";
131 - $customAttribs['style']=$wgPureWikiDeletionBlankLinkStyle;
132 - //$options='broken';
 132+ } elseif ( !isset( $query['action'] )
 133+ && !isset( $query['curid'] )
 134+ && !isset( $query['oldid'] ) ) {
 135+ $query['action'] = "edit";
 136+ $customAttribs['style'] = $wgPureWikiDeletionBlankLinkStyle;
 137+ // $options='broken';
133138 }
134139 }
135140 return true;
@@ -136,10 +141,10 @@
137142
138143 public static function PureWikiDeletionEditHook( $editPage ) {
139144 global $wgLang;
140 - wfLoadExtensionMessages('PureWikiDeletion');
 145+ wfLoadExtensionMessages( 'PureWikiDeletion' );
141146 $dbr = wfGetDB( DB_SLAVE );
142 - $blank_page_id=$editPage->getArticle()->getID();
143 - $blank_row=array(
 147+ $blank_page_id = $editPage->getArticle()->getID();
 148+ $blank_row = array(
144149 'blank_user_id',
145150 'blank_user_name',
146151 'blank_timestamp',
@@ -147,25 +152,25 @@
148153 'blank_parent_id'
149154 );
150155
151 - $result=$dbr->selectRow('blanked_page',$blank_row,array
152 - ('blank_page_id' => $blank_page_id));
153 - if (!$result){
 156+ $result = $dbr->selectRow( 'blanked_page', $blank_row, array
 157+ ( 'blank_page_id' => $blank_page_id ) );
 158+ if ( !$result ) {
154159 return true;
155160 }
156161
157 - $blank_user_id=$result->blank_user_id;
158 - if ($blank_user_id==0){
159 - $blank_user_name=$result->blank_user_name;
 162+ $blank_user_id = $result->blank_user_id;
 163+ if ( $blank_user_id == 0 ) {
 164+ $blank_user_name = $result->blank_user_name;
160165 } else {
161 - $blanking_user=User::newFromId($blank_user_id);
162 - $blank_user_name=$blanking_user->getName();
 166+ $blanking_user = User::newFromId( $blank_user_id );
 167+ $blank_user_name = $blanking_user->getName();
163168 }
164169 $html = wfMsgExt( 'purewikideletion-blanked', 'parse', array
165 - ($blank_user_name
166 - ,$wgLang->timeanddate( wfTimestamp( TS_MW
 170+ ( $blank_user_name
 171+ , $wgLang->timeanddate( wfTimestamp( TS_MW
167172 , $result->blank_timestamp ), true )
168 - ,$result->blank_summary
169 - ,$result->blank_parent_id ) );
 173+ , $result->blank_summary
 174+ , $result->blank_parent_id ) );
170175 $editPage->editFormPageTop .= $html;
171176
172177 return true;
@@ -174,23 +179,23 @@
175180 public static function PureWikiDeletionDeleteHook( &$article, &$user, $reason, $id )
176181 {
177182 $dbr = wfGetDB( DB_SLAVE );
178 - $result=$dbr->selectRow('blanked_page','blank_page_id'
179 - ,array("blank_page_id" => $id));
180 - if (!$result){
 183+ $result = $dbr->selectRow( 'blanked_page', 'blank_page_id'
 184+ , array( "blank_page_id" => $id ) );
 185+ if ( !$result ) {
181186 return true;
182187 } else {
183 - $dbw=wfGetDB( DB_MASTER );
184 - $dbw->delete ('blanked_page',array("blank_page_id" => $id));
 188+ $dbw = wfGetDB( DB_MASTER );
 189+ $dbw->delete ( 'blanked_page', array( "blank_page_id" => $id ) );
185190 }
186191 return true;
187192 }
188193
189194 public static function PureWikiDeletionUndeleteHook( $title, $create ) {
190195 $dbr = wfGetDB( DB_SLAVE );
191 - $myRevision=Revision::loadFromTitle($dbr,$title);
192 - if ($myRevision->getRawText ()==""){
 196+ $myRevision = Revision::loadFromTitle( $dbr, $title );
 197+ if ( $myRevision->getRawText () == "" ) {
193198 $dbw = wfGetDB( DB_MASTER );
194 - $blank_row=array(
 199+ $blank_row = array(
195200 'blank_page_id' => $title->getArticleID(),
196201 'blank_user_id' => $myRevision->getRawUser(),
197202 'blank_user_name' => $myRevision->getRawUserText(),
@@ -198,7 +203,7 @@
199204 'blank_summary' => $myRevision->getRawComment (),
200205 'blank_parent_id' => $myRevision->getParentId()
201206 );
202 - $dbw->insert('blanked_page',$blank_row);
 207+ $dbw->insert( 'blanked_page', $blank_row );
203208 }
204209 return true;
205210 }
@@ -221,35 +226,35 @@
222227 return true;
223228 }
224229
225 - public static function efPureWikiDeletionParserFunction_RenderBlank( $parser, $param1 = '', $param2='', $param3='') {
226 - return PureWikiDeletionHooks::evaluateBlankness ($parser, $param1, $param2, $param3);
 230+ public static function efPureWikiDeletionParserFunction_RenderBlank( $parser, $param1 = '', $param2 = '', $param3 = '' ) {
 231+ return PureWikiDeletionHooks::evaluateBlankness ( $parser, $param1, $param2, $param3 );
227232 }
228233
229 - public static function efPureWikiDeletionParserFunction_RenderNotBlank( $parser, $param1 = '', $param2='', $param3='') {
230 - return PureWikiDeletionHooks::evaluateBlankness ($parser, $param1, $param3, $param2);
 234+ public static function efPureWikiDeletionParserFunction_RenderNotBlank( $parser, $param1 = '', $param2 = '', $param3 = '' ) {
 235+ return PureWikiDeletionHooks::evaluateBlankness ( $parser, $param1, $param3, $param2 );
231236 }
232237
233 - public static function evaluateBlankness ($parser, $param1 = '', $param2='', $param3=''){
234 - global $wgNamespaceAliases,$wgExpensiveParserFunctionLimit;
235 - if ($parser->incrementExpensiveFunctionCount()){
 238+ public static function evaluateBlankness ( $parser, $param1 = '', $param2 = '', $param3 = '' ) {
 239+ global $wgNamespaceAliases, $wgExpensiveParserFunctionLimit;
 240+ if ( $parser->incrementExpensiveFunctionCount() ) {
236241 $title = Title::newFromText( $param1 );
237 - if ($title==null){
 242+ if ( $title == null ) {
238243 return;
239244 }
240 - if( $title->getNamespace() == NS_SPECIAL || $title->getNamespace() == NS_MEDIA
241 - || $title->isExternal()) {
 245+ if ( $title->getNamespace() == NS_SPECIAL || $title->getNamespace() == NS_MEDIA
 246+ || $title->isExternal() ) {
242247 return $param3; // These not-editable namespaces are never considered blank
243248 }
244 - $param1=$title->getDBkey ();
245 - $searchNameSpace=$title->getNamespace();
 249+ $param1 = $title->getDBkey ();
 250+ $searchNameSpace = $title->getNamespace();
246251 $dbr = wfGetDB( DB_SLAVE );
247 - if (!$title->exists()){
 252+ if ( !$title->exists() ) {
248253 return $param3; // This page does not exist; therefore it can't be blank
249254 }
250 - $blank_page_id=$title->getArticleID();
251 - $row=$dbr->selectRow('blanked_page','blank_page_id',array
252 - ("blank_page_id" => $blank_page_id));
253 - if (!$row){
 255+ $blank_page_id = $title->getArticleID();
 256+ $row = $dbr->selectRow( 'blanked_page', 'blank_page_id', array
 257+ ( "blank_page_id" => $blank_page_id ) );
 258+ if ( !$row ) {
254259 return $param3; // This page exists but is not blanked
255260 }
256261 return $param2; // This page exists and is blanked

Status & tagging log