aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Upload/AssemblyStream.php88
-rw-r--r--apps/files_sharing/appinfo/routes.php6
-rw-r--r--apps/files_sharing/lib/Activity/Providers/RemoteShares.php2
-rw-r--r--apps/files_sharing/lib/Capabilities.php2
-rw-r--r--apps/files_sharing/lib/Command/CleanupRemoteStorages.php6
-rw-r--r--apps/files_sharing/lib/ExpireSharesJob.php1
-rw-r--r--apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php2
-rw-r--r--apps/files_sharing/lib/ShareBackend/Folder.php6
-rw-r--r--apps/files_sharing/tests/BackendTest.php2
-rw-r--r--apps/files_sharing/tests/CapabilitiesTest.php3
-rw-r--r--apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php1
-rw-r--r--apps/files_sharing/tests/HelperTest.php2
-rw-r--r--apps/files_sharing/tests/MountProviderTest.php1
-rw-r--r--apps/files_sharing/tests/SharedMountTest.php18
-rw-r--r--apps/files_sharing/tests/SizePropagationTest.php1
-rw-r--r--apps/files_sharing/tests/UnshareChildrenTest.php2
-rw-r--r--apps/files_sharing/tests/UpdaterTest.php8
-rw-r--r--apps/provisioning_api/lib/Controller/AppsController.php4
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php18
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php7
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php2
-rw-r--r--apps/testing/appinfo/app.php2
-rw-r--r--apps/testing/appinfo/routes.php118
-rw-r--r--apps/testing/lib/AppInfo/Application.php (renamed from apps/testing/lib/Application.php)2
-rw-r--r--apps/testing/lib/Controller/ConfigController.php (renamed from apps/testing/lib/Config.php)50
-rw-r--r--apps/testing/lib/Controller/LockingController.php246
-rw-r--r--apps/testing/lib/Locking/FakeDBLockingProvider.php (renamed from apps/testing/locking/fakedblockingprovider.php)0
-rw-r--r--apps/testing/locking/provisioning.php227
-rwxr-xr-xbuild/image-optimization.sh (renamed from core/img/image-optimization.sh)2
-rw-r--r--core/Controller/LostController.php2
-rw-r--r--lib/private/Activity/Manager.php2
-rw-r--r--lib/private/AllConfig.php2
-rw-r--r--lib/private/App/DependencyAnalyzer.php9
-rw-r--r--lib/private/App/InfoParser.php2
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php14
-rw-r--r--lib/private/Archive/Archive.php32
-rw-r--r--lib/private/Archive/TAR.php30
-rw-r--r--lib/private/Archive/ZIP.php30
-rw-r--r--lib/private/Authentication/Token/DefaultTokenMapper.php3
-rw-r--r--lib/private/Command/AsyncBus.php2
-rw-r--r--lib/private/Files/ObjectStore/S3.php8
-rw-r--r--lib/private/Mail/EMailTemplate.php5
-rw-r--r--lib/private/Mail/Mailer.php4
-rw-r--r--lib/private/Mail/Message.php2
-rw-r--r--lib/private/Memcache/Memcached.php12
-rw-r--r--lib/private/Memcache/XCache.php12
-rw-r--r--lib/private/Notification/Manager.php2
-rw-r--r--lib/private/Preview/Bitmap.php2
-rw-r--r--lib/private/Preview/Office.php2
-rw-r--r--lib/private/Preview/SVG.php2
-rw-r--r--lib/private/Repair/CleanTags.php2
-rw-r--r--lib/private/Search/Provider/File.php2
-rw-r--r--lib/private/Security/Crypto.php4
-rw-r--r--lib/private/Security/Hasher.php4
-rw-r--r--lib/private/Security/TrustedDomainHelper.php4
-rw-r--r--lib/private/Server.php4
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php6
-rw-r--r--lib/private/Share20/DefaultShareProvider.php2
-rw-r--r--lib/private/SystemTag/SystemTagManager.php2
-rw-r--r--lib/private/SystemTag/SystemTagObjectMapper.php2
-rw-r--r--lib/private/TempManager.php2
-rw-r--r--lib/private/legacy/app.php2
-rw-r--r--lib/private/legacy/user.php119
-rw-r--r--settings/ajax/togglesubadmins.php4
-rw-r--r--settings/ajax/uninstallapp.php2
-rw-r--r--settings/ajax/updateapp.php4
-rw-r--r--tests/Settings/Mailer/NewUserMailHelperTest.php10
-rw-r--r--tests/data/emails/new-account-email-custom.html5
-rw-r--r--tests/data/emails/new-account-email-single-button.html5
-rw-r--r--tests/data/emails/new-account-email.html5
70 files changed, 529 insertions, 669 deletions
diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php
index b623f717b31..4b327cecaac 100644
--- a/apps/dav/lib/Upload/AssemblyStream.php
+++ b/apps/dav/lib/Upload/AssemblyStream.php
@@ -20,6 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
namespace OCA\DAV\Upload;
use Sabre\DAV\IFile;
@@ -44,15 +45,15 @@ class AssemblyStream implements \Icewind\Streams\File {
/** @var int */
private $pos = 0;
- /** @var array */
- private $sortedNodes;
-
/** @var int */
- private $size;
+ private $size = 0;
/** @var resource */
private $currentStream = null;
+ /** @var int */
+ private $currentNode = 0;
+
/**
* @param string $path
* @param string $mode
@@ -63,24 +64,18 @@ class AssemblyStream implements \Icewind\Streams\File {
public function stream_open($path, $mode, $options, &$opened_path) {
$this->loadContext('assembly');
- // sort the nodes
$nodes = $this->nodes;
// http://stackoverflow.com/a/10985500
- @usort($nodes, function(IFile $a, IFile $b) {
+ @usort($nodes, function (IFile $a, IFile $b) {
return strnatcmp($a->getName(), $b->getName());
});
- $this->nodes = $nodes;
-
- // build additional information
- $this->sortedNodes = [];
- $start = 0;
- foreach($this->nodes as $node) {
- $size = $node->getSize();
- $name = $node->getName();
- $this->sortedNodes[$name] = ['node' => $node, 'start' => $start, 'end' => $start + $size];
- $start += $size;
- $this->size = $start;
+ $this->nodes = array_values($nodes);
+ if (count($this->nodes) > 0) {
+ $this->currentStream = $this->getStream($this->nodes[0]);
}
+ $this->size = array_reduce($this->nodes, function ($size, IFile $file) {
+ return $size + $file->getSize();
+ }, 0);
return true;
}
@@ -105,36 +100,27 @@ class AssemblyStream implements \Icewind\Streams\File {
* @return string
*/
public function stream_read($count) {
- do {
- if ($this->currentStream === null) {
- list($node, $posInNode) = $this->getNodeForPosition($this->pos);
- if (is_null($node)) {
- // reached last node, no more data
- return '';
- }
- $this->currentStream = $this->getStream($node);
- fseek($this->currentStream, $posInNode);
- }
+ if (is_null($this->currentStream)) {
+ return '';
+ }
+ do {
$data = fread($this->currentStream, $count);
- // isset is faster than strlen
- if (isset($data[$count - 1])) {
- // we read the full count
- $read = $count;
- } else {
- // reaching end of stream, which happens less often so strlen is ok
- $read = strlen($data);
- }
+ $read = strlen($data);
if (feof($this->currentStream)) {
fclose($this->currentStream);
- $this->currentNode = null;
- $this->currentStream = null;
+ $this->currentNode++;
+ if ($this->currentNode < count($this->nodes)) {
+ $this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
+ } else {
+ $this->currentStream = null;
+ }
}
// if no data read, try again with the next node because
// returning empty data can make the caller think there is no more
// data left to read
- } while ($read === 0);
+ } while ($read === 0 && !is_null($this->currentStream));
// update position
$this->pos += $read;
@@ -235,9 +221,10 @@ class AssemblyStream implements \Icewind\Streams\File {
public static function wrap(array $nodes) {
$context = stream_context_create([
'assembly' => [
- 'nodes' => $nodes]
+ 'nodes' => $nodes
+ ]
]);
- stream_wrapper_register('assembly', '\OCA\DAV\Upload\AssemblyStream');
+ stream_wrapper_register('assembly', self::class);
try {
$wrapped = fopen('assembly://', 'r', null, $context);
} catch (\BadMethodCallException $e) {
@@ -249,19 +236,6 @@ class AssemblyStream implements \Icewind\Streams\File {
}
/**
- * @param $pos
- * @return IFile | null
- */
- private function getNodeForPosition($pos) {
- foreach($this->sortedNodes as $node) {
- if ($pos >= $node['start'] && $pos < $node['end']) {
- return [$node['node'], $pos - $node['start']];
- }
- }
- return null;
- }
-
- /**
* @param IFile $node
* @return resource
*/
@@ -269,9 +243,11 @@ class AssemblyStream implements \Icewind\Streams\File {
$data = $node->get();
if (is_resource($data)) {
return $data;
+ } else {
+ $tmp = fopen('php://temp', 'w+');
+ fwrite($tmp, $data);
+ rewind($tmp);
+ return $tmp;
}
-
- return fopen('data://text/plain,' . $data,'r');
}
-
}
diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php
index 56eece341a9..7a5f5650fc5 100644
--- a/apps/files_sharing/appinfo/routes.php
+++ b/apps/files_sharing/appinfo/routes.php
@@ -26,8 +26,6 @@
*
*/
-use OCP\API;
-
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerRoutes($this, [
'resources' => [
@@ -127,7 +125,3 @@ $application->registerRoutes($this, [
/** @var $this \OCP\Route\IRouter */
$this->create('sharing_external_shareinfo', '/shareinfo')
->actionInclude('files_sharing/ajax/shareinfo.php');
-
-// OCS API
-
-//TODO: SET: mail notification, waiting for PR #4689 to be accepted
diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
index cf4954800e8..f89fb0b0052 100644
--- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
+++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
@@ -23,9 +23,7 @@ namespace OCA\Files_Sharing\Activity\Providers;
use OCP\Activity\IEvent;
use OCP\Activity\IManager;
-use OCP\Activity\IProvider;
use OCP\Federation\ICloudIdManager;
-use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\L10N\IFactory;
diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php
index 22a8a8a0a3d..e8e6a4c26f3 100644
--- a/apps/files_sharing/lib/Capabilities.php
+++ b/apps/files_sharing/lib/Capabilities.php
@@ -71,7 +71,7 @@ class Capabilities implements ICapability {
$public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
$public['upload_files_drop'] = $public['upload'];
}
- $res["public"] = $public;
+ $res['public'] = $public;
$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
index 504caba1417..389b0dc4985 100644
--- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
+++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
@@ -60,11 +60,11 @@ class CleanupRemoteStorages extends Command {
$remoteStorages = $this->getRemoteStorages();
- $output->writeln(count($remoteStorages) . " remote storage(s) need(s) to be checked");
+ $output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked');
$remoteShareIds = $this->getRemoteShareIds();
- $output->writeln(count($remoteShareIds) . " remote share(s) exist");
+ $output->writeln(count($remoteShareIds) . ' remote share(s) exist');
foreach ($remoteShareIds as $id => $remoteShareId) {
if (isset($remoteStorages[$remoteShareId])) {
@@ -79,7 +79,7 @@ class CleanupRemoteStorages extends Command {
}
if (empty($remoteStorages)) {
- $output->writeln("<info>no storages deleted</info>");
+ $output->writeln('<info>no storages deleted</info>');
} else {
$dryRun = $input->getOption('dry-run');
foreach ($remoteStorages as $id => $numericId) {
diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php
index 19c0606dc46..212b7fa008e 100644
--- a/apps/files_sharing/lib/ExpireSharesJob.php
+++ b/apps/files_sharing/lib/ExpireSharesJob.php
@@ -44,7 +44,6 @@ class ExpireSharesJob extends TimedJob {
*/
public function run($argument) {
$connection = \OC::$server->getDatabaseConnection();
- $logger = \OC::$server->getLogger();
//Current time
$now = new \DateTime();
diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
index 5712b96b97d..9dd8d2e5ae9 100644
--- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
@@ -37,6 +37,7 @@ use OCA\Files_Sharing\Exceptions\S2SException;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\Share\IManager;
+use OCP\Share\Exceptions\ShareNotFound;
/**
* Checks whether the "sharing check" is enabled
@@ -88,6 +89,7 @@ class SharingCheckMiddleware extends Middleware {
* @param string $methodName
* @throws NotFoundException
* @throws S2SException
+ * @throws ShareNotFound
*/
public function beforeController($controller, $methodName) {
if(!$this->isSharingEnabled()) {
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index 4929bebf40b..07e353cc6a6 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -50,8 +50,8 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
$share['file_path'] = $name;
$displayNameOwner = \OCP\User::getDisplayName($share['uid_owner']);
$displayNameShareWith = \OCP\User::getDisplayName($share['share_with']);
- $share['displayname_owner'] = ($displayNameOwner) ? $displayNameOwner : $share['uid_owner'];
- $share['share_with_displayname'] = ($displayNameShareWith) ? $displayNameShareWith : $share['uid_owner'];
+ $share['displayname_owner'] = $displayNameOwner ? $displayNameOwner : $share['uid_owner'];
+ $share['share_with_displayname'] = $displayNameShareWith ? $displayNameShareWith : $share['uid_owner'];
$result[] = $share;
}
@@ -72,7 +72,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
$query = \OCP\DB::prepare('SELECT `parent` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
$result = $query->execute(array($child));
$row = $result->fetchRow();
- $parent = ($row) ? $row['parent'] : null;
+ $parent = $row ? $row['parent'] : null;
return $parent;
}
diff --git a/apps/files_sharing/tests/BackendTest.php b/apps/files_sharing/tests/BackendTest.php
index cea8762a5b4..b9c7f0e813d 100644
--- a/apps/files_sharing/tests/BackendTest.php
+++ b/apps/files_sharing/tests/BackendTest.php
@@ -68,7 +68,7 @@ class BackendTest extends TestCase {
parent::tearDown();
}
- function testGetParents() {
+ public function testGetParents() {
$fileinfo1 = $this->view->getFileInfo($this->folder);
$fileinfo2 = $this->view->getFileInfo($this->folder . $this->subfolder . $this->subsubfolder);
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index 663adc1f271..1747bbc4ed2 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -24,8 +24,7 @@
namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\Capabilities;
-use OCA\Files_Sharing\Tests\TestCase;
-use OCP\App\IAppManager;
+
/**
* Class CapabilitiesTest
diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
index 5dcf7f83105..827fcc15797 100644
--- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
+++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
@@ -22,7 +22,6 @@
namespace OCA\Files_Sharing\Tests\Command;
use OCA\Files_Sharing\Command\CleanupRemoteStorages;
-use OCP\DB\QueryBuilder\IQueryBuilder;
use Test\TestCase;
/**
diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php
index d5fe83f44e2..e1e73ee82c2 100644
--- a/apps/files_sharing/tests/HelperTest.php
+++ b/apps/files_sharing/tests/HelperTest.php
@@ -35,7 +35,7 @@ class HelperTest extends TestCase {
/**
* test set and get share folder
*/
- function testSetGetShareFolder() {
+ public function testSetGetShareFolder() {
$this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
\OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index b700d417ad4..04476987a32 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -33,7 +33,6 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\Share\IShare;
use OCP\Share\IManager;
-use OCP\Files\Mount\IMountPoint;
/**
* @group DB
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index 72cc891e368..6f21bd3b92d 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -54,8 +54,8 @@ class SharedMountTest extends TestCase {
$this->view->mkdir($this->folder);
// save file with content
- $this->view->file_put_contents($this->filename, "root file");
- $this->view->file_put_contents($this->folder . $this->filename, "file in subfolder");
+ $this->view->file_put_contents($this->filename, 'root file');
+ $this->view->file_put_contents($this->folder . $this->filename, 'file in subfolder');
$this->groupManager = \OC::$server->getGroupManager();
$this->userManager = \OC::$server->getUserManager();
@@ -204,18 +204,18 @@ class SharedMountTest extends TestCase {
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- \OC\Files\Filesystem::rename($this->filename, "newFileName");
+ \OC\Files\Filesystem::rename($this->filename, 'newFileName');
$this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName'));
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName"));
+ $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName"));
+ $this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
//cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -240,7 +240,7 @@ class SharedMountTest extends TestCase {
if ($exception) {
$this->assertSame(10, $e->getCode());
} else {
- $this->assertTrue(false, "Exception catched, but expected: " . $expectedResult);
+ $this->assertTrue(false, 'Exception catched, but expected: ' . $expectedResult);
}
}
}
@@ -323,7 +323,7 @@ class SharedMountTest extends TestCase {
*
* @dataProvider dataPermissionMovedGroupShare
*/
- function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
+ public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
if ($type === 'file') {
$path = $this->filename;
@@ -355,7 +355,7 @@ class SharedMountTest extends TestCase {
$this->assertEquals($beforePerm, $result->getPermissions());
// Now move the item forcing a new entry in the share table
- \OC\Files\Filesystem::rename($path, "newPath");
+ \OC\Files\Filesystem::rename($path, 'newPath');
$this->assertTrue(\OC\Files\Filesystem::file_exists('newPath'));
$this->assertFalse(\OC\Files\Filesystem::file_exists($path));
@@ -388,7 +388,7 @@ class SharedMountTest extends TestCase {
* If the permissions on a group share are upgraded be sure to still respect
* removed shares by a member of that group
*/
- function testPermissionUpgradeOnUserDeletedGroupShare() {
+ public function testPermissionUpgradeOnUserDeletedGroupShare() {
$testGroup = $this->groupManager->createGroup('testGroup');
$user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1);
$user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php
index 9d80633b46a..f7ad9057959 100644
--- a/apps/files_sharing/tests/SizePropagationTest.php
+++ b/apps/files_sharing/tests/SizePropagationTest.php
@@ -26,7 +26,6 @@
namespace OCA\Files_Sharing\Tests;
use OC\Files\View;
-use Test\Traits\MountProviderTrait;
use Test\Traits\UserTrait;
/**
diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php
index 2bde37af20e..ce7767d1920 100644
--- a/apps/files_sharing/tests/UnshareChildrenTest.php
+++ b/apps/files_sharing/tests/UnshareChildrenTest.php
@@ -74,7 +74,7 @@ class UnshareChildrenTest extends TestCase {
/**
* @medium
*/
- function testUnshareChildren() {
+ public function testUnshareChildren() {
$fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index bb320336d48..c35bcf1a08c 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -69,7 +69,7 @@ class UpdaterTest extends TestCase {
* points should be unshared before the folder gets deleted so
* that the mount point doesn't end up at the trash bin
*/
- function testDeleteParentFolder() {
+ public function testDeleteParentFolder() {
$status = \OC_App::isEnabled('files_trashbin');
(new \OC_App())->enable('files_trashbin');
@@ -96,8 +96,8 @@ class UpdaterTest extends TestCase {
$foldersShared = \OCP\Share::getItemsSharedWith('folder');
$this->assertSame(1, count($foldersShared));
- $view->mkdir("localFolder");
- $view->file_put_contents("localFolder/localFile.txt", "local file");
+ $view->mkdir('localFolder');
+ $view->file_put_contents('localFolder/localFile.txt', 'local file');
$view->rename($this->folder, 'localFolder/' . $this->folder);
@@ -196,7 +196,7 @@ class UpdaterTest extends TestCase {
/**
* if a folder gets renamed all children mount points should be renamed too
*/
- function testRename() {
+ public function testRename() {
$fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php
index 70316875762..d65b925cf7b 100644
--- a/apps/provisioning_api/lib/Controller/AppsController.php
+++ b/apps/provisioning_api/lib/Controller/AppsController.php
@@ -91,9 +91,9 @@ class AppsController extends OCSController {
$info = \OCP\App::getAppInfo($app);
if(!is_null($info)) {
return new DataResponse(OC_App::getAppInfo($app));
- } else {
- throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
}
+
+ throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
}
/**
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 2d329bf974b..e167c07582f 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -30,6 +30,7 @@ use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\IUser;
@@ -43,21 +44,27 @@ class GroupsController extends OCSController {
/** @var IUserSession */
private $userSession;
+ /** @var ILogger */
+ private $logger;
+
/**
* @param string $appName
* @param IRequest $request
* @param IGroupManager $groupManager
* @param IUserSession $userSession
+ * @param ILogger $logger
*/
public function __construct(
$appName,
IRequest $request,
IGroupManager $groupManager,
- IUserSession $userSession) {
+ IUserSession $userSession,
+ ILogger $logger) {
parent::__construct($appName, $request);
$this->groupManager = $groupManager;
$this->userSession = $userSession;
+ $this->logger = $logger;
}
/**
@@ -120,9 +127,9 @@ class GroupsController extends OCSController {
}, $users);
$users = array_values($users);
return new DataResponse(['users' => $users]);
- } else {
- throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
}
+
+ throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
}
/**
@@ -136,8 +143,8 @@ class GroupsController extends OCSController {
*/
public function addGroup($groupid) {
// Validate name
- if(empty($groupid)){
- \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
+ if(empty($groupid)) {
+ $this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
throw new OCSException('Invalid group name', 101);
}
// Check if it exists
@@ -179,6 +186,7 @@ class GroupsController extends OCSController {
throw new OCSException('Group does not exist', 101);
}
+ /** @var IUser[] $subadmins */
$subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup);
// New class returns IUser[] so convert back
$uids = [];
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index 25059e85425..caf6ae109f7 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -37,6 +37,7 @@ class GroupsControllerTest extends \Test\TestCase {
protected $userSession;
/** @var \OC\SubAdmin|\PHPUnit_Framework_MockObject_MockObject */
protected $subAdminManager;
+
/** @var GroupsController */
protected $api;
@@ -60,11 +61,15 @@ class GroupsControllerTest extends \Test\TestCase {
$request = $this->getMockBuilder('OCP\IRequest')
->disableOriginalConstructor()
->getMock();
+
+ $logger = $this->createMock(ILogger::class);
+
$this->api = new GroupsController(
'provisioning_api',
$request,
$this->groupManager,
- $this->userSession
+ $this->userSession,
+ $logger
);
}
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index c712cd7485d..19b5fa65e9a 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -1128,7 +1128,7 @@ class UsersControllerTest extends TestCase {
}
public function testEditUserAdminUserSelfEditChangeValidQuota() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();;
+ $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
diff --git a/apps/testing/appinfo/app.php b/apps/testing/appinfo/app.php
index 402889f2674..5dce74bf786 100644
--- a/apps/testing/appinfo/app.php
+++ b/apps/testing/appinfo/app.php
@@ -19,5 +19,5 @@
*
*/
-$app = new \OCA\Testing\Application();
+$app = new \OCA\Testing\AppInfo\Application();
diff --git a/apps/testing/appinfo/routes.php b/apps/testing/appinfo/routes.php
index d45cfe00eca..3e5fda4fc14 100644
--- a/apps/testing/appinfo/routes.php
+++ b/apps/testing/appinfo/routes.php
@@ -20,63 +20,63 @@
*
*/
-namespace OCA\Testing\AppInfo;
+return [
+ 'routes' => [
+ [
+ 'name' => 'RateLimitTest#userAndAnonProtected',
+ 'url' => '/userAndAnonProtected',
+ 'verb' => 'GET',
+ ],
+ [
+ 'name' => 'RateLimitTest#onlyAnonProtected',
+ 'url' => '/anonProtected',
+ 'verb' => 'GET',
+ ],
+ ],
-use OCA\Testing\Config;
-use OCA\Testing\Locking\Provisioning;
-use OCP\API;
-use OCP\AppFramework\App;
-
-$config = new Config(
- \OC::$server->getConfig(),
- \OC::$server->getRequest()
-);
-
-$app = new App('testing');
-$app->registerRoutes(
- $this,
- [
- 'routes' => [
- [
- 'name' => 'RateLimitTest#userAndAnonProtected',
- 'url' => '/userAndAnonProtected',
- 'verb' => 'GET',
- ],
- [
- 'name' => 'RateLimitTest#onlyAnonProtected',
- 'url' => '/anonProtected',
- 'verb' => 'GET',
- ],
- ]
- ]
-);
-
-API::register(
- 'post',
- '/apps/testing/api/v1/app/{appid}/{configkey}',
- [$config, 'setAppValue'],
- 'testing',
- API::ADMIN_AUTH
-);
-
-API::register(
- 'delete',
- '/apps/testing/api/v1/app/{appid}/{configkey}',
- [$config, 'deleteAppValue'],
- 'testing',
- API::ADMIN_AUTH
-);
-
-$locking = new Provisioning(
- \OC::$server->getLockingProvider(),
- \OC::$server->getDatabaseConnection(),
- \OC::$server->getConfig(),
- \OC::$server->getRequest()
-);
-API::register('get', '/apps/testing/api/v1/lockprovisioning', [$locking, 'isLockingEnabled'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('get', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'isLocked'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('post', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'acquireLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('put', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'changeLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}/{user}', [$locking, 'releaseLock'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('delete', '/apps/testing/api/v1/lockprovisioning/{type}', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH);
-API::register('delete', '/apps/testing/api/v1/lockprovisioning', [$locking, 'releaseAll'], 'files_lockprovisioning', API::ADMIN_AUTH);
+ 'ocs' => [
+ [
+ 'name' => 'Config#setAppValue',
+ 'url' => '/api/v1/app/{appid}/{configkey}',
+ 'verb' => 'POST',
+ ],
+ [
+ 'name' => 'Config#deleteAppValue',
+ 'url' => '/api/v1/app/{appid}/{configkey}',
+ 'verb' => 'DELETE',
+ ],
+ [
+ 'name' => 'Locking#isLockingEnabled',
+ 'url' => '/api/v1/lockprovisioning',
+ 'verb' => 'GET',
+ ],
+ [
+ 'name' => 'Locking#isLocked',
+ 'url' => '/api/v1/lockprovisioning/{type}/{user}',
+ 'verb' => 'GET',
+ ],
+ [
+ 'name' => 'Locking#acquireLock',
+ 'url' => '/api/v1/lockprovisioning/{type}/{user}',
+ 'verb' => 'POST',
+ ],
+ [
+ 'name' => 'Locking#changeLock',
+ 'url' => '/api/v1/lockprovisioning/{type}/{user}',
+ 'verb' => 'PUT',
+ ],
+ [
+ 'name' => 'Locking#releaseLock',
+ 'url' => '/api/v1/lockprovisioning/{type}/{user}',
+ 'verb' => 'DELETE',
+ ],
+ [
+ 'name' => 'Locking#releaseAll',
+ 'url' => '/api/v1/lockprovisioning/{type}',
+ 'verb' => 'DELETE',
+ 'defaults' => [
+ 'type' => null
+ ]
+ ],
+ ],
+];
diff --git a/apps/testing/lib/Application.php b/apps/testing/lib/AppInfo/Application.php
index 8f42d0442dd..9d2b100e8b0 100644
--- a/apps/testing/lib/Application.php
+++ b/apps/testing/lib/AppInfo/Application.php
@@ -19,7 +19,7 @@
*
*/
-namespace OCA\Testing;
+namespace OCA\Testing\AppInfo;
use OCP\AppFramework\App;
use OCA\Testing\AlternativeHomeUserBackend;
diff --git a/apps/testing/lib/Config.php b/apps/testing/lib/Controller/ConfigController.php
index 6cdd28d4b3e..7b3e73ab173 100644
--- a/apps/testing/lib/Config.php
+++ b/apps/testing/lib/Controller/ConfigController.php
@@ -20,52 +20,48 @@
*
*/
-namespace OCA\Testing;
+namespace OCA\Testing\Controller;
+use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\IRequest;
-class Config {
+class ConfigController extends OCSController {
/** @var IConfig */
private $config;
- /** @var IRequest */
- private $request;
-
/**
- * @param IConfig $config
+ * @param string $appName
* @param IRequest $request
+ * @param IConfig $config
*/
- public function __construct(IConfig $config, IRequest $request) {
+ public function __construct($appName,
+ IRequest $request,
+ IConfig $config) {
+ parent::__construct($appName, $request);
$this->config = $config;
- $this->request = $request;
}
/**
- * @param array $parameters
- * @return \OC_OCS_Result
+ * @param string $appid
+ * @param string $configkey
+ * @param string $value
+ * @return DataResponse
*/
- public function setAppValue($parameters) {
- $app = $parameters['appid'];
- $configKey = $parameters['configkey'];
-
- $value = $this->request->getParam('value');
- $this->config->setAppValue($app, $configKey, $value);
-
- return new \OC_OCS_Result();
+ public function setAppValue($appid, $configkey, $value) {
+ $this->config->setAppValue($appid, $configkey, $value);
+ return new DataResponse();
}
/**
- * @param array $parameters
- * @return \OC_OCS_Result
+ * @param string $appid
+ * @param string $configkey
+ * @return DataResponse
*/
- public function deleteAppValue($parameters) {
- $app = $parameters['appid'];
- $configKey = $parameters['configkey'];
-
- $this->config->deleteAppValue($app, $configKey);
-
- return new \OC_OCS_Result();
+ public function deleteAppValue($appid, $configkey) {
+ $this->config->deleteAppValue($appid, $configkey);
+ return new DataResponse();
}
}
diff --git a/apps/testing/lib/Controller/LockingController.php b/apps/testing/lib/Controller/LockingController.php
new file mode 100644
index 00000000000..6056d9d5d7e
--- /dev/null
+++ b/apps/testing/lib/Controller/LockingController.php
@@ -0,0 +1,246 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Testing\Controller;
+
+use OC\Lock\DBLockingProvider;
+use OC\User\NoUserException;
+use OCA\Testing\Locking\FakeDBLockingProvider;
+use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCS\OCSException;
+use OCP\AppFramework\OCSController;
+use OCP\Files\IRootFolder;
+use OCP\Files\NotFoundException;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\IRequest;
+use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
+
+class LockingController extends OCSController {
+
+ /** @var ILockingProvider */
+ protected $lockingProvider;
+
+ /** @var FakeDBLockingProvider */
+ protected $fakeDBLockingProvider;
+
+ /** @var IDBConnection */
+ protected $connection;
+
+ /** @var IConfig */
+ protected $config;
+
+ /** @var IRootFolder */
+ protected $rootFolder;
+
+ /**
+ * @param string $appName
+ * @param IRequest $request
+ * @param ILockingProvider $lockingProvider
+ * @param FakeDBLockingProvider $fakeDBLockingProvider
+ * @param IDBConnection $connection
+ * @param IConfig $config
+ * @param IRootFolder $rootFolder
+ */
+ public function __construct($appName,
+ IRequest $request,
+ ILockingProvider $lockingProvider,
+ FakeDBLockingProvider $fakeDBLockingProvider,
+ IDBConnection $connection,
+ IConfig $config,
+ IRootFolder $rootFolder) {
+ parent::__construct($appName, $request);
+
+ $this->lockingProvider = $lockingProvider;
+ $this->fakeDBLockingProvider = $fakeDBLockingProvider;
+ $this->connection = $connection;
+ $this->config = $config;
+ $this->rootFolder = $rootFolder;
+ }
+
+ /**
+ * @return ILockingProvider
+ * @throws \RuntimeException
+ */
+ protected function getLockingProvider() {
+ if ($this->lockingProvider instanceof DBLockingProvider) {
+ return $this->fakeDBLockingProvider;
+ }
+ throw new \RuntimeException('Lock provisioning is only possible using the DBLockingProvider');
+ }
+
+ /**
+ * @param string $user
+ * @param string $path
+ * @return string
+ * @throws NotFoundException
+ */
+ protected function getPath($user, $path) {
+ $node = $this->rootFolder->getUserFolder($user)->get($path);
+ return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
+ }
+
+ /**
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function isLockingEnabled() {
+ try {
+ $this->getLockingProvider();
+ return new DataResponse();
+ } catch (\RuntimeException $e) {
+ throw new OCSException($e->getMessage(), Http::STATUS_NOT_IMPLEMENTED, $e);
+ }
+ }
+
+ /**
+ * @param int $type
+ * @param string $user
+ * @param string $path
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function acquireLock($type, $user, $path) {
+ try {
+ $path = $this->getPath($user, $path);
+ } catch (NoUserException $e) {
+ throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
+ } catch (NotFoundException $e) {
+ throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
+ }
+
+ $lockingProvider = $this->getLockingProvider();
+
+ try {
+ $lockingProvider->acquireLock($path, $type);
+ $this->config->setAppValue('testing', 'locking_' . $path, $type);
+ return new DataResponse();
+ } catch (LockedException $e) {
+ throw new OCSException('', Http::STATUS_LOCKED, $e);
+ }
+ }
+
+ /**
+ * @param int $type
+ * @param string $user
+ * @param string $path
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function changeLock($type, $user, $path) {
+ try {
+ $path = $this->getPath($user, $path);
+ } catch (NoUserException $e) {
+ throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
+ } catch (NotFoundException $e) {
+ throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
+ }
+
+ $lockingProvider = $this->getLockingProvider();
+
+ try {
+ $lockingProvider->changeLock($path, $type);
+ $this->config->setAppValue('testing', 'locking_' . $path, $type);
+ return new DataResponse();
+ } catch (LockedException $e) {
+ throw new OCSException('', Http::STATUS_LOCKED, $e);
+ }
+ }
+
+ /**
+ * @param int $type
+ * @param string $user
+ * @param string $path
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function releaseLock($type, $user, $path) {
+ try {
+ $path = $this->getPath($user, $path);
+ } catch (NoUserException $e) {
+ throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
+ } catch (NotFoundException $e) {
+ throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
+ }
+
+ $lockingProvider = $this->getLockingProvider();
+
+ try {
+ $lockingProvider->releaseLock($path, $type);
+ $this->config->deleteAppValue('testing', 'locking_' . $path);
+ return new DataResponse();
+ } catch (LockedException $e) {
+ throw new OCSException('', Http::STATUS_LOCKED, $e);
+ }
+ }
+
+ /**
+ * @param int $type
+ * @param string $user
+ * @param string $path
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function isLocked($type, $user, $path) {
+ try {
+ $path = $this->getPath($user, $path);
+ } catch (NoUserException $e) {
+ throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
+ } catch (NotFoundException $e) {
+ throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
+ }
+
+ $lockingProvider = $this->getLockingProvider();
+
+ if ($lockingProvider->isLocked($path, $type)) {
+ return new DataResponse();
+ }
+
+ throw new OCSException('', Http::STATUS_LOCKED);
+ }
+
+ /**
+ * @param int $type
+ * @return DataResponse
+ */
+ public function releaseAll($type = null) {
+ $lockingProvider = $this->getLockingProvider();
+
+ foreach ($this->config->getAppKeys('testing') as $lock) {
+ if (strpos($lock, 'locking_') === 0) {
+ $path = substr($lock, strlen('locking_'));
+
+ if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) {
+ $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
+ } else if ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) {
+ $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
+ } else {
+ $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
+ }
+ }
+ }
+
+ return new DataResponse();
+ }
+}
diff --git a/apps/testing/locking/fakedblockingprovider.php b/apps/testing/lib/Locking/FakeDBLockingProvider.php
index 174cc2ec7fe..174cc2ec7fe 100644
--- a/apps/testing/locking/fakedblockingprovider.php
+++ b/apps/testing/lib/Locking/FakeDBLockingProvider.php
diff --git a/apps/testing/locking/provisioning.php b/apps/testing/locking/provisioning.php
deleted file mode 100644
index 7e3256ec605..00000000000
--- a/apps/testing/locking/provisioning.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace OCA\Testing\Locking;
-
-use OC\Lock\DBLockingProvider;
-use OC\User\NoUserException;
-use OCP\AppFramework\Http;
-use OCP\Files\NotFoundException;
-use OCP\IConfig;
-use OCP\IDBConnection;
-use OCP\IRequest;
-use OCP\Lock\ILockingProvider;
-use OCP\Lock\LockedException;
-
-class Provisioning {
-
- /** @var ILockingProvider */
- protected $lockingProvider;
-
- /** @var IDBConnection */
- protected $connection;
-
- /** @var IConfig */
- protected $config;
-
- /** @var IRequest */
- protected $request;
-
- /**
- * @param ILockingProvider $lockingProvider
- * @param IDBConnection $connection
- * @param IConfig $config
- * @param IRequest $request
- */
- public function __construct(ILockingProvider $lockingProvider, IDBConnection $connection, IConfig $config, IRequest $request) {
- $this->lockingProvider = $lockingProvider;
- $this->connection = $connection;
- $this->config = $config;
- $this->request = $request;
- }
-
- /**
- * @return ILockingProvider
- */
- protected function getLockingProvider() {
- if ($this->lockingProvider instanceof DBLockingProvider) {
- return \OC::$server->query('OCA\Testing\Locking\FakeDBLockingProvider');
- } else {
- throw new \RuntimeException('Lock provisioning is only possible using the DBLockingProvider');
- }
- }
-
- /**
- * @param array $parameters
- * @return int
- */
- protected function getType($parameters) {
- return isset($parameters['type']) ? (int) $parameters['type'] : 0;
- }
-
- /**
- * @param array $parameters
- * @return int
- */
- protected function getPath($parameters) {
- $node = \OC::$server->getRootFolder()
- ->getUserFolder($parameters['user'])
- ->get($this->request->getParam('path'));
- return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
- }
-
- /**
- * @return \OC_OCS_Result
- */
- public function isLockingEnabled() {
- try {
- $this->getLockingProvider();
- return new \OC_OCS_Result(null, 100);
- } catch (\RuntimeException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_IMPLEMENTED, $e->getMessage());
- }
- }
-
- /**
- * @param array $parameters
- * @return \OC_OCS_Result
- */
- public function acquireLock(array $parameters) {
- try {
- $path = $this->getPath($parameters);
- } catch (NoUserException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'User not found');
- } catch (NotFoundException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'Path not found');
- }
- $type = $this->getType($parameters);
-
- $lockingProvider = $this->getLockingProvider();
-
- try {
- $lockingProvider->acquireLock($path, $type);
- $this->config->setAppValue('testing', 'locking_' . $path, $type);
- return new \OC_OCS_Result(null, 100);
- } catch (LockedException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_LOCKED);
- }
- }
-
- /**
- * @param array $parameters
- * @return \OC_OCS_Result
- */
- public function changeLock(array $parameters) {
- try {
- $path = $this->getPath($parameters);
- } catch (NoUserException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'User not found');
- } catch (NotFoundException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'Path not found');
- }
- $type = $this->getType($parameters);
-
- $lockingProvider = $this->getLockingProvider();
-
- try {
- $lockingProvider->changeLock($path, $type);
- $this->config->setAppValue('testing', 'locking_' . $path, $type);
- return new \OC_OCS_Result(null, 100);
- } catch (LockedException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_LOCKED);
- }
- }
-
- /**
- * @param array $parameters
- * @return \OC_OCS_Result
- */
- public function releaseLock(array $parameters) {
- try {
- $path = $this->getPath($parameters);
- } catch (NoUserException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'User not found');
- } catch (NotFoundException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'Path not found');
- }
- $type = $this->getType($parameters);
-
- $lockingProvider = $this->getLockingProvider();
-
- try {
- $lockingProvider->releaseLock($path, $type);
- $this->config->deleteAppValue('testing', 'locking_' . $path);
- return new \OC_OCS_Result(null, 100);
- } catch (LockedException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_LOCKED);
- }
- }
-
- /**
- * @param array $parameters
- * @return \OC_OCS_Result
- */
- public function isLocked(array $parameters) {
- try {
- $path = $this->getPath($parameters);
- } catch (NoUserException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'User not found');
- } catch (NotFoundException $e) {
- return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND, 'Path not found');
- }
- $type = $this->getType($parameters);
-
- $lockingProvider = $this->getLockingProvider();
-
- if ($lockingProvider->isLocked($path, $type)) {
- return new \OC_OCS_Result(null, 100);
- }
-
- return new \OC_OCS_Result(null, Http::STATUS_LOCKED);
- }
-
- /**
- * @param array $parameters
- * @return \OC_OCS_Result
- */
- public function releaseAll(array $parameters) {
- $type = $this->getType($parameters);
-
- $lockingProvider = $this->getLockingProvider();
-
- foreach ($this->config->getAppKeys('testing') as $lock) {
- if (strpos($lock, 'locking_') === 0) {
- $path = substr($lock, strlen('locking_'));
-
- if ($type === ILockingProvider::LOCK_EXCLUSIVE && $this->config->getAppValue('testing', $lock) == ILockingProvider::LOCK_EXCLUSIVE) {
- $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
- } else if ($type === ILockingProvider::LOCK_SHARED && $this->config->getAppValue('testing', $lock) == ILockingProvider::LOCK_SHARED) {
- $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
- } else {
- $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock));
- }
- }
- }
-
- return new \OC_OCS_Result(null, 100);
- }
-}
diff --git a/core/img/image-optimization.sh b/build/image-optimization.sh
index b5de96e018b..cf82e120dcd 100755
--- a/core/img/image-optimization.sh
+++ b/build/image-optimization.sh
@@ -17,4 +17,4 @@ do
done;
}
-recursive_optimize_images ../../
+recursive_optimize_images ../
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 0d5988a2495..59a4e0b2534 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -267,7 +267,7 @@ class LostController extends Controller {
\OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', array('uid' => $userId, 'password' => $password));
$this->config->deleteUserValue($userId, 'core', 'lostpassword');
- @\OC_User::unsetMagicInCookie();
+ @\OC::$server->getUserSession()->unsetMagicInCookie();
} catch (\Exception $e){
return $this->error($e->getMessage());
}
diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php
index bbb6f694156..7640a367e74 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -588,7 +588,7 @@ class Manager implements IManager {
$users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
- if (sizeof($users) !== 1) {
+ if (count($users) !== 1) {
// No unique user found
throw new \UnexpectedValueException('The token is invalid');
}
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 1f59e677a54..52b0679bb20 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -409,7 +409,7 @@ class AllConfig implements \OCP\IConfig {
array_unshift($queryParams, $key);
array_unshift($queryParams, $appName);
- $placeholders = (sizeof($chunk) == 50) ? $placeholders50 : implode(',', array_fill(0, sizeof($chunk), '?'));
+ $placeholders = (count($chunk) === 50) ? $placeholders50 : implode(',', array_fill(0, count($chunk), '?'));
$query = 'SELECT `userid`, `configvalue` ' .
'FROM `*PREFIX*preferences` ' .
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php
index 84d87efa3d3..1ec028b9728 100644
--- a/lib/private/App/DependencyAnalyzer.php
+++ b/lib/private/App/DependencyAnalyzer.php
@@ -43,7 +43,7 @@ class DependencyAnalyzer {
* @param Platform $platform
* @param \OCP\IL10N $l
*/
- function __construct(Platform $platform, IL10N $l) {
+ public function __construct(Platform $platform, IL10N $l) {
$this->platform = $platform;
$this->l = $l;
}
@@ -179,7 +179,7 @@ class DependencyAnalyzer {
}, $supportedDatabases);
$currentDatabase = $this->platform->getDatabase();
if (!in_array($currentDatabase, $supportedDatabases)) {
- $missing[] = (string)$this->l->t('Following databases are supported: %s', join(', ', $supportedDatabases));
+ $missing[] = (string)$this->l->t('Following databases are supported: %s', implode(', ', $supportedDatabases));
}
return $missing;
}
@@ -282,7 +282,7 @@ class DependencyAnalyzer {
}
$currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) {
- $missing[] = (string)$this->l->t('Following platforms are supported: %s', join(', ', $oss));
+ $missing[] = (string)$this->l->t('Following platforms are supported: %s', implode(', ', $oss));
}
return $missing;
}
@@ -349,8 +349,9 @@ class DependencyAnalyzer {
* @return mixed
*/
private function getValue($element) {
- if (isset($element['@value']))
+ if (isset($element['@value'])) {
return $element['@value'];
+ }
return (string)$element;
}
}
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index 47ce28e6e98..fef8ab7a1e8 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -176,7 +176,7 @@ class InfoParser {
* @param \SimpleXMLElement $xml
* @return array
*/
- function xmlToArray($xml) {
+ public function xmlToArray($xml) {
if (!$xml->children()) {
return (string)$xml;
}
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 86d14a2f330..b233f3ca9b6 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -315,7 +315,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated implements only deprecated methods
* @return IApi
*/
- function getCoreApi()
+ public function getCoreApi()
{
return $this->query('API');
}
@@ -323,7 +323,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
/**
* @return \OCP\IServerContainer
*/
- function getServer()
+ public function getServer()
{
return $this->server;
}
@@ -332,7 +332,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param string $middleWare
* @return boolean|null
*/
- function registerMiddleWare($middleWare) {
+ public function registerMiddleWare($middleWare) {
array_push($this->middleWares, $middleWare);
}
@@ -340,7 +340,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* used to return the appname of the set application
* @return string the name of your application
*/
- function getAppName() {
+ public function getAppName() {
return $this->query('AppName');
}
@@ -348,7 +348,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated use IUserSession->isLoggedIn()
* @return boolean
*/
- function isLoggedIn() {
+ public function isLoggedIn() {
return \OC::$server->getUserSession()->isLoggedIn();
}
@@ -356,7 +356,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated use IGroupManager->isAdmin($userId)
* @return boolean
*/
- function isAdminUser() {
+ public function isAdminUser() {
$uid = $this->getUserId();
return \OC_User::isAdminUser($uid);
}
@@ -371,7 +371,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param string $level
* @return mixed
*/
- function log($message, $level) {
+ public function log($message, $level) {
switch($level){
case 'debug':
$level = \OCP\Util::DEBUG;
diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php
index fadc12d2a24..15ec3e1fe56 100644
--- a/lib/private/Archive/Archive.php
+++ b/lib/private/Archive/Archive.php
@@ -36,100 +36,100 @@ abstract class Archive {
/**
* @param $source
*/
- abstract function __construct($source);
+ public abstract function __construct($source);
/**
* add an empty folder to the archive
* @param string $path
* @return bool
*/
- abstract function addFolder($path);
+ public abstract function addFolder($path);
/**
* add a file to the archive
* @param string $path
* @param string $source either a local file or string data
* @return bool
*/
- abstract function addFile($path, $source='');
+ public abstract function addFile($path, $source='');
/**
* rename a file or folder in the archive
* @param string $source
* @param string $dest
* @return bool
*/
- abstract function rename($source, $dest);
+ public abstract function rename($source, $dest);
/**
* get the uncompressed size of a file in the archive
* @param string $path
* @return int
*/
- abstract function filesize($path);
+ public abstract function filesize($path);
/**
* get the last modified time of a file in the archive
* @param string $path
* @return int
*/
- abstract function mtime($path);
+ public abstract function mtime($path);
/**
* get the files in a folder
* @param string $path
* @return array
*/
- abstract function getFolder($path);
+ public abstract function getFolder($path);
/**
* get all files in the archive
* @return array
*/
- abstract function getFiles();
+ public abstract function getFiles();
/**
* get the content of a file
* @param string $path
* @return string
*/
- abstract function getFile($path);
+ public abstract function getFile($path);
/**
* extract a single file from the archive
* @param string $path
* @param string $dest
* @return bool
*/
- abstract function extractFile($path, $dest);
+ public abstract function extractFile($path, $dest);
/**
* extract the archive
* @param string $dest
* @return bool
*/
- abstract function extract($dest);
+ public abstract function extract($dest);
/**
* check if a file or folder exists in the archive
* @param string $path
* @return bool
*/
- abstract function fileExists($path);
+ public abstract function fileExists($path);
/**
* remove a file or folder from the archive
* @param string $path
* @return bool
*/
- abstract function remove($path);
+ public abstract function remove($path);
/**
* get a file handler
* @param string $path
* @param string $mode
* @return resource
*/
- abstract function getStream($path, $mode);
+ public abstract function getStream($path, $mode);
/**
* add a folder and all its content
* @param string $path
* @param string $source
* @return boolean|null
*/
- function addRecursive($path, $source) {
+ public function addRecursive($path, $source) {
$dh = opendir($source);
if(is_resource($dh)) {
$this->addFolder($path);
while (($file = readdir($dh)) !== false) {
- if($file=='.' or $file=='..') {
+ if($file === '.' || $file === '..') {
continue;
}
if(is_dir($source.'/'.$file)) {
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index 07ccd09f399..e6f7ad2b998 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -52,7 +52,7 @@ class TAR extends Archive {
/**
* @param string $source
*/
- function __construct($source) {
+ public function __construct($source) {
$types = array(null, 'gz', 'bz2');
$this->path = $source;
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
@@ -90,7 +90,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function addFolder($path) {
+ public function addFolder($path) {
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
if (substr($path, -1, 1) != '/') {
$path .= '/';
@@ -120,7 +120,7 @@ class TAR extends Archive {
* @param string $source either a local file or string data
* @return bool
*/
- function addFile($path, $source = '') {
+ public function addFile($path, $source = '') {
if ($this->fileExists($path)) {
$this->remove($path);
}
@@ -140,7 +140,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function rename($source, $dest) {
+ public function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive
$tmp = \OCP\Files::tmpFolder();
$this->tar->extract($tmp);
@@ -180,7 +180,7 @@ class TAR extends Archive {
* @param string $path
* @return int
*/
- function filesize($path) {
+ public function filesize($path) {
$stat = $this->getHeader($path);
return $stat['size'];
}
@@ -191,7 +191,7 @@ class TAR extends Archive {
* @param string $path
* @return int
*/
- function mtime($path) {
+ public function mtime($path) {
$stat = $this->getHeader($path);
return $stat['mtime'];
}
@@ -202,7 +202,7 @@ class TAR extends Archive {
* @param string $path
* @return array
*/
- function getFolder($path) {
+ public function getFolder($path) {
$files = $this->getFiles();
$folderContent = array();
$pathLength = strlen($path);
@@ -228,7 +228,7 @@ class TAR extends Archive {
*
* @return array
*/
- function getFiles() {
+ public function getFiles() {
if ($this->fileList) {
return $this->fileList;
}
@@ -249,7 +249,7 @@ class TAR extends Archive {
* @param string $path
* @return string
*/
- function getFile($path) {
+ public function getFile($path) {
return $this->tar->extractInString($path);
}
@@ -260,7 +260,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function extractFile($path, $dest) {
+ public function extractFile($path, $dest) {
$tmp = \OCP\Files::tmpFolder();
if (!$this->fileExists($path)) {
return false;
@@ -283,7 +283,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function extract($dest) {
+ public function extract($dest) {
return $this->tar->extract($dest);
}
@@ -293,7 +293,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function fileExists($path) {
+ public function fileExists($path) {
$files = $this->getFiles();
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
return true;
@@ -322,7 +322,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function remove($path) {
+ public function remove($path) {
if (!$this->fileExists($path)) {
return false;
}
@@ -346,7 +346,7 @@ class TAR extends Archive {
* @param string $mode
* @return resource
*/
- function getStream($path, $mode) {
+ public function getStream($path, $mode) {
if (strrpos($path, '.') !== false) {
$ext = substr($path, strrpos($path, '.'));
} else {
@@ -371,7 +371,7 @@ class TAR extends Archive {
/**
* write back temporary files
*/
- function writeBack($tmpFile, $path) {
+ public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile);
unlink($tmpFile);
}
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index 0ed0f48acc4..8d616a7ef9a 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -43,7 +43,7 @@ class ZIP extends Archive{
/**
* @param string $source
*/
- function __construct($source) {
+ public function __construct($source) {
$this->path=$source;
$this->zip=new \ZipArchive();
if($this->zip->open($source, \ZipArchive::CREATE)) {
@@ -56,7 +56,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function addFolder($path) {
+ public function addFolder($path) {
return $this->zip->addEmptyDir($path);
}
/**
@@ -65,7 +65,7 @@ class ZIP extends Archive{
* @param string $source either a local file or string data
* @return bool
*/
- function addFile($path, $source='') {
+ public function addFile($path, $source='') {
if($source and $source[0]=='/' and file_exists($source)) {
$result=$this->zip->addFile($source, $path);
}else{
@@ -83,7 +83,7 @@ class ZIP extends Archive{
* @param string $dest
* @return boolean|null
*/
- function rename($source, $dest) {
+ public function rename($source, $dest) {
$source=$this->stripPath($source);
$dest=$this->stripPath($dest);
$this->zip->renameName($source, $dest);
@@ -93,7 +93,7 @@ class ZIP extends Archive{
* @param string $path
* @return int
*/
- function filesize($path) {
+ public function filesize($path) {
$stat=$this->zip->statName($path);
return $stat['size'];
}
@@ -102,7 +102,7 @@ class ZIP extends Archive{
* @param string $path
* @return int
*/
- function mtime($path) {
+ public function mtime($path) {
return filemtime($this->path);
}
/**
@@ -110,7 +110,7 @@ class ZIP extends Archive{
* @param string $path
* @return array
*/
- function getFolder($path) {
+ public function getFolder($path) {
$files=$this->getFiles();
$folderContent=array();
$pathLength=strlen($path);
@@ -127,7 +127,7 @@ class ZIP extends Archive{
* get all files in the archive
* @return array
*/
- function getFiles() {
+ public function getFiles() {
$fileCount=$this->zip->numFiles;
$files=array();
for($i=0;$i<$fileCount;$i++) {
@@ -140,7 +140,7 @@ class ZIP extends Archive{
* @param string $path
* @return string
*/
- function getFile($path) {
+ public function getFile($path) {
return $this->zip->getFromName($path);
}
/**
@@ -149,7 +149,7 @@ class ZIP extends Archive{
* @param string $dest
* @return boolean|null
*/
- function extractFile($path, $dest) {
+ public function extractFile($path, $dest) {
$fp = $this->zip->getStream($path);
file_put_contents($dest, $fp);
}
@@ -158,7 +158,7 @@ class ZIP extends Archive{
* @param string $dest
* @return bool
*/
- function extract($dest) {
+ public function extract($dest) {
return $this->zip->extractTo($dest);
}
/**
@@ -166,7 +166,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function fileExists($path) {
+ public function fileExists($path) {
return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
}
/**
@@ -174,7 +174,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function remove($path) {
+ public function remove($path) {
if($this->fileExists($path.'/')) {
return $this->zip->deleteName($path.'/');
}else{
@@ -187,7 +187,7 @@ class ZIP extends Archive{
* @param string $mode
* @return resource
*/
- function getStream($path, $mode) {
+ public function getStream($path, $mode) {
if($mode=='r' or $mode=='rb') {
return $this->zip->getStream($path);
} else {
@@ -213,7 +213,7 @@ class ZIP extends Archive{
/**
* write back temporary files
*/
- function writeBack($tmpFile, $path) {
+ public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile);
unlink($tmpFile);
}
diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php
index ff31628ffb0..a23be624542 100644
--- a/lib/private/Authentication/Token/DefaultTokenMapper.php
+++ b/lib/private/Authentication/Token/DefaultTokenMapper.php
@@ -82,7 +82,6 @@ class DefaultTokenMapper extends Mapper {
if ($data === false) {
throw new DoesNotExistException('token does not exist');
}
-;
return DefaultToken::fromRow($data);
}
@@ -105,7 +104,7 @@ class DefaultTokenMapper extends Mapper {
$result->closeCursor();
if ($data === false) {
throw new DoesNotExistException('token does not exist');
- };
+ }
return DefaultToken::fromRow($data);
}
diff --git a/lib/private/Command/AsyncBus.php b/lib/private/Command/AsyncBus.php
index 3c1f67da0cb..fb3cbee7240 100644
--- a/lib/private/Command/AsyncBus.php
+++ b/lib/private/Command/AsyncBus.php
@@ -45,7 +45,7 @@ class AsyncBus implements IBus {
/**
* @param \OCP\BackgroundJob\IJobList $jobList
*/
- function __construct($jobList) {
+ public function __construct($jobList) {
$this->jobList = $jobList;
}
diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php
index 5251b473bdf..6f37492271c 100644
--- a/lib/private/Files/ObjectStore/S3.php
+++ b/lib/private/Files/ObjectStore/S3.php
@@ -39,7 +39,7 @@ class S3 implements IObjectStore {
* @return string the container or bucket name where objects are stored
* @since 7.0.0
*/
- function getStorageId() {
+ public function getStorageId() {
return $this->id;
}
@@ -49,7 +49,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- function readObject($urn) {
+ public function readObject($urn) {
// Create the command and serialize the request
$request = $this->getConnection()->getCommand('GetObject', [
'Bucket' => $this->bucket,
@@ -83,7 +83,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- function writeObject($urn, $stream) {
+ public function writeObject($urn, $stream) {
$this->getConnection()->putObject([
'Bucket' => $this->bucket,
'Key' => $urn,
@@ -97,7 +97,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- function deleteObject($urn) {
+ public function deleteObject($urn) {
$this->getConnection()->deleteObject([
'Bucket' => $this->bucket,
'Key' => $urn
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index f924f233f14..8227e69ef06 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -100,10 +100,7 @@ EOF;
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="%s" alt="%s" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="%s" alt="%s" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index b24f72316ba..e438f75d2ce 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -120,7 +120,7 @@ class Mailer implements IMailer {
public function send(Message $message) {
$debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
- if (sizeof($message->getFrom()) === 0) {
+ if (empty($message->getFrom())) {
$message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName()) => $this->defaults->getName()]);
}
@@ -186,7 +186,7 @@ class Mailer implements IMailer {
switch ($this->config->getSystemValue('mail_smtpmode', 'php')) {
case 'smtp':
- $this->instance = $this->getSMTPInstance();
+ $this->instance = $this->getSmtpInstance();
break;
case 'sendmail':
// FIXME: Move into the return statement but requires proper testing
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index 3184f26848b..5ffc050360a 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -37,7 +37,7 @@ class Message {
/**
* @param Swift_Message $swiftMessage
*/
- function __construct(Swift_Message $swiftMessage) {
+ public function __construct(Swift_Message $swiftMessage) {
$this->swiftMessage = $swiftMessage;
}
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php
index bf07fd0e6e7..4347fc99e54 100644
--- a/lib/private/Memcache/Memcached.php
+++ b/lib/private/Memcache/Memcached.php
@@ -97,7 +97,7 @@ class Memcached extends Cache implements IMemcache {
}
public function get($key) {
- $result = self::$cache->get($this->getNamespace() . $key);
+ $result = self::$cache->get($this->getNameSpace() . $key);
if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) {
return null;
} else {
@@ -107,9 +107,9 @@ class Memcached extends Cache implements IMemcache {
public function set($key, $value, $ttl = 0) {
if ($ttl > 0) {
- $result = self::$cache->set($this->getNamespace() . $key, $value, $ttl);
+ $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
} else {
- $result = self::$cache->set($this->getNamespace() . $key, $value);
+ $result = self::$cache->set($this->getNameSpace() . $key, $value);
}
if ($result !== true) {
$this->verifyReturnCode();
@@ -118,12 +118,12 @@ class Memcached extends Cache implements IMemcache {
}
public function hasKey($key) {
- self::$cache->get($this->getNamespace() . $key);
+ self::$cache->get($this->getNameSpace() . $key);
return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
}
public function remove($key) {
- $result= self::$cache->delete($this->getNamespace() . $key);
+ $result= self::$cache->delete($this->getNameSpace() . $key);
if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) {
$this->verifyReturnCode();
}
@@ -131,7 +131,7 @@ class Memcached extends Cache implements IMemcache {
}
public function clear($prefix = '') {
- $prefix = $this->getNamespace() . $prefix;
+ $prefix = $this->getNameSpace() . $prefix;
$allKeys = self::$cache->getAllKeys();
if ($allKeys === false) {
// newer Memcached doesn't like getAllKeys(), flush everything
diff --git a/lib/private/Memcache/XCache.php b/lib/private/Memcache/XCache.php
index 7eb7a138d1f..549896e6c6b 100644
--- a/lib/private/Memcache/XCache.php
+++ b/lib/private/Memcache/XCache.php
@@ -47,28 +47,28 @@ class XCache extends Cache implements IMemcache {
}
public function get($key) {
- return xcache_get($this->getNamespace() . $key);
+ return xcache_get($this->getNameSpace() . $key);
}
public function set($key, $value, $ttl = 0) {
if ($ttl > 0) {
- return xcache_set($this->getNamespace() . $key, $value, $ttl);
+ return xcache_set($this->getNameSpace() . $key, $value, $ttl);
} else {
- return xcache_set($this->getNamespace() . $key, $value);
+ return xcache_set($this->getNameSpace() . $key, $value);
}
}
public function hasKey($key) {
- return xcache_isset($this->getNamespace() . $key);
+ return xcache_isset($this->getNameSpace() . $key);
}
public function remove($key) {
- return xcache_unset($this->getNamespace() . $key);
+ return xcache_unset($this->getNameSpace() . $key);
}
public function clear($prefix = '') {
if (function_exists('xcache_unset_by_prefix')) {
- return xcache_unset_by_prefix($this->getNamespace() . $prefix);
+ return xcache_unset_by_prefix($this->getNameSpace() . $prefix);
} else {
// Since we can not clear by prefix, we just clear the whole cache.
xcache_clear_cache(\XC_TYPE_VAR, 0);
diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php
index c5cad7f2db3..1d139167552 100644
--- a/lib/private/Notification/Manager.php
+++ b/lib/private/Notification/Manager.php
@@ -142,7 +142,7 @@ class Manager implements IManager {
$this->notifiersInfo = [];
foreach ($this->notifiersInfoClosures as $closure) {
$notifier = $closure();
- if (!is_array($notifier) || sizeof($notifier) !== 2 || !isset($notifier['id']) || !isset($notifier['name'])) {
+ if (!is_array($notifier) || count($notifier) !== 2 || !isset($notifier['id']) || !isset($notifier['name'])) {
throw new \InvalidArgumentException('The given notifier information is invalid');
}
if (isset($this->notifiersInfo[$notifier['id']])) {
diff --git a/lib/private/Preview/Bitmap.php b/lib/private/Preview/Bitmap.php
index d3f75b4a205..e9fd6cc7c03 100644
--- a/lib/private/Preview/Bitmap.php
+++ b/lib/private/Preview/Bitmap.php
@@ -48,7 +48,7 @@ abstract class Bitmap extends Provider {
try {
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
} catch (\Exception $e) {
- \OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR);
+ \OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getMessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php
index 9b445a2bbee..a05ffef9e9a 100644
--- a/lib/private/Preview/Office.php
+++ b/lib/private/Preview/Office.php
@@ -59,7 +59,7 @@ abstract class Office extends Provider {
} catch (\Exception $e) {
unlink($absPath);
unlink($pdfPreview);
- \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
+ \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php
index 4ad274c893b..fb06faf9c23 100644
--- a/lib/private/Preview/SVG.php
+++ b/lib/private/Preview/SVG.php
@@ -53,7 +53,7 @@ class SVG extends Provider {
$svg->readImageBlob($content);
$svg->setImageFormat('png32');
} catch (\Exception $e) {
- \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
+ \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php
index d3bea0f9957..de46d039229 100644
--- a/lib/private/Repair/CleanTags.php
+++ b/lib/private/Repair/CleanTags.php
@@ -202,7 +202,7 @@ class CleanTags implements IRepairStep {
}
if ($repairInfo) {
- $output->info(sprintf($repairInfo, sizeof($orphanItems)));
+ $output->info(sprintf($repairInfo, count($orphanItems)));
}
}
}
diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php
index ddb05c759ea..787725ab87b 100644
--- a/lib/private/Search/Provider/File.php
+++ b/lib/private/Search/Provider/File.php
@@ -37,7 +37,7 @@ class File extends \OCP\Search\Provider {
* @param string $query
* @return \OCP\Search\Result
*/
- function search($query) {
+ public function search($query) {
$files = Filesystem::search($query);
$results = array();
// edit results
diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php
index 176faf68e2d..1dd680ea13f 100644
--- a/lib/private/Security/Crypto.php
+++ b/lib/private/Security/Crypto.php
@@ -56,7 +56,7 @@ class Crypto implements ICrypto {
* @param IConfig $config
* @param ISecureRandom $random
*/
- function __construct(IConfig $config, ISecureRandom $random) {
+ public function __construct(IConfig $config, ISecureRandom $random) {
$this->cipher = new AES();
$this->config = $config;
$this->random = $random;
@@ -115,7 +115,7 @@ class Crypto implements ICrypto {
$this->cipher->setPassword($password);
$parts = explode('|', $authenticatedCiphertext);
- if(sizeof($parts) !== 3) {
+ if(count($parts) !== 3) {
throw new \Exception('Authenticated ciphertext could not be decoded.');
}
diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php
index 3bc546fa0a2..ddba82fec43 100644
--- a/lib/private/Security/Hasher.php
+++ b/lib/private/Security/Hasher.php
@@ -58,7 +58,7 @@ class Hasher implements IHasher {
/**
* @param IConfig $config
*/
- function __construct(IConfig $config) {
+ public function __construct(IConfig $config) {
$this->config = $config;
$hashingCost = $this->config->getSystemValue('hashingCost', null);
@@ -86,7 +86,7 @@ class Hasher implements IHasher {
*/
protected function splitHash($prefixedHash) {
$explodedString = explode('|', $prefixedHash, 2);
- if(sizeof($explodedString) === 2) {
+ if(count($explodedString) === 2) {
if((int)$explodedString[0] > 0) {
return array('version' => (int)$explodedString[0], 'hash' => $explodedString[1]);
}
diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php
index a8cbdb6ee6c..221d21fb6a4 100644
--- a/lib/private/Security/TrustedDomainHelper.php
+++ b/lib/private/Security/TrustedDomainHelper.php
@@ -38,7 +38,7 @@ class TrustedDomainHelper {
/**
* @param IConfig $config
*/
- function __construct(IConfig $config) {
+ public function __construct(IConfig $config) {
$this->config = $config;
}
@@ -89,7 +89,7 @@ class TrustedDomainHelper {
if (gettype($trusted) !== 'string') {
break;
}
- $regex = '/^' . join('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/';
+ $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/';
if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) {
return true;
}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index c89931a2d1c..5efbcfecf32 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -113,6 +113,7 @@ use OCP\IServerContainer;
use OCP\ITempManager;
use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\IURLGenerator;
+use OCP\Lock\ILockingProvider;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share\IShareHelper;
@@ -785,7 +786,7 @@ class Server extends ServerContainer implements IServerContainer {
$factory = new $factoryClass($this);
return $factory->getLDAPProvider();
});
- $this->registerService('LockingProvider', function (Server $c) {
+ $this->registerService(ILockingProvider::class, function (Server $c) {
$ini = $c->getIniWrapper();
$config = $c->getConfig();
$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
@@ -800,6 +801,7 @@ class Server extends ServerContainer implements IServerContainer {
}
return new NoopLockingProvider();
});
+ $this->registerAlias('LockingProvider', ILockingProvider::class);
$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
return new \OC\Files\Mount\Manager();
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
index fb1f388c599..e92541c0010 100644
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ b/lib/private/Settings/Personal/PersonalInfo.php
@@ -118,10 +118,10 @@ class PersonalInfo implements ISettings {
'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
'usage_relative' => $storageInfo['relative'],
'quota' => $storageInfo['quota'],
- 'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
+ 'avatarChangeSupported' => $user->canChangeAvatar(),
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
- 'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
+ 'displayNameChangeSupported' => $user->canChangeDisplayName(),
'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
@@ -138,7 +138,7 @@ class PersonalInfo implements ISettings {
'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
'groups' => $this->getGroups($user),
- 'passwordChangeSupported' => \OC_User::canUserChangePassword($uid),
+ 'passwordChangeSupported' => $user->canChangePassword(),
] + $messageParameters + $languageParameters;
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index 6f3741f5ae7..6503e67a8f9 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -860,7 +860,7 @@ class DefaultShareProvider implements IShareProvider {
if (isset($data['f_permissions'])) {
$entryData = $data;
$entryData['permissions'] = $entryData['f_permissions'];
- $entryData['parent'] = $entryData['f_parent'];;
+ $entryData['parent'] = $entryData['f_parent'];
$share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData,
\OC::$server->getMimeTypeLoader()));
}
diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php
index ab0deba0360..08f9b6bc4af 100644
--- a/lib/private/SystemTag/SystemTagManager.php
+++ b/lib/private/SystemTag/SystemTagManager.php
@@ -408,7 +408,7 @@ class SystemTagManager implements ISystemTagManager {
$this->connection->commit();
} catch (\Exception $e) {
- $this->connection->rollback();
+ $this->connection->rollBack();
throw $e;
}
}
diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php
index e562a2dfd4b..4a6ffdeddfb 100644
--- a/lib/private/SystemTag/SystemTagObjectMapper.php
+++ b/lib/private/SystemTag/SystemTagObjectMapper.php
@@ -112,7 +112,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
->andWhere($query->expr()->eq('objecttype', $query->createNamedParameter($objectType)));
if ($limit) {
- if (sizeof($tagIds) !== 1) {
+ if (count($tagIds) !== 1) {
throw new \InvalidArgumentException('Limit is only allowed with a single tag');
}
diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php
index 4dfcbe7f523..dc6dad15d3c 100644
--- a/lib/private/TempManager.php
+++ b/lib/private/TempManager.php
@@ -256,7 +256,7 @@ class TempManager implements ITempManager {
// suppress any possible errors caused by is_writable
// checks missing or invalid path or characters, wrong permissions etc
try {
- if (is_writeable($directory)) {
+ if (is_writable($directory)) {
return true;
}
} catch (\Exception $e) {
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 463e13da915..9f6932b3a89 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -1244,7 +1244,7 @@ class OC_App {
$dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
$missing = $dependencyAnalyzer->analyze($info);
if (!empty($missing)) {
- $missingMsg = join(PHP_EOL, $missing);
+ $missingMsg = implode(PHP_EOL, $missing);
throw new \Exception(
$l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s',
[$info['name'], $missingMsg]
diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php
index 7e7cbab3bce..2b0fba73366 100644
--- a/lib/private/legacy/user.php
+++ b/lib/private/legacy/user.php
@@ -156,20 +156,6 @@ class OC_User {
}
/**
-
- * Try to login a user using the magic cookie (remember login)
- *
- * @deprecated use \OCP\IUserSession::loginWithCookie()
- * @param string $uid The username of the user to log in
- * @param string $token
- * @param string $oldSessionId
- * @return bool
- */
- public static function loginWithCookie($uid, $token, $oldSessionId) {
- return self::getUserSession()->loginWithCookie($uid, $token, $oldSessionId);
- }
-
- /**
* Try to login a user, assuming authentication
* has already happened (e.g. via Single Sign On).
*
@@ -233,7 +219,7 @@ class OC_User {
//setup extra user backends
self::setupBackends();
- self::unsetMagicInCookie();
+ self::getUserSession()->unsetMagicInCookie();
return self::loginWithApache($backend);
}
@@ -382,17 +368,6 @@ class OC_User {
}
/**
- * Autogenerate a password
- *
- * @return string
- *
- * generates a password
- */
- public static function generatePassword() {
- return \OC::$server->getSecureRandom()->generate(30);
- }
-
- /**
* Set password
*
* @param string $uid The username
@@ -412,57 +387,6 @@ class OC_User {
}
/**
- * Check whether user can change his avatar
- *
- * @param string $uid The username
- * @return bool
- *
- * Check whether a specified user can change his avatar
- */
- public static function canUserChangeAvatar($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- return $user->canChangeAvatar();
- } else {
- return false;
- }
- }
-
- /**
- * Check whether user can change his password
- *
- * @param string $uid The username
- * @return bool
- *
- * Check whether a specified user can change his password
- */
- public static function canUserChangePassword($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- return $user->canChangePassword();
- } else {
- return false;
- }
- }
-
- /**
- * Check whether user can change his display name
- *
- * @param string $uid The username
- * @return bool
- *
- * Check whether a specified user can change his display name
- */
- public static function canUserChangeDisplayName($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- return $user->canChangeDisplayName();
- } else {
- return false;
- }
- }
-
- /**
* Check if the password is correct
*
* @param string $uid The username
@@ -547,30 +471,6 @@ class OC_User {
}
/**
- * disables a user
- *
- * @param string $uid the user to disable
- */
- public static function disableUser($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- $user->setEnabled(false);
- }
- }
-
- /**
- * enable a user
- *
- * @param string $uid
- */
- public static function enableUser($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- $user->setEnabled(true);
- }
- }
-
- /**
* checks if a user is enabled
*
* @param string $uid
@@ -586,23 +486,6 @@ class OC_User {
}
/**
- * Set cookie value to use in next page load
- *
- * @param string $username username to be set
- * @param string $token
- */
- public static function setMagicInCookie($username, $token) {
- self::getUserSession()->setMagicInCookie($username, $token);
- }
-
- /**
- * Remove cookie for "remember username"
- */
- public static function unsetMagicInCookie() {
- self::getUserSession()->unsetMagicInCookie();
- }
-
- /**
* Returns the first active backend from self::$_usedBackends.
*
* @return OCP\Authentication\IApacheBackend|null if no backend active, otherwise OCP\Authentication\IApacheBackend
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
index 5658a382410..c9cc078ed09 100644
--- a/settings/ajax/togglesubadmins.php
+++ b/settings/ajax/togglesubadmins.php
@@ -39,8 +39,8 @@ $targetUserObject = \OC::$server->getUserManager()->get($username);
$targetGroupObject = \OC::$server->getGroupManager()->get($group);
$isSubAdminOfGroup = false;
-if($targetUserObject !== null && $targetUserObject !== null) {
- $isSubAdminOfGroup = $subAdminManager->isSubAdminofGroup($targetUserObject, $targetGroupObject);
+if($targetUserObject !== null && $targetGroupObject !== null) {
+ $isSubAdminOfGroup = $subAdminManager->isSubAdminOfGroup($targetUserObject, $targetGroupObject);
}
// Toggle group
diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php
index 0e68a893ef4..79109600a39 100644
--- a/settings/ajax/uninstallapp.php
+++ b/settings/ajax/uninstallapp.php
@@ -47,5 +47,5 @@ if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = \OC::$server->getL10N('settings');
- OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
+ OC_JSON::error(array('data' => array( 'message' => $l->t("Couldn't remove app.") )));
}
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
index bcf8e149140..b398e41033b 100644
--- a/settings/ajax/updateapp.php
+++ b/settings/ajax/updateapp.php
@@ -51,7 +51,7 @@ try {
$config->setSystemValue('maintenance', false);
} catch(Exception $ex) {
$config->setSystemValue('maintenance', false);
- OC_JSON::error(array("data" => array( "message" => $ex->getMessage() )));
+ OC_JSON::error(array('data' => array( 'message' => $ex->getMessage() )));
return;
}
@@ -59,5 +59,5 @@ if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = \OC::$server->getL10N('settings');
- OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
+ OC_JSON::error(array('data' => array( 'message' => $l->t("Couldn't update app.") )));
}
diff --git a/tests/Settings/Mailer/NewUserMailHelperTest.php b/tests/Settings/Mailer/NewUserMailHelperTest.php
index cee3b15b946..40ba9ee1c21 100644
--- a/tests/Settings/Mailer/NewUserMailHelperTest.php
+++ b/tests/Settings/Mailer/NewUserMailHelperTest.php
@@ -182,10 +182,7 @@ class NewUserMailHelperTest extends TestCase {
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>
@@ -418,10 +415,7 @@ EOF;
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>
diff --git a/tests/data/emails/new-account-email-custom.html b/tests/data/emails/new-account-email-custom.html
index 4dd95db0510..e35b9f57848 100644
--- a/tests/data/emails/new-account-email-custom.html
+++ b/tests/data/emails/new-account-email-custom.html
@@ -23,10 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>
diff --git a/tests/data/emails/new-account-email-single-button.html b/tests/data/emails/new-account-email-single-button.html
index 128f4f30db7..d70a8a647d3 100644
--- a/tests/data/emails/new-account-email-single-button.html
+++ b/tests/data/emails/new-account-email-single-button.html
@@ -23,10 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>
diff --git a/tests/data/emails/new-account-email.html b/tests/data/emails/new-account-email.html
index 273e722e052..3e8814bbfbb 100644
--- a/tests/data/emails/new-account-email.html
+++ b/tests/data/emails/new-account-email.html
@@ -23,10 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <!-- convince Outlook to have a max-width of 100px -->
- <!--[if mso]><table><tr><td width="100"><![endif]-->
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
- <!--[if mso]></td></tr></table><![endif]-->
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none" height="50">
</center>
</tr>
</tbody>