r56705 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56704‎ | r56705 | r56706 >
Date:14:44, 21 September 2009
Author:werdna
Status:deferred
Tags:
Comment:
Revert r56562, large whitespace changes committed with no warning, resulting in merge conflicts with several saved patches and my working copy.
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/api/ApiFeedLQTThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/DeletionController.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Dispatch.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/HistoricalThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Hooks.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Thread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/ThreadRevision.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Threads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/compat/HTMLForm.php (modified) (history)
  • /trunk/extensions/LiquidThreads/compat/Lqt-compat.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/compat/LqtCompatArticle.php (modified) (history)
  • /trunk/extensions/LiquidThreads/compat/generateCompatibilityLocalisation.php (modified) (history)
  • /trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/migrateDatabase.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialMergeThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialSplitThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SummaryPageView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadActionPage.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/compat/Lqt-compat.i18n.php
@@ -1,7 +1,7 @@
22 <?php
33 // This file is generated automatically by generateCompatibilityLocalisation.php
44 $messages = array (
5 - 'ar' =>
 5+ 'ar' =>
66 array (
77 'htmlform-reset' => 'الرجوع عن التغييرات',
88 'htmlform-submit' => 'تنفيذ',
@@ -12,13 +12,13 @@
1313 'htmlform-selectorother-other' => 'أخرى',
1414 'htmlform-invalid-input' => 'توجد مشكلات ضمن بعض من مدخلاتك',
1515 ),
16 - 'arc' =>
 16+ 'arc' =>
1717 array (
1818 'htmlform-reset' => 'ܠܐ ܥܒܘܕ ܫܘܚܠܦ̈ܐ',
1919 'htmlform-submit' => 'ܫܕܪ',
2020 'htmlform-selectorother-other' => 'ܐܚܪܢܐ',
2121 ),
22 - 'arz' =>
 22+ 'arz' =>
2323 array (
2424 'htmlform-reset' => 'الرجوع فى التغييرات',
2525 'htmlform-submit' => 'تقديم',
@@ -29,7 +29,7 @@
3030 'htmlform-selectorother-other' => 'تانيين',
3131 'htmlform-invalid-input' => 'فى مشاكل فى المدخلات بتاعتك',
3232 ),
33 - 'bcc' =>
 33+ 'bcc' =>
3434 array (
3535 'htmlform-reset' => 'ترینگ تغییرات',
3636 'htmlform-submit' => 'دیم دی',
@@ -40,7 +40,7 @@
4141 'htmlform-selectorother-other' => 'دگه',
4242 'htmlform-invalid-input' => 'لهتی چه ورودی شما مشکل هست',
4343 ),
44 - 'be-tarask' =>
 44+ 'be-tarask' =>
4545 array (
4646 'htmlform-reset' => 'Адмяніць зьмены',
4747 'htmlform-submit' => 'Захаваць',
@@ -51,13 +51,13 @@
5252 'htmlform-selectorother-other' => 'Іншае',
5353 'htmlform-invalid-input' => 'Узьніклі праблемы з некаторымі з Вашых уваходных зьвестак',
5454 ),
55 - 'bg' =>
 55+ 'bg' =>
5656 array (
5757 'htmlform-reset' => 'Отказване на промените',
5858 'htmlform-submit' => 'Изпращане',
5959 'htmlform-selectorother-other' => 'Друга',
6060 ),
61 - 'br' =>
 61+ 'br' =>
6262 array (
6363 'htmlform-reset' => 'Dizober ar c\'hemmoù',
6464 'htmlform-submit' => 'Kas',
@@ -68,7 +68,7 @@
6969 'htmlform-selectorother-other' => 'Unan all',
7070 'htmlform-invalid-input' => 'Kudennoù zo gant talvoudennoù zo merket ganeoc\'h.',
7171 ),
72 - 'bs' =>
 72+ 'bs' =>
7373 array (
7474 'htmlform-reset' => 'Vrati izmjene',
7575 'htmlform-submit' => 'Pošalji',
@@ -79,7 +79,7 @@
8080 'htmlform-selectorother-other' => 'Ostalo',
8181 'htmlform-invalid-input' => 'Postoje određeni problemi s Vašim unosom',
8282 ),
83 - 'ca' =>
 83+ 'ca' =>
8484 array (
8585 'htmlform-reset' => 'Desfés els canvis',
8686 'htmlform-submit' => 'Tramet',
@@ -90,11 +90,11 @@
9191 'htmlform-selectorother-other' => 'Altres',
9292 'htmlform-invalid-input' => 'Hi ha problemes amb alguna de les seves entrades',
9393 ),
94 - 'ckb-arab' =>
 94+ 'ckb-arab' =>
9595 array (
9696 'htmlform-reset' => 'گەڕانەوەی گۆڕانکاری',
9797 ),
98 - 'cs' =>
 98+ 'cs' =>
9999 array (
100100 'htmlform-reset' => 'Vrátit změny',
101101 'htmlform-submit' => 'Odeslat',
@@ -105,12 +105,12 @@
106106 'htmlform-selectorother-other' => 'Jiná hodnota',
107107 'htmlform-invalid-input' => 'Některé vámi zadané údaje jsou chybné',
108108 ),
109 - 'cy' =>
 109+ 'cy' =>
110110 array (
111111 'htmlform-reset' => 'Datod y newidiadau',
112112 'htmlform-selectorother-other' => 'Arall',
113113 ),
114 - 'da' =>
 114+ 'da' =>
115115 array (
116116 'htmlform-reset' => 'Annuller ændringer',
117117 'htmlform-submit' => 'Gem',
@@ -121,7 +121,7 @@
122122 'htmlform-selectorother-other' => 'Anden',
123123 'htmlform-invalid-input' => 'Det er problemer med dine angivelser',
124124 ),
125 - 'de' =>
 125+ 'de' =>
126126 array (
127127 'htmlform-reset' => 'Änderungen rückgängig machen',
128128 'htmlform-submit' => 'Übertragen',
@@ -132,7 +132,7 @@
133133 'htmlform-selectorother-other' => 'Andere',
134134 'htmlform-invalid-input' => 'Mit einigen Eingaben gibt es Probleme',
135135 ),
136 - 'dsb' =>
 136+ 'dsb' =>
137137 array (
138138 'htmlform-reset' => 'Změny anulěrowaś',
139139 'htmlform-submit' => 'Wótpósłaś',
@@ -143,7 +143,7 @@
144144 'htmlform-selectorother-other' => 'Druge',
145145 'htmlform-invalid-input' => 'Su někotare problemy z twójim zapodaśim',
146146 ),
147 - 'el' =>
 147+ 'el' =>
148148 array (
149149 'htmlform-reset' => 'Αναστροφή αλλαγών',
150150 'htmlform-submit' => 'Υποβολή',
@@ -154,7 +154,7 @@
155155 'htmlform-selectorother-other' => 'Άλλο',
156156 'htmlform-invalid-input' => 'Υπάρχουν κάποια προβλήματα με μερικές από τις εισροές σας',
157157 ),
158 - 'en' =>
 158+ 'en' =>
159159 array (
160160 'htmlform-reset' => 'Undo changes',
161161 'htmlform-submit' => 'Submit',
@@ -165,7 +165,7 @@
166166 'htmlform-selectorother-other' => 'Other',
167167 'htmlform-invalid-input' => 'There are problems with some of your input',
168168 ),
169 - 'eo' =>
 169+ 'eo' =>
170170 array (
171171 'htmlform-reset' => 'Malfari ŝanĝojn',
172172 'htmlform-submit' => 'Ek!',
@@ -176,7 +176,7 @@
177177 'htmlform-selectorother-other' => 'Alia',
178178 'htmlform-invalid-input' => 'Estas problemoj kun iom da via enigo',
179179 ),
180 - 'es' =>
 180+ 'es' =>
181181 array (
182182 'htmlform-reset' => 'Deshacer cambios',
183183 'htmlform-submit' => 'Enviar',
@@ -187,13 +187,13 @@
188188 'htmlform-selectorother-other' => 'Otro',
189189 'htmlform-invalid-input' => 'Hay problemas con alguno de tus ingresos',
190190 ),
191 - 'eu' =>
 191+ 'eu' =>
192192 array (
193193 'htmlform-reset' => 'Aldaketak desegin',
194194 'htmlform-submit' => 'Bidali',
195195 'htmlform-selectorother-other' => 'Beste bat',
196196 ),
197 - 'fa' =>
 197+ 'fa' =>
198198 array (
199199 'htmlform-reset' => 'خنثی کردن تغییرات',
200200 'htmlform-submit' => 'ارسال',
@@ -204,7 +204,7 @@
205205 'htmlform-selectorother-other' => 'دیگر',
206206 'htmlform-invalid-input' => 'بخشی از ورودی شما مشکل دارد',
207207 ),
208 - 'fi' =>
 208+ 'fi' =>
209209 array (
210210 'htmlform-reset' => 'Kumoa muutokset',
211211 'htmlform-submit' => 'Lähetä',
@@ -215,7 +215,7 @@
216216 'htmlform-selectorother-other' => 'Muu',
217217 'htmlform-invalid-input' => 'Antamassasi syötteessä on ongelmia',
218218 ),
219 - 'fr' =>
 219+ 'fr' =>
220220 array (
221221 'htmlform-reset' => 'Défaire les modifications',
222222 'htmlform-submit' => 'Soumettre',
@@ -226,7 +226,7 @@
227227 'htmlform-selectorother-other' => 'Autre',
228228 'htmlform-invalid-input' => 'Des problèmes sont survenus avec certaines valeurs',
229229 ),
230 - 'frp' =>
 230+ 'frp' =>
231231 array (
232232 'htmlform-reset' => 'Dèfâre los changements',
233233 'htmlform-submit' => 'Sometre',
@@ -237,7 +237,7 @@
238238 'htmlform-selectorother-other' => 'Ôtro',
239239 'htmlform-invalid-input' => 'Des problèmos sont arrevâs avouéc quârques valors',
240240 ),
241 - 'gl' =>
 241+ 'gl' =>
242242 array (
243243 'htmlform-reset' => 'Desfacer os cambios',
244244 'htmlform-submit' => 'Enviar',
@@ -248,7 +248,7 @@
249249 'htmlform-selectorother-other' => 'Outra',
250250 'htmlform-invalid-input' => 'Hai algún problema con partes do texto que inseriu',
251251 ),
252 - 'grc' =>
 252+ 'grc' =>
253253 array (
254254 'htmlform-reset' => 'Ἀναστρέφειν μεταβολάς',
255255 'htmlform-submit' => 'Ὑποβάλλειν',
@@ -259,7 +259,7 @@
260260 'htmlform-selectorother-other' => 'Ἄλλον',
261261 'htmlform-invalid-input' => 'Μέρος τῶν εἰσαγομένων δεδομένων σου προβληματικὸν ἐστίν',
262262 ),
263 - 'gsw' =>
 263+ 'gsw' =>
264264 array (
265265 'htmlform-reset' => 'Änderige ruckgängig mache',
266266 'htmlform-submit' => 'Ibertrage',
@@ -270,7 +270,7 @@
271271 'htmlform-selectorother-other' => 'Anderi',
272272 'htmlform-invalid-input' => 'Mit e Teil Yygabe git s Probläm',
273273 ),
274 - 'he' =>
 274+ 'he' =>
275275 array (
276276 'htmlform-reset' => 'ביטול השינויים',
277277 'htmlform-submit' => 'שליחה',
@@ -281,7 +281,7 @@
282282 'htmlform-selectorother-other' => 'אחר',
283283 'htmlform-invalid-input' => 'יש בעיות עם חלק מהקלט שהכנסתם',
284284 ),
285 - 'hr' =>
 285+ 'hr' =>
286286 array (
287287 'htmlform-reset' => 'Poništi izmjene',
288288 'htmlform-submit' => 'Pošalji',
@@ -292,7 +292,7 @@
293293 'htmlform-selectorother-other' => 'Drugi',
294294 'htmlform-invalid-input' => 'Postoje problemi s nekim od vaših unosa',
295295 ),
296 - 'hsb' =>
 296+ 'hsb' =>
297297 array (
298298 'htmlform-reset' => 'Změny cofnyć',
299299 'htmlform-submit' => 'Wotpósłać',
@@ -303,7 +303,7 @@
304304 'htmlform-selectorother-other' => 'Druhe',
305305 'htmlform-invalid-input' => 'Su problemy z twojim zapodaćom',
306306 ),
307 - 'hu' =>
 307+ 'hu' =>
308308 array (
309309 'htmlform-reset' => 'Változtatások visszavonása',
310310 'htmlform-submit' => 'Elküldés',
@@ -314,7 +314,7 @@
315315 'htmlform-selectorother-other' => 'egyéb',
316316 'htmlform-invalid-input' => 'Probléma van az általad megadott értékkel',
317317 ),
318 - 'ia' =>
 318+ 'ia' =>
319319 array (
320320 'htmlform-reset' => 'Disfacer modificationes',
321321 'htmlform-submit' => 'Submitter',
@@ -325,7 +325,7 @@
326326 'htmlform-selectorother-other' => 'Altere',
327327 'htmlform-invalid-input' => 'Il ha problemas con alique que tu entrava',
328328 ),
329 - 'id' =>
 329+ 'id' =>
330330 array (
331331 'htmlform-reset' => 'Batalkan perubahan',
332332 'htmlform-submit' => 'Kirim',
@@ -336,7 +336,7 @@
337337 'htmlform-selectorother-other' => 'Lain-lain',
338338 'htmlform-invalid-input' => 'Ada kesalahan dalam beberapa input Anda',
339339 ),
340 - 'it' =>
 340+ 'it' =>
341341 array (
342342 'htmlform-reset' => 'Annulla modifiche',
343343 'htmlform-submit' => 'Invia',
@@ -347,7 +347,7 @@
348348 'htmlform-selectorother-other' => 'Altro',
349349 'htmlform-invalid-input' => 'Ci sono problemi con l\'input inserito',
350350 ),
351 - 'ja' =>
 351+ 'ja' =>
352352 array (
353353 'htmlform-reset' => '変更を取り消す',
354354 'htmlform-submit' => '送信',
@@ -358,7 +358,7 @@
359359 'htmlform-selectorother-other' => 'その他',
360360 'htmlform-invalid-input' => '入力になんらかの問題があります',
361361 ),
362 - 'jv' =>
 362+ 'jv' =>
363363 array (
364364 'htmlform-reset' => 'Batalna pangowahan',
365365 'htmlform-int-invalid' => 'Aji sing panjenengan lebokaké dudu angka wutuh (integer).',
@@ -368,7 +368,7 @@
369369 'htmlform-selectorother-other' => 'Liya',
370370 'htmlform-invalid-input' => 'Ana masalah jroning sawetara input panjenengan',
371371 ),
372 - 'ka' =>
 372+ 'ka' =>
373373 array (
374374 'htmlform-reset' => 'ცვლილებების გაუქმება',
375375 'htmlform-submit' => 'შენახვა',
@@ -379,7 +379,7 @@
380380 'htmlform-selectorother-other' => 'სხვა',
381381 'htmlform-invalid-input' => 'თქვენს მიერ შეყვანილი ინფორმაციის ნაწილმა გამოიწვია პრობლემები',
382382 ),
383 - 'ko' =>
 383+ 'ko' =>
384384 array (
385385 'htmlform-reset' => '변경한 것을 되돌리기',
386386 'htmlform-submit' => '저장',
@@ -390,7 +390,7 @@
391391 'htmlform-selectorother-other' => '기타',
392392 'htmlform-invalid-input' => '당신이 입력한 값에 문제가 있습니다.',
393393 ),
394 - 'ksh' =>
 394+ 'ksh' =>
395395 array (
396396 'htmlform-reset' => 'Änderunge retuur nämme',
397397 'htmlform-submit' => 'Loß Jonn!',
@@ -401,11 +401,11 @@
402402 'htmlform-selectorother-other' => 'Annder',
403403 'htmlform-invalid-input' => 'Mer han e Problem met jet wat De enjejovve häß',
404404 ),
405 - 'la' =>
 405+ 'la' =>
406406 array (
407407 'htmlform-selectorother-other' => 'Aliud',
408408 ),
409 - 'lb' =>
 409+ 'lb' =>
410410 array (
411411 'htmlform-reset' => 'Ännerungen zrécksetzen',
412412 'htmlform-submit' => 'Späicheren',
@@ -416,7 +416,7 @@
417417 'htmlform-selectorother-other' => 'Anerer',
418418 'htmlform-invalid-input' => 'Et gëtt Problemer mat de Werter déi dir aginn hutt.',
419419 ),
420 - 'lt' =>
 420+ 'lt' =>
421421 array (
422422 'htmlform-reset' => 'Atšaukti pakeitimus',
423423 'htmlform-submit' => 'Siųsti',
@@ -427,7 +427,7 @@
428428 'htmlform-selectorother-other' => 'Kita',
429429 'htmlform-invalid-input' => 'Yra problemų su jūsų įvestimi',
430430 ),
431 - 'lzh' =>
 431+ 'lzh' =>
432432 array (
433433 'htmlform-reset' => '復',
434434 'htmlform-submit' => '呈',
@@ -438,7 +438,7 @@
439439 'htmlform-selectorother-other' => '他',
440440 'htmlform-invalid-input' => '爾之輸問也',
441441 ),
442 - 'mk' =>
 442+ 'mk' =>
443443 array (
444444 'htmlform-reset' => 'Откажи промени',
445445 'htmlform-submit' => 'Зачувај',
@@ -449,11 +449,11 @@
450450 'htmlform-selectorother-other' => 'Друго',
451451 'htmlform-invalid-input' => 'Има проблеми со дел од вашиот внес',
452452 ),
453 - 'ml' =>
 453+ 'ml' =>
454454 array (
455455 'htmlform-reset' => 'മാറ്റങ്ങള്‍ വേണ്ട',
456456 ),
457 - 'ms' =>
 457+ 'ms' =>
458458 array (
459459 'htmlform-reset' => 'Undur perubahan',
460460 'htmlform-submit' => 'Hantar',
@@ -462,7 +462,7 @@
463463 'htmlform-selectorother-other' => 'Lain-lain',
464464 'htmlform-invalid-input' => 'Terdapat beberapa masalah dengan input anda',
465465 ),
466 - 'mt' =>
 466+ 'mt' =>
467467 array (
468468 'htmlform-reset' => 'Annulla l-modifiki',
469469 'htmlform-submit' => 'Ibgħat',
@@ -473,7 +473,7 @@
474474 'htmlform-selectorother-other' => 'Oħrajn',
475475 'htmlform-invalid-input' => 'Hemm xi problemi f\'dak li daħħalt',
476476 ),
477 - 'nds' =>
 477+ 'nds' =>
478478 array (
479479 'htmlform-reset' => 'Ännern trüchsetten',
480480 'htmlform-submit' => 'Afspiekern',
@@ -484,7 +484,7 @@
485485 'htmlform-selectorother-other' => 'Annere',
486486 'htmlform-invalid-input' => 'Mit welk vun de angeven Weerten gifft dat Problemen',
487487 ),
488 - 'nds-nl' =>
 488+ 'nds-nl' =>
489489 array (
490490 'htmlform-reset' => 'Wiezigingen ongedaonmaken',
491491 'htmlform-submit' => 'Opslaon',
@@ -495,7 +495,7 @@
496496 'htmlform-selectorother-other' => 'Aanders',
497497 'htmlform-invalid-input' => 'Der bin preblemen mit een paor in-egeven weerden',
498498 ),
499 - 'nl' =>
 499+ 'nl' =>
500500 array (
501501 'htmlform-reset' => 'Wijzigingen ongedaan maken',
502502 'htmlform-submit' => 'Opslaan',
@@ -506,7 +506,7 @@
507507 'htmlform-selectorother-other' => 'Anders',
508508 'htmlform-invalid-input' => 'Er zijn problemen met enkele ingegeven waarden',
509509 ),
510 - 'nn' =>
 510+ 'nn' =>
511511 array (
512512 'htmlform-reset' => 'Gjer om endringar',
513513 'htmlform-submit' => 'Lagre',
@@ -517,7 +517,7 @@
518518 'htmlform-selectorother-other' => 'Andre',
519519 'htmlform-invalid-input' => 'Det finst problem med innskrivinga di',
520520 ),
521 - 'no' =>
 521+ 'no' =>
522522 array (
523523 'htmlform-reset' => 'Omgjør endringer',
524524 'htmlform-submit' => 'Lagre',
@@ -528,7 +528,7 @@
529529 'htmlform-selectorother-other' => 'Andre',
530530 'htmlform-invalid-input' => 'Det er problemer med noen av inndatene dine',
531531 ),
532 - 'oc' =>
 532+ 'oc' =>
533533 array (
534534 'htmlform-reset' => 'Desfar las modificacions',
535535 'htmlform-submit' => 'Sometre',
@@ -539,11 +539,11 @@
540540 'htmlform-selectorother-other' => 'Autre',
541541 'htmlform-invalid-input' => 'De problèmas son arribats amb d\'unas valors',
542542 ),
543 - 'pdc' =>
 543+ 'pdc' =>
544544 array (
545545 'htmlform-selectorother-other' => 'Annere',
546546 ),
547 - 'pl' =>
 547+ 'pl' =>
548548 array (
549549 'htmlform-reset' => 'Cofnij zmiany',
550550 'htmlform-submit' => 'Zapisz',
@@ -554,11 +554,11 @@
555555 'htmlform-selectorother-other' => 'Inne',
556556 'htmlform-invalid-input' => 'Wystąpił problem z wprowadzonymi danymi',
557557 ),
558 - 'pnt' =>
 558+ 'pnt' =>
559559 array (
560560 'htmlform-selectorother-other' => 'Άλλον',
561561 ),
562 - 'pt' =>
 562+ 'pt' =>
563563 array (
564564 'htmlform-reset' => 'Desfazer alterações',
565565 'htmlform-submit' => 'Enviar',
@@ -569,7 +569,7 @@
570570 'htmlform-selectorother-other' => 'Outros',
571571 'htmlform-invalid-input' => 'Existem problemas com alguns dos dados introduzidos',
572572 ),
573 - 'qu' =>
 573+ 'qu' =>
574574 array (
575575 'htmlform-reset' => 'Hukchasqakunata kutichiy',
576576 'htmlform-submit' => 'Kachay',
@@ -580,7 +580,7 @@
581581 'htmlform-selectorother-other' => 'Wakin',
582582 'htmlform-invalid-input' => 'Yaykuchisqaykiwanqa sasachakuykunam kachkan',
583583 ),
584 - 'ro' =>
 584+ 'ro' =>
585585 array (
586586 'htmlform-reset' => 'Anulează modificările',
587587 'htmlform-submit' => 'Trimite',
@@ -591,7 +591,7 @@
592592 'htmlform-selectorother-other' => 'Altul',
593593 'htmlform-invalid-input' => 'Există probleme la valorile introduse',
594594 ),
595 - 'roa-tara' =>
 595+ 'roa-tara' =>
596596 array (
597597 'htmlform-reset' => 'Annulle le cangiaminde',
598598 'htmlform-submit' => 'Conferme',
@@ -602,7 +602,7 @@
603603 'htmlform-selectorother-other' => 'Otre',
604604 'htmlform-invalid-input' => 'Stonne probbleme cu certe input ca tu è mise',
605605 ),
606 - 'ru' =>
 606+ 'ru' =>
607607 array (
608608 'htmlform-reset' => 'Отменить изменения',
609609 'htmlform-submit' => 'Отправить',
@@ -613,7 +613,7 @@
614614 'htmlform-selectorother-other' => 'Иное',
615615 'htmlform-invalid-input' => 'Часть введённых вами данных вызвала проблемы',
616616 ),
617 - 'sah' =>
 617+ 'sah' =>
618618 array (
619619 'htmlform-reset' => 'Уларытыыны төннөр',
620620 'htmlform-submit' => 'Ыыт',
@@ -624,11 +624,11 @@
625625 'htmlform-selectorother-other' => 'Атын',
626626 'htmlform-invalid-input' => 'Киллэрбит сибидиэнньэҥ сорҕото алҕаһы таһаарда',
627627 ),
628 - 'sc' =>
 628+ 'sc' =>
629629 array (
630630 'htmlform-selectorother-other' => 'Àteru',
631631 ),
632 - 'sh' =>
 632+ 'sh' =>
633633 array (
634634 'htmlform-reset' => 'Vrati izmjene',
635635 'htmlform-submit' => 'Unesi',
@@ -639,7 +639,7 @@
640640 'htmlform-selectorother-other' => 'Ostalo',
641641 'htmlform-invalid-input' => 'Postoje određeni problemi sa Vašim unosom',
642642 ),
643 - 'si' =>
 643+ 'si' =>
644644 array (
645645 'htmlform-reset' => 'වෙනස්කිරීම් අහෝසිකරන්න',
646646 'htmlform-submit' => 'යොමුකරන්න',
@@ -650,7 +650,7 @@
651651 'htmlform-selectorother-other' => 'වෙනත්',
652652 'htmlform-invalid-input' => 'ඔබගේ සමහරක් ප්‍රදානයන් විෂයයෙහි ගැ‍ටළු ඇත',
653653 ),
654 - 'sk' =>
 654+ 'sk' =>
655655 array (
656656 'htmlform-reset' => 'Vrátiť zmeny',
657657 'htmlform-submit' => 'Odoslať',
@@ -661,7 +661,7 @@
662662 'htmlform-selectorother-other' => 'Iné',
663663 'htmlform-invalid-input' => 'Niekotrý z údajov, ktoré ste zadali je problematický',
664664 ),
665 - 'sr-ec' =>
 665+ 'sr-ec' =>
666666 array (
667667 'htmlform-reset' => 'Врати измене',
668668 'htmlform-submit' => 'Пошаљи',
@@ -672,7 +672,7 @@
673673 'htmlform-selectorother-other' => 'Друго',
674674 'htmlform-invalid-input' => 'Има проблема са делом Вашег уноса',
675675 ),
676 - 'sv' =>
 676+ 'sv' =>
677677 array (
678678 'htmlform-reset' => 'Ogör ändringar',
679679 'htmlform-submit' => 'Spara',
@@ -683,15 +683,15 @@
684684 'htmlform-selectorother-other' => 'Andra',
685685 'htmlform-invalid-input' => 'Det finns problem med din inmatning',
686686 ),
687 - 'sw' =>
 687+ 'sw' =>
688688 array (
689689 'htmlform-selectorother-other' => 'Nyingine',
690690 ),
691 - 'te' =>
 691+ 'te' =>
692692 array (
693693 'htmlform-selectorother-other' => 'ఇతర',
694694 ),
695 - 'tr' =>
 695+ 'tr' =>
696696 array (
697697 'htmlform-reset' => 'Değişiklikleri geri al',
698698 'htmlform-submit' => 'Gönder',
@@ -702,7 +702,7 @@
703703 'htmlform-selectorother-other' => 'Diğer',
704704 'htmlform-invalid-input' => 'Girdinizin bir kısmıyla ilgili sorunlar var',
705705 ),
706 - 'uk' =>
 706+ 'uk' =>
707707 array (
708708 'htmlform-reset' => 'Відкотити зміни',
709709 'htmlform-submit' => 'Відправити',
@@ -713,7 +713,7 @@
714714 'htmlform-selectorother-other' => 'Інше',
715715 'htmlform-invalid-input' => 'Частина введених вами даних викликала проблеми',
716716 ),
717 - 'vec' =>
 717+ 'vec' =>
718718 array (
719719 'htmlform-reset' => 'Scancèla modifiche',
720720 'htmlform-submit' => 'Manda',
@@ -723,7 +723,7 @@
724724 'htmlform-select-badoption' => 'El valor che te ghè indicà no\'l xe mia valido.',
725725 'htmlform-invalid-input' => 'Ghe xe problemi con l\'input che te ghè inserìo',
726726 ),
727 - 'vi' =>
 727+ 'vi' =>
728728 array (
729729 'htmlform-reset' => 'Hủy các thay đổi',
730730 'htmlform-submit' => 'Đăng',
@@ -734,15 +734,15 @@
735735 'htmlform-selectorother-other' => 'Khác',
736736 'htmlform-invalid-input' => 'Có vấn đề trong dữ liệu bạn vừa đưa vào',
737737 ),
738 - 'vo' =>
 738+ 'vo' =>
739739 array (
740740 'htmlform-selectorother-other' => 'Votik',
741741 ),
742 - 'xal' =>
 742+ 'xal' =>
743743 array (
744744 'htmlform-reset' => 'Сольлһдудиг уга кех',
745745 ),
746 - 'yue' =>
 746+ 'yue' =>
747747 array (
748748 'htmlform-reset' => '復原更改',
749749 'htmlform-submit' => '遞交',
@@ -753,7 +753,7 @@
754754 'htmlform-selectorother-other' => '其它',
755755 'htmlform-invalid-input' => '響你嘅輸入度有一啲問題',
756756 ),
757 - 'zh-hans' =>
 757+ 'zh-hans' =>
758758 array (
759759 'htmlform-reset' => '撤销更改',
760760 'htmlform-submit' => '提交',
@@ -764,7 +764,7 @@
765765 'htmlform-selectorother-other' => '其他',
766766 'htmlform-invalid-input' => '您输入的内容存在问题',
767767 ),
768 - 'zh-hant' =>
 768+ 'zh-hant' =>
769769 array (
770770 'htmlform-reset' => '復原更改',
771771 'htmlform-submit' => '遞交',
Index: trunk/extensions/LiquidThreads/compat/generateCompatibilityLocalisation.php
@@ -2,27 +2,27 @@
33
44 // Utility script to generate an extension messages file for backwards-compatibility.
55
6 -require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
7 - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
 6+require_once ( getenv('MW_INSTALL_PATH') !== false
 7+ ? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc"
88 : dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
99
10 -$messages = array(
11 - 'htmlform-reset',
12 - 'htmlform-submit',
13 - 'htmlform-int-invalid',
14 - 'htmlform-int-toolow',
15 - 'htmlform-int-toohigh',
16 - 'htmlform-select-badoption',
17 - 'htmlform-selectorother-other',
18 - 'htmlform-invalid-input',
19 -);
 10+$messages = array(
 11+ 'htmlform-reset',
 12+ 'htmlform-submit',
 13+ 'htmlform-int-invalid',
 14+ 'htmlform-int-toolow',
 15+ 'htmlform-int-toohigh',
 16+ 'htmlform-select-badoption',
 17+ 'htmlform-selectorother-other',
 18+ 'htmlform-invalid-input',
 19+ );
2020
21 -$languages = array_keys( Language::getLanguageNames( false ) );
 21+$languages = array_keys(Language::getLanguageNames( false ));
2222 $data = array_fill_keys( $languages, array() );
2323
24 -foreach ( $messages as $msg ) {
 24+foreach( $messages as $msg ) {
2525 print "\nGetting localisation for $msg...";
26 - foreach ( $languages as $lang ) {
 26+ foreach( $languages as $lang ) {
2727 $data[$lang][$msg] = $wgMessageCache->get( $msg, false, $lang );
2828 print " $lang ";
2929 }
@@ -33,24 +33,24 @@
3434
3535 print "Eliminating redundant data... ";
3636
37 -foreach ( $languages as $lang ) {
 37+foreach( $languages as $lang ) {
3838 $fallback = Language::getFallbackFor( $lang );
39 -
 39+
4040 print " [$lang from $fallback] ";
4141 $lastFallback = $lang;
42 -
43 - while ( $fallback && !isset( $originalData[$fallback] ) && $fallback != $lastFallback ) {
 42+
 43+ while ($fallback && !isset($originalData[$fallback]) && $fallback != $lastFallback) {
4444 $lastFallback = $fallback;
4545 $fallback = Language::getFallbackFor( $lang );
4646 }
47 -
48 - if ( $fallback && isset( $originalData[$fallback] ) ) {
 47+
 48+ if ( $fallback && isset($originalData[$fallback]) ) {
4949 $fallbackData = $originalData[$fallback];
50 -
 50+
5151 $data[$lang] = array_diff_assoc( $originalData[$lang], $fallbackData );
52 -
53 - if ( !count( $data[$lang] ) )
54 - unset( $data[$lang] );
 52+
 53+ if (!count($data[$lang]))
 54+ unset($data[$lang]);
5555 }
5656 }
5757
@@ -58,7 +58,7 @@
5959
6060 $export = "<?php\n" .
6161 "// This file is generated automatically by generateCompatibilityLocalisation.php\n" .
62 - '$messages = ' . var_export( $data, true ) . ";\n";
 62+ '$messages = '.var_export($data, true).";\n";
6363
6464 file_put_contents( 'Lqt-compat.i18n.php', $export );
6565
Index: trunk/extensions/LiquidThreads/compat/HTMLForm.php
@@ -1,6 +1,7 @@
22 <?php
33
44 class HTMLForm {
 5+
56 static $jsAdded = false;
67
78 /* The descriptor is an array of arrays.
@@ -25,14 +26,14 @@
2627
2728 function __construct( $descriptor, $messagePrefix ) {
2829 wfLoadExtensionMessages( 'Lqt-Compat' );
29 -
 30+
3031 $this->mMessagePrefix = $messagePrefix;
3132
3233 // Expand out into a tree.
3334 $loadedDescriptor = array();
3435 $this->mFlatFields = array();
3536
36 - foreach ( $descriptor as $fieldname => $info ) {
 37+ foreach( $descriptor as $fieldname => $info ) {
3738 $section = '';
3839 if ( isset( $info['section'] ) )
3940 $section = $info['section'];
@@ -43,10 +44,10 @@
4445 $field->mParent = $this;
4546
4647 $setSection =& $loadedDescriptor;
47 - if ( $section ) {
 48+ if( $section ) {
4849 $sectionParts = explode( '/', $section );
4950
50 - while ( count( $sectionParts ) ) {
 51+ while( count( $sectionParts ) ) {
5152 $newName = array_shift( $sectionParts );
5253
5354 if ( !isset( $setSection[$newName] ) ) {
@@ -78,7 +79,7 @@
7980 $descriptor['class'] = $class;
8081 }
8182
82 - if ( !$class ) {
 83+ if( !$class ) {
8384 throw new MWException( "Descriptor with no class: " . print_r( $descriptor, true ) );
8485 }
8586
@@ -103,7 +104,7 @@
104105 if ( $wgUser->matchEditToken( $editToken ) )
105106 $result = $this->trySubmit();
106107
107 - if ( $result === true )
 108+ if( $result === true )
108109 return $result;
109110
110111 // Display form.
@@ -117,7 +118,7 @@
118119 */
119120 function trySubmit() {
120121 // Check for validation
121 - foreach ( $this->mFlatFields as $fieldname => $field ) {
 122+ foreach( $this->mFlatFields as $fieldname => $field ) {
122123 if ( !empty( $field->mParams['nodata'] ) ) continue;
123124 if ( $field->validate( $this->mFieldData[$fieldname],
124125 $this->mFieldData ) !== true ) {
@@ -204,7 +205,7 @@
205206
206207 $html .= Xml::submitButton( $this->getSubmitText(), $attribs ) . "\n";
207208
208 - if ( $this->mShowReset ) {
 209+ if( $this->mShowReset ) {
209210 $html .= Xml::element(
210211 'input',
211212 array(
@@ -213,7 +214,7 @@
214215 )
215216 ) . "\n";
216217 }
217 -
 218+
218219 return $html;
219220 }
220221
@@ -227,7 +228,7 @@
228229 } else {
229230 $errorstr = $errors;
230231 }
231 -
 232+
232233 $errorstr = Xml::tags( 'div', array( 'class' => 'error' ), $errorstr );
233234
234235 global $wgOut;
@@ -237,7 +238,7 @@
238239 static function formatErrors( $errors ) {
239240 $errorstr = '';
240241 foreach ( $errors as $error ) {
241 - if ( is_array( $error ) ) {
 242+ if( is_array( $error ) ) {
242243 $msg = array_shift( $error );
243244 } else {
244245 $msg = $error;
@@ -284,14 +285,14 @@
285286 $subsectionHtml = '';
286287 $hasLeftColumn = false;
287288
288 - foreach ( $fields as $key => $value ) {
 289+ foreach( $fields as $key => $value ) {
289290 if ( is_object( $value ) ) {
290291 $v = empty( $value->mParams['nodata'] )
291292 ? $this->mFieldData[$key]
292293 : $value->getDefault();
293294 $tableHtml .= $value->getTableRow( $v );
294295
295 - if ( $value->getLabel() != '&nbsp;' )
 296+ if( $value->getLabel() != '&nbsp;' )
296297 $hasLeftColumn = true;
297298 } elseif ( is_array( $value ) ) {
298299 $section = $this->displaySection( $value );
@@ -301,7 +302,7 @@
302303 }
303304
304305 $classes = array();
305 - if ( !$hasLeftColumn ) // Avoid strange spacing when no labels exist
 306+ if( !$hasLeftColumn ) // Avoid strange spacing when no labels exist
306307 $classes[] = 'mw-htmlform-nolabel';
307308 $classes = implode( ' ', $classes );
308309
@@ -315,7 +316,7 @@
316317
317318 $fieldData = array();
318319
319 - foreach ( $this->mFlatFields as $fieldname => $field ) {
 320+ foreach( $this->mFlatFields as $fieldname => $field ) {
320321 if ( !empty( $field->mParams['nodata'] ) ) continue;
321322 if ( !empty( $field->mParams['disabled'] ) ) {
322323 $fieldData[$fieldname] = $field->getDefault();
@@ -325,7 +326,7 @@
326327 }
327328
328329 // Filter data.
329 - foreach ( $fieldData as $name => &$value ) {
 330+ foreach( $fieldData as $name => &$value ) {
330331 $field = $this->mFlatFields[$name];
331332 $value = $field->filter( $value, $this->mFlatFields );
332333 }
@@ -335,12 +336,12 @@
336337
337338 function importData( $fieldData ) {
338339 // Filter data.
339 - foreach ( $fieldData as $name => &$value ) {
 340+ foreach( $fieldData as $name => &$value ) {
340341 $field = $this->mFlatFields[$name];
341342 $value = $field->filter( $value, $this->mFlatFields );
342343 }
343344
344 - foreach ( $this->mFlatFields as $fieldname => $field ) {
 345+ foreach( $this->mFlatFields as $fieldname => $field ) {
345346 if ( !isset( $fieldData[$fieldname] ) )
346347 $fieldData[$fieldname] = $field->getDefault();
347348 }
@@ -369,7 +370,7 @@
370371 }
371372
372373 function filter( $value, $alldata ) {
373 - if ( isset( $this->mFilterCallback ) ) {
 374+ if( isset( $this->mFilterCallback ) ) {
374375 $value = call_user_func( $this->mFilterCallback, $value, $alldata );
375376 }
376377
@@ -377,7 +378,7 @@
378379 }
379380
380381 function loadDataFromRequest( $request ) {
381 - if ( $request->getCheck( $this->mName ) ) {
 382+ if( $request->getCheck( $this->mName ) ) {
382383 return $request->getText( $this->mName );
383384 } else {
384385 return $this->getDefault();
@@ -387,7 +388,7 @@
388389 function __construct( $params ) {
389390 $this->mParams = $params;
390391
391 - if ( isset( $params['label-message'] ) ) {
 392+ if( isset( $params['label-message'] ) ) {
392393 $msgInfo = $params['label-message'];
393394
394395 if ( is_array( $msgInfo ) ) {
@@ -403,8 +404,8 @@
404405 }
405406
406407 if ( isset( $params['name'] ) ) {
407 - $this->mName = 'wp' . $params['name'];
408 - $this->mID = 'mw-input-' . $params['name'];
 408+ $this->mName = 'wp'.$params['name'];
 409+ $this->mID = 'mw-input-'.$params['name'];
409410 }
410411
411412 if ( isset( $params['default'] ) ) {
@@ -441,7 +442,7 @@
442443 Xml::tags( 'label', array( 'for' => $this->mID ), $this->getLabel() )
443444 );
444445 $html .= Xml::tags( 'td', array( 'class' => 'mw-input' ),
445 - $this->getInputHTML( $value ) . "\n$errors" );
 446+ $this->getInputHTML( $value ) ."\n$errors" );
446447
447448 $fieldType = get_class( $this );
448449
@@ -454,7 +455,7 @@
455456
456457 $text = wfMsgExt( $msg, 'parseinline' );
457458
458 - if ( !wfEmptyMsg( $msg, $text ) ) {
 459+ if( !wfEmptyMsg( $msg, $text ) ) {
459460 $row = Xml::tags( 'td', array( 'colspan' => 2, 'class' => 'htmlform-tip' ),
460461 $text );
461462
@@ -482,7 +483,7 @@
483484 static function flattenOptions( $options ) {
484485 $flatOpts = array();
485486
486 - foreach ( $options as $key => $value ) {
 487+ foreach( $options as $key => $value ) {
487488 if ( is_array( $value ) ) {
488489 $flatOpts = array_merge( $flatOpts, self::flattenOptions( $value ) );
489490 } else {
@@ -506,8 +507,8 @@
507508 if ( isset( $this->mParams['maxlength'] ) ) {
508509 $attribs['maxlength'] = $this->mParams['maxlength'];
509510 }
510 -
511 - if ( !empty( $this->mParams['disabled'] ) ) {
 511+
 512+ if( !empty( $this->mParams['disabled'] ) ) {
512513 $attribs['disabled'] = 'disabled';
513514 }
514515
@@ -529,7 +530,7 @@
530531 function validate( $value, $alldata ) {
531532 $p = parent::validate( $value, $alldata );
532533
533 - if ( $p !== true ) return $p;
 534+ if( $p !== true ) return $p;
534535
535536 if ( intval( $value ) != $value ) {
536537 return wfMsgExt( 'htmlform-int-invalid', 'parse' );
@@ -545,7 +546,7 @@
546547
547548 if ( isset( $this->mParams['max'] ) ) {
548549 $max = $this->mParams['max'];
549 - if ( $max < $value )
 550+ if( $max < $value )
550551 return wfMsgExt( 'htmlform-int-toohigh', 'parse', array( $max ) );
551552 }
552553
@@ -559,7 +560,7 @@
560561 $value = !$value;
561562
562563 $attr = array( 'id' => $this->mID );
563 - if ( !empty( $this->mParams['disabled'] ) ) {
 564+ if( !empty( $this->mParams['disabled'] ) ) {
564565 $attr['disabled'] = 'disabled';
565566 }
566567
@@ -578,7 +579,7 @@
579580 }
580581
581582 // GetCheck won't work like we want for checks.
582 - if ( $request->getCheck( 'wpEditToken' ) ) {
 583+ if( $request->getCheck( 'wpEditToken' ) ) {
583584 // XOR has the following truth table, which is what we want
584585 // INVERT VALUE | OUTPUT
585586 // true true | false
@@ -596,7 +597,7 @@
597598
598599 function validate( $value, $alldata ) {
599600 $p = parent::validate( $value, $alldata );
600 - if ( $p !== true ) return $p;
 601+ if( $p !== true ) return $p;
601602
602603 $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
603604 if ( in_array( $value, $validOptions ) )
@@ -613,7 +614,7 @@
614615 // Working around this by forcing all of them to strings.
615616 $options = array_map( 'strval', $this->mParams['options'] );
616617
617 - if ( !empty( $this->mParams['disabled'] ) ) {
 618+ if( !empty( $this->mParams['disabled'] ) ) {
618619 $select->setAttribute( 'disabled', 'disabled' );
619620 }
620621
@@ -627,7 +628,7 @@
628629 static $jsAdded = false;
629630
630631 function __construct( $params ) {
631 - if ( !in_array( 'other', $params['options'] ) ) {
 632+ if( !in_array( 'other', $params['options'] ) ) {
632633 $params['options'][wfMsg( 'htmlform-selectorother-other' )] = 'other';
633634 }
634635
@@ -637,12 +638,9 @@
638639 function getInputHTML( $value ) {
639640 $valInSelect = false;
640641
641 - if ( $value !== false ) {
642 - $valInSelect = in_array(
643 - $value,
644 - HTMLFormField::flattenOptions( $this->mParams['options'] )
645 - );
646 - }
 642+ if( $value !== false )
 643+ $valInSelect = in_array( $value,
 644+ HTMLFormField::flattenOptions( $this->mParams['options'] ) );
647645
648646 $selected = $valInSelect ? $value : 'other';
649647
@@ -652,7 +650,7 @@
653651 $select->setAttribute( 'class', 'mw-htmlform-select-or-other' );
654652
655653 $tbAttribs = array( 'id' => $this->mID . '-other' );
656 - if ( !empty( $this->mParams['disabled'] ) ) {
 654+ if( !empty( $this->mParams['disabled'] ) ) {
657655 $select->setAttribute( 'disabled', 'disabled' );
658656 $tbAttribs['disabled'] = 'disabled';
659657 }
@@ -663,21 +661,19 @@
664662 $tbAttribs['maxlength'] = $this->mParams['maxlength'];
665663 }
666664
667 - $textbox = Xml::input(
668 - $this->mName . '-other',
669 - $this->getSize(),
670 - $valInSelect ? '' : $value,
671 - $tbAttribs
672 - );
 665+ $textbox = Xml::input( $this->mName . '-other',
 666+ $this->getSize(),
 667+ $valInSelect ? '' : $value,
 668+ $tbAttribs );
673669
674670 return "$select<br/>\n$textbox";
675671 }
676672
677673 function loadDataFromRequest( $request ) {
678 - if ( $request->getCheck( $this->mName ) ) {
 674+ if( $request->getCheck( $this->mName ) ) {
679675 $val = $request->getText( $this->mName );
680676
681 - if ( $val == 'other' ) {
 677+ if( $val == 'other' ) {
682678 $val = $request->getText( $this->mName . '-other' );
683679 }
684680
@@ -691,9 +687,9 @@
692688 class HTMLMultiSelectField extends HTMLFormField {
693689 function validate( $value, $alldata ) {
694690 $p = parent::validate( $value, $alldata );
695 - if ( $p !== true ) return $p;
 691+ if( $p !== true ) return $p;
696692
697 - if ( !is_array( $value ) ) return false;
 693+ if( !is_array( $value ) ) return false;
698694
699695 // If all options are valid, array_intersect of the valid options and the provided
700696 // options will return the provided options.
@@ -720,24 +716,17 @@
721717 $attribs['disabled'] = 'disabled';
722718 }
723719
724 - foreach ( $options as $label => $info ) {
725 - if ( is_array( $info ) ) {
 720+ foreach( $options as $label => $info ) {
 721+ if( is_array( $info ) ) {
726722 $html .= Xml::tags( 'h1', null, $label ) . "\n";
727723 $html .= $this->formatOptions( $info, $value );
728724 } else {
729725 $thisAttribs = array( 'id' => $this->mID . "-$info", 'value' => $info );
 726+
 727+ $checkbox = Xml::check( $this->mName . '[]', in_array( $info, $value ),
 728+ $attribs + $thisAttribs );
 729+ $checkbox .= '&nbsp;' . Xml::tags( 'label', array( 'for' => $this->mID . "-$info" ), $label );
730730
731 - $checkbox = Xml::check(
732 - $this->mName . '[]',
733 - in_array( $info, $value ),
734 - $attribs + $thisAttribs
735 - );
736 - $checkbox .= '&nbsp;' . Xml::tags(
737 - 'label',
738 - array( 'for' => $this->mID . "-$info" ),
739 - $label
740 - );
741 -
742731 $html .= $checkbox . '<br />';
743732 }
744733 }
@@ -747,10 +736,10 @@
748737
749738 function loadDataFromRequest( $request ) {
750739 // won't work with getCheck
751 - if ( $request->getCheck( 'wpEditToken' ) ) {
 740+ if( $request->getCheck( 'wpEditToken' ) ) {
752741 $arr = $request->getArray( $this->mName );
753742
754 - if ( !$arr )
 743+ if( !$arr )
755744 $arr = array();
756745
757746 return $arr;
@@ -771,9 +760,9 @@
772761 class HTMLRadioField extends HTMLFormField {
773762 function validate( $value, $alldata ) {
774763 $p = parent::validate( $value, $alldata );
775 - if ( $p !== true ) return $p;
 764+ if( $p !== true ) return $p;
776765
777 - if ( !is_string( $value ) && !is_int( $value ) )
 766+ if( !is_string( $value ) && !is_int( $value ) )
778767 return false;
779768
780769 $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
@@ -789,7 +778,7 @@
790779
791780 return $html;
792781 }
793 -
 782+
794783 function formatOptions( $options, $value ) {
795784 $html = '';
796785
@@ -798,8 +787,8 @@
799788 $attribs['disabled'] = 'disabled';
800789 }
801790
802 - foreach ( $options as $label => $info ) {
803 - if ( is_array( $info ) ) {
 791+ foreach( $options as $label => $info ) {
 792+ if( is_array( $info ) ) {
804793 $html .= Xml::tags( 'h1', null, $label ) . "\n";
805794 $html .= $this->formatOptions( $info, $value );
806795 } else {
Index: trunk/extensions/LiquidThreads/compat/LqtCompatArticle.php
@@ -3,67 +3,68 @@
44
55 global $wgVersion;
66 if ( version_compare( $wgVersion, '1.16', '<' ) ) {
 7+
78 // LiquidThreads compatibility wrapper around the Article object.
89 class Article_LQT_Compat extends Article {
9 -
 10+
1011 public function getOutputFromWikitext( $text, $cache = true, $parserOptions = false ) {
1112 global $wgParser, $wgOut, $wgEnableParserCache, $wgUseFileCache;
12 -
 13+
1314 if ( !$parserOptions ) {
1415 $parserOptions = $wgOut->parserOptions();
1516 }
16 -
17 - $time = - wfTime();
 17+
 18+ $time = -wfTime();
1819 $parserOutput = $wgParser->parse( $text, $this->mTitle,
1920 $parserOptions, true, true, $this->getRevIdFetched() );
2021 $time += wfTime();
21 -
 22+
2223 # Timing hack
23 - if ( $time > 3 ) {
 24+ if( $time > 3 ) {
2425 wfDebugLog( 'slow-parse', sprintf( "%-5.2f %s", $time,
25 - $this->mTitle->getPrefixedDBkey() ) );
 26+ $this->mTitle->getPrefixedDBkey()));
2627 }
27 -
28 - if ( $wgEnableParserCache && $cache && $this && $parserOutput->getCacheTime() != - 1 ) {
 28+
 29+ if( $wgEnableParserCache && $cache && $this && $parserOutput->getCacheTime() != -1 ) {
2930 $parserCache = ParserCache::singleton();
3031 $parserCache->save( $parserOutput, $this, $parserOptions );
3132 }
3233 // Make sure file cache is not used on uncacheable content.
3334 // Output that has magic words in it can still use the parser cache
3435 // (if enabled), though it will generally expire sooner.
35 - if ( $parserOutput->getCacheTime() == - 1 || $parserOutput->containsOldMagic() ) {
 36+ if( $parserOutput->getCacheTime() == -1 || $parserOutput->containsOldMagic() ) {
3637 $wgUseFileCache = false;
3738 }
3839 return $parserOutput;
3940 }
40 -
 41+
4142 /** Stolen from 1.16-alpha, for compatibility with 1.15 */
4243 /** Lightweight method to get the parser output for a page, checking the parser cache
4344 * and so on. Doesn't consider most of the stuff that Article::view is forced to
4445 * consider, so it's not appropriate to use there. */
4546 function getParserOutput( $oldid = null ) {
4647 global $wgEnableParserCache, $wgUser, $wgOut;
47 -
 48+
4849 // Should the parser cache be used?
4950 $useParserCache = $wgEnableParserCache &&
5051 intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 &&
5152 $this->exists() &&
5253 $oldid === null;
53 -
54 - wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
 54+
 55+ wfDebug( __METHOD__.': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
5556 if ( $wgUser->getOption( 'stubthreshold' ) ) {
5657 wfIncrStats( 'pcache_miss_stub' );
5758 }
58 -
 59+
5960 $parserOutput = false;
6061 if ( $useParserCache ) {
6162 $parserOutput = ParserCache::singleton()->get( $this, $wgOut->parserOptions() );
6263 }
63 -
 64+
6465 if ( $parserOutput === false ) {
6566 // Cache miss; parse and output it.
6667 $rev = Revision::newFromTitle( $this->getTitle(), $oldid );
67 -
 68+
6869 return $this->getOutputFromWikitext( $rev->getText(), $useParserCache );
6970 } else {
7071 return $parserOutput;
@@ -71,5 +72,5 @@
7273 }
7374 }
7475 } else {
75 - class Article_LQT_Compat extends Article { }
 76+ class Article_LQT_Compat extends Article {}
7677 }
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -101,7 +101,7 @@
102102 $wgAutoloadClasses['LqtParserFunctions'] = $dir . 'classes/ParserFunctions.php';
103103 $wgAutoloadClasses['LqtDeletionController'] = $dir . 'classes/DeletionController.php';
104104 $wgAutoloadClasses['LqtHooks'] = $dir . 'classes/Hooks.php';
105 -$wgAutoloadClasses['ThreadRevision'] = $dir . "/classes/ThreadRevision.php";
 105+$wgAutoloadClasses['ThreadRevision'] = $dir."/classes/ThreadRevision.php";
106106
107107 // View classes
108108 $wgAutoloadClasses['TalkpageView'] = $dir . 'pages/TalkpageView.php';
Index: trunk/extensions/LiquidThreads/classes/DeletionController.php
@@ -2,97 +2,97 @@
33
44 class LqtDeletionController {
55 static $pageids_to_revive;
6 -
 6+
77 static function onArticleDeleteComplete( &$article, &$user, $reason, $id ) {
88 $title = $article->getTitle();
9 -
10 - if ( $title->getNamespace() != NS_LQT_THREAD ) {
 9+
 10+ if ($title->getNamespace() != NS_LQT_THREAD) {
1111 return true;
1212 }
13 -
 13+
1414 $threads = Threads::where( array( 'thread_root' => $id ) );
15 -
16 - if ( !count( $threads ) ) {
17 - wfDebugLog( __METHOD__ . ": no threads with root $id, ignoring...\n" );
 15+
 16+ if (!count($threads)) {
 17+ wfDebugLog( __METHOD__.": no threads with root $id, ignoring...\n" );
1818 return true;
1919 }
20 -
21 - $thread = array_pop( $threads );
22 -
 20+
 21+ $thread = array_pop($threads);
 22+
2323 // Mark the thread as deleted
24 - $thread->delete( $reason );
25 -
 24+ $thread->delete($reason);
 25+
2626 // Avoid orphaning subthreads, update their parentage.
2727 wfLoadExtensionMessages( 'LiquidThreads' );
2828 if ( $thread->replies() && $thread->isTopmostThread() ) {
29 - $reason = wfMsg( 'lqt-delete-parent-deleted', $reason );
30 - foreach ( $thread->replies() as $reply ) {
 29+ $reason = wfMsg('lqt-delete-parent-deleted', $reason );
 30+ foreach( $thread->replies() as $reply ) {
3131 $reply->root()->doDeleteArticle( $reason, false, $reply->root()->getId() );
3232 }
3333 global $wgOut;
3434 $wgOut->addWikiMsg( 'lqt-delete-replies-done' );
3535 } elseif ( $thread->replies() ) {
36 - foreach ( $thread->replies() as $reply ) {
 36+ foreach( $thread->replies() as $reply ) {
3737 $reply->setSuperthread( $thread->superthread() );
3838 $reply->save( );
3939 }
4040 }
41 -
 41+
4242 return true;
4343 }
44 -
 44+
4545 static function onArticleRevisionUndeleted( &$title, $revision, $page_id ) {
4646 if ( $title->getNamespace() == NS_LQT_THREAD ) {
4747 self::$pageids_to_revive[$page_id] = $title;
4848 }
49 -
 49+
5050 return true;
5151 }
52 -
 52+
5353 static function onArticleUndelete( &$udTitle, $created, $comment = '' ) {
54 - if ( empty( self::$pageids_to_revive ) ) {
 54+ if ( empty(self::$pageids_to_revive) ) {
5555 return true;
5656 }
57 -
58 - foreach ( self::$pageids_to_revive as $pageid => $title ) {
59 - if ( $pageid == 0 ) {
 57+
 58+ foreach( self::$pageids_to_revive as $pageid => $title ) {
 59+ if ($pageid == 0) {
6060 continue;
6161 }
62 -
 62+
6363 // Try to get comment for old versions where it isn't passed, hacky :(
64 - if ( !$comment ) {
 64+ if (!$comment) {
6565 global $wgRequest;
6666 $comment = $wgRequest->getText( 'wpComment' );
6767 }
68 -
 68+
6969 // TX has not been committed yet, so we must select from the master
7070 $dbw = wfGetDB( DB_MASTER );
7171 $res = $dbw->select( 'thread', '*', array( 'thread_root' => $pageid ), __METHOD__ );
7272 $threads = Threads::loadFromResult( $res, $dbw );
73 -
74 - if ( count( $threads ) ) {
75 - $thread = array_pop( $threads );
 73+
 74+ if ( count($threads) ) {
 75+ $thread = array_pop($threads);
7676 $thread->setRoot( new Article( $title ) );
7777 $thread->undelete( $comment );
7878 } else {
79 - wfDebug( __METHOD__ . ":No thread found with root set to $pageid (??)\n" );
 79+ wfDebug( __METHOD__. ":No thread found with root set to $pageid (??)\n" );
8080 }
8181 }
82 -
 82+
8383 return true;
8484 }
85 -
 85+
8686 static function onArticleConfirmDelete( $article, $out, &$reason ) {
87 - if ( $article->getTitle()->getNamespace() != NS_LQT_THREAD ) return true;
88 -
 87+ if ($article->getTitle()->getNamespace() != NS_LQT_THREAD) return true;
 88+
8989 $thread = Threads::withRoot( $article );
90 -
91 - if ( $thread->isTopmostThread() && count( $thread->replies() ) ) {
 90+
 91+ if ( $thread->isTopmostThread() && count($thread->replies()) ) {
9292 wfLoadExtensionMessages( 'LiquidThreads' );
9393 $out->wrapWikiMsg( '<strong>$1</strong>',
9494 'lqt-delete-parent-warning' );
9595 }
96 -
 96+
9797 return true;
9898 }
9999 }
Index: trunk/extensions/LiquidThreads/classes/Thread.php
@@ -31,35 +31,35 @@
3232 protected $subject;
3333 protected $authorId;
3434 protected $authorName;
35 -
 35+
3636 protected $allDataLoaded;
37 -
 37+
3838 protected $isHistorical = false;
39 -
 39+
4040 protected $rootRevision;
4141
4242 /* Flag about who has edited or replied to this thread. */
4343 protected $editedness;
4444
4545 protected $replies;
46 -
 46+
4747 static $titleCacheById = array();
4848 static $replyCacheById = array();
4949 static $articleCacheById = array();
50 -
 50+
5151 static $VALID_TYPES = array( Threads::TYPE_NORMAL, Threads::TYPE_MOVED, Threads::TYPE_DELETED );
5252
5353 function isHistorical() {
5454 return $this->isHistorical;
5555 }
56 -
 56+
5757 static function create( $root, $article, $superthread = null,
58 - $type = Threads::TYPE_NORMAL, $subject = '' ) {
 58+ $type = Threads::TYPE_NORMAL, $subject = '' ) {
5959
60 - $dbw = wfGetDB( DB_MASTER );
 60+ $dbw = wfGetDB( DB_MASTER );
 61+
 62+ $thread = new Thread(null);
6163
62 - $thread = new Thread( null );
63 -
6464 if ( !in_array( $type, self::$VALID_TYPES ) ) {
6565 throw new MWException( __METHOD__ . ": invalid change type $type." );
6666 }
@@ -80,50 +80,50 @@
8181 $thread->setArticle( $article );
8282 $thread->setSubject( $subject );
8383 $thread->setType( $type );
84 -
 84+
8585 $thread->insert();
86 -
 86+
8787 if ( $superthread ) {
8888 $superthread->addReply( $thread );
89 -
 89+
9090 $superthread->commitRevision( $change_type, $thread );
9191 } else {
9292 $hthread = ThreadRevision::create( $thread, $change_type );
9393 }
94 -
 94+
9595 // Create talk page
9696 Threads::createTalkpageIfNeeded( $article );
9797
9898 // Notifications
9999 NewMessages::writeMessageStateForUpdatedThread( $thread, $change_type, $wgUser );
100 -
101 - if ( $wgUser->getOption( 'lqt-watch-threads', false ) ) {
 100+
 101+ if ($wgUser->getOption( 'lqt-watch-threads', false ) ) {
102102 $thread->topmostThread()->root()->doWatch();
103103 }
104104
105105 return $thread;
106106 }
107 -
 107+
108108 function insert() {
109109 $this->dieIfHistorical();
110 -
 110+
111111 $dbw = wfGetDB( DB_MASTER );
112 -
 112+
113113 $row = $this->getRow();
114114 $row['thread_id'] = $dbw->nextSequenceValue( 'thread_thread_id' );
115 -
 115+
116116 $dbw->insert( 'thread', $row, __METHOD__ );
117117 $this->id = $dbw->insertId();
118 -
 118+
119119 // Touch the root
120 - if ( $this->root() ) {
 120+ if ($this->root()) {
121121 $this->root()->getTitle()->invalidateCache();
122122 }
123 -
 123+
124124 // Touch the talk page, too.
125125 $this->article()->getTitle()->invalidateCache();
126126 }
127 -
 127+
128128 function setRoot( $article ) {
129129 $this->rootId = $article->getId();
130130 $this->root = $article;
@@ -136,27 +136,27 @@
137137 $this->modified = wfTimestampNow();
138138 $this->updateEditedness( $change_type );
139139 $this->save();
140 -
 140+
141141 $topmost = $this->topmostThread();
142142 $topmost->modified = wfTimestampNow();
143143 $topmost->save();
144 -
 144+
145145 ThreadRevision::create( $this, $change_type, $change_object, $reason );
146146
147147 if ( $change_type == Threads::CHANGE_EDITED_ROOT ) {
148148 NewMessages::writeMessageStateForUpdatedThread( $this, $change_type, $wgUser );
149149 }
150150 }
151 -
 151+
152152 function updateEditedness( $change_type ) {
153153 global $wgUser;
154 -
 154+
155155 if ( $change_type == Threads::CHANGE_REPLY_CREATED
156156 && $this->editedness == Threads::EDITED_NEVER ) {
157157 $this->editedness = Threads::EDITED_HAS_REPLY;
158158 } elseif ( $change_type == Threads::CHANGE_EDITED_ROOT ) {
159159 $originalAuthor = $this->author();
160 -
 160+
161161 if ( ( $wgUser->getId() == 0 && $originalAuthor->getName() != $wgUser->getName() )
162162 || $wgUser->getId() != $originalAuthor->getId() ) {
163163 $this->editedness = Threads::EDITED_BY_OTHERS;
@@ -165,60 +165,60 @@
166166 }
167167 }
168168 }
169 -
 169+
170170 /** Unless you know what you're doing, you want commitRevision */
171 - function save() {
 171+ function save() {
172172 $this->dieIfHistorical();
173173
174174 $dbr = wfGetDB( DB_MASTER );
175 -
 175+
176176 $res = $dbr->update( 'thread',
177177 /* SET */ $this->getRow(),
178178 /* WHERE */ array( 'thread_id' => $this->id, ),
179179 __METHOD__ );
180 -
 180+
181181 // Touch the root
182 - if ( $this->root() ) {
 182+ if ($this->root()) {
183183 $this->root()->getTitle()->invalidateCache();
184184 }
185 -
 185+
186186 // Touch the talk page, too.
187187 $this->article()->getTitle()->invalidateCache();
188188 }
189 -
 189+
190190 function getRow() {
191191 $id = $this->id();
192 -
 192+
193193 $dbw = wfGetDB( DB_MASTER );
194194
195 - if ( !$id ) {
 195+ if (!$id) {
196196 $id = $dbw->nextSequenceValue( 'thread_thread_id' );
197197 }
198 -
 198+
199199 // Reflect schema changes here.
200 -
 200+
201201 return array(
202 - 'thread_id' => $id,
203 - 'thread_root' => $this->rootId,
204 - 'thread_parent' => $this->parentId,
205 - 'thread_article_namespace' => $this->articleNamespace,
206 - 'thread_article_title' => $this->articleTitle,
207 - 'thread_modified' => $dbw->timestamp( $this->modified ),
208 - 'thread_created' => $dbw->timestamp( $this->created ),
209 - 'thread_ancestor' => $this->ancestorId,
210 - 'thread_type' => $this->type,
211 - 'thread_subject' => $this->subject,
212 - 'thread_author_id' => $this->authorId,
213 - 'thread_author_name' => $this->authorName,
214 - 'thread_summary_page' => $this->summaryId,
215 - 'thread_editedness' => $this->editedness,
216 - );
 202+ 'thread_id' => $id,
 203+ 'thread_root' => $this->rootId,
 204+ 'thread_parent' => $this->parentId,
 205+ 'thread_article_namespace' => $this->articleNamespace,
 206+ 'thread_article_title' => $this->articleTitle,
 207+ 'thread_modified' => $dbw->timestamp($this->modified),
 208+ 'thread_created' => $dbw->timestamp($this->created),
 209+ 'thread_ancestor' => $this->ancestorId,
 210+ 'thread_type' => $this->type,
 211+ 'thread_subject' => $this->subject,
 212+ 'thread_author_id' => $this->authorId,
 213+ 'thread_author_name' => $this->authorName,
 214+ 'thread_summary_page' => $this->summaryId,
 215+ 'thread_editedness' => $this->editedness,
 216+ );
217217 }
218 -
 218+
219219 function author() {
220220 $this->doLazyUpdates();
221 -
222 - if ( $this->authorId ) {
 221+
 222+ if ($this->authorId) {
223223 return User::newFromId( $this->authorId );
224224 } else {
225225 // Do NOT validate username. If the user did it, they did it.
@@ -230,51 +230,49 @@
231231 $this->type = Threads::TYPE_DELETED;
232232 $this->commitRevision( Threads::CHANGE_DELETED, $this, $reason );
233233 /* Mark thread as read by all users, or we get blank thingies in New Messages. */
234 -
 234+
235235 $this->dieIfHistorical();
236 -
 236+
237237 $dbw = wfGetDB( DB_MASTER );
238 -
 238+
239239 $dbw->delete( 'user_message_state', array( 'ums_thread' => $this->id() ),
240240 __METHOD__ );
241241 }
242 -
 242+
243243 function undelete( $reason ) {
244244 $this->type = Threads::TYPE_NORMAL;
245245 $this->commitRevision( Threads::CHANGE_UNDELETED, $this, $reason );
246246 }
247247
248248 function moveToPage( $title, $reason, $leave_trace ) {
249 - if ( !$this->isTopmostThread() )
 249+ if (!$this->isTopmostThread() )
250250 throw new MWException( "Attempt to move non-toplevel thread to another page" );
251 -
 251+
252252 $this->dieIfHistorical();
253 -
 253+
254254 $dbr = wfGetDB( DB_MASTER );
255255
256256 $oldTitle = $this->article()->getTitle();
257257 $newTitle = $title;
258 -
 258+
259259 $new_articleNamespace = $title->getNamespace();
260260 $new_articleTitle = $title->getDBkey();
261 -
 261+
262262 // Update on *all* subthreads.
263 - $dbr->update(
264 - 'thread',
265 - array(
266 - 'thread_revision=thread_revision+1',
267 - 'thread_article_namespace' => $new_articleNamespace,
268 - 'thread_article_title' => $new_articleTitle,
269 - 'thread_modified' => $dbr->timestamp( wfTimestampNow() ),
270 - ),
271 - array( 'thread_ancestor' => $this->id() ),
272 - __METHOD__
273 - );
 263+ $dbr->update( 'thread',
 264+ array(
 265+ 'thread_revision=thread_revision+1',
 266+ 'thread_article_namespace' => $new_articleNamespace,
 267+ 'thread_article_title' => $new_articleTitle,
 268+ 'thread_modified' => $dbr->timestamp( wfTimestampNow() ),
 269+ ),
 270+ array( 'thread_ancestor' => $this->id() ),
 271+ __METHOD__ );
274272
275273 $this->articleNamespace = $new_articleNamespace;
276274 $this->articleTitle = $new_articleTitle;
277275 $this->commitRevision( Threads::CHANGE_MOVED_TALKPAGE, null, $reason );
278 -
 276+
279277 # Log the move
280278 $log = new LogPage( 'liquidthreads' );
281279 $log->addEntry( 'move', $this->title(), $reason, array( $oldTitle, $newTitle ) );
@@ -288,57 +286,59 @@
289287 // there.
290288 function leaveTrace( $reason, $oldTitle, $newTitle ) {
291289 $this->dieIfHistorical();
292 -
 290+
293291 $dbw = wfGetDB( DB_MASTER );
294292
295293 // Create redirect text
296294 $mwRedir = MagicWord::get( 'redirect' );
297295 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $this->title()->getPrefixedText() . "]]\n";
298 -
 296+
299297 // Make the article edit.
300 - $traceTitle = Threads::newThreadTitle( $this->subject(), new Article_LQT_Compat( $oldTitle ) );
 298+ $traceTitle = Threads::newThreadTitle( $this->subject(), new Article_LQT_Compat($oldTitle) );
301299 $redirectArticle = new Article_LQT_Compat( $traceTitle );
302300 $redirectArticle->doEdit( $redirectText, $reason, EDIT_NEW );
303301
304302 // Add the trace thread to the tracking table.
305 - $thread = Threads::newThread( $redirectArticle, new Article_LQT_Compat( $oldTitle ), null,
 303+ $thread = Threads::newThread( $redirectArticle, new Article_LQT_Compat($oldTitle), null,
306304 Threads::TYPE_MOVED, $this->subject() );
307305 }
308306
 307+
 308+
309309 function __construct( $line, $unused = null ) {
310310 /* SCHEMA changes must be reflected here. */
311 -
312 - if ( is_null( $line ) ) { // For Thread::create().
 311+
 312+ if ( is_null($line) ) { // For Thread::create().
313313 $this->modified = wfTimestampNow();
314314 $this->created = wfTimestampNow();
315315 $this->editedness = Threads::EDITED_NEVER;
316316 return;
317317 }
318 -
 318+
319319 $dataLoads = array(
320 - 'thread_id' => 'id',
321 - 'thread_root' => 'rootId',
322 - 'thread_article_namespace' => 'articleNamespace',
323 - 'thread_article_title' => 'articleTitle',
324 - 'thread_summary_page' => 'summaryId',
325 - 'thread_ancestor' => 'ancestorId',
326 - 'thread_parent' => 'parentId',
327 - 'thread_modified' => 'modified',
328 - 'thread_created' => 'created',
329 - 'thread_type' => 'type',
330 - 'thread_editedness' => 'editedness',
331 - 'thread_subject' => 'subject',
332 - 'thread_author_id' => 'authorId',
333 - 'thread_author_name' => 'authorName',
334 - );
335 -
336 - foreach ( $dataLoads as $db_field => $member_field ) {
337 - if ( isset( $line->$db_field ) ) {
 320+ 'thread_id' => 'id',
 321+ 'thread_root' => 'rootId',
 322+ 'thread_article_namespace' => 'articleNamespace',
 323+ 'thread_article_title' => 'articleTitle',
 324+ 'thread_summary_page' => 'summaryId',
 325+ 'thread_ancestor' => 'ancestorId',
 326+ 'thread_parent' => 'parentId',
 327+ 'thread_modified' => 'modified',
 328+ 'thread_created' => 'created',
 329+ 'thread_type' => 'type',
 330+ 'thread_editedness' => 'editedness',
 331+ 'thread_subject' => 'subject',
 332+ 'thread_author_id' => 'authorId',
 333+ 'thread_author_name' => 'authorName',
 334+ );
 335+
 336+ foreach( $dataLoads as $db_field => $member_field ) {
 337+ if ( isset($line->$db_field) ) {
338338 $this->$member_field = $line->$db_field;
339339 }
340340 }
341 -
342 - if ( isset( $line->page_namespace ) && isset( $line->page_title ) ) {
 341+
 342+ if ( isset($line->page_namespace) && isset($line->page_title) ) {
343343 $root_title = Title::makeTitle( $line->page_namespace, $line->page_title );
344344 $this->root = new Article_LQT_Compat( $root_title );
345345 $this->root->loadPageData( $line );
@@ -348,223 +348,220 @@
349349 } else {
350350 $root_title = Title::newFromID( $this->rootId );
351351 }
352 -
353 - if ( $root_title ) {
 352+
 353+ if ($root_title) {
354354 $this->root = new Article_LQT_Compat( $root_title );
355355 }
356356 }
357 -
 357+
358358 $this->doLazyUpdates( $line );
359359 }
360 -
 360+
361361 // Load a list of threads in bulk, including all subthreads.
362 - static function bulkLoad( $rows ) {
 362+ static function bulkLoad( $rows ) {
363363 // Preload subthreads
364364 $thread_ids = array();
365365 $all_thread_rows = $rows;
366366 $pageIds = array();
367367 $linkBatch = new LinkBatch();
368 -
369 - if ( !is_array( self::$replyCacheById ) ) {
 368+
 369+ if (!is_array(self::$replyCacheById)) {
370370 self::$replyCacheById = array();
371371 }
372 -
 372+
373373 // Build a list of threads for which to pull replies, and page IDs to pull data for.
374374 // Also, pre-initialise the reply cache.
375 - foreach ( $rows as $row ) {
 375+ foreach( $rows as $row ) {
376376 $thread_ids[] = $row->thread_id;
377 -
 377+
378378 // Grab page data while we're here.
379 - if ( $row->thread_root )
 379+ if ($row->thread_root)
380380 $pageIds[] = $row->thread_root;
381 - if ( $row->thread_summary_page )
 381+ if ($row->thread_summary_page)
382382 $pageIds[] = $row->thread_summary_page;
383 -
 383+
384384 if ( !isset( self::$replyCacheById[$row->thread_id] ) ) {
385385 self::$replyCacheById[$row->thread_id] = array();
386386 }
387387 }
388 -
 388+
389389 // Pull replies to the threads provided, and as above, pull page IDs to pull data for,
390390 // pre-initialise the reply cache, and stash the row object for later use.
391 - if ( count( $thread_ids ) ) {
 391+ if ( count($thread_ids) ) {
392392 $dbr = wfGetDB( DB_SLAVE );
393393 $res = $dbr->select( 'thread', '*', array( 'thread_ancestor' => $thread_ids ),
394394 __METHOD__ );
395 -
396 - while ( $row = $dbr->fetchObject( $res ) ) {
 395+
 396+ while( $row = $dbr->fetchObject($res) ) {
397397 // Grab page data while we're here.
398 - if ( $row->thread_root )
 398+ if ($row->thread_root)
399399 $pageIds[] = $row->thread_root;
400 - if ( $row->thread_summary_page )
 400+ if ($row->thread_summary_page)
401401 $pageIds[] = $row->thread_summary_page;
402 -
 402+
403403 $all_thread_rows[] = $row;
404 -
 404+
405405 if ( !isset( self::$replyCacheById[$row->thread_id] ) ) {
406406 self::$replyCacheById[$row->thread_id] = array();
407407 }
408408 }
409409 }
410 -
411 - // Preload page data (restrictions, and preload Article object with everything from
 410+
 411+ // Preload page data (restrictions, and preload Article object with everything from
412412 // the page table. Also, precache the title and article objects for pulling later.
413413 $articlesById = array();
414 - if ( count( $pageIds ) ) {
 414+ if ( count($pageIds) ) {
415415 // Pull restriction info. Needs to come first because otherwise it's done per
416416 // page by loadPageData.
417417 $restrictionRows = array_fill_keys( $pageIds, array() );
418418 $res = $dbr->select( 'page_restrictions', '*', array( 'pr_page' => $pageIds ),
419419 __METHOD__ );
420 - while ( $row = $dbr->fetchObject( $res ) ) {
 420+ while( $row = $dbr->fetchObject( $res ) ) {
421421 $restrictionRows[$row->pr_page][] = $row;
422422 }
423 -
 423+
424424 $res = $dbr->select( 'page', '*', array( 'page_id' => $pageIds ), __METHOD__ );
425 -
426 - while ( $row = $dbr->fetchObject( $res ) ) {
 425+
 426+ while( $row = $dbr->fetchObject( $res ) ) {
427427 $t = Title::newFromRow( $row );
428 -
 428+
429429 if ( isset( $restrictionRows[$t->getArticleId()] ) ) {
430430 $t->loadRestrictionsFromRows( $restrictionRows[$t->getArticleId()],
431431 $row->page_restrictions );
432432 }
433 -
 433+
434434 $article = new Article_LQT_Compat( $t );
435435 $article->loadPageData( $row );
436 -
 436+
437437 self::$titleCacheById[$t->getArticleId()] = $t;
438438 $articlesById[$article->getId()] = $article;
439 -
440 - if ( count( self::$titleCacheById ) > 10000 ) {
 439+
 440+ if ( count(self::$titleCacheById) > 10000 ) {
441441 self::$titleCacheById = array();
442442 }
443443 }
444444 }
445 -
 445+
446446 // For every thread we have a row object for, load a Thread object, add the user and
447447 // user talk pages to a link batch, cache the relevant user id/name pair, and
448448 // populate the reply cache.
449 - foreach ( $all_thread_rows as $row ) {
 449+ foreach( $all_thread_rows as $row ) {
450450 $thread = new Thread( $row, null );
451 -
452 - if ( isset( $articlesById[$thread->rootId] ) )
 451+
 452+ if ( isset($articlesById[$thread->rootId]) )
453453 $thread->root = $articlesById[$thread->rootId];
454 -
 454+
455455 Threads::$cache_by_id[$row->thread_id] = $thread;
456 -
 456+
457457 // User cache data
458458 $t = Title::makeTitleSafe( NS_USER, $row->thread_author_name );
459459 $linkBatch->addObj( $t );
460460 $t = Title::makeTitleSafe( NS_USER_TALK, $row->thread_author_name );
461461 $linkBatch->addObj( $t );
462 -
 462+
463463 User::$idCacheByName[$row->thread_author_name] = $row->thread_author_id;
464 -
 464+
465465 if ( $row->thread_parent ) {
466466 self::$replyCacheById[$row->thread_parent][$row->thread_id] = $thread;
467467 }
468468 }
469 -
 469+
470470 // Pull link batch data.
471471 $linkBatch->execute();
472 -
 472+
473473 $threads = array();
474 -
 474+
475475 // Fill and return an array with the threads that were actually requested.
476 - foreach ( $rows as $row ) {
 476+ foreach( $rows as $row ) {
477477 $threads[$row->thread_id] = Threads::$cache_by_id[$row->thread_id];
478478 }
479 -
 479+
480480 return $threads;
481481 }
482 -
 482+
483483 /**
484484 * Return the User object representing the author of the first revision
485485 * (or null, if the database is screwed up).
486486 */
487487 function loadOriginalAuthorFromRevision( ) {
488488 $this->dieIfHistorical();
489 -
 489+
490490 $dbr = wfGetDB( DB_SLAVE );
491 -
 491+
492492 $article = $this->root();
493493
494 - $line = $dbr->selectRow(
495 - 'revision',
496 - 'rev_user_text',
497 - array( 'rev_page' => $article->getID() ),
498 - __METHOD__,
499 - array(
500 - 'ORDER BY' => 'rev_timestamp',
501 - 'LIMIT' => '1'
502 - )
503 - );
504 -
 494+ $line = $dbr->selectRow( 'revision',
 495+ 'rev_user_text',
 496+ array( 'rev_page' => $article->getID() ),
 497+ __METHOD__,
 498+ array(
 499+ 'ORDER BY' => 'rev_timestamp',
 500+ 'LIMIT' => '1'
 501+ ) );
505502 if ( $line )
506503 return User::newFromName( $line->rev_user_text, false );
507504 else
508505 return null;
509506 }
510 -
 507+
511508 // Lazy updates done whenever a thread is loaded.
512509 // Much easier than running a long-running maintenance script.
513510 function doLazyUpdates( ) {
514511 if ( $this->isHistorical() )
515512 return; // Don't do lazy updates on stored historical threads.
516 -
 513+
517514 // This is an invocation guard to avoid infinite recursion when fixing a
518515 // missing ancestor.
519516 static $doingUpdates = false;
520 - if ( $doingUpdates ) return;
 517+ if ($doingUpdates) return;
521518 $doingUpdates = true;
522 -
 519+
523520 // Fix missing ancestry information.
524521 // (there was a bug where this was not saved properly)
525 - if ( $this->parentId && !$this->ancestorId ) {
 522+ if ($this->parentId &&!$this->ancestorId) {
526523 $this->fixMissingAncestor();
527524 }
528 -
 525+
529526 $ancestor = $this->topmostThread();
530 -
 527+
531528 $set = array();
532 -
 529+
533530 // Fix missing subject information
534531 // (this information only started to be added later)
535532 if ( !$this->subject && $this->root() ) {
536533 $detectedSubject = $this->root()->getTitle()->getText();
537534 $parts = self::splitIncrementFromSubject( $detectedSubject );
538 -
 535+
539536 $this->subject = $detectedSubject = $parts[1];
540 -
 537+
541538 // Update in the DB
542539 $set['thread_subject'] = $detectedSubject;
543540 }
544 -
 541+
545542 // Fix inconsistent subject information
546543 // (in some intermediate versions this was not updated when the subject was changed)
547 - if ( $this->subject() != $ancestor->subject() ) {
 544+ if ($this->subject() != $ancestor->subject()) {
548545 $set['thread_subject'] = $ancestor->subject();
549 -
 546+
550547 $this->subject = $ancestor->subject();
551548 }
552 -
 549+
553550 // Fix missing authorship information
554551 // (this information only started to be added later)
555552 if ( !$this->authorName ) {
556553 $author = $this->loadOriginalAuthorFromRevision();
557 -
 554+
558555 $this->authorId = $author->getId();
559556 $this->authorName = $author->getName();
560 -
 557+
561558 $set['thread_author_name'] = $this->authorName;
562559 $set['thread_author_id'] = $this->authorId;
563560 }
564 -
565 - // Check for article being in subject, not talk namespace.
566 - // If the page is non-LiquidThreads and it's in subject-space, we'll assume it's meant
 561+
 562+ //Check for article being in subject, not talk namespace.
 563+ //If the page is non-LiquidThreads and it's in subject-space, we'll assume it's meant
567564 // to be on the corresponding talk page, but only if the talk-page is a LQT page.
568 - // (Previous versions stored the subject page, for some totally bizarre reason)
 565+ //(Previous versions stored the subject page, for some totally bizarre reason)
569566 // Old versions also sometimes store the thread page for trace threads as the
570567 // article, not as the root.
571568 // Trying not to exacerbate this by moving it to be the 'Thread talk' page.
@@ -574,103 +571,99 @@
575572 $articleTitle->getNamespace() != NS_LQT_THREAD ) {
576573 $newTitle = $articleTitle->getTalkPage();
577574 $newArticle = new Article_LQT_Compat( $newTitle );
578 -
 575+
579576 $set['thread_article_namespace'] = $newTitle->getNamespace();
580577 $set['thread_article_title'] = $newTitle->getDbKey();
581 -
 578+
582579 $this->articleNamespace = $newTitle->getNamespace();
583580 $this->articleTitle = $newTitle->getDbKey();
584 -
 581+
585582 $this->article = $newArticle;
586583 }
587 -
 584+
588585 // Check for article corruption from incomplete thread moves.
589586 // (thread moves only updated this on immediate replies, not replies to replies etc)
590 - if ( ! $ancestor->article()->getTitle()->equals( $this->article()->getTitle() ) ) {
 587+ if (! $ancestor->article()->getTitle()->equals( $this->article()->getTitle() ) ) {
591588 $title = $ancestor->article()->getTitle();
592589 $set['thread_article_namespace'] = $title->getNamespace();
593590 $set['thread_article_title'] = $title->getDbKey();
594 -
 591+
595592 $this->articleNamespace = $title->getNamespace();
596593 $this->articleTitle = $title->getDbKey();
597 -
 594+
598595 $this->article = $ancestor->article();
599596 }
600 -
601 - if ( count( $set ) ) {
 597+
 598+ if ( count($set) ) {
602599 $dbw = wfGetDB( DB_MASTER );
603 -
 600+
604601 $dbw->update( 'thread', $set, array( 'thread_id' => $this->id() ), __METHOD__ );
605602 }
606 -
 603+
607604 // Done
608605 $doingUpdates = false;
609606 }
610607
611608 function addReply( $thread ) {
612609 $thread->setSuperThread( $this );
613 -
614 - if ( is_array( $this->replies ) ) {
 610+
 611+ if ( is_array($this->replies) ) {
615612 $this->replies[$thread->id()] = $thread;
616613 } else {
617614 $this->replies();
618615 $this->replies[$thread->id()] = $thread;
619616 }
620617 }
621 -
 618+
622619 function removeReply( $thread ) {
623 - if ( is_object( $thread ) ) {
 620+ if ( is_object($thread) ) {
624621 $thread = $thread->id();
625622 }
626 -
 623+
627624 $this->replies();
628 -
 625+
629626 unset( $thread->replies[$thread] );
630627 }
631 -
 628+
632629 function replies() {
633 - if ( !is_null( $this->replies ) ) {
 630+ if ( !is_null($this->replies) ) {
634631 return $this->replies;
635632 }
636 -
 633+
637634 $this->dieIfHistorical();
638 -
 635+
639636 // Check cache
640637 if ( isset( self::$replyCacheById[$this->id()] ) ) {
641638 return $this->replies = self::$replyCacheById[$this->id()];
642639 }
643 -
 640+
644641 $this->replies = array();
645 -
 642+
646643 $dbr = wfGetDB( DB_SLAVE );
647 -
648 - $res = $dbr->select(
649 - 'thread',
650 - '*',
651 - array( 'thread_parent' => $this->id() ),
652 - __METHOD__
653 - );
654 -
 644+
 645+ $res = $dbr->select( 'thread', '*',
 646+ array( 'thread_parent' => $this->id() ), __METHOD__ );
 647+
655648 $rows = array();
656 - while ( $row = $dbr->fetchObject( $res ) ) {
 649+ while ( $row = $dbr->fetchObject($res) ) {
657650 $rows[] = $row;
658651 }
659 -
 652+
660653 $this->replies = Thread::bulkLoad( $rows );
661 -
 654+
662655 return $this->replies;
663656 }
664657
665658 function setSuperthread( $thread ) {
666 - if ( $thread == null ) {
 659+ if ($thread == null) {
667660 $this->parentId = null;
668661 $this->ancestorId = 0;
669662 return;
670663 }
671 -
 664+
672665 $this->parentId = $thread->id();
673666 $this->superthread = $thread;
674 -
 667+
675668 if ( $thread->isTopmostThread() ) {
676669 $this->ancestorId = $thread->id();
677670 $this->ancestor = $thread;
@@ -696,23 +689,23 @@
697690 function topmostThread() {
698691 if ( $this->isTopmostThread() ) {
699692 return $this->ancestor = $this;
700 - } elseif ( $this->ancestor ) {
 693+ } elseif ($this->ancestor) {
701694 return $this->ancestor;
702695 } else {
703696 $this->dieIfHistorical();
704 -
 697+
705698 $thread = Threads::withId( $this->ancestorId );
706699
707 - if ( !$thread ) {
 700+ if (!$thread) {
708701 $thread = $this->fixMissingAncestor();
709702 }
710 -
 703+
711704 $this->ancestor = $thread;
712 -
 705+
713706 return $thread;
714707 }
715708 }
716 -
 709+
717710 function setAncestor( $newAncestor ) {
718711 if ( is_object( $newAncestor ) ) {
719712 $this->ancestorId = $newAncestor->id();
@@ -725,23 +718,19 @@
726719 // Fix the corruption by repeatedly grabbing the parent until we hit the topmost thread.
727720 function fixMissingAncestor() {
728721 $thread = $this;
729 -
 722+
730723 $this->dieIfHistorical();
731 -
 724+
732725 while ( !$thread->isTopmostThread() ) {
733726 $thread = $thread->superthread();
734727 }
735 -
 728+
736729 $this->ancestorId = $thread->id();
737 -
 730+
738731 $dbw = wfGetDB( DB_MASTER );
739 - $dbw->update(
740 - 'thread',
741 - array( 'thread_ancestor' => $thread->id() ),
742 - array( 'thread_id' => $this->id() ),
743 - __METHOD__
744 - );
745 -
 732+ $dbw->update( 'thread', array( 'thread_ancestor' => $thread->id() ),
 733+ array( 'thread_id' => $this->id() ), __METHOD__ );
 734+
746735 return $thread;
747736 }
748737
@@ -756,14 +745,14 @@
757746 $this->articleTitle = $a->getTitle()->getDBkey();
758747 $this->touch();
759748 }
760 -
 749+
761750 function touch() {
762751 // Nothing here yet
763752 }
764753
765754 function article() {
766755 if ( $this->article ) return $this->article;
767 -
 756+
768757 if ( !is_null( $this->articleId ) ) {
769758 $title = Title::newFromID( $this->articleId );
770759 if ( $title ) {
@@ -791,19 +780,19 @@
792781 function root( ) {
793782 if ( !$this->rootId ) return null;
794783 if ( !$this->root ) {
795 - if ( isset( self::$articleCacheById[$this->rootId] ) ) {
 784+ if ( isset(self::$articleCacheById[$this->rootId]) ) {
796785 $this->root = self::$articleCacheById[$this->rootId];
797786 return $this->root;
798787 }
799 -
 788+
800789 if ( isset( self::$titleCacheById[$this->rootId] ) ) {
801790 $title = self::$titleCacheById[$this->rootId];
802791 } else {
803792 $title = Title::newFromID( $this->rootId );
804793 }
805 -
806 - if ( !$title ) return null;
807 -
 794+
 795+ if (!$title) return null;
 796+
808797 $this->root = new Article_LQT_Compat( $title );
809798 }
810799 return $this->root;
@@ -816,19 +805,20 @@
817806 function summary() {
818807 if ( !$this->summaryId )
819808 return null;
820 -
 809+
821810 if ( !$this->summary ) {
822811 $title = Title::newFromID( $this->summaryId );
823 -
824 - if ( !$title ) {
825 - wfDebug( __METHOD__ . ": supposed summary doesn't exist" );
 812+
 813+ if (!$title) {
 814+ wfDebug( __METHOD__.": supposed summary doesn't exist" );
826815 $this->summaryId = null;
827816 return null;
828817 }
829 -
 818+
830819 $this->summary = new Article_LQT_Compat( $title );
831 - }
832820
 821+ }
 822+
833823 return $this->summary;
834824 }
835825
@@ -858,7 +848,7 @@
859849 function subject() {
860850 return $this->subject;
861851 }
862 -
 852+
863853 function setSubject( $subject ) {
864854 $this->subject = $subject;
865855 }
@@ -893,8 +883,8 @@
894884 function type() {
895885 return $this->type;
896886 }
897 -
898 - function setType( $t ) {
 887+
 888+ function setType($t) {
899889 $this->type = $t;
900890 }
901891
@@ -902,7 +892,7 @@
903893 $rev = Revision::newFromId( $this->root()->getLatest() );
904894 $rtitle = Title::newFromRedirect( $rev->getRawText() );
905895 if ( !$rtitle ) return null;
906 -
 896+
907897 $this->dieIfHistorical();
908898 $rthread = Threads::withRoot( new Article_LQT_Compat( $rtitle ) );
909899 return $rthread;
@@ -926,102 +916,98 @@
927917 $result = $parent_restrictions;
928918 return false;
929919 }
930 - }
931920
 921+ }
 922+
932923 function getAnchorName() {
933924 return "lqt_thread_{$this->id()}";
934925 }
935 -
 926+
936927 function updateHistory() {
937928 // $dbr = wfGetDB( DB_SLAVE );
938 -//
939 -// $res = $dbr->select(
940 -// 'historical_thread',
941 -// '*',
942 -// array( 'hthread_id' => $this->id() ),
943 -// __METHOD__,
944 -// array( 'ORDER BY' => 'hthread_revision ASC' )
945 -// );
946 -//
 929+//
 930+// $res = $dbr->select( 'historical_thread', '*',
 931+// array( 'hthread_id' => $this->id() ),
 932+// __METHOD__,
 933+// array( 'ORDER BY' => 'hthread_revision ASC' ) );
 934+//
947935 // foreach( $row as $res ) {
948936 // $historical_thread = HistoricalThread::fromTextRepresentation( $row->hthread_content );
949 -//
950 -// // Insert a revision into the database.
951 -// $rev = ThreadRevision::create(
952 -// $historical_thread,
953 -// $historical_thread->changeType(),
954 -// $historical_thread->changeObject(),
955 -// $historical_thread->changeComment(),
956 -// $historical_thread->changeUser(),
957 -// $historical_thread->modified()
958 -// );
 937+//
 938+// // Insert a revision into the database.
 939+// $rev = ThreadRevision::create( $historical_thread,
 940+// $historical_thread->changeType(),
 941+// $historical_thread->changeObject(),
 942+// $historical_thread->changeComment(),
 943+// $historical_thread->changeUser(),
 944+// $historical_thread->modified() );
959945 // }
960946 }
961 -
 947+
962948 function setAuthor( $user ) {
963949 $this->authorId = $user->getId();
964950 $this->authorName = $user->getName();
965951 }
966 -
 952+
967953 // Load all lazy-loaded data in prep for (e.g.) serialization.
968954 function loadAllData() {
969955 // Make sure superthread and topmost thread are loaded.
970956 $this->superthread();
971957 $this->topmostThread();
972 -
 958+
973959 // Make sure replies, and all the data therein, is loaded.
974 - foreach ( $this->replies() as $reply ) {
 960+ foreach( $this->replies() as $reply ) {
975961 $reply->loadAllData();
976962 }
977963 }
978 -
 964+
979965 // On serialization, load all data because it will be different in the DB when we wake up.
980966 function __sleep() {
981 -
 967+
982968 $this->loadAllData();
983 -
 969+
984970 $fields = array_keys( get_object_vars( $this ) );
985 -
 971+
986972 // Filter out article objects, there be dragons (or unserialization problems)
987973 $fields = array_diff( $fields, array( 'root', 'article', 'summary', 'sleeping' ) );
988 -
 974+
989975 return $fields;
990976 }
991 -
 977+
992978 function __wakeup() {
993979 // Mark as historical.
994980 $this->isHistorical = true;
995981 }
996 -
 982+
997983 // This is a safety valve that makes sure that the DB is NEVER touched by a historical
998984 // thread (even for reading, because the data will be out of date).
999985 function dieIfHistorical() {
1000 - if ( $this->isHistorical() ) {
 986+ if ($this->isHistorical()) {
1001987 throw new MWException( "Attempted write or DB operation on historical thread" );
1002988 }
1003989 }
1004 -
 990+
1005991 function rootRevision() {
1006 - if ( !$this->isHistorical() || !isset( $this->topmostThread()->threadRevision ) ) {
 992+ if ( !$this->isHistorical() || !isset($this->topmostThread()->threadRevision) ) {
1007993 return null;
1008994 }
1009 -
 995+
1010996 $dbr = wfGetDB( DB_SLAVE );
1011 -
 997+
1012998 $revision = $this->topmostThread()->threadRevision;
1013999 $timestamp = $dbr->timestamp( $revision->getTimestamp() );
1014 -
 1000+
10151001 $conds = array(
1016 - 'rev_timestamp<=' . $dbr->addQuotes( $timestamp ),
 1002+ 'rev_timestamp<='.$dbr->addQuotes( $timestamp ),
10171003 'page_namespace' => $this->root()->getTitle()->getNamespace(),
10181004 'page_title' => $this->root()->getTitle()->getDBKey(),
10191005 );
1020 -
 1006+
10211007 $join_conds = array( 'page' => array( 'JOIN', 'rev_page=page_id' ) );
1022 -
 1008+
10231009 $row = $dbr->selectRow( array( 'revision', 'page' ), '*', $conds, __METHOD__,
10241010 array( 'ORDER BY' => 'rev_timestamp DESC' ), $join_conds );
1025 -
 1011+
10261012 return $row->rev_id;
10271013 }
10281014 }
Index: trunk/extensions/LiquidThreads/classes/HistoricalThread.php
@@ -2,6 +2,7 @@
33 if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class HistoricalThread extends Thread {
 6+
67 /* Information about what changed in this revision. */
78 protected $changeType;
89 protected $changeObject;
@@ -56,12 +57,12 @@
5758 function isHistorical() {
5859 return true;
5960 }
 61+
6062
61 -
6263 function changeType() {
6364 return $this->changeType;
6465 }
65 -
 66+
6667 function changeObject() {
6768 return $this->replyWithId( $this->changeObject );
6869 }
@@ -94,7 +95,7 @@
9596 function changeComment() {
9697 return $this->changeComment;
9798 }
98 -
 99+
99100 function setChangeUser( $user ) {
100101 $this->changeUser = $user->getId();
101102 $this->changeUserText = $user->getName();
Index: trunk/extensions/LiquidThreads/classes/Threads.php
@@ -3,6 +3,7 @@
44
55 /** Module of factory methods. */
66 class Threads {
 7+
78 const TYPE_NORMAL = 0;
89 const TYPE_MOVED = 1;
910 const TYPE_DELETED = 2;
@@ -20,7 +21,7 @@
2122 const CHANGE_MERGED_FROM = 10;
2223 const CHANGE_MERGED_TO = 11;
2324 const CHANGE_SPLIT_FROM = 12;
24 -
 25+
2526 static $VALID_CHANGE_TYPES = array( self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT,
2627 self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED,
2728 self::CHANGE_MOVED_TALKPAGE, self::CHANGE_SPLIT, self::CHANGE_EDITED_SUBJECT,
@@ -57,26 +58,26 @@
5859 }
5960 }
6061 }
61 -
 62+
6263 static function loadFromResult( $res, $db ) {
6364 $rows = array();
64 -
65 - while ( $row = $db->fetchObject( $res ) ) {
 65+
 66+ while( $row = $db->fetchObject( $res ) ) {
6667 $rows[] = $row;
6768 }
68 -
 69+
6970 return Thread::bulkLoad( $rows );
7071 }
7172
7273 static function where( $where, $options = array() ) {
7374 global $wgDBprefix;
7475 $dbr = wfGetDB( DB_SLAVE );
75 -
 76+
7677 $res = $dbr->select( 'thread', '*', $where, __METHOD__, $options );
7778 $threads = Threads::loadFromResult( $res, $dbr );
7879
7980 foreach ( $threads as $thread ) {
80 - if ( $thread->root() ) {
 81+ if ($thread->root()) {
8182 self::$cache_by_root[$thread->root()->getID()] = $thread;
8283 }
8384 self::$cache_by_id[$thread->id()] = $thread;
@@ -92,7 +93,7 @@
9394
9495 private static function assertSingularity( $threads, $attribute, $value ) {
9596 if ( count( $threads ) == 0 ) { return null; }
96 - if ( count( $threads ) == 1 ) { return array_pop( $threads ); }
 97+ if ( count( $threads ) == 1 ) { return array_pop($threads); }
9798 if ( count( $threads ) > 1 ) {
9899 Threads::databaseError( "More than one thread with $attribute = $value." );
99100 return null;
@@ -125,7 +126,7 @@
126127 return self::$cache_by_id[$id];
127128 }
128129 $ts = Threads::where( array( 'thread_id' => $id ) );
129 -
 130+
130131 return self::assertSingularity( $ts, 'thread_id', $id );
131132 }
132133
@@ -135,78 +136,78 @@
136137 }
137138
138139 /**
139 - * Horrible, horrible!
140 - * List of months in which there are >0 threads, suitable for threadsOfArticleInMonth.
141 - * Returned as an array of months in the format yyyymm
142 - */
 140+ * Horrible, horrible!
 141+ * List of months in which there are >0 threads, suitable for threadsOfArticleInMonth.
 142+ * Returned as an array of months in the format yyyymm
 143+ */
143144 static function monthsWhereArticleHasThreads( $article ) {
144145 // FIXME this probably performs absolutely horribly for pages with lots of threads.
145 -
 146+
146147 $threads = Threads::where( Threads::articleClause( $article ) );
147148 $months = array();
148 -
 149+
149150 foreach ( $threads as $t ) {
150151 $month = substr( $t->modified(), 0, 6 );
151 -
 152+
152153 $months[$month] = true;
153154 }
154 -
 155+
155156 // Some code seems to assume that it's sorted by month, make sure it's true.
156157 ksort( $months );
157 -
158 - return array_keys( $months );
 158+
 159+ return array_keys($months);
159160 }
160161
161162 static function articleClause( $article ) {
162163 $dbr = wfGetDB( DB_SLAVE );
163 -
 164+
164165 $arr = array( 'thread_article_title' => $article->getTitle()->getDBKey(),
165166 'thread_article_namespace' => $article->getTitle()->getNamespace() );
166 -
 167+
167168 return $dbr->makeList( $arr, LIST_AND );
168169 }
169170
170171 static function topLevelClause() {
171172 $dbr = wfGetDB( DB_SLAVE );
172 -
 173+
173174 $arr = array( 'thread_ancestor=thread_id', 'thread_parent' => null );
174 -
 175+
175176 return $dbr->makeList( $arr, LIST_OR );
176177 }
177 -
 178+
178179 static function scratchTitle() {
179180 $token = md5( uniqid( rand(), true ) );
180181 return Title::newFromText( "Thread:$token" );
181182 }
182 -
 183+
183184 static function newThreadTitle( $subject, $article ) {
184185 wfLoadExtensionMessages( 'LiquidThreads' );
185186 $subject = $subject ? $subject : wfMsg( 'lqt_nosubject' );
186 -
 187+
187188 $base = $article->getTitle()->getPrefixedText() . "/$subject";
188 -
 189+
189190 return self::incrementedTitle( $base, NS_LQT_THREAD );
190191 }
191 -
 192+
192193 static function newSummaryTitle( $t ) {
193194 return self::incrementedTitle( $t->title()->getText(), NS_LQT_SUMMARY );
194195 }
195 -
196 - static function newReplyTitle( $thread, $user ) {
 196+
 197+ static function newReplyTitle( $thread, $user) {
197198 $topThread = $thread->topmostThread();
198 -
 199+
199200 $base = $topThread->title()->getText() . '/' . $user->getName();
200 -
 201+
201202 return self::incrementedTitle( $base, NS_LQT_THREAD );
202203 }
203 -
 204+
204205 /** Keep trying titles starting with $basename until one is unoccupied. */
205206 public static function incrementedTitle( $basename, $namespace ) {
206207 $i = 2;
207 -
 208+
208209 $replacements = array_fill_keys( array( '[', ']', '{', '}', '|' ), '_' );
209210 $basename = strtr( $basename, $replacements );
210 -
 211+
211212 $t = Title::makeTitleSafe( $namespace, $basename );
212213 while ( !$t || $t->exists() ||
213214 in_array( $t->getPrefixedDBkey(), self::$occupied_titles ) ) {
@@ -214,5 +215,5 @@
215216 $i++;
216217 }
217218 return $t;
218 - }
 219+ }
219220 }
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -1,10 +1,11 @@
22 <?php
 3+
34 /**
4 - * @package MediaWiki
5 - * @subpackage LiquidThreads
6 - * @author David McCabe <davemccabe@gmail.com>
7 - * @licence GPL2
8 - */
 5+* @package MediaWiki
 6+* @subpackage LiquidThreads
 7+* @author David McCabe <davemccabe@gmail.com>
 8+* @licence GPL2
 9+*/
910
1011 if ( !defined( 'MEDIAWIKI' ) ) {
1112 echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
@@ -24,7 +25,7 @@
2526 public $threadNestingLevel = 0;
2627
2728 protected $sort_order = LQT_NEWEST_CHANGES;
28 -
 29+
2930 static $stylesAndScriptsDone = false;
3031
3132 function __construct( &$output, &$article, &$title, &$user, &$request ) {
@@ -41,10 +42,10 @@
4243 $this->headerLevel = $int;
4344 }
4445
45 - /**
46 - * (1) linking to liquidthreads pages and
47 - * (2) figuring out what page you're on and what you need to do.
48 - */
 46+ /*************************
 47+ * (1) linking to liquidthreads pages and
 48+ * (2) figuring out what page you're on and what you need to do.
 49+ *************************/
4950
5051 function methodAppliesToThread( $method, $thread ) {
5152 return $this->request->getVal( 'lqt_method' ) == $method &&
@@ -56,65 +57,64 @@
5758
5859 static function permalinkUrl( $thread, $method = null, $operand = null,
5960 $uquery = array() ) {
60 - list ( $title, $query ) = self::permalinkData( $thread, $method, $operand );
61 -
 61+ list ($title, $query) = self::permalinkData( $thread, $method, $operand );
 62+
6263 $query = array_merge( $query, $uquery );
63 -
 64+
6465 $queryString = wfArrayToCGI( $query );
65 -
 66+
6667 return $title->getFullUrl( $queryString );
6768 }
68 -
 69+
6970 /** Gets an array of (title, query-parameters) for a permalink **/
7071 static function permalinkData( $thread, $method = null, $operand = null ) {
7172 $query = array();
72 -
73 - if ( $method ) {
 73+
 74+ if ($method) {
7475 $query['lqt_method'] = $method;
7576 }
76 - if ( $operand ) {
 77+ if ($operand) {
7778 $query['lqt_operand'] = $operand;
7879 }
79 -
 80+
8081 return array( $thread->root()->getTitle(), $query );
8182 }
8283
8384 /* This is used for action=history so that the history tab works, which is
84 - * why we break the lqt_method paradigm.
85 - */
 85+ why we break the lqt_method paradigm. */
8686 static function permalinkUrlWithQuery( $thread, $query ) {
87 - if ( !is_array( $query ) ) {
 87+ if ( !is_array($query) ) {
8888 $query = wfCGIToArray( $query );
8989 }
90 -
 90+
9191 return self::permalinkUrl( $thread, null, null, $query );
9292 }
93 -
 93+
9494 static function permalink( $thread, $text = null, $method = null, $operand = null,
9595 $sk = null, $attribs = array(), $uquery = array() ) {
96 - if ( is_null( $sk ) ) {
 96+ if ( is_null($sk) ) {
9797 global $wgUser;
9898 $sk = $wgUser->getSkin();
9999 }
100 -
 100+
101101 list( $title, $query ) = self::permalinkData( $thread, $method, $operand );
102 -
 102+
103103 $query = array_merge( $query, $uquery );
104 -
 104+
105105 return $sk->link( $title, $text, $attribs, $query );
106106 }
107 -
 107+
108108 static function diffQuery( $thread, $revision ) {
109109 $changed_thread = $revision->getChangeObject();
110110 $curr_rev_id = $revision->getThreadObj()->rootRevision();
111111 $curr_rev = Revision::newFromId( $curr_rev_id );
112112 $prev_rev = $curr_rev->getPrevious();
113113 $oldid = $prev_rev ? $prev_rev->getId() : "";
114 -
 114+
115115 $query = array( 'lqt_method' => 'diff',
116116 'diff' => $curr_rev_id,
117117 'oldid' => $oldid );
118 -
 118+
119119 return $query;
120120 }
121121
@@ -122,49 +122,49 @@
123123 $query = self::diffQuery( $thread );
124124 return self::permalinkUrl( $thread->changeObject(), null, null, $query );
125125 }
126 -
 126+
127127 static function diffPermalink( $thread, $text, $revision ) {
128128 $query = self::diffQuery( $thread, $revision );
129129 return self::permalink( $thread, $text, null, null, null, array(), $query );
130130 }
131 -
132 - static function talkpageLink( $title, $text = null , $method = null, $operand = null,
133 - $includeFragment = true, $attribs = array(),
 131+
 132+ static function talkpageLink( $title, $text = null , $method=null, $operand=null,
 133+ $includeFragment=true, $attribs = array(),
134134 $options = array() ) {
135135 list( $title, $query ) = self::talkpageLinkData( $title, $method, $operand,
136136 $includeFragment );
137 -
 137+
138138 global $wgUser;
139139 $sk = $wgUser->getSkin();
140 -
 140+
141141 return $sk->link( $title, $text, $attribs, $query, $options );
142142 }
143 -
 143+
144144 static function talkpageLinkData( $title, $method = null, $operand = null,
145145 $includeFragment = true ) {
146146 global $wgRequest;
147147 $query = array();
148 -
149 - if ( $method ) {
 148+
 149+ if ($method) {
150150 $query['lqt_method'] = $method;
151151 }
152 -
153 - if ( $operand ) {
 152+
 153+ if ($operand) {
154154 $query['lqt_operand'] = $operand->id();
155155 }
156 -
 156+
157157 $oldid = $wgRequest->getVal( 'oldid', null );
158 -
 158+
159159 if ( $oldid !== null ) {
160160 // this is an immensely ugly hack to make editing old revisions work.
161161 $query['oldid'] = $oldid;
162162 }
163 -
 163+
164164 // Add fragment if appropriate.
165 - if ( $operand && $includeFragment ) {
166 - $title->mFragment = 'lqt_thread_' . $operand->id();
 165+ if ($operand && $includeFragment) {
 166+ $title->mFragment = 'lqt_thread_'.$operand->id();
167167 }
168 -
 168+
169169 return array( $title, $query );
170170 }
171171
@@ -172,40 +172,40 @@
173173 $includeFragment = true ) {
174174 global $wgUser;
175175 $sk = $wgUser->getSkin();
176 -
 176+
177177 list( $title, $query ) =
178178 self::talkpageLinkData( $title, $method, $operand, $includeFragment );
179 -
 179+
180180 return $title->getLinkUrl( $query );
181181 }
182182
183183
184184 /**
185 - * Return a URL for the current page, including Title and query vars,
 185+ * Return a URL for the current page, including Title and query vars,
186186 * with the given replacements made.
187 - * @param $repls array( 'name'=>new_value, ... )
188 - */
 187+ * @param $repls array( 'name'=>new_value, ... )
 188+ */
189189 function queryReplaceLink( $repls ) {
190190 $query = $this->getReplacedQuery( $repls );
191 -
 191+
192192 return $this->title->getFullURL( wfArrayToCGI( $vs ) );
193193 }
194 -
 194+
195195 function getReplacedQuery( $replacements ) {
196196 $values = $this->request->getValues();
197 -
 197+
198198 foreach ( $replacements as $k => $v ) {
199199 $values[$k] = $v;
200200 }
201 -
 201+
202202 return $values;
203203 }
204204
205 - /**
206 - * Editing methods (here be dragons)
207 - * Forget dragons: This section distorts the rest of the code
208 - * like a star bending spacetime around itself.
209 - */
 205+ /*************************************************************
 206+ * Editing methods (here be dragons) *
 207+ * Forget dragons: This section distorts the rest of the code *
 208+ * like a star bending spacetime around itself. *
 209+ *************************************************************/
210210
211211 /**
212212 * Return an HTML form element whose value is gotten from the request.
@@ -246,37 +246,37 @@
247247 $this->output->addWikiMsg( 'lqt-summarize-intro' );
248248 $this->showEditingFormInGeneral( $thread, 'summarize', $thread );
249249 }
250 -
 250+
251251 function doInlineEditForm() {
252252 $method = $this->request->getVal( 'lqt_method' );
253253 $operand = $this->request->getVal( 'lqt_operand' );
254 -
255 - $thread = Threads::withId( intval( $operand ) );
256 -
257 - if ( $method == 'reply' ) {
 254+
 255+ $thread = Threads::withId( intval($operand) );
 256+
 257+ if ($method == 'reply') {
258258 $this->showReplyForm( $thread );
259 - } elseif ( $method == 'talkpage_new_thread' ) {
 259+ } elseif ($method == 'talkpage_new_thread') {
260260 $this->showNewThreadForm();
261261 }
262 -
 262+
263263 $this->output->setArticleBodyOnly( true );
264264 }
265265
266266 private function showEditingFormInGeneral( $thread, $edit_type, $edit_applies_to ) {
267267 /*
268 - * EditPage needs an Article. If there isn't a real one, as for new posts,
269 - * replies, and new summaries, we need to generate a title. Auto-generated
270 - * titles are based on the subject line. If the subject line is blank, we
271 - * can temporarily use a random scratch title. It's fine if the title changes
272 - * throughout the edit cycle, since the article doesn't exist yet anyways.
273 - */
 268+ EditPage needs an Article. If there isn't a real one, as for new posts,
 269+ replies, and new summaries, we need to generate a title. Auto-generated
 270+ titles are based on the subject line. If the subject line is blank, we
 271+ can temporarily use a random scratch title. It's fine if the title changes
 272+ throughout the edit cycle, since the article doesn't exist yet anyways.
 273+ */
274274
275 - // Stuff that might break the save
 275+ // Stuff that might break the save
276276 $valid_subject = true;
277277 $failed_rename = false;
278 -
 278+
279279 $subject = $this->request->getVal( 'lqt_subject_field', '' );
280 -
 280+
281281 if ( $edit_type == 'summarize' && $edit_applies_to->summary() ) {
282282 $article = $edit_applies_to->summary();
283283 } elseif ( $edit_type == 'summarize' ) {
@@ -287,7 +287,7 @@
288288 // Dodgy title
289289 $valid_subject = false;
290290 $t = $this->scratchTitle();
291 - } else {
 291+ } else {
292292 if ( $edit_type == 'new' ) {
293293 $t = $this->newScratchTitle( $subject );
294294 } elseif ( $edit_type == 'reply' ) {
@@ -300,16 +300,16 @@
301301 }
302302
303303 $e = new EditPage( $article );
304 -
305 -
 304+
 305+
306306 // Find errors.
307 - if ( !$valid_subject && $subject ) {
308 - $e->editFormPageTop .=
 307+ if (!$valid_subject && $subject) {
 308+ $e->editFormPageTop .=
309309 Xml::tags( 'div', array( 'class' => 'error' ),
310310 wfMsgExt( 'lqt_invalid_subject', 'parse' ) );
311311 }
312 -
313 - if ( ( !$valid_subject && $subject ) || $failed_rename ) {
 312+
 313+ if ( (!$valid_subject && $subject) || $failed_rename ) {
314314 // Dirty hack to prevent saving from going ahead
315315 global $wgRequest;
316316 $wgRequest->setVal( 'wpPreview', true );
@@ -320,20 +320,20 @@
321321 $this->perpetuate( 'lqt_method', 'hidden' ) .
322322 $this->perpetuate( 'lqt_operand', 'hidden' ) .
323323 Xml::hidden( 'lqt_nonce', wfGenerateToken() );
324 -
 324+
325325 // Add a one-time random string to a hidden field. Store the random string
326326 // in memcached on submit and don't allow the edit to go ahead if it's already
327327 // been added.
328328 $submitted_nonce = $this->request->getVal( 'lqt_nonce' );
329 - if ( $submitted_nonce ) {
 329+ if ($submitted_nonce) {
330330 global $wgMemc;
331 -
 331+
332332 $key = wfMemcKey( 'lqt-nonce', $submitted_nonce, $this->user->getName() );
333 - if ( $wgMemc->get( $key ) ) {
 333+ if ( $wgMemc->get($key) ) {
334334 $this->output->redirect( $this->article->getTitle()->getFullURL() );
335335 return;
336336 }
337 -
 337+
338338 $wgMemc->set( $key, 1, 3600 );
339339 }
340340
@@ -343,9 +343,9 @@
344344 $db_subject = $thread ? $thread->subjectWithoutIncrement() : '';
345345 $subject = $this->request->getVal( 'lqt_subject_field', $db_subject );
346346 $subject_label = wfMsg( 'lqt_subject' );
347 -
 347+
348348 $attr = array( 'tabindex' => 1 );
349 -
 349+
350350 $e->editFormTextBeforeContent .=
351351 Xml::inputLabel( $subject_label, 'lqt_subject_field', 'lqt_subject_field',
352352 60, $subject, $attr ) . Xml::element( 'br' );
@@ -354,8 +354,9 @@
355355 $e->edit();
356356
357357 // Override what happens in EditPage::showEditForm, called from $e->edit():
358 - $this->output->setArticleFlag( false );
359358
 359+ $this->output->setArticleFlag( false );
 360+
360361 if ( $e->didSave ) {
361362 $thread = self::postEditUpdates( $edit_type, $edit_applies_to, $article, $this->article,
362363 $subject, $e->summary, $thread );
@@ -366,24 +367,24 @@
367368 // so $thread is null. In that case, just allow editpage to redirect back to the talk page.
368369 if ( $this->output->getRedirect() != '' && $thread ) {
369370 $redirectTitle = clone $thread->article()->getTitle();
370 - $redirectTitle->setFragment( '#' . $this->anchorName( $thread ) );
 371+ $redirectTitle->setFragment( '#'.$this->anchorName( $thread ) );
371372 $this->output->redirect( $this->title->getFullURL() );
372373 } else if ( $this->output->getRedirect() != '' && $edit_applies_to ) {
373374 // For summaries:
374375 $redirectTitle = clone $edit_applies_to->article()->getTitle();
375 - $redirectTitle->setFragment( '#' . $this->anchorName( $edit_applies_to ) );
 376+ $redirectTitle->setFragment( '#'.$this->anchorName( $edit_applies_to ) );
376377 $this->output->redirect( $redirectTitle->getFullURL() );
377378 }
378379 }
379 -
380 - static function postEditUpdates( $edit_type, $edit_applies_to, $edit_page, $article,
 380+
 381+ static function postEditUpdates($edit_type, $edit_applies_to, $edit_page, $article,
381382 $subject, $edit_summary, $thread ) {
382383 // Update metadata - create and update thread and thread revision objects as
383384 // appropriate.
384 -
 385+
385386 if ( $edit_type == 'reply' ) {
386387 $subject = $edit_applies_to->subject();
387 -
 388+
388389 $thread = Threads::newThread( $edit_page, $article, $edit_applies_to,
389390 Threads::TYPE_NORMAL, $subject );
390391 } elseif ( $edit_type == 'summarize' ) {
@@ -394,25 +395,25 @@
395396 // Move the thread and replies if subject changed.
396397 if ( $subject && $subject != $thread->subjectWithoutIncrement() ) {
397398 $thread->setSubject( $subject );
398 -
 399+
399400 // Disabled page-moving for now.
400401 // $this->renameThread( $thread, $subject, $e->summary );
401402 }
402 -
 403+
403404 // Add the history entry.
404405 $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $edit_summary );
405406 } else {
406407 $thread = Threads::newThread( $edit_page, $article, null,
407408 Threads::TYPE_NORMAL, $subject );
408409 }
409 -
 410+
410411 return $thread;
411412 }
412413
413414 function renameThread( $t, $s, $reason ) {
414415 $this->simplePageMove( $t->root()->getTitle(), $s, $reason );
415416 // TODO here create a redirect from old page to new.
416 -
 417+
417418 foreach ( $t->subthreads() as $st ) {
418419 $this->renameThread( $st, $s, $reason );
419420 }
@@ -421,15 +422,15 @@
422423 function scratchTitle() {
423424 return Threads::scratchTitle();
424425 }
425 -
 426+
426427 function newScratchTitle( $subject ) {
427428 return Threads::newThreadTitle( $subject, $this->article );
428429 }
429 -
 430+
430431 function newSummaryTitle( $thread ) {
431432 return Threads::newSummaryTitle( $thread );
432433 }
433 -
 434+
434435 function newReplyTitle( $unused, $thread ) {
435436 return Threads::newReplyTitle( $thread, $this->user );
436437 }
@@ -489,77 +490,77 @@
490491 'enabled' => true );
491492
492493 if ( $this->user->isAllowed( 'delete' ) ) {
493 - $delete_url = $thread->title()->getFullURL( 'action=delete' );
 494+ $delete_url = $thread->title()->getFullURL( 'action=delete');
494495 $deleteMsg = $thread->type() == Threads::TYPE_DELETED ? 'lqt_undelete' : 'delete';
495 -
 496+
496497 $commands['delete'] = array( 'label' => wfMsgExt( $deleteMsg, 'parseinline' ),
497498 'href' => $delete_url,
498499 'enabled' => true );
499500 }
500 -
 501+
501502 if ( !$thread->isTopmostThread() && $this->user->isAllowed( 'lqt-split' ) ) {
502503 $splitUrl = SpecialPage::getTitleFor( 'SplitThread',
503504 $thread->title()->getPrefixedText() )->getFullURL();
504505 $commands['split'] = array( 'label' => wfMsgExt( 'lqt-thread-split', 'parseinline' ),
505506 'href' => $splitUrl, 'enabled' => true );
506507 }
507 -
 508+
508509 if ( $this->user->isAllowed( 'lqt-merge' ) ) {
509510 $mergeParams = $_GET;
510511 $mergeParams['lqt_merge_from'] = $thread->id();
511 -
512 - unset( $mergeParams['title'] );
513 -
 512+
 513+ unset($mergeParams['title']);
 514+
514515 $mergeUrl = $this->title->getFullURL( wfArrayToCGI( $mergeParams ) );
515516 $label = wfMsgExt( 'lqt-thread-merge', 'parseinline' );
516 -
 517+
517518 $commands['merge'] = array( 'label' => $label,
518519 'href' => $mergeUrl, 'enabled' => true );
519520 }
520521
521522 return $commands;
522523 }
523 -
 524+
524525 // Commands for the bottom.
525526 function threadMajorCommands( $thread ) {
526527 wfLoadExtensionMessages( 'LiquidThreads' );
527 -
528 - if ( $thread->isHistorical() ) {
 528+
 529+ if ($thread->isHistorical() ) {
529530 // No links for historical threads.
530531 return array();
531532 }
532 -
 533+
533534 $commands = array();
534 -
 535+
535536 if ( $this->user->isAllowed( 'lqt-merge' ) &&
536537 $this->request->getCheck( 'lqt_merge_from' ) ) {
537538 $srcThread = Threads::withId( $this->request->getVal( 'lqt_merge_from' ) );
538539 $par = $srcThread->title()->getPrefixedText();
539540 $mergeTitle = SpecialPage::getTitleFor( 'MergeThread', $par );
540 - $mergeUrl = $mergeTitle->getFullURL( 'dest=' . $thread->id() );
 541+ $mergeUrl = $mergeTitle->getFullURL( 'dest='.$thread->id() );
541542 $label = wfMsgExt( 'lqt-thread-merge-to', 'parseinline' );
542 -
 543+
543544 $commands['merge-to'] = array( 'label' => $label, 'href' => $mergeUrl,
544545 'enabled' => true, 'tooltip' => $label );
545546 }
546 -
 547+
547548 $commands['reply'] = array( 'label' => wfMsgExt( 'lqt_reply', 'parseinline' ),
548549 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
549550 'enabled' => true, 'icon' => 'reply.png', 'showlabel' => 1,
550551 'tooltip' => wfMsg( 'lqt_reply' ) );
551 -
 552+
552553 $commands['link'] = array( 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ),
553554 'href' => $thread->title()->getFullURL(),
554555 'enabled' => true, 'icon' => 'link.png',
555556 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' ) );
556 -
 557+
557558 if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) {
558559 $commands['edit'] = array( 'label' => wfMsgExt( 'edit', 'parseinline' ),
559560 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
560561 'enabled' => true, 'icon' => 'edit.png',
561562 'tooltip' => wfMsgExt( 'edit', 'parseinline' ) );
562563 }
563 -
 564+
564565 return $commands;
565566 }
566567
@@ -567,41 +568,33 @@
568569 wfLoadExtensionMessages( 'LiquidThreads' );
569570 $commands = array();
570571
571 - $commands['history'] = array(
572 - 'label' => wfMsg( 'history_short' ),
573 - 'href' => self::permalinkUrl( $thread, 'thread_history' ),
574 - 'enabled' => true
575 - );
 572+ $commands['history'] = array( 'label' => wfMsg( 'history_short' ),
 573+ 'href' => self::permalinkUrl( $thread, 'thread_history' ),
 574+ 'enabled' => true );
576575
577576 if ( in_array( 'move', $this->user->getRights() ) ) {
578577 $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getFullURL()
579578 . '/' . $thread->title()->getPrefixedURL();
580 - $commands['move'] = array(
581 - 'label' => wfMsg( 'move' ),
582 - 'href' => $move_href,
583 - 'enabled' => true
584 - );
 579+ $commands['move'] = array( 'label' => wfMsg( 'move' ),
 580+ 'href' => $move_href,
 581+ 'enabled' => true );
585582 }
586583 if ( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) {
587 - $commands['watch'] = array(
588 - 'label' => wfMsg( 'watch' ),
589 - 'href' => self::permalinkUrlWithQuery( $thread, 'action=watch' ),
590 - 'enabled' => true
591 - );
 584+ $commands['watch'] = array( 'label' => wfMsg( 'watch' ),
 585+ 'href' => self::permalinkUrlWithQuery( $thread, 'action=watch' ),
 586+ 'enabled' => true );
592587 } else if ( !$this->user->isAnon() ) {
593 - $commands['unwatch'] = array(
594 - 'label' => wfMsg( 'unwatch' ),
595 - 'href' => self::permalinkUrlWithQuery( $thread, 'action=unwatch' ),
596 - 'enabled' => true
597 - );
 588+ $commands['unwatch'] = array( 'label' => wfMsg( 'unwatch' ),
 589+ 'href' => self::permalinkUrlWithQuery( $thread, 'action=unwatch' ),
 590+ 'enabled' => true );
598591 }
599 -
 592+
600593 $summarizeUrl = self::permalinkUrl( $thread, 'summarize', $thread->id() );
601594 $commands['summarize'] = array(
602 - 'label' => wfMsgExt( 'lqt_summarize_link', 'parseinline' ),
603 - 'href' => $summarizeUrl,
604 - 'enabled' => true,
605 - );
 595+ 'label' => wfMsgExt( 'lqt_summarize_link', 'parseinline' ),
 596+ 'href' => $summarizeUrl,
 597+ 'enabled' => true,
 598+ );
606599
607600 return $commands;
608601 }
@@ -613,38 +606,38 @@
614607 static function addJSandCSS() {
615608 // Changed this to be static so that we can call it from
616609 // wfLqtBeforeWatchlistHook.
617 -
 610+
618611 if ( self::$stylesAndScriptsDone ) {
619612 return;
620613 }
621 -
 614+
622615 global $wgOut;
623616 global $wgScriptPath, $wgStyleVersion;
624617 global $wgEnableJS2system;
625618
626619 $wgOut->addInlineScript( 'var wgLqtMessages = ' . self::exportJSLocalisation() . ';' );
627 -
628 - if ( !$wgEnableJS2system ) {
 620+
 621+ if (!$wgEnableJS2system) {
629622 $wgOut->addScriptFile( "{$wgScriptPath}/extensions/LiquidThreads/js2.combined.js" );
630623 }
631 -
 624+
632625 $wgOut->addScriptFile( "{$wgScriptPath}/extensions/LiquidThreads/lqt.js" );
633626 $wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/LiquidThreads/lqt.css?{$wgStyleVersion}" );
634 -
 627+
635628 self::$stylesAndScriptsDone = true;
636629 }
637 -
 630+
638631 static function exportJSLocalisation() {
639632 wfLoadExtensionMessages( 'LiquidThreads' );
640 -
 633+
641634 $messages = array( 'lqt-quote-intro', 'lqt-quote', 'lqt-ajax-updated',
642635 'lqt-ajax-update-link' );
643636 $data = array();
644 -
645 - foreach ( $messages as $msg ) {
 637+
 638+ foreach( $messages as $msg ) {
646639 $data[$msg] = wfMsgNoTrans( $msg );
647640 }
648 -
 641+
649642 return json_encode( $data );
650643 }
651644
@@ -654,83 +647,65 @@
655648 * $post->getParserOutput. */
656649 function showPostBody( $post, $oldid = null ) {
657650 global $wgOut;
658 -
 651+
659652 // Load compatibility layer for older versions
660 - if ( !( $post instanceof Article_LQT_Compat ) ) {
 653+ if ( !($post instanceof Article_LQT_Compat) ) {
661654 wfWarn( "No article compatibility layer loaded, inefficiently duplicating information." );
662655 $post = new Article_LQT_Compat( $post->getTitle() );
663656 }
664 -
 657+
665658 $parserOutput = $post->getParserOutput( $oldid );
666659 $wgOut->addParserOutputNoText( $parserOutput );
667 -
 660+
668661 return $parserOutput->getText();
669662 }
670 -
 663+
671664 function showThreadToolbar( $thread ) {
672665 global $wgLang;
673 -
 666+
674667 $sk = $this->user->getSkin();
675668 $html = '';
676669
677670 $headerParts = array();
678 -
679 - foreach ( $this->threadMajorCommands( $thread ) as $key => $cmd ) {
 671+
 672+ foreach( $this->threadMajorCommands( $thread ) as $key => $cmd ) {
680673 $content = $this->contentForCommand( $cmd, false /* No icon divs */ );
681 - $headerParts[] = Xml::tags(
682 - 'li',
683 - array( 'class' => "lqt-command lqt-command-$key" ),
684 - $content
685 - );
 674+ $headerParts[] = Xml::tags( 'li',
 675+ array( 'class' => "lqt-command lqt-command-$key" ),
 676+ $content );
686677 }
687 -
 678+
688679 // Drop-down menu
689680 $commands = $this->threadCommands( $thread );
690 - $menuHTML = Xml::tags(
691 - 'ul',
692 - array( 'class' => 'lqt-thread-toolbar-command-list' ),
693 - $this->listItemsForCommands( $commands )
694 - );
695 -
696 - $triggerText = Xml::tags(
697 - 'span',
698 - array( 'class' => 'lqt-thread-actions-icon' ),
699 - '&nbsp;'
700 - );
701 - $dropDownTrigger = Xml::tags(
702 - 'div',
703 - array(
704 - 'class' => 'lqt-thread-actions-trigger ' .
705 - 'lqt-command-icon', 'style' => 'display: none;'
706 - ),
707 - $triggerText
708 - );
709 - $headerParts[] = Xml::tags(
710 - 'li',
711 - array( 'class' => 'lqt-thread-toolbar-menu' ),
712 - $dropDownTrigger
713 - );
714 -
 681+ $menuHTML = Xml::tags( 'ul', array( 'class' => 'lqt-thread-toolbar-command-list'),
 682+ $this->listItemsForCommands( $commands ) );
 683+
 684+ $triggerText = Xml::tags( 'span', array('class' => 'lqt-thread-actions-icon'),
 685+ '&nbsp;');
 686+ $dropDownTrigger = Xml::tags( 'div',
 687+ array( 'class' => 'lqt-thread-actions-trigger '.
 688+ 'lqt-command-icon', 'style' => 'display: none;'),
 689+ $triggerText );
 690+ $headerParts[] = Xml::tags( 'li',
 691+ array( 'class' => 'lqt-thread-toolbar-menu' ),
 692+ $dropDownTrigger );
 693+
715694 $html .= implode( ' ', $headerParts );
716 -
 695+
717696 $html = Xml::tags( 'ul', array( 'class' => 'lqt-thread-toolbar-commands' ), $html );
718697 $html .= Xml::tags( 'div', array( 'style' => 'clear: both; height: 0;' ), '&nbsp;' );
719 -
 698+
720699 // Box stuff
721 - $boxElements = array(
722 - 'lqt-thread-toolbar-box-tl',
723 - 'lqt-thread-toolbar-box-tr',
724 - 'lqt-thread-toolbar-box-br',
725 - 'lqt-thread-toolbar-box-bl'
726 - );
727 - foreach ( $boxElements as $class ) {
 700+ $boxElements = array( 'lqt-thread-toolbar-box-tl', 'lqt-thread-toolbar-box-tr',
 701+ 'lqt-thread-toolbar-box-br', 'lqt-thread-toolbar-box-bl' );
 702+ foreach( $boxElements as $class ) {
728703 $html = Xml::openElement( 'div', array( 'class' => $class ) ) . $html .
729704 Xml::closeElement( 'div' );
730705 }
731 -
 706+
732707 $html = Xml::tags( 'div', array( 'class' => 'lqt-thread-toolbar' ), $html ) .
733708 $menuHTML;
734 -
 709+
735710 return $html;
736711 }
737712
@@ -738,72 +713,55 @@
739714 $result = array();
740715 foreach ( $commands as $key => $command ) {
741716 $thisCommand = $this->contentForCommand( $command );
742 -
743 - $thisCommand = Xml::tags(
744 - 'li',
745 - array( 'class' => 'lqt-command lqt-command-' . $key ),
746 - $thisCommand
747 - );
748 -
 717+
 718+ $thisCommand = Xml::tags( 'li',
 719+ array( 'class' => 'lqt-command lqt-command-'.$key ),
 720+ $thisCommand );
 721+
749722 $result[] = $thisCommand;
750723 }
751724 return join( ' ', $result );
752725 }
753 -
 726+
754727 function contentForCommand( $command, $icon_divs = true ) {
755728 $label = $command['label'];
756729 $href = $command['href'];
757730 $enabled = $command['enabled'];
758 - $tooltip = isset( $command['tooltip'] ) ? $command['tooltip'] : '';
759 -
 731+ $tooltip = isset($command['tooltip']) ? $command['tooltip'] : '';
 732+
760733 if ( isset( $command['icon'] ) ) {
761734 global $wgScriptPath;
762 - $icon = Xml::tags(
763 - 'div',
764 - array(
765 - 'title' => $label,
766 - 'class' => 'lqt-command-icon'
767 - ),
768 - '&nbsp;'
769 - );
770 - if ( $icon_divs ) {
771 - if ( !empty( $command['showlabel'] ) ) {
772 - $label = $icon . '&nbsp;' . $label;
 735+ $icon = Xml::tags( 'div', array( 'title' => $label,
 736+ 'class' => 'lqt-command-icon' ), '&nbsp;' );
 737+ if ($icon_divs) {
 738+ if ( !empty($command['showlabel']) ) {
 739+ $label = $icon.'&nbsp;'.$label;
773740 } else {
774741 $label = $icon;
775742 }
776743 } else {
777 - if ( empty( $command['showlabel'] ) ) {
 744+ if ( empty($command['showlabel']) ) {
778745 $label = '';
779746 }
780747 }
781748 }
782 -
 749+
783750 $thisCommand = '';
784 -
 751+
785752 if ( $enabled ) {
786 - $thisCommand = Xml::tags(
787 - 'a',
788 - array( 'href' => $href, 'title' => $tooltip ),
789 - $label
790 - );
 753+ $thisCommand = Xml::tags( 'a', array( 'href' => $href, 'title' => $tooltip ),
 754+ $label );
791755 } else {
792 - $thisCommand = Xml::tags(
793 - 'span',
794 - array(
795 - 'class' => 'lqt_command_disabled',
796 - 'title' => $tooltip
797 - ),
798 - $label
799 - );
 756+ $thisCommand = Xml::tags( 'span', array( 'class' => 'lqt_command_disabled',
 757+ 'title' => $tooltip), $label );
800758 }
801 -
 759+
802760 return $thisCommand;
803761 }
804762
805763 /** Shows a normal (i.e. not deleted or moved) thread body */
806764 function showThreadBody( $thread ) {
807 -
 765+
808766 // Remove 'editsection', it won't work.
809767 $popts = $this->output->parserOptions();
810768 $previous_editsection = $popts->getEditSection();
@@ -811,7 +769,7 @@
812770 $this->output->parserOptions( $popts );
813771
814772 $post = $thread->root();
815 -
 773+
816774 $divClass = $this->postDivClass( $thread );
817775 $html = '';
818776
@@ -831,7 +789,7 @@
832790 $html = Xml::openElement( 'div', array( 'class' => $divClass ) );
833791 $this->output->addHTML( $html );
834792 $html = '';
835 -
 793+
836794 // No way am I refactoring EditForm to send its output as HTML.
837795 // so I'm just flushing the HTML and displaying it as-is.
838796 $this->showPostEditingForm( $thread );
@@ -842,8 +800,8 @@
843801 $html .= $this->showPostBody( $post, $oldid );
844802 $html .= Xml::closeElement( 'div' );
845803 $html .= $this->threadSignature( $thread );
846 - }
847 -
 804+ }
 805+
848806 // If we're replying to this thread, show the reply form after it.
849807 if ( $this->methodAppliesToThread( 'reply', $thread ) ) {
850808 // As with above, flush HTML to avoid refactoring EditPage.
@@ -851,69 +809,60 @@
852810 $this->showReplyForm( $thread );
853811 $html = '';
854812 } else {
855 - $html .= Xml::tags(
856 - 'div',
857 - array(
858 - 'class' => 'lqt-reply-form lqt-edit-form',
859 - 'style' => 'display: none;'
860 - ),
861 - ''
862 - );
 813+ $html .= Xml::tags( 'div',
 814+ array( 'class' => 'lqt-reply-form lqt-edit-form',
 815+ 'style' => 'display: none;' ),
 816+ '' );
863817 }
864 -
 818+
865819 $this->output->addHTML( $html );
866820
867821 $popts->setEditSection( $previous_editsection );
868822 $this->output->parserOptions( $popts );
869823 }
870 -
 824+
871825 function threadSignature( $thread ) {
872826 global $wgUser;
873827 $sk = $wgUser->getSkin();
874 -
 828+
875829 $author = $thread->author();
876830 $signature = $sk->userLink( $author->getId(), $author->getName() );
877 - $signature = '&mdash; ' . Xml::tags( 'span', array( 'class' => 'lqt-thread-author' ),
 831+ $signature = '&mdash; '. Xml::tags( 'span', array( 'class' => 'lqt-thread-author' ),
878832 $signature );
879833 $signature .= $sk->userToolLinks( $author->getId(), $author->getName() );
880 -
 834+
881835 $signature = Xml::tags( 'div', array( 'class' => 'lqt-thread-signature' ),
882836 $signature );
883 -
 837+
884838 return $signature;
885839 }
886 -
 840+
887841 function threadInfoPanel( $thread ) {
888842 global $wgUser, $wgLang;
889 -
 843+
890844 $sk = $wgUser->getSkin();
891 -
 845+
892846 $infoElements = array();
893 -
 847+
894848 $timestamp = $wgLang->timeanddate( $thread->created(), true );
895849 $infoElements[] = Xml::element( 'div', array( 'class' => 'lqt-thread-toolbar-timestamp' ),
896850 $timestamp );
897 -
 851+
898852 // Check for edited flag.
899 - $editedFlag = $thread->editedness();
 853+ $editedFlag = $thread->editedness();
900854 $ebLookup = array( Threads::EDITED_BY_AUTHOR => 'author',
901855 Threads::EDITED_BY_OTHERS => 'others' );
902856 if ( isset( $ebLookup[$editedFlag] ) ) {
903857
904858 $editedBy = $ebLookup[$editedFlag];
905 - $editedNotice = wfMsgExt( 'lqt-thread-edited-' . $editedBy, 'parseinline' );
906 - $infoElements[] = Xml::element(
907 - 'div',
908 - array( 'class' => 'lqt-thread-toolbar-edited-' . $editedBy ),
909 - $editedNotice
910 - );
 859+ $editedNotice = wfMsgExt( 'lqt-thread-edited-'.$editedBy, 'parseinline' );
 860+ $infoElements[] = Xml::element( 'div', array( 'class' =>
 861+ 'lqt-thread-toolbar-edited-'.$editedBy ),
 862+ $editedNotice );
911863 }
912 -
913 - return Xml::tags(
914 - 'div',
915 - array( 'class' => 'lqt-thread-info-panel' ),
916 - implode( "\n", $infoElements )
917 - );
 864+
 865+ return Xml::tags( 'div', array( 'class' => 'lqt-thread-info-panel' ),
 866+ implode( "\n", $infoElements ) );
918867 }
919868
920869 /** Shows the headING for a thread (as opposed to the headeER for a post within
@@ -924,57 +873,53 @@
925874 $commands_html = "";
926875 } else {
927876 $lis = $this->listItemsForCommands( $this->topLevelThreadCommands( $thread ) );
928 - $commands_html = Xml::tags(
929 - 'ul',
930 - array( 'class' => 'lqt_threadlevel_commands' ),
931 - $lis
932 - );
 877+ $commands_html = Xml::tags( 'ul',
 878+ array( 'class' => 'lqt_threadlevel_commands' ),
 879+ $lis );
933880 }
 881+
 882+ $id = 'lqt-header-'.$thread->id();
934883
935 - $id = 'lqt-header-' . $thread->id();
936 -
937884 $html = $this->output->parseInline( $thread->subjectWithoutIncrement() );
938885 $html = Xml::tags( 'span', array( 'class' => 'mw-headline' ), $html );
939 - $html = Xml::tags(
940 - 'h' . $this->headerLevel,
941 - array( 'class' => 'lqt_header', 'id' => $id ),
942 - $html
943 - ) . $commands_html;
944 -
 886+ $html = Xml::tags( 'h'.$this->headerLevel,
 887+ array( 'class' => 'lqt_header', 'id' => $id),
 888+ $html ) . $commands_html;
 889+
945890 return $html;
946891 }
947 -
 892+
948893 return '';
949894 }
950895
951896 function postDivClass( $thread ) {
952 - $levelClass = 'lqt-thread-nest-' . $this->threadNestingLevel;
953 - $alternatingType = ( $this->threadNestingLevel % 2 ) ? 'odd' : 'even';
 897+ $levelClass = 'lqt-thread-nest-'.$this->threadNestingLevel;
 898+ $alternatingType = ($this->threadNestingLevel % 2) ? 'odd' : 'even';
954899 $alternatingClass = "lqt-thread-$alternatingType";
955 -
 900+
956901 return "lqt_post $levelClass $alternatingClass";
957902 }
958903
959904 static function anchorName( $thread ) {
960905 return $thread->getAnchorName();
961906 }
962 -
 907+
963908 // Display a moved thread
964909 function showMovedThread( $thread ) {
965910 global $wgLang;
966 -
 911+
967912 $sk = $this->user->getSkin();
968 -
 913+
969914 // Grab target thread
970915 $article = new Article( $thread->title() );
971916 $target = Title::newFromRedirect( $article->getContent() );
972917 $t_thread = Threads::withRoot( new Article( $target ) );
973 -
 918+
974919 // Grab data about the new post.
975920 $author = $thread->author();
976921 $sig = $sk->userLink( $author->getID(), $author->getName() ) .
977922 $sk->userToolLinks( $author->getID(), $author->getName() );
978 -
 923+
979924 $html =
980925 wfMsgExt( 'lqt_move_placeholder', array( 'parseinline', 'replaceafter' ),
981926 $sk->link( $target ),
@@ -982,10 +927,10 @@
983928 $wgLang->date( $thread->modified() ),
984929 $wgLang->time( $thread->modified() )
985930 );
986 -
 931+
987932 $this->output->addHTML( $html );
988933 }
989 -
 934+
990935 /** Shows a deleted thread. Returns true to show the thread body */
991936 function showDeletedThread( $thread ) {
992937 $sk = $this->user->getSkin();
@@ -1001,233 +946,216 @@
1002947 return false;
1003948 }
1004949 }
1005 -
 950+
1006951 // Shows a single thread, rather than a thread tree.
1007952 function showSingleThread( $thread ) {
1008953 wfLoadExtensionMessages( 'LiquidThreads' );
1009 -
 954+
1010955 $html = '';
1011 -
 956+
1012957 // If it's a 'moved' thread, show the placeholder
1013958 if ( $thread->type() == Threads::TYPE_MOVED ) {
1014959 $this->showMovedThread( $thread );
1015960 return;
1016961 } elseif ( $thread->type() == Threads::TYPE_DELETED ) {
1017962 $res = $this->showDeletedThread( $thread );
1018 -
1019 - if ( !$res ) return;
 963+
 964+ if (!$res) return;
1020965 }
1021 -
 966+
1022967 $this->output->addHTML( $this->threadInfoPanel( $thread ) );
1023 -
 968+
1024969 if ( $thread->summary() ) {
1025970 $html .= $this->getSummary( $thread );
1026971 }
1027 -
 972+
1028973 // Unfortunately, I can't rewrite showRootPost() to pass back HTML
1029974 // as it would involve rewriting EditPage, which I do NOT intend to do.
1030975
1031976 $this->output->addHTML( $html );
1032 -
 977+
1033978 $this->showThreadBody( $thread );
1034 -
 979+
1035980 }
1036981
1037982 function showThread( $thread, $levelNum = 1, $totalInLevel = 1, $options = array() ) {
1038983 global $wgLang;
1039 -
 984+
1040985 // Safeguard
1041986 if ( $thread->type() == Threads::TYPE_DELETED
1042 - && ! ( $this->request->getBool( 'lqt_show_deleted_threads' )
 987+ && ! ($this->request->getBool( 'lqt_show_deleted_threads' )
1043988 && $this->user->isAllowed( 'deletedhistory' ) ) ) {
1044989 return;
1045990 }
1046 -
 991+
1047992 $this->threadNestingLevel++;
1048 -
 993+
1049994 // Figure out which threads *need* to be shown because they're involved in an
1050995 // operation
1051996 static $mustShowThreads = null; // Array of thread IDs
1052 - if ( is_null( $mustShowThreads ) ) {
 997+ if ( is_null($mustShowThreads) ) {
1053998 $mustShowThreads = array();
1054999 if ( $this->request->getVal( 'lqt_operand' ) ) {
10551000 $walk_thread = Threads::withId( $this->request->getVal( 'lqt_operand' ) );
1056 -
 1001+
10571002 do {
10581003 $mustShowThreads[$walk_thread->id()] = $walk_thread;
10591004 $walk_thread = $walk_thread->superthread();
10601005 } while ( $walk_thread );
10611006 }
10621007 }
1063 -
 1008+
10641009 $sk = $this->user->getSkin();
1065 -
 1010+
10661011 $html = '';
10671012
1068 - $html .= Xml::element( 'a', array( 'name' => $this->anchorName( $thread ) ), ' ' );
 1013+ $html .= Xml::element( 'a', array( 'name' => $this->anchorName($thread) ), ' ' );
10691014
10701015 $html .= $this->showThreadHeading( $thread );
1071 -
 1016+
10721017 $class = $this->threadDivClass( $thread );
1073 - if ( $levelNum == 1 ) {
 1018+ if ($levelNum == 1) {
10741019 $class .= ' lqt-thread-first';
1075 - } elseif ( $levelNum == $totalInLevel ) {
 1020+ } elseif ($levelNum == $totalInLevel) {
10761021 $class .= ' lqt-thread-last';
10771022 }
 1023+
 1024+ $html .= Xml::openElement( 'div', array( 'class' => $class,
 1025+ 'id' => 'lqt_thread_id_'. $thread->id() ) );
10781026
1079 - $html .= Xml::openElement(
1080 - 'div',
1081 - array(
1082 - 'class' => $class,
1083 - 'id' => 'lqt_thread_id_' . $thread->id()
1084 - )
1085 - );
1086 -
10871027 // Modified time for topmost threads...
10881028 if ( $thread->isTopmostThread() ) {
1089 - $html .= Xml::hidden('lqt-thre
1090 - ad-modified-' . $thread->id(),
1091 - wfTimestamp( TS_MW, $thread->modified() ),
1092 - array(
1093 - 'id' => 'lqt-thread-modified-' . $thread->id(),
1094 - 'class' => 'lqt-thread-modified'
1095 - )
1096 - );
1097 - }
 1029+ $html .= Xml::hidden( 'lqt-thread-modified-'.$thread->id(),
 1030+ wfTimestamp( TS_MW, $thread->modified() ),
 1031+ array( 'id' => 'lqt-thread-modified-'.$thread->id(),
 1032+ 'class' => 'lqt-thread-modified' ) );
 1033+ }
10981034
10991035 // Flush output to display thread
11001036 $this->output->addHTML( $html );
1101 - $this->output->addHTML( Xml::openElement(
1102 - 'div',
1103 - array( 'class' => 'lqt-post-wrapper' )
1104 - ) );
 1037+ $this->output->addHTML( Xml::openElement( 'div',
 1038+ array( 'class' => 'lqt-post-wrapper' ) ) );
11051039 $this->showSingleThread( $thread );
11061040 $this->output->addHTML( Xml::closeElement( 'div' ) );
11071041
11081042 // Check depth and count
1109 - if ( isset( $options['maxDepth'] ) ) {
 1043+ if ( isset($options['maxDepth']) ) {
11101044 $maxDepth = $options['maxDepth'];
11111045 } else {
11121046 $maxDepth = $this->user->getOption( 'lqtdisplaydepth' );
11131047 }
1114 -
1115 - if ( isset( $options['maxCount'] ) ) {
 1048+
 1049+ if ( isset($options['maxCount']) ) {
11161050 $maxCount = $options['maxCount'];
11171051 } else {
11181052 $maxCount = $this->user->getOption( 'lqtdisplaycount' );
11191053 }
1120 -
 1054+
11211055 if ( isset( $options['startAt'] ) ) {
11221056 $startAt = $options['startAt'];
11231057 } else {
11241058 $startAt = 0;
11251059 }
1126 -
 1060+
11271061 $cascadeOptions = $options;
1128 - unset( $cascadeOptions['startAt'] );
1129 -
1130 - $showThreads = ( $maxDepth == - 1 ) || ( $this->threadNestingLevel <= $maxDepth );
1131 -
 1062+ unset($cascadeOptions['startAt']);
 1063+
 1064+ $showThreads = ($maxDepth == -1) || ( $this->threadNestingLevel <= $maxDepth );
 1065+
11321066 // Show subthreads if one of the subthreads is on the must-show list
11331067 $showThreads = $showThreads ||
1134 - count( array_intersect( array_keys( $mustShowThreads ), array_keys( $thread->replies() ) ) );
 1068+ count( array_intersect( array_keys($mustShowThreads), array_keys( $thread->replies() ) ) );
11351069 if ( $thread->hasSubthreads() && $showThreads ) {
1136 - $repliesClass = 'lqt-thread-replies lqt-thread-replies-' . $this->threadNestingLevel;
 1070+ $repliesClass = 'lqt-thread-replies lqt-thread-replies-'.$this->threadNestingLevel;
11371071 $div = Xml::openElement( 'div', array( 'class' => $repliesClass ) );
11381072 $this->output->addHTML( $div );
1139 -
 1073+
11401074 $subthreadCount = count( $thread->subthreads() );
11411075 $i = 0;
11421076 $showCount = 0;
11431077 $showThreads = true;
1144 -
 1078+
11451079 foreach ( $thread->subthreads() as $st ) {
11461080 ++$i;
1147 -
 1081+
11481082 // Only show undeleted threads that are above our 'startAt' index.
11491083 $shown = false;
1150 - if ( $st->type() != Threads::TYPE_DELETED && $i >= $startAt && $showThreads ) {
1151 - if ( $showCount > $maxCount && $maxCount > 0 ) {
 1084+ if ($st->type() != Threads::TYPE_DELETED && $i >= $startAt && $showThreads) {
 1085+ if ($showCount > $maxCount && $maxCount > 0) {
11521086 // We've shown too many threads.
11531087 $linkText = wfMsgExt( 'lqt-thread-show-more', 'parseinline' );
11541088 $linkTitle = clone $thread->topmostThread()->title();
1155 - $linkTitle->setFragment( '#' . $st->getAnchorName() );
1156 -
1157 - $link = $sk->link(
1158 - $linkTitle,
1159 - $linkText,
1160 - array( 'class' => 'lqt-show-more-posts' )
1161 - );
1162 - $link .= Xml::hidden(
1163 - 'lqt-thread-start-at',
1164 - $i,
1165 - array( 'class' => 'lqt-thread-start-at' )
1166 - );
1167 -
 1089+ $linkTitle->setFragment( '#'.$st->getAnchorName() );
 1090+
 1091+ $link = $sk->link( $linkTitle, $linkText,
 1092+ array( 'class' => 'lqt-show-more-posts' ) );
 1093+ $link .= Xml::hidden( 'lqt-thread-start-at', $i,
 1094+ array( 'class' => 'lqt-thread-start-at' ) );
 1095+
11681096 $this->output->addHTML( $link );
11691097 $showThreads = false;
11701098 continue;
11711099 }
1172 -
 1100+
11731101 ++$showCount;
1174 - if ( $showCount == 1 ) {
 1102+ if ($showCount == 1 ) {
11751103 $this->output->addHTML(
11761104 Xml::tags( 'div', array( 'class' => 'lqt-post-sep' ), '&nbsp;' ) );
11771105 }
1178 -
 1106+
11791107 $this->showThread( $st, $i, $subthreadCount, $cascadeOptions );
11801108 $shown = true;
11811109 }
1182 -
1183 - if ( $st->type() != Threads::TYPE_DELETED && !$shown &&
 1110+
 1111+ if ($st->type() != Threads::TYPE_DELETED && !$shown &&
11841112 array_key_exists( $st->id(), $mustShowThreads ) ) {
1185 -
 1113+
11861114 $this->showThread( $st, $i, $subthreadCount, $cascadeOptions );
11871115 }
11881116 }
1189 -
 1117+
11901118 $finishDiv = Xml::tags( 'div', array( 'class' => 'lqt-replies-finish' ),
11911119 Xml::tags( 'div', array( 'class' => 'lqt-replies-finish-corner' ), '&nbsp;' ) );
1192 -
 1120+
11931121 $this->output->addHTML( $finishDiv . Xml::CloseElement( 'div' ) );
11941122 } elseif ( $thread->hasSubthreads() && !$showThreads ) {
11951123 // Add a "show subthreads" link.
1196 - $replies = count( $thread->replies() );
1197 - $linkText = wfMsgExt( 'lqt-thread-show-replies', 'parseinline', $wgLang->formatNum( $replies ) );
 1124+ $replies = count($thread->replies());
 1125+ $linkText = wfMsgExt( 'lqt-thread-show-replies', 'parseinline', $wgLang->formatNum($replies) );
11981126 $linkTitle = clone $thread->topmostThread()->title();
1199 - $linkTitle->setFragment( '#' . $thread->getAnchorName() );
1200 -
 1127+ $linkTitle->setFragment( '#'.$thread->getAnchorName() );
 1128+
12011129 $link = $sk->link( $linkTitle, $linkText, array( 'class' => 'lqt-show-replies' ) );
1202 -
 1130+
12031131 $this->output->addHTML( Xml::tags( 'div', array( 'class' => 'lqt-thread-replies' ), $link ) );
1204 -
1205 - if ( $levelNum < $totalInLevel ) {
 1132+
 1133+ if ($levelNum < $totalInLevel) {
12061134 $this->output->addHTML(
12071135 Xml::tags( 'div', array( 'class' => 'lqt-post-sep' ), '&nbsp;' ) );
12081136 }
1209 - } elseif ( $levelNum < $totalInLevel ) {
 1137+ } elseif ($levelNum < $totalInLevel) {
12101138 $this->output->addHTML(
12111139 Xml::tags( 'div', array( 'class' => 'lqt-post-sep' ), '&nbsp;' ) );
12121140 }
12131141
1214 - if ( $this->threadNestingLevel == 1 ) {
 1142+ if ($this->threadNestingLevel == 1) {
12151143 $finishDiv = Xml::tags( 'div', array( 'class' => 'lqt-replies-finish' ),
12161144 Xml::tags( 'div', array( 'class' => 'lqt-replies-finish-corner' ), '&nbsp;' ) );
1217 -
 1145+
12181146 $this->output->addHTML( $finishDiv );
12191147 }
12201148
12211149 $this->output->addHTML( Xml::closeElement( 'div' ) );
1222 -
 1150+
12231151 $this->threadNestingLevel--;
12241152 }
1225 -
 1153+
12261154 function threadDivClass( $thread ) {
1227 - $levelClass = 'lqt-thread-nest-' . $this->threadNestingLevel;
1228 - $alternatingType = ( $this->threadNestingLevel % 2 ) ? 'odd' : 'even';
 1155+ $levelClass = 'lqt-thread-nest-'.$this->threadNestingLevel;
 1156+ $alternatingType = ($this->threadNestingLevel % 2) ? 'odd' : 'even';
12291157 $alternatingClass = "lqt-thread-$alternatingType";
12301158 $topmostClass = $thread->isTopmostThread() ? ' lqt-thread-topmost' : '';
1231 -
 1159+
12321160 return "lqt_thread $levelClass $alternatingClass$topmostClass";
12331161 }
12341162
@@ -1237,42 +1165,32 @@
12381166 wfLoadExtensionMessages( 'LiquidThreads' );
12391167 global $wgUser;
12401168 $sk = $wgUser->getSkin();
1241 -
 1169+
12421170 $label = wfMsgExt( 'lqt_summary_label', 'parseinline' );
12431171 $edit_text = wfMsgExt( 'edit', 'parseinline' );
12441172 $link_text = wfMsg( 'lqt_permalink', 'parseinline' );
1245 -
 1173+
12461174 $html = '';
1247 -
 1175+
12481176 $html .= Xml::tags( 'span',
12491177 array( 'class' => 'lqt_thread_permalink_summary_title' ),
12501178 $label );
1251 -
 1179+
12521180 $link = $sk->link( $t->summary()->getTitle(), $link_text );
12531181 $edit_link = self::permalink( $t, $edit_text, 'summarize', $t->id() );
12541182 $links = "[$link]\n[$edit_link]";
1255 - $html .= Xml::tags(
1256 - 'span',
1257 - array( 'class' => 'lqt_thread_permalink_summary_edit' ),
1258 - $links
1259 - );
1260 -
 1183+ $html .= Xml::tags( 'span', array( 'class' => 'lqt_thread_permalink_summary_edit' ),
 1184+ $links );
 1185+
12611186 $summary_body = $this->showPostBody( $t->summary() );
1262 - $html .= Xml::tags(
1263 - 'div',
1264 - array( 'class' => 'lqt_thread_permalink_summary_body' ),
1265 - $summary_body
1266 - );
1267 -
1268 - $html = Xml::tags(
1269 - 'div',
1270 - array( 'class' => 'lqt_thread_permalink_summary' ),
1271 - $html
1272 - );
1273 -
 1187+ $html .= Xml::tags( 'div', array( 'class' => 'lqt_thread_permalink_summary_body' ),
 1188+ $summary_body );
 1189+
 1190+ $html = Xml::tags( 'div', array( 'class' => 'lqt_thread_permalink_summary' ), $html );
 1191+
12741192 return $html;
12751193 }
1276 -
 1194+
12771195 function showSummary( $t ) {
12781196 $this->output->addHTML( $this->getSummary( $t ) );
12791197 }
Index: trunk/extensions/LiquidThreads/classes/Dispatch.php
@@ -13,42 +13,41 @@
1414 'ThreadProtectionFormView' => 'ThreadProtectionFormView',
1515 'ThreadWatchView' => 'ThreadWatchView',
1616 'SummaryPageView' => 'SummaryPageView'
17 - );
18 -
 17+ );
 18+
1919 /** static cache of per-page LiquidThreads activation setting */
2020 static $userLQTActivated;
2121
2222 static function talkpageMain( &$output, &$article, &$title, &$user, &$request ) {
2323 // We are given a talkpage article and title. Fire up a TalkpageView
24 -
 24+
2525 if ( $title->getNamespace() == NS_LQT_THREAD + 1 /* talk page */ ) {
2626 // Threads don't have talk pages; redirect to the thread page.
2727 $output->redirect( $title->getSubjectPage()->getFullUrl() );
2828 return false;
2929 }
30 -
 30+
3131 // If we came here from a red-link, redirect to the thread page.
3232 $redlink = $request->getCheck( 'redlink' ) &&
3333 $request->getText( 'action' ) == 'edit';
34 - if ( $redlink ) {
 34+ if( $redlink ) {
3535 $output->redirect( $title->getFullURL() );
3636 return false;
3737 }
3838
3939 /* Certain actions apply to the "header", which is stored in the actual talkpage
40 - * in the database. Drop everything and behave like a normal page if those
41 - * actions come up, to avoid hacking the various history, editing, etc. code.
42 - */
 40+ in the database. Drop everything and behave like a normal page if those
 41+ actions come up, to avoid hacking the various history, editing, etc. code. */
4342 $action = $request->getVal( 'action' );
4443 $header_actions = array( 'history', 'edit', 'submit', 'delete' );
4544 global $wgRequest;
46 - if ( $action == 'edit' && $request->getVal( 'section' ) == 'new' ) {
 45+ if ($action == 'edit' && $request->getVal('section') == 'new') {
4746 // Hijack section=new for "new thread".
4847 $request->setVal( 'lqt_method', 'talkpage_new_thread' );
4948 $request->setVal( 'section', '' );
50 -
 49+
5150 $viewname = self::$views['TalkpageView'];
52 -
 51+
5352 } elseif ( $request->getVal( 'lqt_method', null ) === null &&
5453 ( in_array( $action, $header_actions ) ||
5554 $request->getVal( 'diff', null ) !== null ) ) {
@@ -65,6 +64,7 @@
6665 }
6766
6867 static function threadPermalinkMain( &$output, &$article, &$title, &$user, &$request ) {
 68+
6969 $action = $request->getVal( 'action' );
7070 $lqt_method = $request->getVal( 'lqt_method' );
7171
@@ -88,7 +88,7 @@
8989 } else {
9090 $viewname = self::$views['ThreadPermalinkView'];
9191 }
92 -
 92+
9393 $view = new $viewname( $output, $article, $title, $user, $request );
9494 return $view->show();
9595 }
@@ -98,28 +98,29 @@
9999 $view = new $viewname( $output, $article, $title, $user, $request );
100100 return $view->show();
101101 }
102 -
 102+
103103 static function isLqtPage( $title ) {
104104 global $wgLqtPages, $wgLqtTalkPages;
105 - $isTalkPage = ( $title->isTalkPage() && $wgLqtTalkPages ) ||
 105+ $isTalkPage = ($title->isTalkPage() && $wgLqtTalkPages) ||
106106 in_array( $title->getPrefixedText(), $wgLqtPages ) ||
107107 self::hasUserEnabledLQT( $title->getArticleId() );
108 -
 108+
109109 return $isTalkPage;
110110 }
111 -
 111+
112112 static function hasUserEnabledLQT( $article ) {
113 - if ( is_object( $article ) ) {
 113+
 114+ if (is_object($article)) {
114115 $article = $article->getId();
115116 }
116 -
 117+
117118 // Instance cache
118119 if ( isset( self::$userLQTActivated[$article] ) ) {
119120 $cacheVal = self::$userLQTActivated[$article];
120121
121122 return $cacheVal;
122123 }
123 -
 124+
124125 // Memcached: It isn't clear that this is needed yet, but since I already wrote the
125126 // code, I might as well leave it commented out instead of deleting it.
126127 // Main reason I've left this commented out is because it isn't obvious how to
@@ -134,21 +135,15 @@
135136 // return $wgLqtThreadArchiveStartDays;
136137 // }
137138 // }
138 -
 139+
139140 // Load from the database.
140141 $dbr = wfGetDB( DB_SLAVE );
141 -
142 - $dbVal = $dbr->selectField(
143 - 'page_props',
144 - 'pp_value',
145 - array(
146 - 'pp_propname' => 'use-liquid-threads',
147 - 'pp_page' => $article
148 - ),
149 - __METHOD__
150 - );
151 -
152 - if ( $dbVal ) {
 142+
 143+ $dbVal = $dbr->selectField( 'page_props', 'pp_value',
 144+ array( 'pp_propname' => 'use-liquid-threads',
 145+ 'pp_page' => $article ), __METHOD__ );
 146+
 147+ if ($dbVal) {
153148 self::$userLQTActivated[$article] = true;
154149 # $wgMemc->set( $key, $dbVal, 1800 );
155150 return true;
Index: trunk/extensions/LiquidThreads/classes/Hooks.php
@@ -5,12 +5,10 @@
66 // Shortcut for non-LQT pages.
77 if ( !LqtDispatch::isLqtPage( $ot ) )
88 return true;
9 -
 9+
1010 // Move the threads on that page to the new page.
11 - $threads = Threads::where( array(
12 - Threads::articleClause( new Article( $ot ) ),
13 - Threads::topLevelClause() )
14 - );
 11+ $threads = Threads::where( array( Threads::articleClause( new Article( $ot ) ),
 12+ Threads::topLevelClause() ) );
1513
1614 foreach ( $threads as $t ) {
1715 $t->moveToPage( $nt, false );
@@ -22,7 +20,7 @@
2321 static function customizeOldChangesList( &$changeslist, &$s, $rc ) {
2422 if ( $rc->getTitle()->getNamespace() != NS_LQT_THREAD )
2523 return true;
26 -
 24+
2725 $thread = Threads::withRoot( new Article( $rc->getTitle() ) );
2826 if ( !$thread ) return true;
2927
@@ -31,7 +29,7 @@
3230
3331 if ( $rc->mAttribs['rc_new'] ) {
3432 global $wgOut;
35 -
 33+
3634 $sig = "";
3735 $changeslist->insertUserRelatedLinks( $sig, $rc );
3836
@@ -45,7 +43,7 @@
4644 $link = $sk->link( $thread->title(), wfMsg( 'lqt_rc_ellipsis' ),
4745 array( 'class' => 'lqt_rc_ellipsis' ), array(), array( 'known' ) );
4846 }
49 -
 47+
5048 $quote = $wgOut->parseInline( $quote ) . $link;
5149
5250 if ( $thread->isTopmostThread() ) {
@@ -53,10 +51,10 @@
5452 } else {
5553 $message_name = 'lqt_rc_new_reply';
5654 }
57 -
 55+
5856 $tmp_title = $thread->article()->getTitle();
5957 $tmp_title->setFragment( '#' . LqtView::anchorName( $thread ) );
60 -
 58+
6159 // Make sure it points to the right page. The Pager seems to use the DB
6260 // representation of a timestamp for its offset field, odd.
6361 $dbr = wfGetDB( DB_SLAVE );
@@ -64,7 +62,7 @@
6563 $offset = $dbr->timestamp( $offset );
6664
6765 $thread_link = $changeslist->skin->link( $tmp_title,
68 - htmlspecialchars( $thread->subjectWithoutIncrement() ),
 66+ htmlspecialchars($thread->subjectWithoutIncrement()),
6967 array(), array( 'offset' => $offset ), array( 'known' ) );
7068
7169 $talkpage_link = $changeslist->skin->link(
@@ -74,19 +72,19 @@
7573
7674 $s = wfMsg( $message_name, $thread_link, $talkpage_link, $sig )
7775 . Xml::tags( 'blockquote', array( 'class' => 'lqt_rc_blockquote' ), $quote );
78 -
 76+
7977 $classes = array();
8078 $changeslist->insertTags( $s, $rc, $classes );
8179 $changeslist->insertExtra( $s, $rc, $classes );
8280 } else {
8381 // Add whether it was original author.
8482 if ( $thread->author()->getName() != $rc->mAttribs['rc_user_text'] ) {
85 - $appendix = Xml::tags(
86 - 'span',
87 - array( 'class' => 'lqt_rc_author_notice ' . 'lqt_rc_author_notice_others' ),
88 - wfMsgExt( 'lqt_rc_author_others', 'parseinline' )
89 - );
90 -
 83+ $appendix = Xml::tags( 'span',
 84+ array( 'class' => 'lqt_rc_author_notice ' .
 85+ 'lqt_rc_author_notice_others' ),
 86+ wfMsgExt( 'lqt_rc_author_others', 'parseinline' )
 87+ );
 88+
9189 $s .= ' ' . $appendix;
9290 }
9391 }
@@ -104,10 +102,8 @@
105103 && ! $watchlist_t->equals( $wgTitle )
106104 && ! $usertalk_t->equals( $wgTitle )
107105 ) {
108 - $s = wfMsgExt(
109 - 'lqt_youhavenewmessages', array( 'parseinline' ),
110 - $newmsg_t->getFullURL()
111 - );
 106+ $s = wfMsgExt( 'lqt_youhavenewmessages', array( 'parseinline' ),
 107+ $newmsg_t->getFullURL() );
112108 $tpl->set( "newtalk", $s );
113109 $wgOut->setSquidMaxage( 0 );
114110 } else {
@@ -116,64 +112,62 @@
117113
118114 return true;
119115 }
120 -
 116+
121117 static function beforeWatchlist( &$conds, &$tables, &$join_conds, &$fields ) {
122118 global $wgOut, $wgUser;
123 -
 119+
124120 $db = wfGetDB( DB_SLAVE );
125 -
 121+
126122 if ( !in_array( 'page', $tables ) ) {
127123 $tables[] = 'page';
128124 // Yes, this is the correct field to join to. Weird naming.
129125 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
130126 }
131 - $conds[] = "page_namespace != " . $db->addQuotes( NS_LQT_THREAD );
132 -
 127+ $conds[] = "page_namespace != " . $db->addQuotes(NS_LQT_THREAD);
 128+
133129 $talkpage_messages = NewMessages::newUserMessages( $wgUser );
134130 $tn = count( $talkpage_messages );
135 -
 131+
136132 $watch_messages = NewMessages::watchedThreadsForUser( $wgUser );
137133 $wn = count( $watch_messages );
138 -
 134+
139135 if ( $tn == 0 && $wn == 0 )
140136 return true;
141 -
 137+
142138 LqtView::addJSandCSS();
143139 wfLoadExtensionMessages( 'LiquidThreads' );
144140 $messages_title = SpecialPage::getTitleFor( 'NewMessages' );
145141 $new_messages = wfMsgExt( 'lqt-new-messages', 'parseinline' );
146 -
 142+
147143 $sk = $wgUser->getSkin();
148 - $link = $sk->link(
149 - $messages_title,
150 - $new_messages,
151 - array( 'class' => 'lqt_watchlist_messages_notice' )
152 - );
 144+ $link = $sk->link( $messages_title, $new_messages,
 145+ array( 'class' => 'lqt_watchlist_messages_notice' ) );
153146 $wgOut->addHTML( $link );
154 -
 147+
155148 return true;
156149 }
157 -
 150+
158151 static function getPreferences( $user, &$preferences ) {
159152 global $wgEnableEmail;
160153 wfLoadExtensionMessages( 'LiquidThreads' );
161 -
162 - if ( $wgEnableEmail ) {
163 - $preferences['lqtnotifytalk'] = array(
164 - 'type' => 'toggle',
165 - 'label-message' => 'lqt-preference-notify-talk',
166 - 'section' => 'personal/email'
167 - );
 154+
 155+ if ($wgEnableEmail) {
 156+ $preferences['lqtnotifytalk'] =
 157+ array(
 158+ 'type' => 'toggle',
 159+ 'label-message' => 'lqt-preference-notify-talk',
 160+ 'section' => 'personal/email'
 161+ );
168162 }
169 -
170 -
 163+
 164+
171165 $preferences['lqt-watch-threads'] =
172166 array(
173167 'type' => 'toggle',
174168 'label-message' => 'lqt-preference-watch-threads',
175169 'section' => 'watchlist/advancedwatchlist',
176170 );
177 -
 171+
178172 // Display depth and count
179173 $preferences['lqtdisplaydepth'] =
180174 array(
@@ -181,7 +175,7 @@
182176 'label-message' => 'lqt-preference-display-depth',
183177 'section' => 'lqt',
184178 );
185 -
 179+
186180 // Display depth and count
187181 $preferences['lqtdisplaycount'] =
188182 array(
@@ -189,40 +183,36 @@
190184 'label-message' => 'lqt-preference-display-count',
191185 'section' => 'lqt',
192186 );
193 -
 187+
194188 return true;
195189 }
196 -
 190+
197191 static function updateNewtalkOnEdit( $article ) {
198192 $title = $article->getTitle();
199 -
 193+
200194 if ( LqtDispatch::isLqtPage( $title ) ) {
201195 // They're only editing the header, don't update newtalk.
202196 return false;
203197 }
204 -
 198+
205199 return true;
206200 }
207 -
 201+
208202 static function dumpThreadData( $writer, &$out, $row, $title ) {
209 - $editedStati = array(
210 - Threads::EDITED_NEVER => 'never',
211 - Threads::EDITED_HAS_REPLY => 'has-reply',
212 - Threads::EDITED_BY_AUTHOR => 'by-author',
213 - Threads::EDITED_BY_OTHERS => 'by-others'
214 - );
215 - $threadTypes = array(
216 - Threads::TYPE_NORMAL => 'normal',
217 - Threads::TYPE_MOVED => 'moved',
218 - Threads::TYPE_DELETED => 'deleted'
219 - );
 203+ $editedStati = array( Threads::EDITED_NEVER => 'never',
 204+ Threads::EDITED_HAS_REPLY => 'has-reply',
 205+ Threads::EDITED_BY_AUTHOR => 'by-author',
 206+ Threads::EDITED_BY_OTHERS => 'by-others' );
 207+ $threadTypes = array( Threads::TYPE_NORMAL => 'normal',
 208+ Threads::TYPE_MOVED => 'moved',
 209+ Threads::TYPE_DELETED => 'deleted' );
220210 // Is it a thread
221211 if ( $row->thread_id ) {
222212 $thread = new Thread( $row );
223213 $threadInfo = "\n";
224214 $attribs = array();
225215 $attribs['ThreadSubject'] = $thread->subject();
226 - if ( $thread->hasSuperThread() ) {
 216+ if ($thread->hasSuperThread()) {
227217 $attribs['ThreadParent'] = $thread->superThread()->id();
228218 }
229219 $attribs['ThreadAncestor'] = $thread->topmostThread()->id();
@@ -234,39 +224,39 @@
235225 $attribs['ThreadAuthor'] = $thread->author()->getName();
236226 $attribs['ThreadEditStatus'] = $editedStati[$thread->editedness()];
237227 $attribs['ThreadType'] = $threadTypes[$thread->type()];
238 -
239 - foreach ( $attribs as $key => $value ) {
240 - $threadInfo .= "\t" . Xml::element( $key, null, $value ) . "\n";
 228+
 229+ foreach( $attribs as $key => $value ) {
 230+ $threadInfo .= "\t".Xml::element( $key, null, $value ) . "\n";
241231 }
242 -
 232+
243233 $out .= Xml::tags( 'DiscussionThreading', null, $threadInfo ) . "\n";
244234 }
245 -
 235+
246236 return true;
247237 }
248 -
 238+
249239 static function modifyExportQuery( $db, &$tables, &$cond, &$opts, &$join ) {
250240 $tables[] = 'thread';
251 -
 241+
252242 $join['thread'] = array( 'left join', array( 'thread_root=page_id' ) );
253 -
 243+
254244 return true;
255245 }
256 -
 246+
257247 static function customiseSearchResultTitle( &$title, &$text, $result, $terms, $page ) {
258248 if ( $title->getNamespace() != NS_LQT_THREAD ) {
259249 return true;
260250 }
261 -
262 - $thread = Threads::withRoot( new Article( $title ) );
 251+
 252+ $thread = Threads::withRoot( new Article($title) );
263253 $text = $thread->subject();
264 -
 254+
265255 $title = clone $thread->topmostThread()->title();
266 - $title->setFragment( '#' . $thread->getAnchorName() );
267 -
 256+ $title->setFragment( '#'.$thread->getAnchorName() );
 257+
268258 return true;
269259 }
270 -
 260+
271261 static function onUserRename( $renameUserSQL ) {
272262 // Always use the job queue, talk page edits will take forever
273263 $renameUserSQL->tablesJob['thread'] =
@@ -275,55 +265,57 @@
276266 array( 'th_user_text', 'th_user', 'th_timestamp' );
277267 return true;
278268 }
279 -
 269+
280270 static function editCheckboxes( $editPage, &$checkboxes, &$tabIndex ) {
281271 $article = $editPage->getArticle();
282272 $title = $article->getTitle();
283 -
 273+
284274 if ( !$article->exists() && $title->getNamespace() == NS_LQT_THREAD ) {
285275 unset( $checkboxes['minor'] );
286276 }
287 -
 277+
288278 return true;
289279 }
290 -
 280+
291281 static function customiseSearchProfiles( &$profiles ) {
292282 wfLoadExtensionMessages( 'LiquidThreads' );
293 -
 283+
294284 $namespaces = array( NS_LQT_THREAD, NS_LQT_SUMMARY );
295 -
 285+
296286 // Add odd namespaces
297 - foreach ( SearchEngine::searchableNamespaces() as $ns => $nsName ) {
298 - if ( $ns % 2 == 1 ) {
 287+ foreach( SearchEngine::searchableNamespaces() as $ns => $nsName ) {
 288+ if ($ns % 2 == 1) {
299289 $namespaces[] = $ns;
300290 }
301291 }
302 -
 292+
303293 $insert = array(
304 - 'threads' => array(
305 - 'message' => 'searchprofile-threads',
306 - 'tooltip' => 'searchprofile-threads-tooltip',
307 - 'namespaces' => $namespaces,
308 - 'namespace-messages' => SearchEngine::namespacesAsText( $namespaces ),
309 - ),
 294+ 'threads' =>
 295+ array(
 296+ 'message' => 'searchprofile-threads',
 297+ 'tooltip' => 'searchprofile-threads-tooltip',
 298+ 'namespaces' => $namespaces,
 299+ 'namespace-messages' => SearchEngine::namespacesAsText( $namespaces ),
 300+ ),
310301 );
311 -
 302+
312303 $profiles = wfArrayInsertAfter( $profiles, $insert, 'help' );
313 -
 304+
314305 return true;
315306 }
316 -
 307+
317308 public static function onLoadExtensionSchemaUpdates() {
318309 global $wgExtNewTables, $wgExtNewFields, $wgExtPGNewFields,
319310 $wgExtPGAlteredFields, $wgExtNewIndexes, $wgDBtype;
320311
321312 $dir = realpath( dirname( __FILE__ ) . '/..' );
322 -
 313+
323314 // DB updates
324315 $wgExtNewTables[] = array( 'thread', "$dir/lqt.sql" );
325316 $wgExtNewTables[] = array( 'user_message_state', "$dir/lqt.sql" );
326317 $wgExtNewTables[] = array( 'thread_history', "$dir/schema-changes/thread_history_table.sql" );
327 -
 318+
 319+
328320 $wgExtNewFields[] = array( "thread", "thread_article_namespace", "$dir/schema-changes/split-thread_article.sql" );
329321 $wgExtNewFields[] = array( "thread", "thread_article_title", "$dir/schema-changes/split-thread_article.sql" );
330322 $wgExtNewFields[] = array( "thread", "thread_ancestor", "$dir/schema-changes/normalise-ancestry.sql" );
@@ -334,9 +326,9 @@
335327 $wgExtNewFields[] = array( "thread", "thread_subject", "$dir/schema-changes/store_subject-author.sql" );
336328 $wgExtNewFields[] = array( "thread", "thread_author_id", "$dir/schema-changes/store_subject-author.sql" );
337329 $wgExtNewFields[] = array( "thread", "thread_author_name", "$dir/schema-changes/store_subject-author.sql" );
338 -
 330+
339331 $wgExtNewIndexes[] = array( 'thread', 'thread_summary_page', '(thread_summary_page)' );
340 -
 332+
341333 return true;
342334 }
343335 }
Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -2,6 +2,7 @@
33 if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class NewMessages {
 6+
67 static function markThreadAsUnreadByUser( $thread, $user ) {
78 self::writeUserMessageState( $thread, $user, null );
89 }
@@ -28,17 +29,10 @@
2930 }
3031
3132 $dbw = wfGetDB( DB_MASTER );
32 -
33 - $dbw->replace(
34 - 'user_message_state',
35 - array( array( 'ums_user', 'ums_thread' ) ),
36 - array(
37 - 'ums_user' => $user_id,
38 - 'ums_thread' => $thread_id,
39 - 'ums_read_timestamp' => $timestamp
40 - ),
41 - __METHOD__
42 - );
 33+
 34+ $dbw->replace( 'user_message_state', array( array( 'ums_user', 'ums_thread' ) ),
 35+ array( 'ums_user' => $user_id, 'ums_thread' => $thread_id,
 36+ 'ums_read_timestamp' => $timestamp ), __METHOD__ );
4337 }
4438
4539 /**
@@ -47,7 +41,7 @@
4842 */
4943 static function writeMessageStateForUpdatedThread( $t, $type, $changeUser ) {
5044 global $wgUser;
51 -
 45+
5246 wfDebugLog( 'LiquidThreads', 'Doing notifications' );
5347
5448 $dbw =& wfGetDB( DB_MASTER );
@@ -56,50 +50,40 @@
5751 $root_t = $t->topmostThread()->root()->getTitle();
5852
5953 // Select any applicable watchlist entries for the thread.
60 - $talkpageWhere = array(
61 - 'wl_namespace' => $tpTitle->getNamespace(),
62 - 'wl_title' => $tpTitle->getDBkey()
63 - );
64 - $rootWhere = array(
65 - 'wl_namespace' => $root_t->getNamespace(),
66 - 'wl_title' => $root_t->getDBkey()
67 - );
68 -
 54+ $talkpageWhere = array( 'wl_namespace' => $tpTitle->getNamespace(),
 55+ 'wl_title' => $tpTitle->getDBkey() );
 56+ $rootWhere = array( 'wl_namespace' => $root_t->getNamespace(),
 57+ 'wl_title' => $root_t->getDBkey() );
 58+
6959 $talkpageWhere = $dbw->makeList( $talkpageWhere, LIST_AND );
7060 $rootWhere = $dbw->makeList( $rootWhere, LIST_AND );
71 -
 61+
7262 $where_clause = $dbw->makeList( array( $talkpageWhere, $rootWhere ), LIST_OR );
73 -
 63+
7464 // <= 1.15 compatibility, it kinda sucks having to do all this up here.
7565 $tables = array( 'watchlist', 'user_message_state' );
76 - $joins = array(
77 - 'user_message_state' => array(
78 - 'left join',
79 - array(
80 - 'ums_user=wl_user',
81 - 'ums_thread' => $t->id()
82 - )
83 - )
84 - );
 66+ $joins = array( 'user_message_state' =>
 67+ array( 'left join',
 68+ array( 'ums_user=wl_user', 'ums_thread' => $t->id() ) ) );
8569 $fields = array( 'wl_user', 'ums_user', 'ums_read_timestamp' );
86 -
 70+
8771 $oldPrefCompat = false;
8872 global $wgVersion;
8973 if ( version_compare( $wgVersion, '1.16', '<' ) ) {
9074 $oldPrefCompat = true;
91 -
 75+
9276 $tables[] = 'user';
9377 $joins['user'] = array( 'left join', 'user_id=wl_user' );
9478 $fields[] = 'user_options';
9579 } else {
9680 $tables[] = 'user_properties';
97 - $joins['user_properties'] = array(
98 - 'left join',
 81+ $joins['user_properties'] =
9982 array(
100 - 'up_user=wl_user',
101 - 'up_property' => 'lqtnotifytalk'
102 - )
103 - );
 83+ 'left join',
 84+ array( 'up_user=wl_user',
 85+ 'up_property' => 'lqtnotifytalk',
 86+ )
 87+ );
10488 $fields[] = 'up_value';
10589 }
10690
@@ -107,83 +91,78 @@
10892 // user_message_state row exists for them, and whether or not to send an email
10993 // notification.
11094 $dbr = wfGetDB( DB_SLAVE );
111 - $res = $dbr->select( $tables, $fields, $where_clause, __METHOD__, array(), $joins );
112 -
 95+ $res = $dbr->select( $tables, $fields, $where_clause, __METHOD__, array(), $joins);
 96+
11397 $insert_rows = array();
11498 $update_tuples = array();
11599 $notify_users = array();
116 - while ( $row = $dbr->fetchObject( $res ) ) {
 100+ while( $row = $dbr->fetchObject( $res ) ) {
117101 // Don't notify yourself
118102 if ( $changeUser->getId() == $row->wl_user )
119103 continue;
120 -
 104+
121105 if ( $row->ums_user && !$row->ums_read_timestamp ) {
122106 // It's already positive.
123107 } else {
124 - $insert_rows[] = array(
125 - 'ums_user' => $row->wl_user,
126 - 'ums_thread' => $t->id(),
127 - 'ums_read_timestamp' => null,
128 - );
129 -
 108+ $insert_rows[] =
 109+ array(
 110+ 'ums_user' => $row->wl_user,
 111+ 'ums_thread' => $t->id(),
 112+ 'ums_read_timestamp' => null,
 113+ );
 114+
130115 // Set newtalk
131116 $u = User::newFromId( $row->wl_user );
132117 $u->setNewtalk( true );
133118 }
134 -
 119+
135120 $wantsTalkNotification = false;
136 -
 121+
137122 if ( $oldPrefCompat ) {
138123 $decodedOptions = self::decodeUserOptions( $row->user_options );
139 -
140 - $wantsTalkNotification = ( is_null( $decodedOptions['lqtnotifytalk'] ) &&
 124+
 125+ $wantsTalkNotification = ( is_null( $decodedOptions['lqtnotifytalk'] ) &&
141126 User::getDefaultOption( 'lqtnotifytalk' ) ) || $row->up_value;
142127 } else {
143128 $wantsTalkNotification =
144 - ( is_null( $row->up_value ) && User::getDefaultOption( 'lqtnotifytalk' ) )
 129+ (is_null($row->up_value) && User::getDefaultOption( 'lqtnotifytalk' ) )
145130 || $row->up_value;
146131 }
147 -
 132+
148133 if ( $wantsTalkNotification ) {
149134 $notify_users[] = $row->wl_user;
150135 }
151136 }
152 -
 137+
153138 // Add user talk notification
154139 if ( $t->article()->getTitle()->getNamespace() == NS_USER_TALK ) {
155140 $name = $t->article()->getTitle()->getText();
156 -
 141+
157142 $user = User::newFromName( $name );
158143 if ( $user ) {
159144 $user->setNewtalk( true );
160 -
161 - $insert_rows[] = array(
162 - 'ums_user' => $user->getId(),
163 - 'ums_thread' => $t->id(),
164 - 'ums_read_timestamp' => null
165 - );
166 -
 145+
 146+ $insert_rows[] = array( 'ums_user' => $user->getId(),
 147+ 'ums_thread' => $t->id(),
 148+ 'ums_read_timestamp' => null );
 149+
167150 if ( $user->getOption( 'enotifusertalkpages' ) ) {
168151 $notify_users[] = $user->getId();
169152 }
170153 }
171154 }
172 -
 155+
173156 // Do the actual updates
174 - if ( count( $insert_rows ) ) {
175 - $dbw->replace(
176 - 'user_message_state',
177 - array( array( 'ums_user', 'ums_thread' ) ),
178 - $insert_rows,
179 - __METHOD__
180 - );
 157+ if ( count($insert_rows) ) {
 158+ $dbw->replace( 'user_message_state', array( array( 'ums_user', 'ums_thread' ) ),
 159+ $insert_rows, __METHOD__ );
181160 }
182 -
183 - if ( count( $notify_users ) ) {
 161+
 162+ if ( count($notify_users) ) {
184163 self::notifyUsersByMail( $t, $notify_users, wfTimestampNow(), $type );
185164 }
186165 }
187 -
 166+
188167 // Would refactor User::decodeOptions, but the whole point is that this is
189168 // compatible with old code :)
190169 static function decodeUserOptions( $str ) {
@@ -195,10 +174,10 @@
196175 $opts[$m[1]] = $m[2];
197176 }
198177 }
199 -
 178+
200179 return $opts;
201180 }
202 -
 181+
203182 static function notifyUsersByMail( $t, $watching_users, $timestamp, $type ) {
204183 wfLoadExtensionMessages( 'LiquidThreads' );
205184 $messages = array(
@@ -209,169 +188,148 @@
210189 Threads::CHANGE_REPLY_CREATED => 'lqt-enotif-subject-reply',
211190 Threads::CHANGE_NEW_THREAD => 'lqt-enotif-subject-newthread',
212191 );
213 -
214 - if ( !isset( $messages[$type] ) || !isset( $subjects[$type] ) ) {
 192+
 193+ if ( !isset($messages[$type]) || !isset($subjects[$type]) ) {
215194 wfDebugLog( 'LiquidThreads', "Email notification failed: type $type unrecognised" );
216195 return;
217196 } else {
218197 $msgName = $messages[$type];
219198 $subjectMsg = $subjects[$type];
220199 }
221 -
 200+
222201 // Send email notification, fetching all the data in one go
223 -
 202+
224203 global $wgVersion;
225204 $tables = array( 'user' );
226205 $fields = array( 'user.*' );
227206 $join_conds = array();
228207 $oldPreferenceFormat = false;
229 - if ( version_compare( $wgVersion, '1.16', '<' ) ) {
 208+ if (version_compare( $wgVersion, '1.16', '<' )) {
230209 $oldPreferenceFormat = true;
231210 } else {
232211 $tables[] = 'user_properties as tc_prop';
233212 $fields[] = 'tc_prop.up_value as timecorrection';
234 -
 213+
235214 $join_conds['user_properties as tc_prop'] =
236 - array( 'left join',
 215+ array( 'left join',
237216 array(
238217 'up_user=user_id',
239218 'up_property' => 'timecorrection',
240219 )
241220 );
242 -
 221+
243222 $tables[] = 'user_properties as l_prop';
244223 $fields[] = 'l_prop.up_value as language';
245 -
 224+
246225 $join_conds['user_properties as l_prop'] =
247 - array( 'left join',
 226+ array( 'left join',
248227 array(
249228 'up_user=user_id',
250229 'up_property' => 'language',
251230 )
252231 );
253232 }
254 -
 233+
255234 $dbr = wfGetDB( DB_SLAVE );
256 - $res = $dbr->select(
257 - $tables,
258 - $fields,
259 - array( 'user_id' => $watching_users ),
260 - __METHOD__,
261 - array(),
262 - $join_conds
263 - );
264 -
 235+ $res = $dbr->select( $tables, $fields,
 236+ array( 'user_id' => $watching_users ), __METHOD__, array(),
 237+ $join_conds
 238+ );
 239+
265240 // Set up one-time data.
266241 $link_title = clone $t->article()->getTitle();
267 - $link_title->setFragment( '#' . $t->getAnchorName() );
 242+ $link_title->setFragment( '#'.$t->getAnchorName() );
268243 $permalink = $link_title->getFullURL();
269244 $talkPage = $t->article()->getTitle()->getPrefixedText();
270245 $from = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
271246 $threadSubject = $t->subject();
272 -
 247+
273248 // Parse content and strip HTML of post content
274249 // Doesn't work for some reason (transaction issues?)
275250 // $content = $t->root()->getContent();
276251 // global $wgOut;
277252 // $html = $wgOut->parse( $content );
278253 // $text = StringUtils::delimiterReplace( '<', '>', '', $html );
279 -
280 - while ( $row = $dbr->fetchObject( $res ) ) {
 254+
 255+ while( $row = $dbr->fetchObject( $res ) ) {
281256 $u = User::newFromRow( $row );
282 -
283 - if ( $oldPreferenceFormat ) {
 257+
 258+ if ($oldPreferenceFormat) {
284259 $langCode = $u->getOption( 'language' );
285 - } elseif ( $row->language ) {
 260+ } elseif ($row->language) {
286261 $langCode = $row->language;
287262 } else {
288263 global $wgLanguageCode;
289264 $langCode = $wgLanguageCode;
290265 }
291 -
 266+
292267 $lang = Language::factory( $langCode );
293 -
 268+
294269 // Adjust with time correction
295 - if ( $oldPreferenceFormat ) {
 270+ if ($oldPreferenceFormat) {
296271 $timeCorrection = $u->getOption( 'timecorrection' );
297272 } else {
298273 $timeCorrection = $row->timecorrection;
299274 }
300275 $adjustedTimestamp = $lang->userAdjust( $timestamp, $timeCorrection );
301 -
 276+
302277 $date = $lang->date( $adjustedTimestamp );
303278 $time = $lang->time( $adjustedTimestamp );
304 -
 279+
305280 $params = array( $u->getName(), $t->subjectWithoutIncrement(),
306281 $date, $time, $talkPage, $permalink );
307 -
 282+
308283 // Get message in user's own language, bug 20645
309284 $msg = wfMsgReal( $msgName, $params, true /* use DB */, $langCode,
310285 true /*transform*/ );
311 -
 286+
312287 global $wgPasswordSender;
313 -
 288+
314289 $to = new MailAddress( $u );
315 - $subject = wfMsgReal( $subjectMsg, array( $threadSubject ), true /* use DB */,
316 - $langCode, true /* transform */ );
317 -
 290+ $subject = wfMsgReal( $subjectMsg, array($threadSubject), true /* use DB */,
 291+ $langCode, true /* transform */);
 292+
318293 UserMailer::send( $to, $from, $subject, $msg );
319294 }
320295 }
321296
322297 static function newUserMessages( $user ) {
323298 $talkPage = new Article( $user->getUserPage()->getTalkPage() );
324 -
 299+
325300 $dbr = wfGetDB( DB_SLAVE );
326 -
 301+
327302 $joinConds = array( 'ums_user' => null );
328 - $joinConds[] = $dbr->makeList(
329 - array(
330 - 'ums_user' => $user->getId(),
331 - 'ums_thread=thread_id'
332 - ),
333 - LIST_AND
334 - );
 303+ $joinConds[] = $dbr->makeList( array( 'ums_user' => $user->getId(),
 304+ 'ums_thread=thread_id' ), LIST_AND );
335305 $joinClause = $dbr->makeList( $joinConds, LIST_OR );
336 -
337 - $res = $dbr->select(
338 - array( 'thread', 'user_message_state' ),
339 - '*',
340 - array(
341 - 'ums_read_timestamp' => null,
342 - Threads::articleClause( $talkPage )
343 - ),
344 - __METHOD__,
345 - array(),
346 - array(
347 - 'user_message_state' =>
348 - array( 'LEFT OUTER JOIN', $joinClause )
349 - )
350 - );
351 -
 306+
 307+ $res = $dbr->select( array( 'thread', 'user_message_state' ), '*',
 308+ array( 'ums_read_timestamp' => null,
 309+ Threads::articleClause( $talkPage ) ),
 310+ __METHOD__, array(),
 311+ array(
 312+ 'user_message_state' =>
 313+ array( 'LEFT OUTER JOIN', $joinClause )
 314+ ) );
 315+
352316 return Threads::loadFromResult( $res, $dbr );
353317 }
354318
355319 static function watchedThreadsForUser( $user ) {
356320 $talkPage = new Article( $user->getUserPage()->getTalkPage() );
357 -
 321+
358322 $dbr = wfGetDB( DB_SLAVE );
359 -
360 - $res = $dbr->select(
361 - array( 'thread', 'user_message_state' ),
362 - '*',
363 - array(
364 - 'ums_read_timestamp' => null,
365 - 'ums_user' => $user->getId(),
366 - 'not (' . Threads::articleClause( $talkPage ) . ')',
367 - ),
368 - __METHOD__,
369 - array(),
370 - array(
371 - 'user_message_state' =>
372 - array( 'INNER JOIN', 'ums_thread=thread_id' ),
373 - )
374 - );
375 -
 323+
 324+ $res = $dbr->select( array( 'thread', 'user_message_state' ), '*',
 325+ array( 'ums_read_timestamp' => null,
 326+ 'ums_user' => $user->getId(),
 327+ 'not (' . Threads::articleClause( $talkPage ) . ')',
 328+ ),
 329+ __METHOD__, array(),
 330+ array( 'user_message_state' =>
 331+ array( 'INNER JOIN', 'ums_thread=thread_id' ),
 332+ ) );
 333+
376334 return Threads::loadFromResult( $res, $dbr );
377335 }
378336 }
Index: trunk/extensions/LiquidThreads/classes/ThreadRevision.php
@@ -6,157 +6,157 @@
77 array(
88 'th_id' => 'mId',
99 'th_thread' => 'mThreadId',
10 -
 10+
1111 'th_timestamp' => 'mTimestamp',
12 -
 12+
1313 'th_user' => 'mUserId',
1414 'th_user_text' => 'mUserText',
15 -
 15+
1616 'th_change_type' => 'mChangeType',
1717 'th_change_object' => 'mChangeObjectId',
1818 'th_change_comment' => 'mChangeComment',
1919 'th_content' => 'mObjSer',
2020 );
21 -
 21+
2222 protected $mId, $mThreadId, $mTimestamp, $mUserId, $mUserText, $mChangeType,
2323 $mChangeObjectId, $mChangeObject, $mChangeComment, $mObjSer, $mThreadObj;
24 -
 24+
2525 static function loadFromId( $id ) {
2626 $dbr = wfGetDB( DB_SLAVE );
2727 $row = $dbr->selectRow( 'thread_history', '*', array( 'th_id' => $id ), __METHOD__ );
28 -
 28+
2929 return self::loadFromRow( $row );
3030 }
31 -
 31+
3232 static function loadFromRow( $row ) {
3333 $rev = new ThreadRevision;
34 -
35 - foreach ( self::$load as $col => $field ) {
 34+
 35+ foreach( self::$load as $col => $field ) {
3636 $rev->$field = $row->$col;
3737 }
38 -
 38+
3939 $rev->mUser = User::newFromName( $rev->mUserText, /* Don't validate */ false );
4040 $rev->mThreadObj = unserialize( $rev->mObjSer );
41 -
 41+
4242 return $rev;
4343 }
44 -
 44+
4545 static function create( $thread, $change_type, $change_object = null, $comment = '',
4646 $user = null, $timestamp = null ) {
47 - if ( is_null( $user ) ) {
 47+ if ( is_null($user) ) {
4848 global $wgUser;
4949 $user = $wgUser;
5050 }
51 -
52 - if ( is_null( $timestamp ) ) {
 51+
 52+ if ( is_null($timestamp) ) {
5353 $timestamp = wfTimestampNow();
5454 }
55 -
 55+
5656 $rev = new ThreadRevision;
57 -
 57+
5858 $rev->mThreadId = $thread->topmostThread()->id();
5959 $rev->mTimestamp = $timestamp;
60 -
 60+
6161 $rev->mUser = $user;
6262 $rev->mUserId = $user->getId();
6363 $rev->mUserText = $user->getName();
64 -
 64+
6565 $rev->mChangeType = $change_type;
66 -
 66+
6767 if ( $change_object instanceof Thread ) {
6868 $rev->mChangeObjectId = $change_object->id();
6969 $rev->mChangeObject = $change_object;
70 - } elseif ( is_null( $change_object ) ) {
 70+ } elseif ( is_null($change_object) ) {
7171 $rev->mChangeObjectId = $thread->id();
7272 $rev->mChangeObject = $thread;
7373 } else {
7474 $rev->mChangeObjectId = $change_object;
7575 }
76 -
 76+
7777 $rev->mChangeComment = $comment;
78 -
 78+
7979 $rev->mThreadObj = $thread->topmostThread();
8080 $rev->mObjSer = serialize( $rev->mThreadObj );
81 -
 81+
8282 $rev->insert();
83 -
 83+
8484 return $rev;
8585 }
86 -
 86+
8787 function insert() {
8888 $dbw = wfGetDB( DB_MASTER );
89 -
 89+
9090 $row = $this->getRow();
9191 $row['th_id'] = $dbw->nextSequenceValue( 'thread_history_th_id' );
92 -
 92+
9393 $dbw->insert( 'thread_history', $row, __METHOD__ );
94 -
 94+
9595 $this->mId = $dbw->insertId();
9696 }
97 -
 97+
9898 function save() {
9999 $row = $this->getRow();
100 -
 100+
101101 $dbw = wfGetDB( DB_MASTER );
102 -
 102+
103103 $dbw->replace( 'thread_history', array( 'th_thread' ), $row, __METHOD__ );
104104 }
105 -
 105+
106106 function getRow() {
107107 $row = array();
108 -
 108+
109109 // First, prep the data for insertion
110110 $dbw = wfGetDB( DB_MASTER );
111111 $this->mTimestamp = $dbw->timestamp( $this->mTimestamp );
112 -
113 - foreach ( self::$load as $col => $field ) {
 112+
 113+ foreach( self::$load as $col => $field ) {
114114 $row[$col] = $this->$field;
115115 }
116 -
 116+
117117 return $row;
118118 }
119 -
 119+
120120 function getTimestamp() {
121121 return wfTimestamp( TS_MW, $this->mTimestamp );
122122 }
123 -
 123+
124124 function getUser() {
125 - if ( $this->mUserId ) {
 125+ if ($this->mUserId) {
126126 return User::newFromId( $this->mUserId );
127127 }
128 -
 128+
129129 return User::newFromText( $this->mUserText, /* No validation */ false );
130130 }
131 -
 131+
132132 function getChangeType() {
133133 return $this->mChangeType;
134134 }
135 -
 135+
136136 function getChangeObject() {
137137 if ( !$this->mChangeObject && $this->mChangeObjectId ) {
138138 $this->mChangeObject = Threads::withId( $this->mChangeObjectId );
139139 }
140 -
 140+
141141 return $this->mChangeObject;
142142 }
143 -
 143+
144144 function getChangeComment() {
145145 return $this->mChangeComment;
146146 }
147 -
 147+
148148 function getId() {
149149 return $this->mId;
150150 }
151 -
 151+
152152 function getThreadObj() {
153153 if ( !$this->mThreadObj && $this->mObjSer ) {
154154 $this->mThreadObj = unserialize( $this->mObjSer );
155 - } elseif ( !$this->mThreadObj ) {
 155+ } elseif (!$this->mThreadObj) {
156156 throw new MWException( "Missing mObjSer" );
157157 }
158 -
 158+
159159 $this->mThreadObj->threadRevision = $this;
160 -
 160+
161161 return $this->mThreadObj;
162162 }
163163 }
Index: trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php
@@ -26,7 +26,7 @@
2727 $this->request = $wgRequest;
2828
2929 $this->setHeaders();
30 -
 30+
3131 $article = new Article( $this->getTitle() );
3232 $title = $this->getTitle();
3333
@@ -42,27 +42,21 @@
4343 $wgOut->addWikitext( wfMsg( 'lqt-no-new-messages' ) );
4444 return;
4545 }
46 -
 46+
4747 $html = '';
48 -
 48+
4949 $html .= $view->getReadAllButton( $both_sets );
5050
5151 $view->setHeaderLevel( 3 );
5252
53 - $html .= Xml::tags(
54 - 'h2',
55 - array( 'class' => 'lqt_newmessages_section' ),
56 - wfMsgExt( 'lqt-messages-sent', 'parseinline' )
57 - );
 53+ $html .= Xml::tags( 'h2', array( 'class' => 'lqt_newmessages_section' ),
 54+ wfMsgExt( 'lqt-messages-sent', 'parseinline' ) );
5855 $wgOut->addHTML( $html );
5956 $view->setThreads( $first_set );
6057 $view->show();
6158
62 - $wgOut->addHTML( Xml::tags(
63 - 'h2',
64 - array( 'class' => 'lqt_newmessages_section' ),
65 - wfMsgExt( 'lqt-other-messages', 'parseinline' )
66 - ) );
 59+ $wgOut->addHTML( Xml::tags( 'h2', array( 'class' => 'lqt_newmessages_section' ),
 60+ wfMsgExt( 'lqt-other-messages', 'parseinline' ) ) );
6761 $view->setThreads( $second_set );
6862 $view->show();
6963 }
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -19,7 +19,7 @@
2020
2121 function showHeader() {
2222 /* Show the contents of the actual talkpage article if it exists. */
23 -
 23+
2424 global $wgUser;
2525 $sk = $wgUser->getSkin();
2626
@@ -32,124 +32,107 @@
3333 // when the first thread was posted to make the links blue.
3434 if ( $article->exists() && $article->getContent() ) {
3535 $html = '';
36 -
 36+
3737 $article->view();
38 -
 38+
3939 $actionLinks = array();
40 - $actionLinks[] = $sk->link(
41 - $this->title,
42 - wfMsgExt( 'edit', 'parseinline' ) . "&uarr;",
43 - array(),
44 - array( 'action' => 'edit' )
45 - );
46 - $actionLinks[] = $sk->link(
47 - $this->title,
48 - wfMsgExt( 'history_short', 'parseinline' ) . "&uarr;",
49 - array(),
50 - array( 'action' => 'history' )
51 - );
52 -
 40+ $actionLinks[] = $sk->link( $this->title,
 41+ wfMsgExt( 'edit', 'parseinline' ) . "&uarr;",
 42+ array(), array( 'action' => 'edit' ) );
 43+ $actionLinks[] = $sk->link( $this->title,
 44+ wfMsgExt( 'history_short', 'parseinline' ) . "&uarr;",
 45+ array(), array( 'action' => 'history' ) );
 46+
5347 if ( $wgUser->isAllowed( 'delete' ) ) {
54 - $actionLinks[] = $sk->link(
55 - $this->title,
56 - wfMsgExt( 'delete', 'parseinline' ) . '&uarr;',
57 - array(),
58 - array( 'action' => 'delete' )
59 - );
 48+ $actionLinks[] = $sk->link( $this->title,
 49+ wfMsgExt( 'delete', 'parseinline' ) . '&uarr;',
 50+ array(), array( 'action' => 'delete' ) );
6051 }
61 -
 52+
6253 $actions = '';
63 - foreach ( $actionLinks as $link ) {
 54+ foreach( $actionLinks as $link ) {
6455 $actions .= Xml::tags( 'li', null, "[$link]" ) . "\n";
6556 }
6657 $actions = Xml::tags( 'ul', array( 'class' => 'lqt_header_commands' ), $actions );
6758 $html .= $actions;
6859
6960 $html = Xml::tags( 'div', array( 'class' => 'lqt_header_content' ), $html );
70 -
 61+
7162 $this->output->addHTML( $html );
7263 } else {
73 -
74 - $editLink = $sk->link(
75 - $this->title,
76 - wfMsgExt( 'lqt_add_header', 'parseinline' ),
77 - array(),
78 - array( 'action' => 'edit' )
79 - );
80 -
 64+
 65+ $editLink = $sk->link( $this->title, wfMsgExt( 'lqt_add_header', 'parseinline' ),
 66+ array(), array( 'action' => 'edit' ) );
 67+
8168 $html = Xml::tags( 'p', array( 'class' => 'lqt_header_notice' ), "[$editLink]" );
82 -
 69+
8370 $this->output->addHTML( $html );
8471 }
8572 }
86 -
 73+
8774 function getTOC( $threads ) {
8875 global $wgLang;
89 -
 76+
9077 wfLoadExtensionMessages( 'LiquidThreads' );
9178
9279 $sk = $this->user->getSkin();
93 -
 80+
9481 $html = '';
95 -
 82+
9683 $h2_header = Xml::tags( 'h2', null, wfMsgExt( 'lqt_contents_title', 'parseinline' ) );
97 -
 84+
9885 // Header row
9986 $headerRow = '';
100 - $headers = array(
101 - 'lqt_toc_thread_title',
102 - 'lqt_toc_thread_author',
103 - 'lqt_toc_thread_replycount',
104 - 'lqt_toc_thread_modified'
105 - );
106 - foreach ( $headers as $msg ) {
 87+ $headers = array( 'lqt_toc_thread_title', 'lqt_toc_thread_author',
 88+ 'lqt_toc_thread_replycount', 'lqt_toc_thread_modified' );
 89+ foreach( $headers as $msg ) {
10790 $headerRow .= Xml::tags( 'th', null, wfMsgExt( $msg, 'parseinline' ) );
10891 }
10992 $headerRow = Xml::tags( 'tr', null, $headerRow );
11093 $headerRow = Xml::tags( 'thead', null, $headerRow );
111 -
 94+
11295 // Table body
11396 $rows = array();
114 - foreach ( $threads as $thread ) {
 97+ foreach( $threads as $thread ) {
11598 $row = '';
116 - $anchor = '#' . $this->anchorName( $thread );
 99+ $anchor = '#'.$this->anchorName( $thread );
117100 $subject = $this->output->parseInline( $thread->subjectWithoutIncrement() );
118101 $subject = Xml::tags( 'a', array( 'href' => $anchor ), $subject );
119102 $row .= Xml::tags( 'td', null, $subject );
120 -
 103+
121104 $author = $thread->author();
122105 $authorLink = $sk->userLink( $author->getId(), $author->getName() );
123106 $row .= Xml::tags( 'td', null, $authorLink );
124 -
 107+
125108 $row .= Xml::element( 'td', null, count( $thread->replies() ) );
126 -
 109+
127110 $timestamp = $wgLang->timeanddate( $thread->modified(), true );
128111 $row .= Xml::element( 'td', null, $timestamp );
129 -
 112+
130113 $row = Xml::tags( 'tr', null, $row );
131114 $rows[] = $row;
132115 }
133 -
 116+
134117 $html .= $headerRow . "\n" . Xml::tags( 'tbody', null, implode( "\n", $rows ) );
135118 $html = $h2_header . Xml::tags( 'table', array( 'class' => 'lqt_toc' ), $html );
136 -
 119+
137120 return $html;
138121 }
139 -
 122+
140123 function getList( $kind, $class, $id, $contents ) {
141124 $html = '';
142125 foreach ( $contents as $li ) {
143126 $html .= Xml::tags( 'li', null, $li );
144127 }
145128 $html = Xml::tags( $kind, array( 'class' => $class, 'id' => $id ), $html );
146 -
 129+
147130 return $html;
148131 }
149132
150133 function getArchiveWidget( ) {
151134 wfLoadExtensionMessages( 'LiquidThreads' );
152135 $url = $this->talkpageUrl( $this->title, 'talkpage_archive' );
153 -
 136+
154137 $html = '';
155138 $html = Xml::tags( 'div', array( 'class' => 'lqt_archive_teaser' ), $html );
156139 return $html;
@@ -161,44 +144,32 @@
162145 if ( $article->exists() ) {
163146 $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order' );
164147 $go = wfMsg( 'go' );
165 -
 148+
166149 $html = '';
167 -
 150+
168151 $html .= Xml::label( wfMsg( 'lqt_sorting_order' ), 'lqt_sort_select' ) . ' ';
169152
170153 $sortOrderSelect =
171154 new XmlSelect( 'lqt_order', 'lqt_sort_select', $this->getSortType() );
172 -
 155+
173156 $sortOrderSelect->setAttribute( 'class', 'lqt_sort_select' );
174 - $sortOrderSelect->addOption(
175 - wfMsg( 'lqt_sort_newest_changes' ),
176 - LQT_NEWEST_CHANGES
177 - );
178 - $sortOrderSelect->addOption(
179 - wfMsg( 'lqt_sort_newest_threads' ),
180 - LQT_NEWEST_THREADS
181 - );
182 - $sortOrderSelect->addOption(
183 - wfMsg( 'lqt_sort_oldest_threads' ),
184 - LQT_OLDEST_THREADS
185 - );
 157+ $sortOrderSelect->addOption( wfMsg( 'lqt_sort_newest_changes' ),
 158+ LQT_NEWEST_CHANGES );
 159+ $sortOrderSelect->addOption( wfMsg( 'lqt_sort_newest_threads' ),
 160+ LQT_NEWEST_THREADS );
 161+ $sortOrderSelect->addOption( wfMsg( 'lqt_sort_oldest_threads' ),
 162+ LQT_OLDEST_THREADS );
186163 $html .= $sortOrderSelect->getHTML();
187 -
 164+
188165 $html .= Xml::submitButton( wfMsg( 'go' ), array( 'class' => 'lqt_go_sort' ) );
189166 $html .= Xml::hidden( 'title', $this->title->getPrefixedText() );
190 -
191 -
192 - $html = Xml::tags(
193 - 'form',
194 - array(
195 - 'action' => $form_action_url,
196 - 'method' => 'get',
197 - 'name' => 'lqt_sort'
198 - ),
199 - $html
200 - );
 167+
 168+
 169+ $html = Xml::tags( 'form', array( 'action' => $form_action_url,
 170+ 'method' => 'get',
 171+ 'name' => 'lqt_sort' ), $html );
201172 $html = Xml::tags( 'div', array( 'class' => 'lqt_view_options' ), $html );
202 -
 173+
203174 return $html;
204175 }
205176 }
@@ -211,62 +182,54 @@
212183
213184 $this->output->setPageTitle( $this->title->getPrefixedText() );
214185 self::addJSandCSS();
215 -
 186+
216187 $sk = $this->user->getSkin();
217 -
 188+
218189 $article = new Article( $this->title );
219 -
 190+
220191 if ( $this->request->getBool( 'lqt_inline' ) ) {
221192 $this->doInlineEditForm();
222193 return false;
223194 }
224 -
 195+
225196 // Search!
226197 if ( $this->request->getCheck( 'lqt_search' ) ) {
227198 $q = $this->request->getText( 'lqt_search' );
228 - $q .= ' ondiscussionpage:' . $article->getTitle()->getPrefixedText();
229 -
230 - $params = array(
231 - 'search' => $q,
232 - 'fulltext' => 1,
233 - 'ns' . NS_LQT_THREAD => 1,
234 - );
235 -
 199+ $q .= ' ondiscussionpage:'.$article->getTitle()->getPrefixedText();
 200+
 201+ $params = array( 'search' => $q,
 202+ 'fulltext' => 1,
 203+ 'ns'.NS_LQT_THREAD => 1,
 204+ );
 205+
236206 $t = SpecialPage::getTitleFor( 'Search' );
237207 $url = $t->getLocalURL( wfArrayToCGI( $params ) );
238 -
 208+
239209 $this->output->redirect( $url );
 210+
240211 }
241212
242213 $this->showHeader();
243 -
 214+
244215 $html = '';
245 -
 216+
246217 // Set up a per-page header for new threads, search box, and sorting stuff.
247 -
 218+
248219 $talkpageHeader = '';
249 -
 220+
250221 $newThreadText = wfMsgExt( 'lqt_new_thread', 'parseinline' );
251 - $newThreadLink = $sk->link(
252 - $this->title, $newThreadText,
253 - array(),
254 - array( 'lqt_method' => 'talkpage_new_thread' ),
255 - array( 'known' )
256 - );
257 -
258 - $talkpageHeader .= Xml::tags(
259 - 'strong',
260 - array( 'class' => 'lqt_start_discussion' ),
261 - $newThreadLink
262 - );
 222+ $newThreadLink = $sk->link( $this->title, $newThreadText,
 223+ array( ),
 224+ array( 'lqt_method' => 'talkpage_new_thread' ),
 225+ array( 'known' ) );
 226+
 227+ $talkpageHeader .= Xml::tags( 'strong', array( 'class' => 'lqt_start_discussion' ),
 228+ $newThreadLink );
263229 $talkpageHeader .= $this->getSearchBox();
264230 $talkpageHeader .= $this->showTalkpageViewOptions( $article );
265 - $talkpageHeader = Xml::tags(
266 - 'div',
267 - array( 'class' => 'lqt-talkpage-header' ),
268 - $talkpageHeader
269 - );
270 -
 231+ $talkpageHeader = Xml::tags( 'div', array( 'class' => 'lqt-talkpage-header' ),
 232+ $talkpageHeader );
 233+
271234 $this->output->addHTML( $talkpageHeader );
272235
273236 global $wgRequest;
@@ -279,71 +242,63 @@
280243 $this->output->addHTML( Xml::tags( 'div',
281244 array( 'class' => 'lqt-new-thread lqt-edit-form' ), '' ) );
282245 }
283 -
 246+
284247 $pager = $this->getPager();
285 -
 248+
286249 $threads = $this->getPageThreads( $pager );
287250
288 - if ( count( $threads ) > 0 ) {
 251+ if ( count($threads) > 0 ) {
289252 $html .= Xml::element( 'br', array( 'style' => 'clear: both;' ) );
290253 $html .= $this->getTOC( $threads );
291254 } else {
292255 $html .= wfMsgExt( 'lqt-no-threads', 'parseinline' );
293256 }
294 -
 257+
295258 $html .= $pager->getNavigationBar();
296 -
 259+
297260 $this->output->addHTML( $html );
298261
299262 foreach ( $threads as $t ) {
300263 $this->showThread( $t );
301264 }
302 -
 265+
303266 $this->output->addHTML( $pager->getNavigationBar() );
304 -
 267+
305268 return false;
306269 }
307 -
 270+
308271 function getSearchBox() {
309272 $html = '';
310 - $html .= Xml::inputLabel(
311 - wfMsg( 'lqt-search-label' ),
312 - 'lqt_search',
313 - 'lqt-search-box',
314 - 45
315 - );
316 -
 273+ $html .= Xml::inputLabel( wfMsg('lqt-search-label'), 'lqt_search', 'lqt-search-box',
 274+ 45 );
 275+
317276 $html .= ' ' . Xml::submitButton( wfMsg( 'lqt-search-button' ) );
318277 $html .= Xml::hidden( 'title', $this->title->getPrefixedText() );
319 - $html = Xml::tags(
320 - 'form',
321 - array(
322 - 'action' => $this->title->getLocalURL(),
323 - 'method' => 'get'
324 - ),
325 - $html
326 - );
327 -
 278+ $html = Xml::tags( 'form',
 279+ array( 'action' => $this->title->getLocalURL(),
 280+ 'method' => 'get' ),
 281+ $html );
 282+
328283 # $html = Xml::fieldset( wfMsg('lqt-search-legend' ), $html,
329284 # array( 'class' => 'lqt-talkpage-search' ) );
330285
331286 $html = Xml::tags( 'div', array( 'class' => 'lqt-talkpage-search' ), $html );
332 -
 287+
333288 return $html;
334289 }
335 -
 290+
336291 function getPager() {
337 -
 292+
338293 $sortType = $this->getSortType();
339294 return new LqtDiscussionPager( $this->article, $sortType );
340295 }
341 -
 296+
342297 function getPageThreads( $pager ) {
343298 $rows = $pager->getRows();
344 -
 299+
345300 return Thread::bulkLoad( $rows );
346301 }
347 -
 302+
348303 function getSortType() {
349304 // Determine sort order
350305 if ( $this->request->getCheck( 'lqt_order' ) ) {
@@ -358,7 +313,7 @@
359314 return LQT_OLDEST_THREADS;
360315 }
361316 }
362 -
 317+
363318 // Default
364319 return LQT_NEWEST_CHANGES;
365320 }
@@ -369,37 +324,39 @@
370325 function __construct( $article, $orderType ) {
371326 $this->article = $article;
372327 $this->orderType = $orderType;
373 -
 328+
374329 parent::__construct();
375 -
 330+
376331 $this->mLimit = 20;
377332 }
378 -
 333+
379334 function getQueryInfo() {
380 - $queryInfo = array(
381 - 'tables' => array( 'thread' ),
382 - 'fields' => '*',
383 - 'conds' => array(
384 - Threads::articleClause( $this->article ),
385 - Threads::topLevelClause(),
386 - 'thread_type != ' . $this->mDb->addQuotes( Threads::TYPE_DELETED ),
387 - ),
388 - );
389 -
 335+ $queryInfo =
 336+ array(
 337+ 'tables' => array( 'thread' ),
 338+ 'fields' => '*',
 339+ 'conds' =>
 340+ array(
 341+ Threads::articleClause( $this->article ),
 342+ Threads::topLevelClause(),
 343+ 'thread_type != '. $this->mDb->addQuotes( Threads::TYPE_DELETED ),
 344+ ),
 345+ );
 346+
390347 return $queryInfo;
391348 }
392 -
 349+
393350 // Adapted from getBody().
394351 function getRows() {
395352 if ( !$this->mQueryDone ) {
396353 $this->doQuery();
397354 }
398 -
 355+
399356 # Don't use any extra rows returned by the query
400357 $numRows = min( $this->mResult->numRows(), $this->mLimit );
401358
402359 $rows = array();
403 -
 360+
404361 if ( $numRows ) {
405362 if ( $this->mIsBackwards ) {
406363 for ( $i = $numRows - 1; $i >= 0; $i-- ) {
@@ -415,14 +372,14 @@
416373 }
417374 }
418375 }
419 -
 376+
420377 return $rows;
421378 }
422 -
 379+
423380 function formatRow( $row ) {
424381 // No-op, we get the list of rows from getRows()
425382 }
426 -
 383+
427384 function getIndexField() {
428385 switch( $this->orderType ) {
429386 case LQT_NEWEST_CHANGES:
@@ -431,10 +388,10 @@
432389 case LQT_NEWEST_THREADS:
433390 return 'thread_created';
434391 default:
435 - throw new MWException( "Unknown sort order " . $this->orderType );
 392+ throw new MWException( "Unknown sort order ".$this->orderType );
436393 }
437394 }
438 -
 395+
439396 function getDefaultDirections() {
440397 switch( $this->orderType ) {
441398 case LQT_NEWEST_CHANGES:
@@ -443,10 +400,10 @@
444401 case LQT_OLDEST_THREADS:
445402 return false; // Ascending
446403 default:
447 - throw new MWException( "Unknown sort order " . $this->orderType );
 404+ throw new MWException( "Unknown sort order ".$this->orderType );
448405 }
449406 }
450 -
 407+
451408 /**
452409 * A navigation bar with images
453410 * Stolen from TablePager because it's pretty.
@@ -496,7 +453,7 @@
497454 $s .= "</tr></table>\n";
498455 return $s;
499456 }
500 -
 457+
501458 function getNavClass() {
502459 return 'TalkpagePager_nav';
503460 }
Index: trunk/extensions/LiquidThreads/pages/SpecialSplitThread.php
@@ -5,20 +5,23 @@
66
77 function getFormFields() {
88 $splitForm = array(
9 - 'src' => array(
10 - 'type' => 'info',
11 - 'label-message' => 'lqt-thread-split-thread',
12 - 'default' => LqtView::permalink( $this->mThread ),
13 - 'raw' => 1,
14 - ),
15 - 'subject' => array(
16 - 'type' => 'text',
17 - 'label-message' => 'lqt-thread-split-subject',
18 - ),
19 - 'reason' => array(
20 - 'label-message' => 'movereason',
21 - 'type' => 'text',
22 - )
 9+ 'src' =>
 10+ array(
 11+ 'type' => 'info',
 12+ 'label-message' => 'lqt-thread-split-thread',
 13+ 'default' => LqtView::permalink( $this->mThread ),
 14+ 'raw' => 1,
 15+ ),
 16+ 'subject' =>
 17+ array(
 18+ 'type' => 'text',
 19+ 'label-message' => 'lqt-thread-split-subject',
 20+ ),
 21+ 'reason' =>
 22+ array(
 23+ 'label-message' => 'movereason',
 24+ 'type' => 'text',
 25+ ),
2326 );
2427
2528 return $splitForm;
@@ -50,16 +53,13 @@
5154 $this->mThread->commitRevision( Threads::CHANGE_SPLIT, null, $reason );
5255
5356 $title = clone $this->mThread->article()->getTitle();
54 - $title->setFragment( '#' . $this->mThread->getAnchorName() );
 57+ $title->setFragment( '#'.$this->mThread->getAnchorName() );
5558
5659 $link = $this->user->getSkin()->link( $title, $this->mThread->subject() );
5760
5861 global $wgOut;
59 - $wgOut->addHTML( wfMsgExt(
60 - 'lqt-split-success',
61 - array( 'parseinline', 'replaceafter' ),
62 - $link )
63 - );
 62+ $wgOut->addHTML( wfMsgExt( 'lqt-split-success', array( 'parseinline', 'replaceafter' ),
 63+ $link ) );
6464
6565 return true;
6666 }
@@ -68,19 +68,19 @@
6969 $thread->setSubject( $subject );
7070 $thread->setAncestor( $ancestor->id() );
7171
72 - if ( $first ) {
 72+ if ($first) {
7373 $thread->setSuperThread( null );
7474 }
7575
7676 $thread->save( );
7777
78 - foreach ( $thread->replies() as $subThread ) {
 78+ foreach( $thread->replies() as $subThread ) {
7979 $this->recursiveSet( $subThread, $subject, $ancestor );
8080 }
8181 }
8282
8383 function validateSubject( $target ) {
84 - if ( !$target ) {
 84+ if (!$target) {
8585 return wfMsgExt( 'lqt_split_nosubject', 'parseinline' );
8686 }
8787
Index: trunk/extensions/LiquidThreads/pages/SummaryPageView.php
@@ -8,14 +8,12 @@
99 $thread = Threads::withSummary( $this->article );
1010 if ( $thread ) {
1111 global $wgUser;
12 -
 12+
1313 $t = $thread->root()->getTitle();
1414 $link = $wgUser->getSkin()->link( $t );
15 - $this->output->setSubtitle( wfMsgExt(
16 - 'lqt_summary_subtitle',
17 - array( 'parseinline', 'replaceafter' ),
18 - $link )
19 - );
 15+ $this->output->setSubtitle(
 16+ wfMsgExt( 'lqt_summary_subtitle', array( 'parseinline', 'replaceafter' ),
 17+ $link ) );
2018 }
2119 return true;
2220 }
Index: trunk/extensions/LiquidThreads/pages/SpecialMergeThread.php
@@ -5,66 +5,70 @@
66
77 function getFormFields() {
88 $splitForm = array(
9 - 'src' => array(
10 - 'type' => 'info',
11 - 'label-message' => 'lqt-thread-merge-source',
12 - 'default' => $this->formatThreadField( 'src', $this->mThread->id() ),
13 - 'raw' => 1,
14 - ),
15 - 'dest' => array(
16 - 'type' => 'info',
17 - 'label-message' => 'lqt-thread-merge-dest',
18 - 'default' => $this->formatThreadField( 'dest', $this->request->getVal( 'dest' ) ),
19 - 'raw' => 1,
20 - ),
21 - 'reason' => array(
22 - 'label-message' => 'movereason',
23 - 'type' => 'text',
24 - )
 9+ 'src' =>
 10+ array(
 11+ 'type' => 'info',
 12+ 'label-message' => 'lqt-thread-merge-source',
 13+ 'default' => $this->formatThreadField( 'src', $this->mThread->id() ),
 14+ 'raw' => 1,
 15+ ),
 16+ 'dest' =>
 17+ array(
 18+ 'type' => 'info',
 19+ 'label-message' => 'lqt-thread-merge-dest',
 20+ 'default' =>
 21+ $this->formatThreadField( 'dest', $this->request->getVal( 'dest' ) ),
 22+ 'raw' => 1,
 23+ ),
 24+ 'reason' =>
 25+ array(
 26+ 'label-message' => 'movereason',
 27+ 'type' => 'text',
 28+ ),
2529 );
26 -
 30+
2731 return $splitForm;
2832 }
29 -
 33+
3034 protected function getRightRequirement() { return 'lqt-merge'; }
31 -
 35+
3236 public function checkParameters( $par ) {
3337 global $wgOut;
34 - if ( !parent::checkParameters( $par ) ) {
 38+ if ( !parent::checkParameters($par) ) {
3539 return false;
3640 }
37 -
 41+
3842 $dest = $this->request->getVal( 'dest' );
39 -
40 - if ( !$dest ) {
 43+
 44+ if (!$dest) {
4145 $wgOut->addWikiMsg( 'lqt_threadrequired' );
4246 return false;
4347 }
44 -
 48+
4549 $thread = Threads::withId( $dest );
46 -
47 - if ( !$thread ) {
 50+
 51+ if (!$thread) {
4852 $wgOut->addWikiMsg( 'lqt_nosuchthread' );
4953 return false;
5054 }
51 -
 55+
5256 $this->mDestThread = $thread;
53 -
 57+
5458 return true;
5559 }
5660
5761 function formatThreadField( $field, $threadid ) {
58 -
59 - if ( !is_object( $threadid ) ) {
 62+
 63+ if ( !is_object($threadid) ) {
6064 $t = Threads::withId( $threadid );
6165 } else {
6266 $t = $threadid;
6367 $threadid = $t->id();
6468 }
65 -
 69+
6670 $out = Xml::hidden( $field, $threadid );
6771 $out .= LqtView::permalink( $t );
68 -
 72+
6973 return $out;
7074 }
7175
@@ -75,63 +79,63 @@
7680 wfLoadExtensionMessages( 'LiquidThreads' );
7781 return wfMsg( 'lqt_merge_thread' );
7882 }
79 -
 83+
8084 function trySubmit( $data ) {
8185 // Load data
8286 $srcThread = $this->mThread;
8387 $dstThread = $this->mDestThread;
8488 $newSubject = $dstThread->subject();
8589 $reason = $data['reason'];
86 -
 90+
8791 $oldTopThread = $srcThread->topmostThread();
8892 $oldParent = $srcThread->superthread();
89 -
 93+
9094 $this->recursiveSet( $srcThread, $newSubject, $dstThread, $dstThread );
9195
9296 $dstThread->addReply( $srcThread );
93 -
94 - if ( $oldParent ) {
 97+
 98+ if ($oldParent) {
9599 $oldParent->removeReply( $srcThread );
96100 }
97 -
 101+
98102 $oldTopThread->commitRevision( Threads::CHANGE_MERGED_FROM, $srcThread, $reason );
99103 $dstThread->commitRevision( Threads::CHANGE_MERGED_TO, $srcThread, $reason );
100 -
 104+
101105 $srcTitle = clone $srcThread->article()->getTitle();
102 - $srcTitle->setFragment( '#' . $srcThread->getAnchorName() );
103 -
 106+ $srcTitle->setFragment( '#'.$srcThread->getAnchorName() );
 107+
104108 $dstTitle = clone $dstThread->article()->getTitle();
105 - $dstTitle->setFragment( '#' . $dstThread->getAnchorName() );
106 -
 109+ $dstTitle->setFragment( '#'.$dstThread->getAnchorName() );
 110+
107111 $srcLink = $this->user->getSkin()->link( $srcTitle, $srcThread->subject() );
108112 $dstLink = $this->user->getSkin()->link( $dstTitle, $dstThread->subject() );
109 -
 113+
110114 global $wgOut;
111115 $wgOut->addHTML( wfMsgExt( 'lqt-merge-success', array( 'parseinline', 'replaceafter' ),
112116 $srcLink, $dstLink ) );
113 -
 117+
114118 return true;
115119 }
116 -
 120+
117121 function recursiveSet( $thread, $subject, $ancestor, $superthread = false ) {
118122 $thread->setSubject( $subject );
119123 $thread->setAncestor( $ancestor->id() );
120 -
121 - if ( $superthread ) {
 124+
 125+ if ($superthread) {
122126 $thread->setSuperThread( $superthread );
123127 }
124 -
 128+
125129 $thread->save();
126 -
127 - foreach ( $thread->replies() as $subThread ) {
 130+
 131+ foreach( $thread->replies() as $subThread ) {
128132 $this->recursiveSet( $subThread, $subject, $ancestor );
129133 }
130134 }
131 -
 135+
132136 function getPageName() {
133137 return 'MergeThread';
134138 }
135 -
 139+
136140 function getSubmitText() {
137141 wfLoadExtensionMessages( 'LiquidThreads' );
138142 return wfMsg( 'lqt-merge-submit' );
Index: trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php
@@ -26,44 +26,30 @@
2727
2828 if ( $wgRequest->getVal( 'action' ) === 'edit' ) {
2929 wfLoadExtensionMessages( 'LiquidThreads' );
30 -
 30+
3131 $html = '';
32 -
33 - $warn_bold = Xml::tags(
34 - 'strong',
35 - null,
36 - wfMsgExt( 'lqt_header_warning_bold', 'parseinline' )
37 - );
38 -
39 - $warn_link = $this->talkpageLink(
40 - $wgTitle,
41 - wfMsgExt( 'lqt_header_warning_new_discussion', 'parseinline' ),
42 - 'talkpage_new_thread'
43 - );
44 -
45 - $html .= wfMsgExt(
46 - 'lqt_header_warning_before_big',
47 - array( 'parseinline', 'replaceafter' ),
48 - array( $warn_bold, $warn_link )
49 - );
50 - $html .= Xml::tags(
51 - 'big',
52 - null,
53 - wfMsgExt(
54 - 'lqt_header_warning_big',
55 - array( 'parseinline', 'replaceafter' ),
56 - array( $warn_bold, $warn_link )
57 - )
58 - );
 32+
 33+ $warn_bold = Xml::tags( 'strong', null,
 34+ wfMsgExt( 'lqt_header_warning_bold', 'parseinline' ) );
 35+
 36+ $warn_link =
 37+ $this->talkpageLink( $wgTitle, wfMsgExt( 'lqt_header_warning_new_discussion',
 38+ 'parseinline' ), 'talkpage_new_thread' );
 39+
 40+ $html .= wfMsgExt( 'lqt_header_warning_before_big',
 41+ array('parseinline', 'replaceafter' ),
 42+ array( $warn_bold, $warn_link ) );
 43+ $html .= Xml::tags( 'big', null,
 44+ wfMsgExt( 'lqt_header_warning_big',
 45+ array( 'parseinline', 'replaceafter' ),
 46+ array( $warn_bold, $warn_link ) ) );
5947 $html .= wfMsg( 'word-separator' );
60 - $html .= wfMsgExt(
61 - 'lqt_header_warning_after_big',
62 - array( 'parseinline', 'replaceafter' ),
63 - array( $warn_bold, $warn_link )
64 - );
65 -
 48+ $html .= wfMsgExt( 'lqt_header_warning_after_big',
 49+ array( 'parseinline', 'replaceafter' ),
 50+ array( $warn_bold, $warn_link ) );
 51+
6652 $html = Xml::tags( 'p', array( 'class' => 'lqt_header_warning' ), $html );
67 -
 53+
6854 $wgOut->addHTML( $html );
6955 }
7056
Index: trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php
@@ -16,16 +16,12 @@
1717 function customizeSubtitle() {
1818 wfLoadExtensionMessages( 'LiquidThreads' );
1919 $msg = wfMsgExt( 'lqt_hist_view_whole_thread', 'parseinline' );
20 - $threadhist = $this->permalink(
21 - $this->thread->topmostThread(),
22 - $msg,
23 - 'thread_history'
24 - );
25 - $this->output->setSubtitle(
26 - parent::getSubtitle() . '<br />' .
27 - $this->output->getSubtitle() .
28 - "<br />$threadhist"
29 - );
 20+ $threadhist = $this->permalink( $this->thread->topmostThread(),
 21+ $msg,
 22+ 'thread_history' );
 23+ $this->output->setSubtitle( parent::getSubtitle() . '<br />' .
 24+ $this->output->getSubtitle() .
 25+ "<br />$threadhist" );
3026 return true;
3127 }
3228
Index: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php
@@ -11,125 +11,119 @@
1212 wfLoadExtensionMessages( 'LiquidThreads' );
1313 return wfMsg( 'lqt_movethread' );
1414 }
15 -
 15+
1616 function getFormFields() {
17 - return array(
18 - 'dest-title' => array(
19 - 'label-message' => 'lqt_move_destinationtitle',
20 - 'type' => 'text',
21 - 'validation-callback' => array( $this, 'validateTarget' ),
22 - ),
23 - 'reason' => array(
24 - 'label-message' => 'movereason',
25 - 'type' => 'text',
26 - ),
27 - );
 17+ return
 18+ array(
 19+ 'dest-title' =>
 20+ array(
 21+ 'label-message' => 'lqt_move_destinationtitle',
 22+ 'type' => 'text',
 23+ 'validation-callback' => array( $this, 'validateTarget' ),
 24+ ),
 25+ 'reason' =>
 26+ array(
 27+ 'label-message' => 'movereason',
 28+ 'type' => 'text',
 29+ ),
 30+ );
2831 }
29 -
 32+
3033 function getPageName() { return 'MoveThread'; }
31 -
 34+
3235 function getSubmitText() {
3336 wfLoadExtensionMessages( 'LiquidThreads' );
3437 return wfMsg( 'lqt_move_move' );
3538 }
36 -
 39+
3740 function buildForm() {
3841 $form = parent::buildForm();
39 -
 42+
4043 // Generate introduction
4144 $intro = '';
42 -
 45+
4346 global $wgUser;
4447 $sk = $wgUser->getSkin();
4548 $page = $article_name = $this->mThread->article()->getTitle()->getPrefixedText();
46 -
 49+
4750 $edit_text = wfMsgExt( 'lqt_move_torename_edit', 'parseinline' );
48 - $edit_link = $sk->link(
49 - $this->mThread->title(),
50 - $edit_text,
51 - array(),
52 - array( 'lqt_method' => 'edit', 'lqt_operand' => $this->mThread->id() )
53 - );
54 -
55 - $intro .= wfMsgExt(
56 - 'lqt_move_movingthread',
57 - 'parse',
58 - array( '[[' . $this->mTarget . ']]', '[[' . $page . ']]' )
59 - );
60 - $intro .= wfMsgExt(
61 - 'lqt_move_torename',
62 - array( 'parse', 'replaceafter' ),
63 - array( $edit_link )
64 - );
65 -
 51+ $edit_link = $sk->link( $this->mThread->title(), $edit_text, array(),
 52+ array( 'lqt_method' => 'edit', 'lqt_operand' => $this->mThread->id() ) );
 53+
 54+ $intro .= wfMsgExt( 'lqt_move_movingthread', 'parse',
 55+ array('[['.$this->mTarget.']]', '[['.$page.']]') );
 56+ $intro .= wfMsgExt( 'lqt_move_torename', array( 'parse', 'replaceafter' ),
 57+ array( $edit_link ) );
 58+
6659 $form->setIntro( $intro );
67 -
 60+
6861 return $form;
6962 }
70 -
 63+
7164 function checkUserRights( $oldTitle, $newTitle ) {
7265 global $wgUser, $wgOut;
73 -
 66+
7467 $oldErrors = $oldTitle->getUserPermissionsErrors( 'move', $wgUser );
7568 $newErrors = $newTitle->getUserPermissionsErrors( 'move', $wgUser );
76 -
 69+
7770 // Custom merge/unique function because we don't have the second parameter to
7871 // array_unique on Wikimedia.
7972 $mergedErrors = array();
80 - foreach ( array_merge( $oldErrors, $newErrors ) as $key => $value ) {
81 - if ( !is_numeric( $key ) ) {
 73+ foreach( array_merge( $oldErrors, $newErrors ) as $key => $value ) {
 74+ if ( !is_numeric($key) ) {
8275 $mergedErrors[$key] = $value;
8376 } elseif ( !in_array( $value, $mergedErrors ) ) {
8477 $mergedErrors[] = $value;
8578 }
8679 }
87 -
88 - if ( count( $mergedErrors ) > 0 ) {
89 - return $wgOut->parse(
90 - $wgOut->formatPermissionsErrorMessage( $mergedErrors, 'move' )
91 - );
 80+
 81+ if ( count($mergedErrors) > 0 ) {
 82+ return $wgOut->parse(
 83+ $wgOut->formatPermissionsErrorMessage( $mergedErrors, 'move' )
 84+ );
9285 }
9386
9487 return true;
9588 }
96 -
 89+
9790 function trySubmit( $data ) {
9891 // Load data
9992 $tmp = $data['dest-title'];
10093 $newtitle = Title::newFromText( $tmp );
10194 $reason = $data['reason'];
102 -
 95+
10396 $rightsResult = $this->checkUserRights( $this->mThread->title(), $newtitle );
104 -
105 - if ( $rightsResult !== true )
 97+
 98+ if ($rightsResult !== true)
10699 return $rightsResult;
107100
108101 // TODO no status code from this method.
109102 $this->mThread->moveToPage( $newtitle, $reason, true );
110 -
 103+
111104 global $wgOut, $wgUser;
112105 $sk = $wgUser->getSkin();
113106 $wgOut->addHTML( wfMsgExt( 'lqt_move_success', array( 'parse', 'replaceafter' ),
114107 array( $sk->link( $newtitle ) ) ) );
115 -
 108+
116109 return true;
117110 }
118 -
 111+
119112 function validateTarget( $target ) {
120 - if ( !$target ) {
 113+ if (!$target) {
121114 return wfMsgExt( 'lqt_move_nodestination', 'parseinline' );
122115 }
123 -
 116+
124117 $title = Title::newFromText( $target );
125 -
 118+
126119 if ( !$title || !LqtDispatch::isLqtPage( $title ) ) {
127120 return wfMsgExt( 'lqt_move_thread_bad_destination', 'parseinline' );
128121 }
129 -
 122+
130123 if ( $title->equals( $this->mThread->article()->getTitle() ) ) {
131124 return wfMsgExt( 'lqt_move_samedestination', 'parseinline' );
132125 }
133 -
 126+
134127 return true;
135128 }
 129+
136130 }
Index: trunk/extensions/LiquidThreads/pages/ThreadActionPage.php
@@ -6,40 +6,40 @@
77 function __construct() {
88 parent::__construct( $this->getPageName(), $this->getRightRequirement() );
99 $this->includable( false );
10 -
 10+
1111 global $wgOut, $wgUser, $wgRequest;
1212 $this->output = $wgOut;
1313 $this->user = $wgUser;
1414 $this->request = $wgRequest;
1515 }
16 -
 16+
1717 abstract function getPageName();
18 -
 18+
1919 abstract function getFormFields();
20 -
 20+
2121 protected function getRightRequirement() { return ''; }
2222
2323 function execute( $par ) {
2424 wfLoadExtensionMessages( 'LiquidThreads' );
25 -
 25+
2626 global $wgOut, $wgUser;
27 -
 27+
2828 if ( !$this->userCanExecute( $wgUser ) ) {
2929 $this->displayRestrictionError();
3030 return;
3131 }
32 -
 32+
3333 // Page title
3434 $wgOut->setPageTitle( $this->getDescription() );
35 -
36 - if ( !$this->checkParameters( $par ) ) {
 35+
 36+ if ( !$this->checkParameters($par) ) {
3737 return;
3838 }
39 -
 39+
4040 $form = $this->buildForm();
4141 $form->show();
4242 }
43 -
 43+
4444 // Loads stuff like the thread and so on
4545 function checkParameters( $par ) {
4646 // Handle parameter
@@ -49,31 +49,32 @@
5050 $this->output->addHTML( wfMsg( 'lqt_threadrequired' ) );
5151 return false;
5252 }
53 -
 53+
5454 $thread = Threads::withRoot( new Article( Title::newFromURL( $par ) ) );
5555 if ( !$thread ) {
5656 $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) );
5757 return false;
5858 }
59 -
 59+
6060 $this->mThread = $thread;
61 -
 61+
6262 return true;
6363 }
64 -
 64+
6565 abstract function getSubmitText();
66 -
 66+
6767 function buildForm() {
68 - $form = new HTMLForm( $this->getFormFields(), 'lqt-' . $this->getPageName() );
69 -
 68+ $form = new HTMLForm( $this->getFormFields(), 'lqt-'.$this->getPageName() );
 69+
7070 $par = $this->mThread->title()->getPrefixedText();
71 -
 71+
7272 $form->setSubmitText( $this->getSubmitText() );
7373 $form->setTitle( SpecialPage::getTitleFor( $this->getPageName(), $par ) );
7474 $form->setSubmitCallback( array( $this, 'trySubmit' ) );
75 -
 75+
7676 return $form;
7777 }
 78+
 79+ abstract function trySubmit( $data );
7880
79 - abstract function trySubmit( $data );
8081 }
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php
@@ -3,6 +3,7 @@
44 if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadHistoricalRevisionView extends ThreadPermalinkView {
 7+
78 public $mDisplayRevision = null;
89
910 /* TOOD: customize tabs so that History is highlighted. */
@@ -11,16 +12,16 @@
1213 $changedObject = $this->mDisplayRevision->getChangeObject();
1314 $is_changed_thread = $changedObject &&
1415 ( $changedObject->id() == $thread->id() );
15 -
 16+
1617 $class = parent::postDivClass( $thread );
17 -
 18+
1819 if ( $is_changed_thread ) {
1920 return "$class lqt_post_changed_by_history";
2021 } else {
2122 return $class;
2223 }
2324 }
24 -
 25+
2526 function getMessageForChangeType( $ct ) {
2627 static $messages = array(
2728 Threads::CHANGE_NEW_THREAD => 'lqt_change_new_thread',
@@ -35,11 +36,11 @@
3637 Threads::CHANGE_SPLIT_FROM => 'lqt_change_split_from',
3738 Threads::CHANGE_EDITED_SUMMARY => 'lqt_change_edited_summary',
3839 );
39 -
40 - if ( isset( $messages[$ct] ) ) {
 40+
 41+ if ( isset($messages[$ct]) ) {
4142 return $messages[$ct];
4243 }
43 -
 44+
4445 return '';
4546 }
4647
@@ -48,38 +49,33 @@
4950 wfLoadExtensionMessages( 'LiquidThreads' );
5051
5152 $html = '';
52 - $html .= wfMsgExt(
53 - 'lqt_revision_as_of', 'parseinline',
54 - array(
55 - $wgLang->timeanddate( $this->mDisplayRevision->getTimestamp() ),
56 - $wgLang->date( $this->mDisplayRevision->getTimestamp() ),
57 - $wgLang->time( $this->mDisplayRevision->getTimestamp() )
58 - )
59 - );
60 -
 53+ $html .= wfMsgExt( 'lqt_revision_as_of', 'parseinline',
 54+ array(
 55+ $wgLang->timeanddate( $this->mDisplayRevision->getTimestamp() ),
 56+ $wgLang->date( $this->mDisplayRevision->getTimestamp() ),
 57+ $wgLang->time( $this->mDisplayRevision->getTimestamp() )
 58+ )
 59+ );
 60+
6161 $html .= '<br/>';
6262
6363 $ct = $this->mDisplayRevision->getChangeType();
64 -
 64+
6565 $msg = '';
6666 if ( $ct == Threads::CHANGE_EDITED_ROOT ) {
67 - $diff_link = $this->diffPermalink(
68 - $this->thread,
69 - wfMsgExt( 'diff', 'parseinline' ),
70 - $this->mDisplayRevision
71 - );
72 - $msg = wfMsgExt(
73 - 'lqt_change_edited_root',
74 - 'parseinline'
75 - ) . " [$diff_link]";
 67+ $diff_link = $this->diffPermalink( $this->thread,
 68+ wfMsgExt( 'diff', 'parseinline' ),
 69+ $this->mDisplayRevision );
 70+ $msg = wfMsgExt( 'lqt_change_edited_root', 'parseinline' ) .
 71+ " [$diff_link]";
7672 } else {
77 - $msg = wfMsgExt( $this->getMessageForChangeType( $ct ), 'parseinline' );
 73+ $msg = wfMsgExt( $this->getMessageForChangeType($ct), 'parseinline' );
7874 }
79 -
 75+
8076 $html .= $msg;
81 -
 77+
8278 $html = Xml::tags( 'div', array( 'class' => 'lqt_history_info' ), $html );
83 -
 79+
8480 $this->output->addHTML( $html );
8581 }
8682
@@ -88,12 +84,12 @@
8985 $this->showMissingThreadPage();
9086 return false;
9187 }
92 -
 88+
9389 $oldid = $this->request->getInt( 'lqt_oldid' );
9490 $this->mDisplayRevision = ThreadRevision::loadFromId( $oldid );
9591
9692 $this->thread = $this->mDisplayRevision->getThreadObj();
97 -
 93+
9894 $this->showHistoryInfo();
9995 parent::show();
10096 return false;
Index: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php
@@ -10,13 +10,13 @@
1111 // Insert fake 'article' and 'discussion' tabs before the thread tab.
1212 // If you call the key 'talk', the url gets re-set later. TODO:
1313 // the access key for the talk tab doesn't work.
14 - if ( $this->thread ) {
 14+ if ($this->thread) {
1515 $article_t = $this->thread->article()->getTitle();
1616 $talk_t = $this->thread->article()->getTitle();
1717 } else {
1818 return true;
1919 }
20 -
 20+
2121 $articleTab =
2222 array(
2323 'text' => wfMsg( $article_t->getNamespaceKey() ),
@@ -24,27 +24,27 @@
2525 'class' => $article_t->exists() ? '' : 'new'
2626 );
2727 efInsertIntoAssoc( 'article', $articleTab, 'nstab-thread', $content_actions );
28 -
 28+
2929 $talkTab =
3030 array(
3131 // talkpage certainly exists since this thread is from it.
3232 'text' => wfMsg( 'talk' ),
3333 'href' => $talk_t->getFullURL()
3434 );
35 -
 35+
3636 efInsertIntoAssoc( 'not_talk', $talkTab, 'nstab-thread', $content_actions );
3737
3838 unset( $content_actions['edit'] );
3939 unset( $content_actions['viewsource'] );
4040 unset( $content_actions['talk'] );
41 -
 41+
4242 $subpage = $this->thread->title()->getPrefixedText();
43 -
 43+
4444 if ( array_key_exists( 'move', $content_actions ) && $this->thread ) {
4545 $content_actions['move']['href'] =
4646 SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
4747 }
48 -
 48+
4949 if ( array_key_exists( 'delete', $content_actions ) && $this->thread ) {
5050 $content_actions['delete']['href'] =
5151 $this->thread->title()->getFullURL( 'action=delete' );
@@ -77,39 +77,33 @@
7878
7979 function getSubtitle() {
8080 wfLoadExtensionMessages( 'LiquidThreads' );
81 -
 81+
8282 $sk = $this->user->getSkin();
83 - $fragment = '#' . $this->anchorName( $this->thread );
84 -
 83+ $fragment = '#'.$this->anchorName( $this->thread );
 84+
8585 if ( $this->thread->isHistorical() ) {
8686 // TODO: Point to the relevant part of the archive.
8787 $query = '';
8888 } else {
8989 $query = '';
9090 }
91 -
 91+
9292 $talkpage = $this->thread->article()->getTitle();
9393 $talkpage->setFragment( $fragment );
9494 $talkpage_link = $sk->link( $talkpage );
95 -
 95+
9696 if ( $this->thread->hasSuperthread() ) {
9797 $topmostTitle = $this->thread->topmostThread()->title();
9898 $topmostTitle->setFragment( $fragment );
99 -
 99+
100100 $linkText = wfMsgExt( 'lqt_discussion_link', 'parseinline' );
101101 $permalink = $sk->link( $topmostTitle, $linkText );
102 -
103 - return wfMsgExt(
104 - 'lqt_fragment',
105 - array( 'parseinline', 'replaceafter' ),
106 - array( $permalink, $talkpage_link )
107 - );
 102+
 103+ return wfMsgExt( 'lqt_fragment', array('parseinline', 'replaceafter'),
 104+ array( $permalink, $talkpage_link ) );
108105 } else {
109 - return wfMsgExt(
110 - 'lqt_from_talk',
111 - array( 'parseinline', 'replaceafter' ),
112 - array( $talkpage_link )
113 - );
 106+ return wfMsgExt( 'lqt_from_talk', array('parseinline', 'replaceafter'),
 107+ array($talkpage_link) );
114108 }
115109 }
116110
@@ -118,7 +112,7 @@
119113 parent::__construct( $output, $article, $title, $user, $request );
120114
121115 $t = Threads::withRoot( $this->article );
122 -
 116+
123117 $this->thread = $t;
124118 if ( !$t ) {
125119 return; // error reporting is handled in show(). this kinda sucks.
@@ -138,7 +132,7 @@
139133 $this->showMissingThreadPage();
140134 return false;
141135 }
142 -
 136+
143137 if ( $this->request->getBool( 'lqt_inline' ) ) {
144138 $this->doInlineEditForm();
145139 return false;
@@ -152,8 +146,8 @@
153147 elseif ( $this->methodApplies( 'split' ) )
154148 $this->showSplitForm( $this->thread );
155149
156 - $this->showThread( $this->thread, 1, 1, array( 'maxDepth' => - 1, 'maxCount' => - 1 ) );
157 -
 150+ $this->showThread( $this->thread, 1, 1, array( 'maxDepth' => -1, 'maxCount' => -1 ) );
 151+
158152 $this->output->setPageTitle( $this->thread->subject() );
159153 return false;
160154 }
Index: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php
@@ -13,15 +13,10 @@
1414 $html = '';
1515 $html .= Xml::hidden( 'lqt_method', 'mark_as_read' );
1616 $html .= Xml::hidden( 'lqt_operand', $ids_s );
17 - $html .= Xml::submitButton(
18 - $label,
19 - array(
20 - 'name' => 'lqt_read_button',
21 - 'title' => $title
22 - )
23 - );
 17+ $html .= Xml::submitButton( $label, array( 'name' => 'lqt_read_button',
 18+ 'title' => $title ) );
2419 $html = Xml::tags( 'form', array( 'method' => 'post', 'class' => $class ), $html );
25 -
 20+
2621 return $html;
2722 }
2823
@@ -29,56 +24,49 @@
3025 wfLoadExtensionMessages( 'LiquidThreads' );
3126 $ids = array_map( create_function( '$t', 'return $t->id();' ), $threads ); // ew
3227 return $this->htmlForReadButton(
33 - wfMsg( 'lqt-read-all' ),
34 - wfMsg( 'lqt-read-all-tooltip' ),
35 - "lqt_newmessages_read_all_button",
36 - $ids
37 - );
 28+ wfMsg( 'lqt-read-all' ),
 29+ wfMsg( 'lqt-read-all-tooltip' ),
 30+ "lqt_newmessages_read_all_button",
 31+ $ids
 32+ );
3833 }
3934
4035 function getUndoButton( $ids ) {
4136 wfLoadExtensionMessages( 'LiquidThreads' );
42 -
 37+
4338 if ( count( $ids ) == 1 ) {
4439 $t = Threads::withId( $ids[0] );
4540 if ( !$t )
4641 return; // empty or just bogus operand.
47 - $msg = wfMsgExt( 'lqt-marked-read', 'parseinline', array( $t->subject() ) );
 42+ $msg = wfMsgExt( 'lqt-marked-read', 'parseinline', array($t->subject()) );
4843 } else {
4944 $count = count( $ids );
50 - $msg = wfMsgExt( 'lqt-count-marked-read', 'parseinline', array( $count ) );
 45+ $msg = wfMsgExt( 'lqt-count-marked-read', 'parseinline', array($count) );
5146 }
5247 $operand = implode( ',', $ids );
53 -
 48+
5449 $html = '';
5550 $html .= $msg;
5651 $html .= Xml::hidden( 'lqt_method', 'mark_as_unread' );
5752 $html .= Xml::hidden( 'lqt_operand', $operand );
58 - $html .= Xml::submitButton(
59 - wfMsg( 'lqt-email-undo' ),
60 - array(
61 - 'name' => 'lqt_read_button',
62 - 'title' => wfMsg( 'lqt-email-info-undo' )
63 - )
64 - );
65 -
66 - $html = Xml::tags(
67 - 'form',
68 - array( 'method' => 'post', 'class' => 'lqt_undo_mark_as_read' ),
69 - $html
70 - );
71 -
 53+ $html .= Xml::submitButton( wfMsg('lqt-email-undo'), array( 'name' => 'lqt_read_button',
 54+ 'title' => wfMsg( 'lqt-email-info-undo' ) ) );
 55+
 56+ $html = Xml::tags( 'form',
 57+ array( 'method' => 'post', 'class' => 'lqt_undo_mark_as_read' ),
 58+ $html );
 59+
7260 return $html;
7361 }
7462
7563 function postDivClass( $thread ) {
7664 $origClass = parent::postDivClass( $thread );
77 -
 65+
7866 $topid = $thread->topmostThread()->id();
79 -
 67+
8068 if ( in_array( $thread->id(), $this->targets[$topid] ) )
8169 return "$origClass lqt_post_new_message";
82 -
 70+
8371 return $origClass;
8472 }
8573
@@ -94,13 +82,11 @@
9583
9684 if ( $this->request->wasPosted() && $this->methodApplies( 'mark_as_unread' ) ) {
9785 $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) );
98 -
 86+
9987 if ( $ids !== false ) {
10088 foreach ( $ids as $id ) {
101 - $tmp_thread = Threads::withId( $id );
102 - if ( $tmp_thread ) {
 89+ $tmp_thread = Threads::withId( $id ); if ( $tmp_thread )
10390 NewMessages::markThreadAsUnReadByUser( $tmp_thread, $this->user );
104 - }
10591 }
10692 $this->output->redirect( $this->title->getFullURL() );
10793 }
@@ -109,9 +95,8 @@
11096 if ( $ids !== false ) {
11197 foreach ( $ids as $id ) {
11298 $tmp_thread = Threads::withId( $id );
113 - if ( $tmp_thread ) {
 99+ if ( $tmp_thread )
114100 NewMessages::markThreadAsReadByUser( $tmp_thread, $this->user );
115 - }
116101 }
117102 $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode( ',', $ids );
118103 $this->output->redirect( $this->title->getFullURL( $query ) );
@@ -126,7 +111,7 @@
127112 if ( ! is_array( $this->threads ) ) {
128113 throw new MWException( 'You must use NewUserMessagesView::setThreads() before calling NewUserMessagesView::show().' );
129114 }
130 -
 115+
131116 if ( $this->request->getBool( 'lqt_inline' ) ) {
132117 $this->doInlineEditForm();
133118 return false;
@@ -139,10 +124,10 @@
140125 $this->tops = array();
141126 foreach ( $this->threads as $t ) {
142127 $top = $t->topmostThread();
143 -
 128+
144129 // It seems that in some cases $top is zero.
145 - if ( !$top )
146 - throw new MWException( "{$t->id()} seems to have no topmost thread" );
 130+ if (!$top)
 131+ throw new MWException("{$t->id()} seems to have no topmost thread");
147132
148133 if ( !array_key_exists( $top->id(), $this->tops ) )
149134 $this->tops[$top->id()] = $top;
@@ -150,7 +135,7 @@
151136 $this->targets[$top->id()] = array();
152137 $this->targets[$top->id()][] = $t->id();
153138 }
154 -
 139+
155140 $this->output->addHTML( '<table><tbody>' );
156141
157142 foreach ( $this->tops as $t ) {
@@ -160,39 +145,34 @@
161146
162147 $this->showWrappedThread( $t );
163148 }
164 -
 149+
165150 $this->output->addHTML( '</tbody></table>' );
166 -
 151+
167152 return false;
168153 }
169 -
 154+
170155 function showWrappedThread( $t ) {
171156 wfLoadExtensionMessages( 'LiquidThreads' );
172 -
 157+
173158 $read_button = $this->htmlForReadButton(
174159 wfMsg( 'lqt-read-message' ),
175160 wfMsg( 'lqt-read-message-tooltip' ),
176161 'lqt_newmessages_read_button',
177162 $this->targets[$t->id()] );
178 -
 163+
179164 // Left-hand column � read button and context link to the full thread.
180165 $topmostThread = $t->topmostThread();
181 - $contextLink = self::permalink(
182 - $topmostThread,
183 - wfMsgExt( 'lqt-newmessages-context', 'parseinline' )
184 - );
 166+ $contextLink = self::permalink( $topmostThread,
 167+ wfMsgExt( 'lqt-newmessages-context', 'parseinline' ) );
185168 $leftColumn = Xml::tags( 'p', null, $read_button ) .
186169 Xml::tags( 'p', null, $contextLink );
187 - $leftColumn = Xml::tags(
188 - 'td',
189 - array( 'class' => 'mw-lqt-newmessages-left' ),
190 - $leftColumn
191 - );
 170+ $leftColumn = Xml::tags( 'td', array( 'class' => 'mw-lqt-newmessages-left' ),
 171+ $leftColumn );
192172 $html = "<tr>$leftColumn<td>";
193173 $this->output->addHTML( $html );
194174
195175 $this->showThread( $t );
196 -
 176+
197177 $this->output->addHTML( "</td></tr>" );
198178 }
199179
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php
@@ -13,90 +13,92 @@
1414 }
1515 self::addJSandCSS();
1616 wfLoadExtensionMessages( 'LiquidThreads' );
17 -
 17+
1818 $this->thread->updateHistory();
1919
2020 $this->output->setPageTitle( wfMsg( 'lqt-history-title' ) );
2121 $this->output->setSubtitle( $this->getSubtitle() . '<br />' .
2222 wfMsg( 'lqt_hist_listing_subtitle' ) );
2323 $this->showThreadHeading( $this->thread );
24 -
 24+
2525 $pager = new ThreadHistoryPager( $this, $this->thread );
26 -
 26+
2727 $html = $pager->getNavigationBar() .
2828 $pager->getBody() .
2929 $pager->getNavigationBar();
30 -
 30+
3131 $this->output->addHTML( $html );
32 -
 32+
3333 $this->showThread( $this->thread );
34 -
 34+
3535 return false;
3636 }
3737 }
3838
3939 class ThreadHistoryPager extends TablePager {
4040 static $change_names;
 41+
4142
42 -
4343 function __construct( $view, $thread ) {
4444 parent::__construct();
45 -
 45+
4646 $this->thread = $thread;
4747 $this->view = $view;
48 -
49 - self::$change_names = array(
50 - Threads::CHANGE_EDITED_ROOT => wfMsgNoTrans( 'lqt_hist_comment_edited' ),
51 - Threads::CHANGE_EDITED_SUMMARY => wfMsgNoTrans( 'lqt_hist_summary_changed' ),
52 - Threads::CHANGE_REPLY_CREATED => wfMsgNoTrans( 'lqt_hist_reply_created' ),
53 - Threads::CHANGE_NEW_THREAD => wfMsgNoTrans( 'lqt_hist_thread_created' ),
54 - Threads::CHANGE_DELETED => wfMsgNoTrans( 'lqt_hist_deleted' ),
55 - Threads::CHANGE_UNDELETED => wfMsgNoTrans( 'lqt_hist_undeleted' ),
56 - Threads::CHANGE_MOVED_TALKPAGE => wfMsgNoTrans( 'lqt_hist_moved_talkpage' ),
57 - Threads::CHANGE_EDITED_SUBJECT => wfMsgNoTrans( 'lqt_hist_edited_subject' ),
58 - Threads::CHANGE_SPLIT => wfMsgNoTrans( 'lqt_hist_split' ),
59 - Threads::CHANGE_MERGED_FROM => wfMsgNoTrans( 'lqt_hist_merged_from' ),
60 - Threads::CHANGE_MERGED_TO => wfMsgNoTrans( 'lqt_hist_merged_to' ),
61 - Threads::CHANGE_SPLIT_FROM => wfMsgNoTrans( 'lqt_hist_split_from' ),
62 - );
 48+
 49+ self::$change_names =
 50+ array(
 51+ Threads::CHANGE_EDITED_ROOT => wfMsgNoTrans( 'lqt_hist_comment_edited' ),
 52+ Threads::CHANGE_EDITED_SUMMARY => wfMsgNoTrans( 'lqt_hist_summary_changed' ),
 53+ Threads::CHANGE_REPLY_CREATED => wfMsgNoTrans( 'lqt_hist_reply_created' ),
 54+ Threads::CHANGE_NEW_THREAD => wfMsgNoTrans( 'lqt_hist_thread_created' ),
 55+ Threads::CHANGE_DELETED => wfMsgNoTrans( 'lqt_hist_deleted' ),
 56+ Threads::CHANGE_UNDELETED => wfMsgNoTrans( 'lqt_hist_undeleted' ),
 57+ Threads::CHANGE_MOVED_TALKPAGE => wfMsgNoTrans( 'lqt_hist_moved_talkpage' ),
 58+ Threads::CHANGE_EDITED_SUBJECT => wfMsgNoTrans( 'lqt_hist_edited_subject' ),
 59+ Threads::CHANGE_SPLIT => wfMsgNoTrans( 'lqt_hist_split' ),
 60+ Threads::CHANGE_MERGED_FROM => wfMsgNoTrans( 'lqt_hist_merged_from' ),
 61+ Threads::CHANGE_MERGED_TO => wfMsgNoTrans( 'lqt_hist_merged_to' ),
 62+ Threads::CHANGE_SPLIT_FROM => wfMsgNoTrans( 'lqt_hist_split_from' ),
 63+ );
6364 }
64 -
 65+
6566 function getQueryInfo() {
66 - $queryInfo = array(
67 - 'tables' => array( 'thread_history' ),
68 - 'fields' => '*',
69 - 'conds' => array( 'th_thread' => $this->thread->id() ),
70 - 'options' => array( 'order by' => 'th_timestamp desc' ),
71 - );
72 -
 67+ $queryInfo =
 68+ array(
 69+ 'tables' => array( 'thread_history' ),
 70+ 'fields' => '*',
 71+ 'conds' => array( 'th_thread' => $this->thread->id() ),
 72+ 'options' => array( 'order by' => 'th_timestamp desc' ),
 73+ );
 74+
7375 return $queryInfo;
7476 }
75 -
 77+
7678 function getFieldNames() {
7779 static $headers = null;
7880
79 - if ( !empty( $headers ) ) {
 81+ if (!empty($headers)) {
8082 return $headers;
8183 }
8284
83 - $headers = array(
84 - 'th_timestamp' => 'lqt-history-time',
85 - 'th_user_text' => 'lqt-history-user',
 85+ $headers = array(
 86+ 'th_timestamp' => 'lqt-history-time',
 87+ 'th_user_text' => 'lqt-history-user',
8688 'th_change_type' => 'lqt-history-action',
87 - 'th_change_comment' => 'lqt-history-comment',
88 - );
 89+ 'th_change_comment' => 'lqt-history-comment',
 90+ );
8991
9092 $headers = array_map( 'wfMsg', $headers );
9193
9294 return $headers;
9395 }
94 -
 96+
9597 function formatValue( $name, $value ) {
96 - global $wgOut, $wgLang, $wgTitle;
 98+ global $wgOut,$wgLang, $wgTitle;
9799
98 - static $sk = null;
 100+ static $sk=null;
99101
100 - if ( empty( $sk ) ) {
 102+ if (empty($sk)) {
101103 global $wgUser;
102104 $sk = $wgUser->getSkin();
103105 }
@@ -105,7 +107,7 @@
106108
107109 $formatted = '';
108110
109 - switch( $name ) {
 111+ switch($name) {
110112 case 'th_timestamp':
111113 $formatted = $wgLang->timeanddate( $value );
112114 return $sk->link( $wgTitle, $formatted, array(),
@@ -122,19 +124,20 @@
123125 break;
124126 }
125127 }
126 -
 128+
127129 function getIndexField() {
128130 return 'th_timestamp';
129131 }
130 -
 132+
131133 function getDefaultSort() {
132134 return 'th_timestamp';
133135 }
134136
135 - function isFieldSortable( $name ) {
 137+ function isFieldSortable($name) {
136138 $sortable_fields = array( 'th_timestamp', 'th_user_text', 'th_change_type' );
137139 return in_array( $name, $sortable_fields );
138140 }
139 -
 141+
140142 function getDefaultDirections() { return true; /* descending */ }
141143 }
 144+
Index: trunk/extensions/LiquidThreads/migrateDatabase.php
@@ -3,73 +3,71 @@
44 // Utility script to update your LiquidThreads installation by batch-running lazy updates
55 // normally done on-demand when a thread is loaded. Also runs any necessary database updates.
66
7 -require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
8 - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
 7+require_once ( getenv('MW_INSTALL_PATH') !== false
 8+ ? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc"
99 : dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
10 -
 10+
1111 $db = wfGetDB( DB_MASTER );
1212
1313 // Do database updates
14 -$threadFieldUpdates = array(
15 - 'thread_article_namespace' => 'split-thread_article.sql',
16 - 'thread_article_title' => 'split-thread_article.sql',
17 - 'thread_ancestor' => 'normalise-ancestry.sql',
18 - 'thread_parent' => 'normalise-ancestry.sql',
19 - 'thread_modified' => 'split-timestamps.sql',
20 - 'thread_created' => 'split-timestamps.sql',
21 - 'thread_editedness' => 'store-editedness.sql',
22 - 'thread_subject' => 'store_subject-author.sql',
23 - 'thread_author_id' => 'store_subject-author.sql',
24 - 'thread_author_name' => 'store_subject-author.sql',
25 -);
26 -$threadIndexUpdates = array( 'thread_summary_page' => 'index-summary_page.sql' );
 14+$threadFieldUpdates = array('thread_article_namespace' => 'split-thread_article.sql',
 15+ 'thread_article_title' => 'split-thread_article.sql',
 16+ 'thread_ancestor' => 'normalise-ancestry.sql',
 17+ 'thread_parent' => 'normalise-ancestry.sql',
 18+ 'thread_modified' => 'split-timestamps.sql',
 19+ 'thread_created' => 'split-timestamps.sql',
 20+ 'thread_editedness' => 'store-editedness.sql',
 21+ 'thread_subject' => 'store_subject-author.sql',
 22+ 'thread_author_id' => 'store_subject-author.sql',
 23+ 'thread_author_name' => 'store_subject-author.sql',
 24+ );
 25+$threadIndexUpdates = array('thread_summary_page' => 'index-summary_page.sql');
2726
2827 $newTableUpdates = array( 'thread_history' => 'thread_history_table.sql' );
2928
30 -foreach ( $threadFieldUpdates as $field => $patch ) {
31 - if ( !$db->fieldExists( 'thread', $field, 'lqt-update-script' ) ) {
32 - dbsource( dirname( __FILE__ ) . '/schema-changes/' . $patch );
 29+foreach( $threadFieldUpdates as $field => $patch ) {
 30+ if (!$db->fieldExists( 'thread', $field, 'lqt-update-script' ) ) {
 31+ dbsource( dirname( __FILE__ ).'/schema-changes/'.$patch );
3332 }
3433 }
3534
36 -foreach ( $threadIndexUpdates as $index => $patch ) {
37 - if ( !$db->indexExists( 'thread', $index, 'lqt-update-script' ) ) {
38 - dbsource( dirname( __FILE__ ) . '/schema-changes/' . $patch );
 35+foreach( $threadIndexUpdates as $index => $patch ) {
 36+ if (!$db->indexExists( 'thread', $index, 'lqt-update-script' ) ) {
 37+ dbsource( dirname( __FILE__ ).'/schema-changes/'.$patch );
3938 }
4039 }
4140
42 -foreach ( $newTableUpdates as $table => $patch ) {
43 - if ( !$db->tableExists( $table, 'lqt-update-script' ) ) {
44 - dbsource( dirname( __FILE__ ) . '/schema-changes/' . $patch );
 41+foreach( $newTableUpdates as $table => $patch ) {
 42+ if (!$db->tableExists( $table, 'lqt-update-script' ) ) {
 43+ dbsource( dirname( __FILE__ ).'/schema-changes/'.$patch );
4544 }
4645 }
4746
 47+
4848 // Batch lazy updates
4949 $upTo = $lastUpTo = 0;
5050
5151 do {
5252 $lastUpTo = $upTo;
53 -
 53+
5454 $db->begin();
55 -
 55+
5656 // Read 500 rows
57 - $res = $db->select(
58 - 'thread', '*', array( 'thread_id>' . $db->addQuotes( $upTo ) ),
59 - 'lqt-update-script', array( 'LIMIT' => 500, 'FOR UPDATE',
60 - 'ORDER BY' => 'thread_id asc' )
61 - );
62 -
 57+ $res = $db->select( 'thread', '*', array( 'thread_id>'.$db->addQuotes($upTo ) ),
 58+ 'lqt-update-script', array( 'LIMIT' => 500, 'FOR UPDATE',
 59+ 'ORDER BY' => 'thread_id asc' ) );
 60+
6361 $threads = Threads::loadFromResult( $res, $db );
64 -
65 - foreach ( $threads as $thread ) {
 62+
 63+ foreach( $threads as $thread ) {
6664 $thread->doLazyUpdates();
6765 $thread->updateHistory();
68 -
 66+
6967 if ( $thread->id() > $upTo ) {
7068 $upTo = $thread->id();
7169 }
7270 }
73 -
 71+
7472 $db->commit();
75 -
 73+
7674 } while ( $lastUpTo != $upTo );
Property changes on: trunk/extensions/LiquidThreads/api/ApiFeedLQTThreads.php
___________________________________________________________________
Deleted: svn:eol-style
7775 - native
Index: trunk/extensions/LiquidThreads/LqtFunctions.php
@@ -19,7 +19,7 @@
2020 * Recreate the original associative array so that a new pair with the given key
2121 * and value is inserted before the given existing key. $original_array gets
2222 * modified in-place.
23 - */
 23+*/
2424 function efInsertIntoAssoc( $new_key, $new_value, $before, &$original_array ) {
2525 $ordered = array();
2626 $i = 0;
@@ -44,7 +44,7 @@
4545
4646 function lqtSetupParserFunctions() {
4747 global $wgParser;
48 -
 48+
4949 $wgParser->setFunctionHook( 'useliquidthreads',
5050 array( 'LqtParserFunctions', 'useLiquidThreads' ) );
5151 return true;
Index: trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php
@@ -183,7 +183,7 @@
184184 'lqt-thread-split' => 'Split to new thread',
185185 'lqt-split-success' => 'You have successfully split off the thread $1.',
186186 'lqt_split_thread' => 'Split a thread',
187 - 'lqt-thread-split-subject' => 'New thread subject:',
 187+ 'lqt-thread-split-subject'=> 'New thread subject:',
188188 'lqt-thread-split-thread' => 'Thread:',
189189 'lqt-split-submit' => 'Split',
190190 'lqt_split_badsubject' => 'The subject you entered is invalid.',
@@ -249,7 +249,7 @@
250250 'lqt-ajax-update-link' => 'Update',
251251 'lqt-thread-show-replies' => 'Show $1 replies',
252252 'lqt-thread-show-more' => 'Show more replies',
253 -
 253+
254254 // Feeds
255255 'lqt-feed-title-all' => '{{SITENAME}} — New posts',
256256 'lqt-feed-title-all-from' => '{{SITENAME}} — New posts from $1',
@@ -1426,7 +1426,7 @@
14271427 'lqt_invalid_subject' => 'El tema que heu introduït no és vàlid.
14281428 Pot:
14291429 * contenir caràcters no vàlids, com []{}&lt;&gt;,
1430 -* ser massa llarg, o
 1430+* ser massa llarg, o
14311431 * entrar en conflicte amb prefixos interwiki o altres espai de noms.',
14321432 'lqt_subject_change_forbidden' => "No podeu canviar el tema d'aquest fil perquè no teniu el permís de moure les pàgines.",
14331433 'lqt_in_response_to' => 'En resposta a $1 per $2, amunt:',

Follow-up revisions

RevisionCommit summaryAuthorDate
r56718Follow-up r56705: set svn:eol-style native backialex16:47, 21 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56562* code formatting updates...siebrand19:54, 17 September 2009

Status & tagging log