r52456 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52455‎ | r52456 | r52457 >
Date:13:07, 26 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Remove QueryGroup class, which is now unused
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php (deleted) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -71,7 +71,6 @@
7272 $wgAutoloadClasses['HistoricalThread'] = $dir . 'classes/LqtHistoricalThread.php';
7373 $wgAutoloadClasses['Thread'] = $dir . 'classes/LqtThread.php';
7474 $wgAutoloadClasses['Threads'] = $dir . 'classes/LqtThreads.php';
75 -$wgAutoloadClasses['QueryGroup'] = $dir . 'classes/LqtQueryGroup.php';
7675 $wgAutoloadClasses['NewMessages'] = $dir . 'classes/LqtNewMessages.php';
7776 $wgAutoloadClasses['LiquidThreadsMagicWords'] = $dir . 'i18n/LiquidThreads.magic.php';
7877 $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 @@
2828 protected $user_color_index;
2929 const number_of_user_colors = 6;
3030
31 - protected $queries;
32 -
3331 protected $sort_order = LQT_NEWEST_CHANGES;
3432
3533 function __construct( &$output, &$article, &$title, &$user, &$request ) {
@@ -39,66 +37,12 @@
4038 $this->request = $request;
4139 $this->user_colors = array();
4240 $this->user_color_index = 1;
43 - $this->queries = $this->initializeQueries();
4441 }
4542
4643 function setHeaderLevel( $int ) {
4744 $this->headerLevel = $int;
4845 }
4946
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 -
10347 static protected $occupied_titles = array();
10448
10549 /*************************

Status & tagging log