Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.i18n.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | <?php |
4 | 4 | $messages = array(); |
5 | 5 | |
6 | | -$messages['en'] = array( |
| 6 | +$messages['en'] = array( |
7 | 7 | 'purewikideletion' => 'Pure wiki deletion', |
8 | 8 | 'randomexcludeblank' => 'Random page (exclude blank)', |
9 | 9 | 'populateblankedpagestable' => 'Populate blanked pages table', |
— | — | @@ -10,21 +10,23 @@ |
11 | 11 | 'purewikideletion-pref-watchblank' => 'Add pages I blank to my watchlist', |
12 | 12 | 'purewikideletion-pref-watchunblank' => 'Add pages I unblank to my watchlist', |
13 | 13 | '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', |
19 | 19 | 'blank-log-name' => 'Blank log', |
20 | 20 | 'blank-log-header' => 'Below is a list of page blankings and unblankings.', |
21 | 21 | 'blank-log-entry-blank' => 'blanked $1', |
22 | 22 | 'blank-log-entry-unblank' => 'unblanked $1', |
| 23 | + 'blank-log-link' => '[[Special:Log/blank|blank log]]', |
23 | 24 | 'blanknologin' => 'Not logged in', |
24 | 25 | '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.' |
26 | 28 | ); |
27 | 29 | |
28 | | -$messages['ar'] = array( |
| 30 | +$messages['ar'] = array( |
29 | 31 | 'purewikideletion' => 'حذف الويكي النقي', |
30 | 32 | 'randomexcludeblank' => 'صفحة عشوائية (لا يشمل ذلك الفارغة)', |
31 | 33 | 'populateblankedpagestable' => 'املأ جدول الصفحات الفارغة', |
— | — | @@ -32,15 +34,15 @@ |
33 | 35 | 'purewikideletion-pref-watchblank' => 'أضف الفصفحات التي أفرغها إلى قائمة مراقبتي', |
34 | 36 | 'purewikideletion-pref-watchunblank' => 'أضف الصفحات التي أملؤها إلى قائمة مراقبتي', |
35 | 37 | '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' => 'فارغة', |
40 | 42 | 'blank-log-name' => 'سجل الإفراغ', |
41 | 43 | 'blank-log-header' => 'بالأسفل قائمة بعمليات إفراغ وملأ الصفحات.', |
42 | 44 | 'blank-log-entry-blank' => 'أفرغ $1', |
43 | 45 | 'blank-log-entry-unblank' => 'ملأ $1', |
44 | 46 | 'blanknologin' => 'غير مسجل الدخول', |
45 | 47 | 'blanknologintext' => 'يجب أن تكون مستخدما مسجلا و ' |
46 | | - .'[[Special:UserLogin|تسجل الدخول]] لإفراغ أو ملأ صفحة.' |
| 48 | + . '[[Special:UserLogin|تسجل الدخول]] لإفراغ أو ملأ صفحة.' |
47 | 49 | ); |
\ No newline at end of file |
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | |
19 | 19 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the |
20 | 20 | # special pages file directly. |
21 | | -if (!defined('MEDIAWIKI')) { |
| 21 | +if ( !defined( 'MEDIAWIKI' ) ) { |
22 | 22 | echo <<<EOT |
23 | 23 | To install the Pure Wiki Deletion extension, put the following line in LocalSettings.php: |
24 | 24 | require_once( "\$IP/extensions/PureWikiDeletion/PureWikiDeletion.php" ); |
— | — | @@ -31,10 +31,10 @@ |
32 | 32 | 'url' => 'http://www.mediawiki.org/wiki/Extension:PureWikiDeletion', |
33 | 33 | 'description' => 'Implements pure wiki deletion', |
34 | 34 | 'descriptionmsg' => 'PureWikiDeletion-desc', |
35 | | - 'version' => '1.0.1', |
| 35 | + 'version' => '1.0.2', |
36 | 36 | ); |
37 | 37 | |
38 | | -$dir = dirname(__FILE__) . '/'; |
| 38 | +$dir = dirname( __FILE__ ) . '/'; |
39 | 39 | |
40 | 40 | $wgAutoloadClasses['PureWikiDeletionHooks'] = "$dir/PureWikiDeletion.hooks.php"; |
41 | 41 | $wgAutoloadClasses['RandomExcludeBlank'] = "$dir/SpecialPureWikiDeletion.php"; |
— | — | @@ -75,12 +75,12 @@ |
76 | 76 | wfLoadExtensionMessages( 'PureWikiDeletion' ); |
77 | 77 | } |
78 | 78 | |
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 ) { |
80 | 80 | $rv = wfMsgReal( 'blank-log-entry-blank', $params ); |
81 | 81 | return $rv; |
82 | 82 | } |
83 | 83 | |
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 ) { |
85 | 85 | $rv = wfMsgReal( 'blank-log-entry-unblank', $params ); |
86 | 86 | return $rv; |
87 | 87 | } |
— | — | @@ -88,27 +88,27 @@ |
89 | 89 | function PureWikiDeletionSaveHook( &$article, &$user, &$text, &$summary, |
90 | 90 | $minor, $watch, $sectionanchor, &$flags ) { |
91 | 91 | 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' ); |
95 | 95 | return false; |
96 | 96 | } |
97 | | - if ($summary==wfMsgForContent( 'autosumm-blank')){ |
| 97 | + if ( $summary == wfMsgForContent( 'autosumm-blank' ) ) { |
98 | 98 | $hasHistory = false; |
99 | | - $summary=$article->generateReason($hasHistory); |
| 99 | + $summary = $article->generateReason( $hasHistory ); |
100 | 100 | } |
101 | 101 | } else { |
102 | 102 | $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' ); |
109 | 109 | return false; |
110 | 110 | } |
111 | | - if ($summary==''){ |
112 | | - $summary=$article->getAutosummary('',$text,EDIT_NEW); |
| 111 | + if ( $summary == '' ) { |
| 112 | + $summary = $article->getAutosummary( '', $text, EDIT_NEW ); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
— | — | @@ -133,18 +133,18 @@ |
134 | 134 | return true; |
135 | 135 | } |
136 | 136 | |
137 | | -function PureWikiDeletionAlternateEditHook ($editPage){ |
138 | | - global $wgUser,$wgOut; |
139 | | - if ($wgUser->isLoggedIn()){ |
| 137 | +function PureWikiDeletionAlternateEditHook ( $editPage ) { |
| 138 | + global $wgUser, $wgOut; |
| 139 | + if ( $wgUser->isLoggedIn() ) { |
140 | 140 | return true; |
141 | 141 | } |
142 | 142 | $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 ) { |
147 | 147 | return true; |
148 | 148 | } |
149 | | - $wgOut->showErrorPage( 'blanknologin','blanknologintext'); |
| 149 | + $wgOut->showErrorPage( 'blanknologin', 'blanknologintext' ); |
150 | 150 | return false; |
151 | 151 | } |
\ No newline at end of file |
Index: trunk/extensions/PureWikiDeletion/PureWikiDeletion.hooks.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) { |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
4 | 4 | echo <<<EOT |
5 | 5 | To install the Pure Wiki Deletion extension, put the following line in LocalSettings.php: |
6 | 6 | require_once( "\$IP/extensions/PureWikiDeletion/PureWikiDeletion.php" ); |
— | — | @@ -11,45 +11,48 @@ |
12 | 12 | |
13 | 13 | public static function PureWikiDeletionOutputPageParserOutputHook( &$out, $parseroutput ) { |
14 | 14 | $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 |
18 | 18 | || $target->getNamespace() == NS_MEDIA |
19 | 19 | || $target->getNamespace() == NS_FILE |
20 | | - || $target->isExternal()) { |
| 20 | + || $target->isExternal() ) { |
21 | 21 | return true; |
22 | 22 | } |
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 ) { |
26 | 26 | return true; |
27 | 27 | } |
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() ); |
31 | 31 | } |
32 | 32 | |
33 | | - $out->setPageTitle($out->getPageTitle()); |
| 33 | + $out->setPageTitle( $out->getPageTitle() ); |
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | 37 | 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 ) ) { |
40 | 43 | return true; |
41 | 44 | } |
42 | | - $mTitle=$article->getTitle(); |
43 | | - if ($mTitle->getNamespace() == NS_FILE){ |
| 45 | + $mTitle = $article->getTitle(); |
| 46 | + if ( $mTitle->getNamespace() == NS_FILE ) { |
44 | 47 | return true; |
45 | 48 | } |
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' ) ) { |
49 | 52 | $hasHistory = false; |
50 | | - $summary=$article->generateReason($hasHistory); |
| 53 | + $summary = $article->generateReason( $hasHistory ); |
51 | 54 | } |
52 | 55 | $dbw = wfGetDB( DB_MASTER ); |
53 | | - $blank_row=array( |
| 56 | + $blank_row = array( |
54 | 57 | 'blank_page_id' => $article->getID(), |
55 | 58 | 'blank_user_id' => $user->getId(), |
56 | 59 | 'blank_user_name' => $user->getName(), |
— | — | @@ -57,45 +60,47 @@ |
58 | 61 | 'blank_summary' => $summary, |
59 | 62 | 'blank_parent_id' => $revision->getParentId() |
60 | 63 | ); |
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 ); |
64 | 67 | $dbw->commit(); |
65 | 68 | $dbw->delete( 'recentchanges', |
66 | 69 | array( 'rc_this_oldid' => $blankRevId |
67 | | - )); |
| 70 | + ) ); |
68 | 71 | Article::onArticleDelete( $mTitle ); |
69 | 72 | $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; |
74 | 75 | } |
| 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 ); |
75 | 82 | } else { |
76 | 83 | $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 ) { |
81 | 88 | return true; |
82 | 89 | } 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 ); |
92 | 99 | $dbw->commit(); |
93 | 100 | $dbw->delete( 'recentchanges', |
94 | 101 | 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; |
100 | 105 | } |
101 | 106 | $mTitle->touchLinks(); |
102 | 107 | $mTitle->invalidateCache(); |
— | — | @@ -107,28 +112,28 @@ |
108 | 113 | |
109 | 114 | |
110 | 115 | public static function PureWikiDeletionLink( $skin, $target, &$text, &$customAttribs, &$query, &$options |
111 | | - , &$ret){ |
| 116 | + , &$ret ) { |
112 | 117 | global $wgPureWikiDeletionBlankLinkStyle; |
113 | 118 | // If it's on the local wiki, then see if it's blanked |
114 | 119 | if ( in_array( 'known', $options ) ) { |
115 | 120 | $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 |
118 | 123 | || $target->getNamespace() == NS_MEDIA |
119 | 124 | || $target->getNamespace() == NS_FILE |
120 | | - || $target->isExternal()) { |
| 125 | + || $target->isExternal() ) { |
121 | 126 | return true; |
122 | 127 | } |
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 ) { |
126 | 131 | 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'; |
133 | 138 | } |
134 | 139 | } |
135 | 140 | return true; |
— | — | @@ -136,10 +141,10 @@ |
137 | 142 | |
138 | 143 | public static function PureWikiDeletionEditHook( $editPage ) { |
139 | 144 | global $wgLang; |
140 | | - wfLoadExtensionMessages('PureWikiDeletion'); |
| 145 | + wfLoadExtensionMessages( 'PureWikiDeletion' ); |
141 | 146 | $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( |
144 | 149 | 'blank_user_id', |
145 | 150 | 'blank_user_name', |
146 | 151 | 'blank_timestamp', |
— | — | @@ -147,25 +152,25 @@ |
148 | 153 | 'blank_parent_id' |
149 | 154 | ); |
150 | 155 | |
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 ) { |
154 | 159 | return true; |
155 | 160 | } |
156 | 161 | |
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; |
160 | 165 | } 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(); |
163 | 168 | } |
164 | 169 | $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 |
167 | 172 | , $result->blank_timestamp ), true ) |
168 | | - ,$result->blank_summary |
169 | | - ,$result->blank_parent_id ) ); |
| 173 | + , $result->blank_summary |
| 174 | + , $result->blank_parent_id ) ); |
170 | 175 | $editPage->editFormPageTop .= $html; |
171 | 176 | |
172 | 177 | return true; |
— | — | @@ -174,23 +179,23 @@ |
175 | 180 | public static function PureWikiDeletionDeleteHook( &$article, &$user, $reason, $id ) |
176 | 181 | { |
177 | 182 | $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 ) { |
181 | 186 | return true; |
182 | 187 | } 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 ) ); |
185 | 190 | } |
186 | 191 | return true; |
187 | 192 | } |
188 | 193 | |
189 | 194 | public static function PureWikiDeletionUndeleteHook( $title, $create ) { |
190 | 195 | $dbr = wfGetDB( DB_SLAVE ); |
191 | | - $myRevision=Revision::loadFromTitle($dbr,$title); |
192 | | - if ($myRevision->getRawText ()==""){ |
| 196 | + $myRevision = Revision::loadFromTitle( $dbr, $title ); |
| 197 | + if ( $myRevision->getRawText () == "" ) { |
193 | 198 | $dbw = wfGetDB( DB_MASTER ); |
194 | | - $blank_row=array( |
| 199 | + $blank_row = array( |
195 | 200 | 'blank_page_id' => $title->getArticleID(), |
196 | 201 | 'blank_user_id' => $myRevision->getRawUser(), |
197 | 202 | 'blank_user_name' => $myRevision->getRawUserText(), |
— | — | @@ -198,7 +203,7 @@ |
199 | 204 | 'blank_summary' => $myRevision->getRawComment (), |
200 | 205 | 'blank_parent_id' => $myRevision->getParentId() |
201 | 206 | ); |
202 | | - $dbw->insert('blanked_page',$blank_row); |
| 207 | + $dbw->insert( 'blanked_page', $blank_row ); |
203 | 208 | } |
204 | 209 | return true; |
205 | 210 | } |
— | — | @@ -221,35 +226,35 @@ |
222 | 227 | return true; |
223 | 228 | } |
224 | 229 | |
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 ); |
227 | 232 | } |
228 | 233 | |
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 ); |
231 | 236 | } |
232 | 237 | |
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() ) { |
236 | 241 | $title = Title::newFromText( $param1 ); |
237 | | - if ($title==null){ |
| 242 | + if ( $title == null ) { |
238 | 243 | return; |
239 | 244 | } |
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() ) { |
242 | 247 | return $param3; // These not-editable namespaces are never considered blank |
243 | 248 | } |
244 | | - $param1=$title->getDBkey (); |
245 | | - $searchNameSpace=$title->getNamespace(); |
| 249 | + $param1 = $title->getDBkey (); |
| 250 | + $searchNameSpace = $title->getNamespace(); |
246 | 251 | $dbr = wfGetDB( DB_SLAVE ); |
247 | | - if (!$title->exists()){ |
| 252 | + if ( !$title->exists() ) { |
248 | 253 | return $param3; // This page does not exist; therefore it can't be blank |
249 | 254 | } |
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 ) { |
254 | 259 | return $param3; // This page exists but is not blanked |
255 | 260 | } |
256 | 261 | return $param2; // This page exists and is blanked |