Index: trunk/phase3/maintenance/tests/UploadFromUrlTest.php |
— | — | @@ -143,9 +143,7 @@ |
144 | 144 | 'token' => $token, |
145 | 145 | ), $data ); |
146 | 146 | |
147 | | - $this->assertThat( $data[0]['upload'], $this->isInstanceOf( 'Status' ), |
148 | | - "Got Status Object" ); |
149 | | - $this->assertTrue( $data[0]['upload']->isOk(), 'Job added'); |
| 147 | + $this->assertTrue( $data[0]['upload']['queued'], 'Job added'); |
150 | 148 | |
151 | 149 | $job = Job::pop(); |
152 | 150 | $this->assertThat( $job, $this->isInstanceOf( 'UploadFromUrlJob' ), |
Index: trunk/phase3/includes/upload/UploadFromUrl.php |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Checks if the upload from URL feature is enabled |
| 28 | + * @return bool |
28 | 29 | */ |
29 | 30 | public static function isEnabled() { |
30 | 31 | global $wgAllowCopyUploads; |
— | — | @@ -32,6 +33,7 @@ |
33 | 34 | |
34 | 35 | /** |
35 | 36 | * Entry point for API upload |
| 37 | + * @return bool true on success |
36 | 38 | */ |
37 | 39 | public function initialize( $name, $url, $comment, $watchlist ) { |
38 | 40 | global $wgUser; |
— | — | @@ -66,7 +68,7 @@ |
67 | 69 | |
68 | 70 | |
69 | 71 | $job = new UploadFromUrlJob( $title, $params ); |
70 | | - $job->insert(); |
| 72 | + return $job->insert(); |
71 | 73 | } |
72 | 74 | |
73 | 75 | /** |
Index: trunk/phase3/includes/JobQueue.php |
— | — | @@ -76,7 +76,8 @@ |
77 | 77 | $namespace = $row->job_namespace; |
78 | 78 | $dbkey = $row->job_title; |
79 | 79 | $title = Title::makeTitleSafe( $namespace, $dbkey ); |
80 | | - $job = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); |
| 80 | + $job = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), |
| 81 | + $row->job_id ); |
81 | 82 | |
82 | 83 | $dbw->delete( 'job', $job->insertFields(), __METHOD__ ); |
83 | 84 | $dbw->commit(); |
— | — | @@ -260,6 +261,7 @@ |
261 | 262 | |
262 | 263 | /** |
263 | 264 | * Insert a single job into the queue. |
| 265 | + * @return bool true on success |
264 | 266 | */ |
265 | 267 | function insert() { |
266 | 268 | $fields = $this->insertFields(); |
— | — | @@ -272,7 +274,7 @@ |
273 | 275 | return; |
274 | 276 | } |
275 | 277 | } |
276 | | - $dbw->insert( 'job', $fields, __METHOD__ ); |
| 278 | + return $dbw->insert( 'job', $fields, __METHOD__ ); |
277 | 279 | } |
278 | 280 | |
279 | 281 | protected function insertFields() { |
Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -92,10 +92,10 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->mUpload = new UploadFromUrl; |
96 | | - $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url'], |
| 96 | + $result = $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url'], |
97 | 97 | $this->mParams['comment'] ); |
98 | 98 | |
99 | | - $this->getResult()->addValue( null, $this->getModuleName(), Status::newGood() ); |
| 99 | + $this->getResult()->addValue( null, $this->getModuleName(), array( 'queued' => $result ) ); |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | } else { |