r87937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87936‎ | r87937 | r87938 >
Date:22:38, 12 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r87935
Modified paths:
  • /trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
@@ -23,6 +23,8 @@
2424 */
2525 protected $time;
2626
 27+ protected $id;
 28+
2729 /**
2830 * The title of the page the changeset holds changes for.
2931 *
@@ -31,15 +33,40 @@
3234 protected $title = false;
3335
3436 /**
 37+ *
 38+ *
 39+ * @param $set
 40+ *
 41+ * @return SWLChangeSet
 42+ */
 43+ public static function newFromDBResult( $set ) {
 44+ $changeSet = new SMWChangeSet(
 45+ SMWDIWikiPage::newFromTitle( Title::newFromID( $set->cg_page_id ) )
 46+ );
 47+
 48+ $changeSet = new SWLChangeSet( // swl_change_groups
 49+ $changeSet,
 50+ User::newFromName( $set->cg_user_name ),
 51+ $set->cg_time,
 52+ $set->cg_id
 53+ );
 54+
 55+ return $changeSet;
 56+ }
 57+
 58+ /**
3559 * Constructor.
3660 *
 61+ * @param SMWChangeSet $changeSet
3762 * @param User $user
3863 * @param integer $time
 64+ * @param integer $id
3965 */
40 - public function __construct( SMWChangeSet $changeSet, /* User */ $user = null, $time = null ) {
 66+ public function __construct( SMWChangeSet $changeSet, /* User */ $user = null, $time = null, $id = null ) {
4167 $this->changeSet = $changeSet;
4268 $this->time = $time;
4369 $this->user = is_null( $user ) ? $GLOBALS['wgUser'] : $user;
 70+ $this->id = $id;
4471 }
4572
4673 /**
@@ -68,8 +95,8 @@
6996 $dbr->insert(
7097 'swl_change_groups',
7198 array(
72 - 'cg_user_name' => $this->getUser(),
73 - 'cg_page_id' => $this->getTitle(),
 99+ 'cg_user_name' => $this->getUser()->getName(),
 100+ 'cg_page_id' => $this->getTitle()->getArticleID(),
74101 'cg_time' => is_null( $this->getTime() ) ? $dbw->timestamp() : $this->getTime()
75102 )
76103 );
@@ -83,20 +110,20 @@
84111 return $this->title;
85112 }
86113
87 - public function setUser() {
88 -
 114+ public function setUser( User $user ) {
 115+ $this->user = $user;
89116 }
90117
91118 public function getUser() {
92 -
 119+ return $this->user;
93120 }
94121
95 - public function setTime() {
96 -
 122+ public function setTime( $time ) {
 123+ $this->time = $time;
97124 }
98125
99126 public function getTime() {
100 -
 127+ return $this->time;
101128 }
102129
103130 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87935commiting changes I made on plane - created a wrapper around SMWChangeSet to ...jeroendedauw22:11, 12 May 2011

Status & tagging log