r108602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108601‎ | r108602 | r108603 >
Date:09:34, 11 January 2012
Author:jeroendedauw
Status:reverted (Comments)
Tags:
Comment:
fix bug 16985 based on attached patch by Nakon
Modified paths:
  • /trunk/extensions/Nuke/Nuke.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Nuke/Nuke_body.php
@@ -7,6 +7,7 @@
88 }
99
1010 public function execute( $par ) {
 11+
1112 if( !$this->userCanExecute( $this->getUser() ) ) {
1213 $this->displayRestrictionError();
1314 return;
@@ -184,7 +185,7 @@
185186 $out->addHTML(
186187 "</ul>\n" .
187188 Xml::submitButton( wfMsg( 'nuke-submit-delete' ) ) .
188 - "</form>"
 189+ '</form>'
189190 );
190191 }
191192
@@ -203,7 +204,6 @@
204205 'rc_namespace',
205206 'rc_title',
206207 'rc_timestamp',
207 - 'COUNT(*) AS edits'
208208 );
209209
210210 $where = array( "(rc_new = 1) OR (rc_log_type = 'upload' AND rc_log_action = 'upload')" );
@@ -233,11 +233,28 @@
234234 $pages = array();
235235
236236 foreach ( $result as $row ) {
 237+ // Note: 'COUNT(*) AS edits' here does not work. For some unknown reason,
 238+ // there sometimes are duplicate entries in recentchanges (possibly caused by importing stuff).
 239+ $resultEdits = $dbr->select(
 240+ 'recentchanges',
 241+ array(
 242+ 'rc_timestamp',
 243+ ),
 244+ array(
 245+ 'rc_title' => $row->rc_title,
 246+ 'rc_namespace' => $row->rc_namespace,
 247+ ),
 248+ __METHOD__,
 249+ array( 'DISTINCT' )
 250+ );
 251+
237252 $pages[] = array(
238253 Title::makeTitle( $row->rc_namespace, $row->rc_title ),
239 - $row->edits,
 254+ $resultEdits->numRows(),
240255 $username == '' ? $row->rc_user_text : false
241256 );
 257+
 258+ $dbr->freeResult( $resultEdits );
242259 }
243260
244261 return $pages;
Index: trunk/extensions/Nuke/Nuke.php
@@ -4,7 +4,7 @@
55 die( 'Not an entry point.' );
66 }
77
8 -define( 'Nuke_VERSION', '1.1.3' );
 8+define( 'Nuke_VERSION', '1.1.4' );
99
1010 $dir = dirname(__FILE__) . '/';
1111
@@ -15,7 +15,7 @@
1616 'path' => __FILE__,
1717 'name' => 'Nuke',
1818 'descriptionmsg' => 'nuke-desc',
19 - 'author' => 'Brion Vibber',
 19+ 'author' => array( 'Brion Vibber', 'Jeroen De Dauw' ),
2020 'url' => 'https://www.mediawiki.org/wiki/Extension:Nuke',
2121 'version' => Nuke_VERSION,
2222 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r108871Revert most of r108602...reedy22:59, 13 January 2012
r113604bug 16985: Show number of recent edits in Special:Nuke...saper00:18, 12 March 2012

Comments

#Comment by Nikerabbit (talk | contribs)   13:19, 11 January 2012

Not sure if I like 500 extra queries...can you make it do less?

#Comment by Jeroen De Dauw (talk | contribs)   16:18, 12 January 2012

I was thinking the same thing when applying the patch but did not see any obvious way to not do this. Then again, I'm not that familiar with the relevant part of the schema, so if you know a better way to get the needed info, I'd be very welcome :)

#Comment by Reedy (talk | contribs)   22:39, 13 January 2012
+			$dbr->freeResult( $resultEdits );

That's deprecated so no point adding that now

Status & tagging log