r107694 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107693‎ | r107694 | r107695 >
Date:02:42, 31 December 2011
Author:mah
Status:deferred
Tags:
Comment:
Making the client lib work better
Modified paths:
  • /trunk/tools/bugzilla/client/bugzilla.php (modified) (history)

Diff [purge]

Index: trunk/tools/bugzilla/client/bugzilla.php
@@ -19,14 +19,13 @@
2020 }
2121
2222 private function fromCache( ) {
23 - $this->bz = self::$bugs[ $this->id ]->bz;
2423 $this->data = self::$bugs[ $this->id ]->data;
2524 }
2625
2726 public function __construct( $id, $bz, $noFetch = false ) {
2827 $this->id = $id;
 28+ $this->bz = $bz;
2929 if( !$this->inCache( ) && !$noFetch ) {
30 - $this->bz = $bz;
3130 $this->data = $this->bz->search( array( "id" => $id ) );
3231 $this->data = $this->data['bugs'][0];
3332 self::$bugs[$id] = $this;
@@ -92,7 +91,7 @@
9392 }
9493
9594 public function getHistory( ) {
96 - return $this->bz->__call( "Bug.history", array( "ids" => $this->id ) );
 95+ return $this->bz->getHistory( $this->id );
9796 }
9897
9998 /* bz 4 reveals this info more easily */
@@ -120,7 +119,6 @@
121120 $this->dependency[] = new BugzillaBug( $id, $this->bz );
122121 }
123122 }
124 -
125123 return $this->dependency;
126124 }
127125 }
@@ -191,7 +189,7 @@
192190 }
193191
194192 public function getById( $id ) {
195 - return new BugzillaBug( $id, $this->bz );
 193+ return new BugzillaBug( $id, $this );
196194 }
197195
198196 public function getFields( ) {
@@ -208,10 +206,14 @@
209207 }
210208
211209 public function getBugHistory( $id ) {
212 - $b = $this->getById( $id );
213 - return $b->getHistory();
 210+ return $this->getHistory( $id );
214211 }
215212
 213+ public function getHistory( $id ) {
 214+ /* By casting to an array this will work if $id is a single bug or a list of bugs */
 215+ return $this->bz->__call( "Bug.history", array( "ids" => (array)$id ) );
 216+ }
 217+
216218 public function getDependencies( $id ) {
217219 $b = $this->getById( $id );
218220 return $b->getDependencies();
@@ -222,4 +224,3 @@
223225 return $this->search(array("resolution" => $resolution, "limit" => 10));
224226 }
225227 }
226 -

Status & tagging log