Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -71,7 +71,6 @@ |
72 | 72 | $wgAutoloadClasses['HistoricalThread'] = $dir . 'classes/LqtHistoricalThread.php'; |
73 | 73 | $wgAutoloadClasses['Thread'] = $dir . 'classes/LqtThread.php'; |
74 | 74 | $wgAutoloadClasses['Threads'] = $dir . 'classes/LqtThreads.php'; |
75 | | -$wgAutoloadClasses['QueryGroup'] = $dir . 'classes/LqtQueryGroup.php'; |
76 | 75 | $wgAutoloadClasses['NewMessages'] = $dir . 'classes/LqtNewMessages.php'; |
77 | 76 | $wgAutoloadClasses['LiquidThreadsMagicWords'] = $dir . 'i18n/LiquidThreads.magic.php'; |
78 | 77 | $wgAutoloadClasses['LqtParserFunctions'] = $dir . 'classes/LqtParserFunctions.php'; // File does not exist |
Index: trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php |
— | — | @@ -1,32 +0,0 @@ |
2 | | -<?php |
3 | | -if ( !defined( 'MEDIAWIKI' ) ) die; |
4 | | - |
5 | | -class QueryGroup { |
6 | | - protected $queries; |
7 | | - |
8 | | - function __construct() { |
9 | | - $this->queries = array(); |
10 | | - } |
11 | | - |
12 | | - function addQuery( $name, $where, $options = array(), $extra_tables = array() ) { |
13 | | - $this->queries[$name] = array( $where, $options, $extra_tables ); |
14 | | - } |
15 | | - |
16 | | - function extendQuery( $original, $newname, $where, $options = array(), $extra_tables = array() ) { |
17 | | - if ( !array_key_exists( $original, $this->queries ) ) return; |
18 | | - $q = $this->queries[$original]; |
19 | | - $this->queries[$newname] = array( array_merge( $q[0], $where ), |
20 | | - array_merge( $q[1], $options ), |
21 | | - array_merge( $q[2], $extra_tables ) ); |
22 | | - } |
23 | | - |
24 | | - function deleteQuery( $name ) { |
25 | | - unset ( $this->queries[$name] ); |
26 | | - } |
27 | | - |
28 | | - function query( $name ) { |
29 | | - if ( !array_key_exists( $name, $this->queries ) ) return array(); |
30 | | - list( $where, $options, $extra_tables ) = $this->queries[$name]; |
31 | | - return Threads::where( $where, $options, $extra_tables ); |
32 | | - } |
33 | | -} |
Index: trunk/extensions/LiquidThreads/classes/LqtView.php |
— | — | @@ -27,8 +27,6 @@ |
28 | 28 | protected $user_color_index; |
29 | 29 | const number_of_user_colors = 6; |
30 | 30 | |
31 | | - protected $queries; |
32 | | - |
33 | 31 | protected $sort_order = LQT_NEWEST_CHANGES; |
34 | 32 | |
35 | 33 | function __construct( &$output, &$article, &$title, &$user, &$request ) { |
— | — | @@ -39,66 +37,12 @@ |
40 | 38 | $this->request = $request; |
41 | 39 | $this->user_colors = array(); |
42 | 40 | $this->user_color_index = 1; |
43 | | - $this->queries = $this->initializeQueries(); |
44 | 41 | } |
45 | 42 | |
46 | 43 | function setHeaderLevel( $int ) { |
47 | 44 | $this->headerLevel = $int; |
48 | 45 | } |
49 | 46 | |
50 | | - function initializeQueries() { |
51 | | - |
52 | | - // Create query group |
53 | | - global $wgOut, $wgLqtThreadArchiveStartDays, $wgLqtThreadArchiveInactiveDays; |
54 | | - $dbr = wfGetDB( DB_SLAVE ); |
55 | | - $g = new QueryGroup(); |
56 | | - |
57 | | - $startdate = Date::now()->nDaysAgo( $wgLqtThreadArchiveStartDays )->midnight(); |
58 | | - $recentstartdate = $startdate->nDaysAgo( $wgLqtThreadArchiveInactiveDays ); |
59 | | - $article_clause = Threads::articleClause( $this->article ); |
60 | | - if ( $this->sort_order == LQT_NEWEST_CHANGES ) { |
61 | | - $sort_clause = 'ORDER BY thread.thread_modified DESC'; |
62 | | - } elseif ( $this->sort_order == LQT_NEWEST_THREADS ) { |
63 | | - $sort_clause = 'ORDER BY thread.thread_created DESC'; |
64 | | - } elseif ( $this->sort_order == LQT_OLDEST_THREADS ) { |
65 | | - $sort_clause = 'ORDER BY thread.thread_created ASC'; |
66 | | - } |
67 | | - |
68 | | - // Add standard queries |
69 | | - $g->addQuery( 'fresh', |
70 | | - array( $article_clause, |
71 | | - 'thread.thread_parent is null', |
72 | | - '(thread.thread_modified >= ' . $startdate->text() . |
73 | | - ' OR (thread.thread_summary_page is NULL' . |
74 | | - ' AND thread.thread_type=' . Threads::TYPE_NORMAL . '))' ), |
75 | | - array( $sort_clause ) ); |
76 | | - |
77 | | - $g->extendQuery( 'fresh', 'fresh-undeleted', |
78 | | - array( 'thread_type != '. $dbr->addQuotes( Threads::TYPE_DELETED ) ) ); |
79 | | - |
80 | | - |
81 | | - $g->addQuery( 'archived', |
82 | | - array( $article_clause, |
83 | | - 'thread.thread_parent is null', |
84 | | - '(thread.thread_summary_page is not null' . |
85 | | - ' OR thread.thread_type=' . Threads::TYPE_NORMAL . ')', |
86 | | - 'thread.thread_modified < ' . $startdate->text() ), |
87 | | - array( $sort_clause ) ); |
88 | | - |
89 | | - $g->extendQuery( 'archived', 'recently-archived', |
90 | | - array( '( thread.thread_modified >=' . $recentstartdate->text() . |
91 | | - ' OR rev_timestamp >= ' . $recentstartdate->text() . ')', |
92 | | - 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id' ), |
93 | | - array(), |
94 | | - array( 'page summary_page', 'revision' ) ); |
95 | | - |
96 | | - $g->addQuery( 'archived', 'archived-undeleted', |
97 | | - array( 'thread_type != '. $dbr->addQuotes( Threads::TYPE_DELETED ) ) ); |
98 | | - |
99 | | - |
100 | | - return $g; |
101 | | - } |
102 | | - |
103 | 47 | static protected $occupied_titles = array(); |
104 | 48 | |
105 | 49 | /************************* |