aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php15
-rw-r--r--apps/federatedfilesharing/tests/FederatedShareProviderTest.php8
-rw-r--r--apps/files/js/file-upload.js15
-rw-r--r--apps/files/js/files.js2
-rw-r--r--apps/files/list.php2
-rw-r--r--apps/files/templates/list.php2
-rw-r--r--apps/files/tests/js/fileUploadSpec.js14
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php10
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php4
-rw-r--r--apps/files_sharing/tests/UpdaterTest.php3
-rw-r--r--apps/provisioning_api/lib/Controller/AppsController.php9
-rw-r--r--apps/provisioning_api/tests/Controller/AppsControllerTest.php20
-rw-r--r--apps/theming/lib/Controller/ThemingController.php2
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php8
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php3
15 files changed, 38 insertions, 79 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 270bf86daf7..6481abe32e2 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -222,6 +222,8 @@ class FederatedShareProvider implements IShareProvider {
$token
);
+ $failure = false;
+
try {
$sharedByFederatedId = $share->getSharedBy();
if ($this->userManager->userExists($sharedByFederatedId)) {
@@ -239,17 +241,22 @@ class FederatedShareProvider implements IShareProvider {
);
if ($send === false) {
- $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.',
- [$share->getNode()->getName(), $share->getSharedWith()]);
- throw new \Exception($message_t);
+ $failure = true;
}
} catch (\Exception $e) {
$this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')');
+ $failure = true;
+ }
+
+ if($failure) {
$this->removeShareFromTableById($shareId);
- throw $e;
+ $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.',
+ [$share->getNode()->getName(), $share->getSharedWith()]);
+ throw new \Exception($message_t);
}
return $shareId;
+
}
/**
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
index 92f6ac5e996..874d4b48a5c 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -227,7 +227,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$share = $this->provider->create($share);
$this->fail();
} catch (\Exception $e) {
- $this->assertEquals('Sharing myFile failed, could not find user@server.com, maybe the server is currently unreachable.', $e->getMessage());
+ $this->assertEquals('Sharing myFile failed, could not find user@server.com, maybe the server is currently unreachable or uses a self-signed certificate.', $e->getMessage());
}
$qb = $this->connection->getQueryBuilder();
@@ -283,7 +283,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$share = $this->provider->create($share);
$this->fail();
} catch (\Exception $e) {
- $this->assertEquals('dummy', $e->getMessage());
+ $this->assertEquals('Sharing myFile failed, could not find user@server.com, maybe the server is currently unreachable or uses a self-signed certificate.', $e->getMessage());
}
$qb = $this->connection->getQueryBuilder();
@@ -707,8 +707,8 @@ class FederatedShareProviderTest extends \Test\TestCase {
$userManager = \OC::$server->getUserManager();
$rootFolder = \OC::$server->getRootFolder();
- $u1 = $userManager->createUser('testFed', 'test');
- $u2 = $userManager->createUser('testFed2', 'test');
+ $u1 = $userManager->createUser('testFed', md5(time()));
+ $u2 = $userManager->createUser('testFed2', md5(time()));
$folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo');
$file1 = $folder1->newFile('bar1');
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 8fec7d5c04e..18d0d973586 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -769,8 +769,7 @@ OC.Uploader.prototype = _.extend({
data.originalFiles.selection = {
uploads: [],
filesToUpload: data.originalFiles.length,
- totalBytes: 0,
- biggestFileBytes: 0
+ totalBytes: 0
};
}
// TODO: move originalFiles to a separate container, maybe inside OC.Upload
@@ -825,18 +824,6 @@ OC.Uploader.prototype = _.extend({
} else {
// add size
selection.totalBytes += file.size;
- // update size of biggest file
- selection.biggestFileBytes = Math.max(selection.biggestFileBytes, file.size);
- }
-
- // check PHP upload limit against biggest file
- if (selection.biggestFileBytes > $('#upload_limit').val()) {
- data.textStatus = 'sizeexceedlimit';
- data.errorThrown = t('files',
- 'Total file size {size1} exceeds upload limit {size2}', {
- 'size1': humanFileSize(selection.biggestFileBytes),
- 'size2': humanFileSize($('#upload_limit').val())
- });
}
// check free space
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 0be098b2e73..1681e2c7e48 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -59,7 +59,6 @@
return;
}
if (response.data !== undefined && response.data.uploadMaxFilesize !== undefined) {
- $('#max_upload').val(response.data.uploadMaxFilesize);
$('#free_space').val(response.data.freeSpace);
$('#upload.button').attr('data-original-title', response.data.maxHumanFilesize);
$('#usedSpacePercent').val(response.data.usedSpacePercent);
@@ -71,7 +70,6 @@
return;
}
if (response[0].uploadMaxFilesize !== undefined) {
- $('#max_upload').val(response[0].uploadMaxFilesize);
$('#upload.button').attr('data-original-title', response[0].maxHumanFilesize);
$('#usedSpacePercent').val(response[0].usedSpacePercent);
Files.displayStorageWarnings();
diff --git a/apps/files/list.php b/apps/files/list.php
index a932cc9a805..93044d4c587 100644
--- a/apps/files/list.php
+++ b/apps/files/list.php
@@ -24,11 +24,9 @@
$config = \OC::$server->getConfig();
// TODO: move this to the generated config.js
$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
-$uploadLimit=OCP\Util::uploadLimit();
// renders the controls and table headers template
$tmpl = new OCP\Template('files', 'list', '');
-$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->printPage();
diff --git a/apps/files/templates/list.php b/apps/files/templates/list.php
index e741849f38b..d66f12f4aff 100644
--- a/apps/files/templates/list.php
+++ b/apps/files/templates/list.php
@@ -15,8 +15,6 @@
through ajax instead (updateStorageStatistics).
*/ ?>
<input type="hidden" name="permissions" value="" id="permissions">
- <input type="hidden" id="max_upload" name="MAX_FILE_SIZE" value="<?php isset($_['uploadMaxFilesize']) ? p($_['uploadMaxFilesize']) : '' ?>">
- <input type="hidden" id="upload_limit" value="<?php isset($_['uploadLimit']) ? p($_['uploadLimit']) : '' ?>">
<input type="hidden" id="free_space" value="<?php isset($_['freeSpace']) ? p($_['freeSpace']) : '' ?>">
<?php if(isset($_['dirToken'])):?>
<input type="hidden" id="publicUploadRequestToken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
diff --git a/apps/files/tests/js/fileUploadSpec.js b/apps/files/tests/js/fileUploadSpec.js
index 19f8cde7e44..fa686dbf3e2 100644
--- a/apps/files/tests/js/fileUploadSpec.js
+++ b/apps/files/tests/js/fileUploadSpec.js
@@ -35,7 +35,6 @@ describe('OC.Upload tests', function() {
// need a dummy button because file-upload checks on it
$('#testArea').append(
'<input type="file" id="file_upload_start" name="files[]" multiple="multiple">' +
- '<input type="hidden" id="upload_limit" name="upload_limit" value="10000000">' + // 10 MB
'<input type="hidden" id="free_space" name="free_space" value="50000000">' + // 50 MB
// TODO: handlebars!
'<div id="new">' +
@@ -97,19 +96,6 @@ describe('OC.Upload tests', function() {
expect(result[0].submit.calledOnce).toEqual(true);
expect(failStub.notCalled).toEqual(true);
});
- it('does not add file if it exceeds upload limit', function() {
- var result;
- $('#upload_limit').val(1000);
-
- result = addFiles(uploader, [testFile]);
-
- expect(result[0]).toEqual(null);
- expect(failStub.calledOnce).toEqual(true);
- expect(failStub.getCall(0).args[1].textStatus).toEqual('sizeexceedlimit');
- expect(failStub.getCall(0).args[1].errorThrown).toEqual(
- 'Total file size 5 KB exceeds upload limit 1000 B'
- );
- });
it('does not add file if it exceeds free space', function() {
var result;
$('#free_space').val(1000);
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 4f80b8fc966..1358663ea2b 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -270,11 +270,17 @@ class ShareAPIController extends OCSController {
throw new OCSNotFoundException($this->l->t('could not delete share'));
}
- if (!$this->canAccessShare($share, false)) {
+ if (!$this->canAccessShare($share)) {
throw new OCSNotFoundException($this->l->t('Could not delete share'));
}
- $this->shareManager->deleteShare($share);
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP &&
+ $share->getShareOwner() !== $this->currentUser &&
+ $share->getSharedBy() !== $this->currentUser) {
+ $this->shareManager->deleteFromSelf($share, $this->currentUser);
+ } else {
+ $this->shareManager->deleteShare($share);
+ }
return new DataResponse();
}
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 62725115dd6..5ad7d3a99f1 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -342,9 +342,8 @@ class ShareController extends Controller {
$freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
}
- $uploadLimit = Util::uploadLimit();
- $maxUploadFilesize = min($freeSpace, $uploadLimit);
$hideFileList = $share->getPermissions() & \OCP\Constants::PERMISSION_READ ? false : true;
+ $maxUploadFilesize = $freeSpace;
$folder = new Template('files', 'list', '');
$folder->assign('dir', $rootFolder->getRelativePath($folderNode->getPath()));
@@ -356,7 +355,6 @@ class ShareController extends Controller {
$folder->assign('uploadMaxFilesize', $maxUploadFilesize);
$folder->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize));
$folder->assign('freeSpace', $freeSpace);
- $folder->assign('uploadLimit', $uploadLimit); // PHP upload limit
$folder->assign('usedSpacePercent', 0);
$folder->assign('trash', false);
$shareTmpl['folder'] = $folder->fetchPage();
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index da292826f0a..bb320336d48 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -71,7 +71,8 @@ class UpdaterTest extends TestCase {
*/
function testDeleteParentFolder() {
$status = \OC_App::isEnabled('files_trashbin');
- \OC_App::enable('files_trashbin');
+ (new \OC_App())->enable('files_trashbin');
+
\OCA\Files_Trashbin\Trashbin::registerHooks();
diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php
index 3821fc343ad..7d11d92b55a 100644
--- a/apps/provisioning_api/lib/Controller/AppsController.php
+++ b/apps/provisioning_api/lib/Controller/AppsController.php
@@ -37,25 +37,20 @@ use OCP\IRequest;
class AppsController extends OCSController {
/** @var \OCP\App\IAppManager */
private $appManager;
- /** @var OCSClient */
- private $ocsClient;
/**
* @param string $appName
* @param IRequest $request
* @param IAppManager $appManager
- * @param OCSClient $ocsClient
*/
public function __construct(
$appName,
IRequest $request,
- IAppManager $appManager,
- OCSClient $ocsClient
+ IAppManager $appManager
) {
parent::__construct($appName, $request);
$this->appManager = $appManager;
- $this->ocsClient = $ocsClient;
}
/**
@@ -64,7 +59,7 @@ class AppsController extends OCSController {
* @throws OCSException
*/
public function getApps($filter = null) {
- $apps = OC_App::listAllApps(false, true, $this->ocsClient);
+ $apps = (new OC_App())->listAllApps();
$list = [];
foreach($apps as $app) {
$list[] = $app['id'];
diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
index 9ac4a8290e4..c891433258f 100644
--- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
@@ -48,8 +48,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
private $api;
/** @var IUserSession */
private $userSession;
- /** @var OCSClient|\PHPUnit_Framework_MockObject_MockObject */
- private $ocsClient;
protected function setUp() {
parent::setUp();
@@ -57,9 +55,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$this->appManager = \OC::$server->getAppManager();
$this->groupManager = \OC::$server->getGroupManager();
$this->userSession = \OC::$server->getUserSession();
- $this->ocsClient = $this->getMockBuilder('OC\OCSClient')
- ->disableOriginalConstructor()
- ->getMock();
$request = $this->getMockBuilder('OCP\IRequest')
->disableOriginalConstructor()
@@ -68,8 +63,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$this->api = new AppsController(
'provisioning_api',
$request,
- $this->appManager,
- $this->ocsClient
+ $this->appManager
);
}
@@ -88,10 +82,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
}
public function testGetApps() {
- $this->ocsClient
- ->expects($this->any())
- ->method($this->anything())
- ->will($this->returnValue(null));
$user = $this->generateUsers();
$this->groupManager->get('admin')->addUser($user);
$this->userSession->setUser($user);
@@ -99,7 +89,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$result = $this->api->getApps();
$data = $result->getData();
- $this->assertEquals(count(\OC_App::listAllApps(false, true, $this->ocsClient)), count($data['apps']));
+ $this->assertEquals(count((new \OC_App())->listAllApps()), count($data['apps']));
}
public function testGetAppsEnabled() {
@@ -109,13 +99,9 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
}
public function testGetAppsDisabled() {
- $this->ocsClient
- ->expects($this->any())
- ->method($this->anything())
- ->will($this->returnValue(null));
$result = $this->api->getApps('disabled');
$data = $result->getData();
- $apps = \OC_App::listAllApps(false, true, $this->ocsClient);
+ $apps = (new \OC_App)->listAllApps();
$list = array();
foreach($apps as $app) {
$list[] = $app['id'];
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 09b4a14f2b0..f274d245887 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -319,7 +319,7 @@ class ThemingController extends Controller {
$responseCss .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: %s; background-position: center center; background-size:contain;' .
- 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
+ 'width:12px; height:12px; padding:0; margin:2px 6px 6px 9px; border-radius:1px;' .
"}\n",
\OC::$WEBROOT,
$elementColor
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index d9d5005e25f..4325e1988b2 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -428,7 +428,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: %s; background-position: center center; background-size:contain;' .
- 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
+ 'width:12px; height:12px; padding:0; margin:2px 6px 6px 9px; border-radius:1px;' .
"}\n",
\OC::$WEBROOT,
$color
@@ -517,7 +517,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: #555555; background-position: center center; background-size:contain;' .
- 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
+ 'width:12px; height:12px; padding:0; margin:2px 6px 6px 9px; border-radius:1px;' .
"}\n",
\OC::$WEBROOT
);
@@ -691,7 +691,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: %s; background-position: center center; background-size:contain;' .
- 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
+ 'width:12px; height:12px; padding:0; margin:2px 6px 6px 9px; border-radius:1px;' .
"}\n",
\OC::$WEBROOT,
$color
@@ -797,7 +797,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: #555555; background-position: center center; background-size:contain;' .
- 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
+ 'width:12px; height:12px; padding:0; margin:2px 6px 6px 9px; border-radius:1px;' .
"}\n",
\OC::$WEBROOT
);
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index 3a1aa5e0f16..7bcc0e86905 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -22,7 +22,6 @@
namespace OCA\UpdateNotification\Notification;
-
use OC\BackgroundJob\TimedJob;
use OC\Installer;
use OC\Updater\VersionCheck;
@@ -215,6 +214,6 @@ class BackgroundJob extends TimedJob {
* @return string|false
*/
protected function isUpdateAvailable($app) {
- return Installer::isUpdateAvailable($app);
+ return Installer::isUpdateAvailable($app, \OC::$server->getAppFetcher());
}
}