From: Mark A. Hershberger Date: Thu, 11 Feb 2010 05:35:21 +0000 (+0000) Subject: follow-up r61355 X-Git-Tag: 1.31.0-rc.0~37826 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=c0cd377c0f67f5686d6dac2e16da0b144260731d;p=lhc%2Fweb%2Fwiklou.git follow-up r61355 Actually test UploadChunks code against Firefogg. Uploads work, but feedback on the Firefogg side seems not too. Also, Firefogg makes a complete upload, but then attempts more uploads. --- diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index de50147b4e..e99e5d9686 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -138,7 +138,15 @@ class ApiUpload extends ApiBase { // Cleanup any temporary mess $this->mUpload->cleanupTempFile(); - $this->getResult()->addValue( null, $this->getModuleName(), $result ); + + if( $this->mParams['enablechunks'] ) { + foreach ($result as $key => $value) { + if($value === null) $value = ""; + $this->getResult()->addValue( null, $key, $value ); + } + } else { + $this->getResult()->addValue( null, $this->getModuleName(), $result ); + } } protected function performUpload() { diff --git a/maintenance/tests/ApiSetup.php b/maintenance/tests/ApiSetup.php index d5fbac72ba..549d8aefb7 100644 --- a/maintenance/tests/ApiSetup.php +++ b/maintenance/tests/ApiSetup.php @@ -10,10 +10,6 @@ abstract class ApiSetup extends PHPUnit_Framework_TestCase { global $wgServerName, $wgServer, $wgContLang, $wgAuth, $wgScriptPath, $wgScriptExtension, $wgMemc, $wgRequest; - if($wgServerName == "localhost" || $wgServer == "http://localhost") { - $this->markTestIncomplete('This test needs $wgServerName and $wgServer to '. - 'be set in LocalSettings.php'); - } self::$apiUrl = $wgServer.$wgScriptPath."/api".$wgScriptExtension; $wgMemc = new FakeMemCachedClient; diff --git a/maintenance/tests/ApiTest.php b/maintenance/tests/ApiTest.php index 04f9c5b9b4..b177ebf200 100644 --- a/maintenance/tests/ApiTest.php +++ b/maintenance/tests/ApiTest.php @@ -5,6 +5,10 @@ require_once( "ApiSetup.php" ); class ApiTest extends ApiSetup { function setup() { + if($wgServerName == "localhost" || $wgServer == "http://localhost") { + $this->markTestIncomplete('This test needs $wgServerName and $wgServer to '. + 'be set in LocalSettings.php'); + } parent::setup(); } diff --git a/maintenance/tests/UploadFromChunksTest.php b/maintenance/tests/UploadFromChunksTest.php index ebad77404b..b0decd69cc 100644 --- a/maintenance/tests/UploadFromChunksTest.php +++ b/maintenance/tests/UploadFromChunksTest.php @@ -115,8 +115,7 @@ class UploadFromChunksTest extends ApiSetup { 'token' => $token, )); - $this->assertArrayHasKey("upload", $data); - $this->assertArrayHasKey("uploadUrl", $data['upload']); + $this->assertArrayHasKey("uploadUrl", $data); return array('data' => $data, 'session' => $_SESSION, 'token' => $token); } @@ -131,7 +130,7 @@ class UploadFromChunksTest extends ApiSetup { $wgUser = User::newFromName(self::$userName); $token = $wgUser->editToken(); - $url = $data['upload']['uploadUrl']; + $url = $data['uploadUrl']; $params = wfCgiToArray(substr($url, strpos($url, "?"))); for($i=0;$i<10;$i++) {