Index: branches/liquidthreads/maintenance/lqt.sql |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | CREATE TABLE /*$wgDBprefix*/thread ( |
3 | 3 | thread_id int(8) unsigned NOT NULL auto_increment, |
4 | 4 | thread_root int(8) unsigned UNIQUE NOT NULL, |
5 | | - thread_root_rev int(8) unsigned NOT NULL default 0, |
6 | 5 | thread_article int(8) unsigned NOT NULL default 0, |
7 | 6 | thread_path text NOT NULL, |
8 | 7 | thread_summary_page int(8) unsigned NULL, |
Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -610,7 +610,7 @@ |
611 | 611 | |
612 | 612 | $this->showArchiveWidget(); |
613 | 613 | |
614 | | - var_dump(HistoricalThread::withIdAtRevision(3,5)); |
| 614 | +// var_dump(HistoricalThread::withIdAtRevision(3,9)); |
615 | 615 | |
616 | 616 | if( $this->methodApplies('talkpage_new_thread') ) { |
617 | 617 | $this->showNewThreadForm(); |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -102,6 +102,9 @@ |
103 | 103 | static function textRepresentation($t) { |
104 | 104 | return serialize($t); |
105 | 105 | } |
| 106 | + static function fromTextRepresentation($r) { |
| 107 | + return unserialize($r); |
| 108 | + } |
106 | 109 | static function create( $t ) { |
107 | 110 | $tmt = $t->topmostThread(); |
108 | 111 | $contents = HistoricalThread::textRepresentation($tmt); |
— | — | @@ -119,7 +122,7 @@ |
120 | 123 | array('hthread_id' => $id, 'hthread_revision' => $rev), |
121 | 124 | __METHOD__); |
122 | 125 | if ( $line ) |
123 | | - return unserialize($line->hthread_contents); |
| 126 | + return HistoricalThread::fromTextRepresentation($line->hthread_contents); |
124 | 127 | else |
125 | 128 | return null; |
126 | 129 | } |
— | — | @@ -148,6 +151,8 @@ |
149 | 152 | |
150 | 153 | protected $id; |
151 | 154 | protected $revisionNumber; |
| 155 | + |
| 156 | + /* Only used by $double to be saved into a historical thread. */ |
152 | 157 | protected $rootRevision; |
153 | 158 | |
154 | 159 | /* Copy of $this made when first loaded from database, to store the data |
— | — | @@ -167,7 +172,6 @@ |
168 | 173 | $dbr =& wfGetDB( DB_MASTER ); |
169 | 174 | $res = $dbr->update( 'thread', |
170 | 175 | /* SET */array( 'thread_root' => $this->rootId, |
171 | | - 'thread_root_rev' => $this->rootRevision, |
172 | 176 | 'thread_article' => $this->articleId, |
173 | 177 | 'thread_path' => $this->path, |
174 | 178 | 'thread_summary_page' => $this->summaryId, |
— | — | @@ -185,13 +189,25 @@ |
186 | 190 | $this->articleId = $line->thread_article; |
187 | 191 | $this->articleNamespace = $line->thread_article_namespace; |
188 | 192 | $this->articleTitle = $line->thread_article_title; |
189 | | - $this->rootRevision = $line->thread_root_rev; |
190 | 193 | $this->summaryId = $line->thread_summary_page; |
191 | 194 | $this->path = $line->thread_path; |
192 | 195 | $this->timestamp = $line->thread_timestamp; |
193 | 196 | $this->revisionNumber = $line->thread_revision; |
194 | 197 | $this->replies = $children; |
| 198 | + |
195 | 199 | $this->double = clone $this; |
| 200 | + |
| 201 | + /* |
| 202 | + Root revision is ignored on live threads but will be important when |
| 203 | + when we save a historical thread, since by that time an edit will |
| 204 | + have already taken place and it will be more difficult to find |
| 205 | + the pre-edit revision number. But I hate this. |
| 206 | + |
| 207 | + (we could do Revision::getPrevious() we just need to know whether or not |
| 208 | + there was a new revision saved at save time. make it run then make it right.) |
| 209 | + */ |
| 210 | + $rev = Revision::newFromTitle( $this->root()->getTitle() ); |
| 211 | + $this->double->rootRevision = $rev->getId(); |
196 | 212 | } |
197 | 213 | |
198 | 214 | function setSuperthread($thread) { |
— | — | @@ -250,7 +266,7 @@ |
251 | 267 | |
252 | 268 | function root() { |
253 | 269 | if ( !$this->rootId ) return null; |
254 | | - if ( !$this->root ) $this->root = new Post( Title::newFromID( $this->rootId ), $this->rootRevision ); |
| 270 | + if ( !$this->root ) $this->root = new Post( Title::newFromID( $this->rootId ) ); |
255 | 271 | return $this->root; |
256 | 272 | } |
257 | 273 | |
Index: branches/liquidthreads/includes/Article.php |
— | — | @@ -44,7 +44,6 @@ |
45 | 45 | function __construct( &$title, $oldId = null ) { |
46 | 46 | $this->mTitle =& $title; |
47 | 47 | $this->mOldId = $oldId; |
48 | | - var_dump($oldId); |
49 | 48 | $this->clear(); |
50 | 49 | } |
51 | 50 | |