Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -687,7 +687,7 @@ |
688 | 688 | } |
689 | 689 | |
690 | 690 | function threads() { |
691 | | - return Thread::threadsWhere($this->where, $this->options); |
| 691 | + return Thread::where($this->where, $this->options); |
692 | 692 | } |
693 | 693 | |
694 | 694 | function formattedMonth($yyyymm) { |
— | — | @@ -836,7 +836,7 @@ |
837 | 837 | } |
838 | 838 | |
839 | 839 | function show() { |
840 | | - $ts = Thread::threadsWhoseRootPostIs( $this->article ); |
| 840 | + $ts = Threads::withRoot( $this->article ); |
841 | 841 | if( count($ts) == 0 ) {echo "no such thread"; die();} |
842 | 842 | if ( count($ts) >1 ) {die();} // TODO handle this screwy situation. |
843 | 843 | $t = $ts[0]; |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | /** Module of factory methods. */ |
244 | 244 | class Threads { |
245 | 245 | |
246 | | - static function threadsWhere( $where, $options = array(), $extra_tables = array() ) { |
| 246 | + static function where( $where, $options = array(), $extra_tables = array() ) { |
247 | 247 | $dbr =& wfGetDB( DB_SLAVE ); |
248 | 248 | if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND ); |
249 | 249 | if ( is_array($options) ) $options = implode(',', $options); |
— | — | @@ -274,8 +274,8 @@ |
275 | 275 | while ( $line = $dbr->fetchObject($res) ) { |
276 | 276 | $path = explode('.', $line->thread_path); |
277 | 277 | Threads::setDeepArray( $tree, $line, $path ); |
278 | | - |
279 | 278 | } |
| 279 | + var_dump($tree); |
280 | 280 | |
281 | 281 | $threads = array(); |
282 | 282 | foreach( $tree as $root ) { |
— | — | @@ -304,7 +304,12 @@ |
305 | 305 | $a[$p[0]] = array(); |
306 | 306 | Threads::setDeepArray( $a[$p[0]], $v, array_slice($p, 1) ); |
307 | 307 | } |
308 | | - } |
| 308 | + } |
| 309 | + |
| 310 | + static function withRoot( $post ) { |
| 311 | + return Threads::where( array('thread.thread_root' => $post->getID()) ); |
| 312 | + } |
| 313 | + |
309 | 314 | } |
310 | 315 | /* |
311 | 316 | function lqtCheapTest() { |
— | — | @@ -349,7 +354,7 @@ |
350 | 355 | function query($name) { |
351 | 356 | if ( !array_key_exists($name,$this->queries) ) return array(); |
352 | 357 | list($where, $options, $extra_tables) = $this->queries[$name]; |
353 | | - return Threads::threadsWhere($where, $options, $extra_tables); |
| 358 | + return Threads::where($where, $options, $extra_tables); |
354 | 359 | } |
355 | 360 | } |
356 | 361 | |