r23405 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23404‎ | r23405 | r23406 >
Date:22:15, 25 June 2007
Author:david
Status:old
Tags:
Comment:
No longer store rootrev for live threads, which was bonkers.
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)
  • /branches/liquidthreads/includes/Article.php (modified) (history)
  • /branches/liquidthreads/maintenance/lqt.sql (modified) (history)

Diff [purge]

Index: branches/liquidthreads/maintenance/lqt.sql
@@ -1,7 +1,6 @@
22 CREATE TABLE /*$wgDBprefix*/thread (
33 thread_id int(8) unsigned NOT NULL auto_increment,
44 thread_root int(8) unsigned UNIQUE NOT NULL,
5 - thread_root_rev int(8) unsigned NOT NULL default 0,
65 thread_article int(8) unsigned NOT NULL default 0,
76 thread_path text NOT NULL,
87 thread_summary_page int(8) unsigned NULL,
Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -610,7 +610,7 @@
611611
612612 $this->showArchiveWidget();
613613
614 - var_dump(HistoricalThread::withIdAtRevision(3,5));
 614+// var_dump(HistoricalThread::withIdAtRevision(3,9));
615615
616616 if( $this->methodApplies('talkpage_new_thread') ) {
617617 $this->showNewThreadForm();
Index: branches/liquidthreads/extensions/LqtModel.php
@@ -102,6 +102,9 @@
103103 static function textRepresentation($t) {
104104 return serialize($t);
105105 }
 106+ static function fromTextRepresentation($r) {
 107+ return unserialize($r);
 108+ }
106109 static function create( $t ) {
107110 $tmt = $t->topmostThread();
108111 $contents = HistoricalThread::textRepresentation($tmt);
@@ -119,7 +122,7 @@
120123 array('hthread_id' => $id, 'hthread_revision' => $rev),
121124 __METHOD__);
122125 if ( $line )
123 - return unserialize($line->hthread_contents);
 126+ return HistoricalThread::fromTextRepresentation($line->hthread_contents);
124127 else
125128 return null;
126129 }
@@ -148,6 +151,8 @@
149152
150153 protected $id;
151154 protected $revisionNumber;
 155+
 156+ /* Only used by $double to be saved into a historical thread. */
152157 protected $rootRevision;
153158
154159 /* Copy of $this made when first loaded from database, to store the data
@@ -167,7 +172,6 @@
168173 $dbr =& wfGetDB( DB_MASTER );
169174 $res = $dbr->update( 'thread',
170175 /* SET */array( 'thread_root' => $this->rootId,
171 - 'thread_root_rev' => $this->rootRevision,
172176 'thread_article' => $this->articleId,
173177 'thread_path' => $this->path,
174178 'thread_summary_page' => $this->summaryId,
@@ -185,13 +189,25 @@
186190 $this->articleId = $line->thread_article;
187191 $this->articleNamespace = $line->thread_article_namespace;
188192 $this->articleTitle = $line->thread_article_title;
189 - $this->rootRevision = $line->thread_root_rev;
190193 $this->summaryId = $line->thread_summary_page;
191194 $this->path = $line->thread_path;
192195 $this->timestamp = $line->thread_timestamp;
193196 $this->revisionNumber = $line->thread_revision;
194197 $this->replies = $children;
 198+
195199 $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();
196212 }
197213
198214 function setSuperthread($thread) {
@@ -250,7 +266,7 @@
251267
252268 function root() {
253269 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 ) );
255271 return $this->root;
256272 }
257273
Index: branches/liquidthreads/includes/Article.php
@@ -44,7 +44,6 @@
4545 function __construct( &$title, $oldId = null ) {
4646 $this->mTitle =& $title;
4747 $this->mOldId = $oldId;
48 - var_dump($oldId);
4948 $this->clear();
5049 }
5150

Status & tagging log