Index: trunk/extensions/LiquidThreads/LqtFunctions.php |
— | — | @@ -14,46 +14,3 @@ |
15 | 15 | return $default; |
16 | 16 | } |
17 | 17 | } |
18 | | - |
19 | | -/** |
20 | | - * Recreate the original associative array so that a new pair with the given key |
21 | | - * and value is inserted before the given existing key. $original_array gets |
22 | | - * modified in-place. |
23 | | -*/ |
24 | | -function efInsertIntoAssoc( $new_key, $new_value, $before, &$original_array ) { |
25 | | - $ordered = array(); |
26 | | - $i = 0; |
27 | | - foreach ( $original_array as $key => $value ) { |
28 | | - $ordered[$i] = array( $key, $value ); |
29 | | - $i += 1; |
30 | | - } |
31 | | - $new_assoc = array(); |
32 | | - foreach ( $ordered as $pair ) { |
33 | | - if ( $pair[0] == $before ) { |
34 | | - $new_assoc[$new_key] = $new_value; |
35 | | - } |
36 | | - $new_assoc[$pair[0]] = $pair[1]; |
37 | | - } |
38 | | - $original_array = $new_assoc; |
39 | | -} |
40 | | - |
41 | | -function lqtSetupParserFunctions( &$parser ) { |
42 | | - $parser->setFunctionHook( |
43 | | - 'useliquidthreads', |
44 | | - array( 'LqtParserFunctions', 'useLiquidThreads' ) |
45 | | - ); |
46 | | - |
47 | | - $parser->setFunctionHook( |
48 | | - 'lqtpagelimit', |
49 | | - array( 'LqtParserFunctions', 'lqtPageLimit' ) |
50 | | - ); |
51 | | - |
52 | | - global $wgLiquidThreadsAllowEmbedding; |
53 | | - |
54 | | - if ($wgLiquidThreadsAllowEmbedding) { |
55 | | - $parser->setHook( 'talkpage', array( 'LqtParserFunctions', 'lqtTalkPage' ) ); |
56 | | - $parser->setHook( 'thread', array( 'LqtParserFunctions', 'lqtThread' ) ); |
57 | | - } |
58 | | - |
59 | | - return true; |
60 | | -} |
Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -21,20 +21,6 @@ |
22 | 22 | define( 'LQT_NEWEST_THREADS', 'nt' ); |
23 | 23 | define( 'LQT_OLDEST_THREADS', 'ot' ); |
24 | 24 | |
25 | | -if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) { |
26 | | - $wgHooks['CanonicalNamespaces'][] = 'wgLqtSetupCanonicalNamespaces'; |
27 | | -} else { |
28 | | - wgLqtSetupCanonicalNamespaces( $wgExtraNamespaces ); |
29 | | -} |
30 | | - |
31 | | -function wgLqtSetupCanonicalNamespaces( &$list ) { |
32 | | - $list[NS_LQT_THREAD] = 'Thread'; |
33 | | - $list[NS_LQT_THREAD_TALK] = 'Thread_talk'; |
34 | | - $list[NS_LQT_SUMMARY] = 'Summary'; |
35 | | - $list[NS_LQT_SUMMARY_TALK] = 'Summary_talk'; |
36 | | - return true; |
37 | | -} |
38 | | - |
39 | 25 | // Localisation |
40 | 26 | $dir = dirname( __FILE__ ) . '/'; |
41 | 27 | $wgExtensionMessagesFiles['LiquidThreads'] = $dir . 'i18n/Lqt.i18n.php'; |
— | — | @@ -94,10 +80,13 @@ |
95 | 81 | 'dependencies' => array( 'ext.liquidThreads' ) |
96 | 82 | ); |
97 | 83 | |
| 84 | +// Hooks |
98 | 85 | // Parser Function Setup |
99 | | -$wgHooks['ParserFirstCallInit'][] = 'lqtSetupParserFunctions'; |
| 86 | +$wgHooks['ParserFirstCallInit'][] = 'LqtHooks::onParserFirstCallInit'; |
100 | 87 | |
101 | | -// Hooks |
| 88 | +// Namespaces |
| 89 | +$wgHooks['CanonicalNamespaces'][] = 'LqtHooks::onCanonicalNamespaces'; |
| 90 | + |
102 | 91 | // Main dispatch hook |
103 | 92 | $wgHooks['MediaWikiPerformAction'][] = 'LqtDispatch::tryPage'; |
104 | 93 | $wgHooks['SkinTemplateTabs'][] = 'LqtDispatch::onSkinTemplateTabs'; |
— | — | @@ -226,13 +215,6 @@ |
227 | 216 | // Job queue |
228 | 217 | $wgJobClasses['synchroniseThreadArticleData'] = 'SynchroniseThreadArticleDataJob'; |
229 | 218 | |
230 | | -// Backwards-compatibility |
231 | | -$wgAutoloadClasses['Article_LQT_Compat'] = $dir . 'compat/LqtCompatArticle.php'; |
232 | | -if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
233 | | - $wgAutoloadClasses['HTMLForm'] = $dir . 'compat/HTMLForm.php'; |
234 | | - $wgExtensionMessagesFiles['Lqt-Compat'] = $dir . 'compat/Lqt-compat.i18n.php'; |
235 | | -} |
236 | | - |
237 | 219 | // Logging |
238 | 220 | $wgLogTypes[] = 'liquidthreads'; |
239 | 221 | $wgLogNames['liquidthreads'] = 'lqt-log-name'; |
Index: trunk/extensions/LiquidThreads/classes/View.php |
— | — | @@ -1230,13 +1230,6 @@ |
1231 | 1231 | function showPostBody( $post, $oldid = null ) { |
1232 | 1232 | global $wgOut; |
1233 | 1233 | |
1234 | | - // Load compatibility layer for older versions |
1235 | | - if ( !( $post instanceof Article_LQT_Compat ) ) { |
1236 | | - // Removed because it's annoying |
1237 | | -// wfWarn( "No article compatibility layer loaded, inefficiently duplicating information." ); |
1238 | | - $post = new Article_LQT_Compat( $post->getTitle() ); |
1239 | | - } |
1240 | | - |
1241 | 1234 | $parserOutput = $post->getParserOutput( $oldid ); |
1242 | 1235 | |
1243 | 1236 | // Remove title, so that it stays set correctly. |
Index: trunk/extensions/LiquidThreads/classes/Hooks.php |
— | — | @@ -814,4 +814,33 @@ |
815 | 815 | return false; |
816 | 816 | } |
817 | 817 | } |
| 818 | + |
| 819 | + public static function onParserFirstCallInit( $parser ) { |
| 820 | + $parser->setFunctionHook( |
| 821 | + 'useliquidthreads', |
| 822 | + array( 'LqtParserFunctions', 'useLiquidThreads' ) |
| 823 | + ); |
| 824 | + |
| 825 | + $parser->setFunctionHook( |
| 826 | + 'lqtpagelimit', |
| 827 | + array( 'LqtParserFunctions', 'lqtPageLimit' ) |
| 828 | + ); |
| 829 | + |
| 830 | + global $wgLiquidThreadsAllowEmbedding; |
| 831 | + |
| 832 | + if ( $wgLiquidThreadsAllowEmbedding ) { |
| 833 | + $parser->setHook( 'talkpage', array( 'LqtParserFunctions', 'lqtTalkPage' ) ); |
| 834 | + $parser->setHook( 'thread', array( 'LqtParserFunctions', 'lqtThread' ) ); |
| 835 | + } |
| 836 | + |
| 837 | + return true; |
| 838 | + } |
| 839 | + |
| 840 | + public static function onCanonicalNamespaces( &$list ) { |
| 841 | + $list[NS_LQT_THREAD] = 'Thread'; |
| 842 | + $list[NS_LQT_THREAD_TALK] = 'Thread_talk'; |
| 843 | + $list[NS_LQT_SUMMARY] = 'Summary'; |
| 844 | + $list[NS_LQT_SUMMARY_TALK] = 'Summary_talk'; |
| 845 | + return true; |
| 846 | + } |
818 | 847 | } |
Index: trunk/extensions/LiquidThreads/classes/Thread.php |
— | — | @@ -426,12 +426,12 @@ |
427 | 427 | ' [[' . $this->title()->getPrefixedText() . "]]\n"; |
428 | 428 | |
429 | 429 | // Make the article edit. |
430 | | - $traceTitle = Threads::newThreadTitle( $this->subject(), new Article_LQT_Compat( $oldTitle ) ); |
431 | | - $redirectArticle = new Article_LQT_Compat( $traceTitle ); |
| 430 | + $traceTitle = Threads::newThreadTitle( $this->subject(), new Article( $oldTitle ) ); |
| 431 | + $redirectArticle = new Article( $traceTitle ); |
432 | 432 | $redirectArticle->doEdit( $redirectText, $reason, EDIT_NEW | EDIT_SUPPRESS_RC ); |
433 | 433 | |
434 | 434 | // Add the trace thread to the tracking table. |
435 | | - $thread = Thread::create( $redirectArticle, new Article_LQT_Compat( $oldTitle ), null, |
| 435 | + $thread = Thread::create( $redirectArticle, new Article( $oldTitle ), null, |
436 | 436 | Threads::TYPE_MOVED, $this->subject() ); |
437 | 437 | |
438 | 438 | $thread->setSortkey( $this->sortkey() ); |
— | — | @@ -529,7 +529,7 @@ |
530 | 530 | |
531 | 531 | if ( isset( $line->page_namespace ) && isset( $line->page_title ) ) { |
532 | 532 | $root_title = Title::makeTitle( $line->page_namespace, $line->page_title ); |
533 | | - $this->root = new Article_LQT_Compat( $root_title ); |
| 533 | + $this->root = new Article( $root_title ); |
534 | 534 | $this->root->loadPageData( $line ); |
535 | 535 | } else { |
536 | 536 | if ( isset( self::$titleCacheById[$this->rootId] ) ) { |
— | — | @@ -539,7 +539,7 @@ |
540 | 540 | } |
541 | 541 | |
542 | 542 | if ( $root_title ) { |
543 | | - $this->root = new Article_LQT_Compat( $root_title ); |
| 543 | + $this->root = new Article( $root_title ); |
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
— | — | @@ -673,7 +673,7 @@ |
674 | 674 | $row->page_restrictions ); |
675 | 675 | } |
676 | 676 | |
677 | | - $article = new Article_LQT_Compat( $t ); |
| 677 | + $article = new Article( $t ); |
678 | 678 | $article->loadPageData( $row ); |
679 | 679 | |
680 | 680 | self::$titleCacheById[$t->getArticleId()] = $t; |
— | — | @@ -851,7 +851,7 @@ |
852 | 852 | $articleTitle->getNamespace() != NS_LQT_THREAD && |
853 | 853 | $wgLiquidThreadsMigrate ) { |
854 | 854 | $newTitle = $articleTitle->getTalkPage(); |
855 | | - $newArticle = new Article_LQT_Compat( $newTitle ); |
| 855 | + $newArticle = new Article( $newTitle ); |
856 | 856 | |
857 | 857 | $set['thread_article_namespace'] = $newTitle->getNamespace(); |
858 | 858 | $set['thread_article_title'] = $newTitle->getDbKey(); |
— | — | @@ -883,7 +883,7 @@ |
884 | 884 | if ( $this->articleId && isset( self::$titleCacheById[$this->articleId] ) ) { |
885 | 885 | // If it corresponds to a title, the article obviously exists. |
886 | 886 | $articleTitle = self::$titleCacheById[$this->articleId]; |
887 | | - $this->article = new Article_LQT_Compat( $articleTitle ); |
| 887 | + $this->article = new Article( $articleTitle ); |
888 | 888 | } elseif ( $this->articleId ) { |
889 | 889 | $articleTitle = Title::newFromID( $this->articleId ); |
890 | 890 | } |
— | — | @@ -893,7 +893,7 @@ |
894 | 894 | if ( !$articleTitle && ( $this->articleId != 0 || $dbTitle->getArticleId() != 0 ) ) { |
895 | 895 | $articleTitle = $dbTitle; |
896 | 896 | $this->articleId = $articleTitle->getArticleId(); |
897 | | - $this->article = new Article_LQT_Compat( $dbTitle ); |
| 897 | + $this->article = new Article( $dbTitle ); |
898 | 898 | |
899 | 899 | $set['thread_article_id'] = $this->articleId; |
900 | 900 | wfDebug( "Unfilled or non-existent thread_article_id, refilling to {$this->articleId}\n" ); |
— | — | @@ -1133,7 +1133,7 @@ |
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | if ( $title ) { |
1137 | | - $article = new Article_LQT_Compat( $title ); |
| 1137 | + $article = new Article( $title ); |
1138 | 1138 | self::$articleCacheById[$this->articleId] = $article; |
1139 | 1139 | } |
1140 | 1140 | } |
— | — | @@ -1143,7 +1143,7 @@ |
1144 | 1144 | return $article; |
1145 | 1145 | } else { |
1146 | 1146 | $title = Title::makeTitle( $this->articleNamespace, $this->articleTitle ); |
1147 | | - return new Article_LQT_Compat( $title ); |
| 1147 | + return new Article( $title ); |
1148 | 1148 | } |
1149 | 1149 | } |
1150 | 1150 | |
— | — | @@ -1182,7 +1182,7 @@ |
1183 | 1183 | return null; |
1184 | 1184 | } |
1185 | 1185 | |
1186 | | - $this->root = new Article_LQT_Compat( $title ); |
| 1186 | + $this->root = new Article( $title ); |
1187 | 1187 | } |
1188 | 1188 | return $this->root; |
1189 | 1189 | } |
— | — | @@ -1204,7 +1204,7 @@ |
1205 | 1205 | return null; |
1206 | 1206 | } |
1207 | 1207 | |
1208 | | - $this->summary = new Article_LQT_Compat( $title ); |
| 1208 | + $this->summary = new Article( $title ); |
1209 | 1209 | |
1210 | 1210 | } |
1211 | 1211 | |
— | — | @@ -1296,7 +1296,7 @@ |
1297 | 1297 | if ( !$rtitle ) return null; |
1298 | 1298 | |
1299 | 1299 | $this->dieIfHistorical(); |
1300 | | - $rthread = Threads::withRoot( new Article_LQT_Compat( $rtitle ) ); |
| 1300 | + $rthread = Threads::withRoot( new Article( $rtitle ) ); |
1301 | 1301 | return $rthread; |
1302 | 1302 | } |
1303 | 1303 | |