Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -771,7 +771,8 @@ |
772 | 772 | static $VALID_CHANGE_TYPES = array(self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT, |
773 | 773 | self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED); |
774 | 774 | |
775 | | - static $loadedThreads = array(); |
| 775 | + static $cache_by_root = array(); |
| 776 | + static $cache_by_id = array(); |
776 | 777 | |
777 | 778 | static $thread_children = array(); |
778 | 779 | |
— | — | @@ -890,11 +891,10 @@ |
891 | 892 | } |
892 | 893 | |
893 | 894 | self::$cache_by_root[$thread->root()->getID()] = $thread; |
| 895 | + self::$cache_by_id[$thread->id()] = $thread; |
894 | 896 | } |
895 | 897 | return $top_level_threads; |
896 | 898 | } |
897 | | - |
898 | | - static $cache_by_root = array(); |
899 | 899 | |
900 | 900 | private static function databaseError( $msg ) { |
901 | 901 | // TODO tie into MW's error reporting facilities. |
— | — | @@ -921,8 +921,8 @@ |
922 | 922 | } |
923 | 923 | |
924 | 924 | static function withId( $id ) { |
925 | | - if( array_key_exists( $id, Threads::$loadedThreads ) ) { |
926 | | - return Threads::$loadedThreads[ $id ]; |
| 925 | + if( array_key_exists( $id, self::$cache_by_id ) ) { |
| 926 | + return self::$cache_by_id[$id]; |
927 | 927 | } |
928 | 928 | |
929 | 929 | $ts = Threads::where( array('thread.thread_id' => $id ) ); |