Index: trunk/tools/bugzilla/client/bugzilla.php |
— | — | @@ -19,14 +19,13 @@ |
20 | 20 | } |
21 | 21 | |
22 | 22 | private function fromCache( ) { |
23 | | - $this->bz = self::$bugs[ $this->id ]->bz; |
24 | 23 | $this->data = self::$bugs[ $this->id ]->data; |
25 | 24 | } |
26 | 25 | |
27 | 26 | public function __construct( $id, $bz, $noFetch = false ) { |
28 | 27 | $this->id = $id; |
| 28 | + $this->bz = $bz; |
29 | 29 | if( !$this->inCache( ) && !$noFetch ) { |
30 | | - $this->bz = $bz; |
31 | 30 | $this->data = $this->bz->search( array( "id" => $id ) ); |
32 | 31 | $this->data = $this->data['bugs'][0]; |
33 | 32 | self::$bugs[$id] = $this; |
— | — | @@ -92,7 +91,7 @@ |
93 | 92 | } |
94 | 93 | |
95 | 94 | public function getHistory( ) { |
96 | | - return $this->bz->__call( "Bug.history", array( "ids" => $this->id ) ); |
| 95 | + return $this->bz->getHistory( $this->id ); |
97 | 96 | } |
98 | 97 | |
99 | 98 | /* bz 4 reveals this info more easily */ |
— | — | @@ -120,7 +119,6 @@ |
121 | 120 | $this->dependency[] = new BugzillaBug( $id, $this->bz ); |
122 | 121 | } |
123 | 122 | } |
124 | | - |
125 | 123 | return $this->dependency; |
126 | 124 | } |
127 | 125 | } |
— | — | @@ -191,7 +189,7 @@ |
192 | 190 | } |
193 | 191 | |
194 | 192 | public function getById( $id ) { |
195 | | - return new BugzillaBug( $id, $this->bz ); |
| 193 | + return new BugzillaBug( $id, $this ); |
196 | 194 | } |
197 | 195 | |
198 | 196 | public function getFields( ) { |
— | — | @@ -208,10 +206,14 @@ |
209 | 207 | } |
210 | 208 | |
211 | 209 | public function getBugHistory( $id ) { |
212 | | - $b = $this->getById( $id ); |
213 | | - return $b->getHistory(); |
| 210 | + return $this->getHistory( $id ); |
214 | 211 | } |
215 | 212 | |
| 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 | + |
216 | 218 | public function getDependencies( $id ) { |
217 | 219 | $b = $this->getById( $id ); |
218 | 220 | return $b->getDependencies(); |
— | — | @@ -222,4 +224,3 @@ |
223 | 225 | return $this->search(array("resolution" => $resolution, "limit" => 10)); |
224 | 226 | } |
225 | 227 | } |
226 | | - |