r23090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23089‎ | r23090 | r23091 >
Date:07:33, 19 June 2007
Author:david
Status:old
Tags:
Comment:
compatibility slowly spreads; about to rewrite tree-building algorithm.
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -687,7 +687,7 @@
688688 }
689689
690690 function threads() {
691 - return Thread::threadsWhere($this->where, $this->options);
 691+ return Thread::where($this->where, $this->options);
692692 }
693693
694694 function formattedMonth($yyyymm) {
@@ -836,7 +836,7 @@
837837 }
838838
839839 function show() {
840 - $ts = Thread::threadsWhoseRootPostIs( $this->article );
 840+ $ts = Threads::withRoot( $this->article );
841841 if( count($ts) == 0 ) {echo "no such thread"; die();}
842842 if ( count($ts) >1 ) {die();} // TODO handle this screwy situation.
843843 $t = $ts[0];
Index: branches/liquidthreads/extensions/LqtModel.php
@@ -242,7 +242,7 @@
243243 /** Module of factory methods. */
244244 class Threads {
245245
246 - static function threadsWhere( $where, $options = array(), $extra_tables = array() ) {
 246+ static function where( $where, $options = array(), $extra_tables = array() ) {
247247 $dbr =& wfGetDB( DB_SLAVE );
248248 if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND );
249249 if ( is_array($options) ) $options = implode(',', $options);
@@ -274,8 +274,8 @@
275275 while ( $line = $dbr->fetchObject($res) ) {
276276 $path = explode('.', $line->thread_path);
277277 Threads::setDeepArray( $tree, $line, $path );
278 -
279278 }
 279+ var_dump($tree);
280280
281281 $threads = array();
282282 foreach( $tree as $root ) {
@@ -304,7 +304,12 @@
305305 $a[$p[0]] = array();
306306 Threads::setDeepArray( $a[$p[0]], $v, array_slice($p, 1) );
307307 }
308 - }
 308+ }
 309+
 310+ static function withRoot( $post ) {
 311+ return Threads::where( array('thread.thread_root' => $post->getID()) );
 312+ }
 313+
309314 }
310315 /*
311316 function lqtCheapTest() {
@@ -349,7 +354,7 @@
350355 function query($name) {
351356 if ( !array_key_exists($name,$this->queries) ) return array();
352357 list($where, $options, $extra_tables) = $this->queries[$name];
353 - return Threads::threadsWhere($where, $options, $extra_tables);
 358+ return Threads::where($where, $options, $extra_tables);
354359 }
355360 }
356361

Status & tagging log