r113604 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113603‎ | r113604 | r113605 >
Date:00:18, 12 March 2012
Author:saper
Status:reverted
Tags:gerritmigration 
Comment:
bug 16985: Show number of recent edits in Special:Nuke

One aggregate query only to get list of recent changes
matching the criteria.

Bumping extension version + adding myself to credits.

Followup-To: r108602 r108871

i18n: remove nuke-viewchanges introduced in r111298
Modified paths:
  • /trunk/extensions/Nuke/Nuke.i18n.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Nuke/Nuke_body.php
@@ -161,11 +161,13 @@
162162 /**
163163 * @var $title Title
164164 */
165 - list( $title, $userName ) = $info;
 165+ list( $title, $userName, $edits ) = $info;
166166
167167 $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
168168 $thumb = $image && $image->exists() ? $image->transform( array( 'width' => 120, 'height' => 120 ), 0 ) : false;
169169
 170+ $changes = wfMsgExt( 'nchanges', 'parsemag', $this->getLanguage()->formatNum( $edits ) );
 171+
170172 $out->addHTML( '<li>' .
171173 Xml::check(
172174 'pages[]',
@@ -179,7 +181,7 @@
180182 ( $userName ? wfMsgExt( 'nuke-editby', 'parseinline', $userName ) . ',&#160;' : '' ) .
181183 Linker::linkKnown(
182184 $title,
183 - wfMsg( 'nuke-viewchanges' ),
 185+ $changes,
184186 array(),
185187 array( 'action' => 'history' )
186188 ) .
@@ -204,13 +206,29 @@
205207 protected function getNewPages( $username, $limit ) {
206208 $dbr = wfGetDB( DB_SLAVE );
207209
 210+ /**
 211+ * This is the worst-case query:
 212+ *
 213+ * SELECT rc_user_text, rc_namespace, rc_title, SUM(1) AS edits, MAX(rc_new)
 214+ * FROM recentchanges
 215+ * WHERE (rc_log_type IS NULL OR (rc_log_type = 'upload' AND rc_log_action='upload'))
 216+ * AND rc_title LIKE 'Test%'
 217+ * GROUP BY rc_user_text, rc_namespace, rc_title
 218+ * HAVING MIN(CASE
 219+ * WHEN rc_log_type IS NULL THEN 2
 220+ * WHEN rc_log_type = 'upload' THEN 1
 221+ * ELSE 0 END) = 1
 222+ * OR MAX(rc_new) = 1
 223+ * ORDER BY min(rc_timestamp) DESC;
 224+ *
 225+ */
 226+
208227 $what = array(
209228 'rc_namespace',
210229 'rc_title',
211 - 'rc_timestamp',
212230 );
213231
214 - $where = array( "(rc_new = 1) OR (rc_log_type = 'upload' AND rc_log_action = 'upload')" );
 232+ $where = array( "(rc_log_type IS NULL) OR (rc_log_type = 'upload' AND rc_log_action = 'upload')" );
215233
216234 if ( $username === '' ) {
217235 $what[] = 'rc_user_text';
@@ -222,16 +240,23 @@
223241 if ( !is_null( $pattern ) && trim( $pattern ) !== '' ) {
224242 $where[] = 'rc_title LIKE ' . $dbr->addQuotes( $pattern );
225243 }
226 - $group = implode( ', ', $what );
 244+ $group = implode( ', ', $what );
 245+ $what[] = "sum(1) AS edits";
227246
228247 $result = $dbr->select( 'recentchanges',
229248 $what,
230249 $where,
231250 __METHOD__,
232251 array(
233 - 'ORDER BY' => 'rc_timestamp DESC',
234252 'GROUP BY' => $group,
235 - 'LIMIT' => $limit
 253+ 'LIMIT' => $limit,
 254+ 'ORDER BY' => 'MIN(rc_timestamp) DESC',
 255+ 'HAVING' => <<<QUERY
 256+ MIN(CASE WHEN rc_log_type IS NULL THEN 2
 257+ WHEN rc_log_type = 'upload' THEN 1
 258+ ELSE 0 END) = 1
 259+ OR MAX(rc_new) = 1
 260+QUERY
236261 )
237262 );
238263
@@ -240,7 +265,8 @@
241266 foreach ( $result as $row ) {
242267 $pages[] = array(
243268 Title::makeTitle( $row->rc_namespace, $row->rc_title ),
244 - $username === '' ? $row->rc_user_text : false
 269+ $username === '' ? $row->rc_user_text : false,
 270+ $row->edits,
245271 );
246272 }
247273
Index: trunk/extensions/Nuke/Nuke.i18n.php
@@ -37,7 +37,6 @@
3838 'nuke-delete-more' => '[[Special:Nuke|Delete more pages]]',
3939 'nuke-pattern' => 'Pattern for the page name:',
4040 'nuke-nopages-global'=> 'There are no new pages in [[Special:RecentChanges|recent changes]].',
41 - 'nuke-viewchanges' => 'view changes',
4241 );
4342
4443 /** Message documentation (Message documentation)
@@ -196,7 +195,6 @@
197196 'nuke-delete-more' => '[[Special:Nuke|Desaniciar más páxines]]',
198197 'nuke-pattern' => 'Patrón pal nome de páxina:',
199198 'nuke-nopages-global' => 'Nun hai páxines nueves nos [[Special:RecentChanges|cambios recientes]].',
200 - 'nuke-viewchanges' => 'ver los cambios',
201199 );
202200
203201 /** Azerbaijani (Azərbaycanca)
@@ -288,7 +286,6 @@
289287 'nuke-delete-more' => '[[Special:Nuke|Масавае выдаленьне старонак]]',
290288 'nuke-pattern' => 'Узор для назвы старонкі:',
291289 'nuke-nopages-global' => 'У [[Special:RecentChanges|апошніх зьменах]] больш няма новых старонак.',
292 - 'nuke-viewchanges' => 'праглядзець зьмены',
293290 );
294291
295292 /** Bulgarian (Български)
@@ -356,7 +353,6 @@
357354 'nuke-delete-more' => '[[Special:Nuke|Diverkañ pajennoù all]]',
358355 'nuke-pattern' => 'Patrom evit anv ar bajenn :',
359356 'nuke-nopages-global' => "N'eus pajenn nevez ebet er [[Special:RecentChanges|c'hemmoù diwezhañ]].",
360 - 'nuke-viewchanges' => "Diskouez ar c'hemmoù",
361357 );
362358
363359 /** Bosnian (Bosanski)
@@ -509,7 +505,6 @@
510506 'nuke-delete-more' => '[[Special:Nuke|Weitere Seiten löschen]]',
511507 'nuke-pattern' => 'Muster für den Seitennamen:',
512508 'nuke-nopages-global' => 'Es gibt keine neuen Seiten unter den [[Special:RecentChanges|letzten Änderungen]].',
513 - 'nuke-viewchanges' => 'Änderungen ansehen',
514509 );
515510
516511 /** German (formal address) (‪Deutsch (Sie-Form)‬)
@@ -569,7 +564,6 @@
570565 'nuke-delete-more' => '[[Special:Nuke|Dalšne boki lašowaś]]',
571566 'nuke-pattern' => 'Pśikład za bokowe mě:',
572567 'nuke-nopages-global' => 'Njejsu žedne nowe boki w [[Special:RecentChanges|aktualnych změnach]].',
573 - 'nuke-viewchanges' => 'změny pokazaś',
574568 );
575569
576570 /** Ewe (Eʋegbe) */
@@ -668,7 +662,6 @@
669663 'nuke-delete-more' => '[[Special:Nuke|Borrar más páginas]]',
670664 'nuke-pattern' => 'Patrón del título de la página:',
671665 'nuke-nopages-global' => 'No hay nuevas páginas en los [[Special:RecentChanges|cambios recientes]].',
672 - 'nuke-viewchanges' => 'Mostrar cambios',
673666 );
674667
675668 /** Estonian (Eesti)
@@ -741,7 +734,6 @@
742735 'nuke-delete-more' => '[[Special:Nuke|حذف صفحه‌های بیشتر]]',
743736 'nuke-pattern' => 'الگو برای نام صفحه:',
744737 'nuke-nopages-global' => 'هیچ صفحهٔ جدیدی در [[Special:RecentChanges|فهرست تغییرات اخیر]] نیست.',
745 - 'nuke-viewchanges' => 'نمایش تغییرات',
746738 );
747739
748740 /** Finnish (Suomi)
@@ -813,7 +805,6 @@
814806 'nuke-delete-more' => '[[Special:Nuke|Supprimer plus de pages]]',
815807 'nuke-pattern' => 'Modèle pour le nom de page:',
816808 'nuke-nopages-global' => "Il n'y a pas de nouvelle page dans [[Special:RecentChanges|changements récents]].",
817 - 'nuke-viewchanges' => 'voir les modifications',
818809 );
819810
820811 /** Franco-Provençal (Arpetan)
@@ -883,7 +874,6 @@
884875 'nuke-delete-more' => '[[Special:Nuke|Borrar máis páxinas]]',
885876 'nuke-pattern' => 'Patrón para o nome de páxina:',
886877 'nuke-nopages-global' => 'Non hai páxinas novas nos [[Special:RecentChanges|cambios recentes]].',
887 - 'nuke-viewchanges' => 'ollar os cambios',
888878 );
889879
890880 /** Ancient Greek (Ἀρχαία ἑλληνικὴ)
@@ -967,7 +957,6 @@
968958 'nuke-delete-more' => '[[Special:Nuke|למחוק עוד דפים]]',
969959 'nuke-pattern' => 'תבנית עבור שם הדף:',
970960 'nuke-nopages-global' => 'אין דפים חדשים ב[[Special:RecentChanges|שינויים אחרונים]].',
971 - 'nuke-viewchanges' => 'הצגת שינויים',
972961 );
973962
974963 /** Hindi (हिन्दी)
@@ -1043,7 +1032,6 @@
10441033 'nuke-delete-more' => '[[Special:Nuke|Dalše strony wušmórnyć]]',
10451034 'nuke-pattern' => 'Přikład za mjeno strony:',
10461035 'nuke-nopages-global' => 'Njejsu žane nowe strony w [[Special:RecentChanges|aktualnych změnach]].',
1047 - 'nuke-viewchanges' => 'změny pokazać',
10481036 );
10491037
10501038 /** Hungarian (Magyar)
@@ -1099,7 +1087,6 @@
11001088 'nuke-delete-more' => '[[Special:Nuke|Deler plus paginas]]',
11011089 'nuke-pattern' => 'Patrono pro le nomine de pagina:',
11021090 'nuke-nopages-global' => 'Il non ha nove paginas in le [[Special:RecentChanges|modificationes recente]].',
1103 - 'nuke-viewchanges' => 'vider modificationes',
11041091 );
11051092
11061093 /** Indonesian (Bahasa Indonesia)
@@ -1234,7 +1221,6 @@
12351222 'nuke-delete-more' => '[[Special:Nuke|Cancella più pagine]]',
12361223 'nuke-pattern' => 'Modello per il titolo della pagina:',
12371224 'nuke-nopages-global' => 'Non ci sono nuove pagine negli [[Special:RecentChanges|ultimi cambiamenti]].',
1238 - 'nuke-viewchanges' => 'vedi modifiche',
12391225 );
12401226
12411227 /** Japanese (日本語)
@@ -1457,7 +1443,6 @@
14581444 'nuke-delete-more' => '[[Special:Nuke|Méi Säite läschen]]',
14591445 'nuke-pattern' => 'Muster fir de Säitennumm:',
14601446 'nuke-nopages-global' => 'Et si keng nei Säiten an de [[Special:RecentChanges|rezenten Ännerungen]].',
1461 - 'nuke-viewchanges' => 'Ännerunge weisen',
14621447 );
14631448
14641449 /** Limburgish (Limburgs)
@@ -1550,7 +1535,6 @@
15511536 'nuke-delete-more' => '[[Special:Nuke|Избриши уште страници]]',
15521537 'nuke-pattern' => 'Мостра за име на страница:',
15531538 'nuke-nopages-global' => 'Нема нови страници во [[Special:RecentChanges|скорешните промени]].',
1554 - 'nuke-viewchanges' => 'прикажи промени',
15551539 );
15561540
15571541 /** Malayalam (മലയാളം)
@@ -1626,7 +1610,6 @@
16271611 'nuke-delete-more' => '[[Special:Nuke|Hapuskan lebih banyak laman]]',
16281612 'nuke-pattern' => 'Pola nama laman:',
16291613 'nuke-nopages-global' => 'Tiada laman baru dalam [[Special:RecentChanges|perubahan terkini]].',
1630 - 'nuke-viewchanges' => 'lihat perubahan',
16311614 );
16321615
16331616 /** Maltese (Malti)
@@ -1763,7 +1746,6 @@
17641747 'nuke-delete-more' => "[[Special:Nuke|Meer pagina's verwijderen]]",
17651748 'nuke-pattern' => 'Patroon voor de paginanaam:',
17661749 'nuke-nopages-global' => "Er zijn geen nieuwe pagina's in de [[Special:RecentChanges|recente wijzigingen]].",
1767 - 'nuke-viewchanges' => 'wijzigingen bekijken',
17681750 );
17691751
17701752 /** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
@@ -1886,7 +1868,6 @@
18871869 'nuke-delete-more' => '[[Special:Nuke|Usuń więcej stron]]',
18881870 'nuke-pattern' => 'Wzór nazwy strony:',
18891871 'nuke-nopages-global' => 'Brak nowych stron w [[Special:RecentChanges|ostatnich zmianach]].',
1890 - 'nuke-viewchanges' => 'widok zmian',
18911872 );
18921873
18931874 /** Piedmontese (Piemontèis)
@@ -1917,7 +1898,6 @@
19181899 'nuke-delete-more' => "[[Special:Nuke|Scancelé pì 'd pàgine]]",
19191900 'nuke-pattern' => 'Model për ël nòm ëd pàgina:',
19201901 'nuke-nopages-global' => "A-i é pa 'd pàgine neuve an [[Special:RecentChanges|ùltime modìfiche]].",
1921 - 'nuke-viewchanges' => 'varda modìfiche',
19221902 );
19231903
19241904 /** Pashto (پښتو)
@@ -2110,7 +2090,6 @@
21112091 'nuke-delete-more' => '[[Special:Nuke|Множественное удаление страниц]]',
21122092 'nuke-pattern' => 'Шаблон для имени страницы:',
21132093 'nuke-nopages-global' => 'В [[Special:RecentChanges|недавних изменениях]] нет новых страниц.',
2114 - 'nuke-viewchanges' => 'Внесённые изменения',
21152094 );
21162095
21172096 /** Rusyn (Русиньскый)
@@ -2251,7 +2230,6 @@
22522231 'nuke-delete-more' => '[[Special:Nuke|Izbriši več strani]]',
22532232 'nuke-pattern' => 'Vzorec imena strani:',
22542233 'nuke-nopages-global' => 'V [[Special:RecentChanges|zadnjih spremembah]] ni novih strani.',
2255 - 'nuke-viewchanges' => 'ogled sprememb',
22562234 );
22572235
22582236 /** Serbian (Cyrillic script) (‪Српски (ћирилица)‬)
@@ -2580,7 +2558,6 @@
25812559 'nuke-delete-more' => '[[Special:Nuke|Xóa thêm trang]]',
25822560 'nuke-pattern' => 'Mẫu tên trang:',
25832561 'nuke-nopages-global' => 'Không có trang mới trong các [[Special:RecentChanges|thay đổi gần đây]].',
2584 - 'nuke-viewchanges' => 'xem thay đổi',
25852562 );
25862563
25872564 /** Volapük (Volapük)
Index: trunk/extensions/Nuke/Nuke.php
@@ -4,7 +4,7 @@
55 die( 'Not an entry point.' );
66 }
77
8 -define( 'Nuke_VERSION', '1.1.4' );
 8+define( 'Nuke_VERSION', '1.1.5' );
99
1010 $dir = dirname(__FILE__) . '/';
1111
@@ -15,7 +15,7 @@
1616 'path' => __FILE__,
1717 'name' => 'Nuke',
1818 'descriptionmsg' => 'nuke-desc',
19 - 'author' => array( 'Brion Vibber', 'Jeroen De Dauw' ),
 19+ 'author' => array( 'Brion Vibber', 'Jeroen De Dauw', 'Marcin Cieślak' ),
2020 'url' => 'https://www.mediawiki.org/wiki/Extension:Nuke',
2121 'version' => Nuke_VERSION,
2222 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r114394Revert r113364, r113598, r113604, r113793, r113795. Unreviewed changes in Nuke....catrope19:25, 21 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108602fix bug 16985 based on attached patch by Nakonjeroendedauw09:34, 11 January 2012
r108871Revert most of r108602...reedy22:59, 13 January 2012
r111298Follow up to r108871; -mjeroendedauw14:45, 12 February 2012

Status & tagging log