Completed
Pull Request — stable10 (#5732)
by Morris
14:18
created
apps/files_external/lib/Lib/Api.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -28,61 +28,61 @@
 block discarded – undo
28 28
 
29 29
 class Api {
30 30
 
31
-	/**
32
-	 * Formats the given mount config to a mount entry.
33
-	 *
34
-	 * @param string $mountPoint mount point name, relative to the data dir
35
-	 * @param array $mountConfig mount config to format
36
-	 *
37
-	 * @return array entry
38
-	 */
39
-	private static function formatMount($mountPoint, $mountConfig) {
40
-		// strip "/$user/files" from mount point
41
-		$mountPoint = explode('/', trim($mountPoint, '/'), 3);
42
-		$mountPoint = $mountPoint[2];
31
+    /**
32
+     * Formats the given mount config to a mount entry.
33
+     *
34
+     * @param string $mountPoint mount point name, relative to the data dir
35
+     * @param array $mountConfig mount config to format
36
+     *
37
+     * @return array entry
38
+     */
39
+    private static function formatMount($mountPoint, $mountConfig) {
40
+        // strip "/$user/files" from mount point
41
+        $mountPoint = explode('/', trim($mountPoint, '/'), 3);
42
+        $mountPoint = $mountPoint[2];
43 43
 
44
-		// split path from mount point
45
-		$path = dirname($mountPoint);
46
-		if ($path === '.') {
47
-			$path = '';
48
-		}
44
+        // split path from mount point
45
+        $path = dirname($mountPoint);
46
+        if ($path === '.') {
47
+            $path = '';
48
+        }
49 49
 
50
-		$isSystemMount = !$mountConfig['personal'];
50
+        $isSystemMount = !$mountConfig['personal'];
51 51
 
52
-		$permissions = \OCP\Constants::PERMISSION_READ;
53
-		// personal mounts can be deleted
54
-		if (!$isSystemMount) {
55
-			$permissions |= \OCP\Constants::PERMISSION_DELETE;
56
-		}
52
+        $permissions = \OCP\Constants::PERMISSION_READ;
53
+        // personal mounts can be deleted
54
+        if (!$isSystemMount) {
55
+            $permissions |= \OCP\Constants::PERMISSION_DELETE;
56
+        }
57 57
 
58
-		$entry = array(
59
-			'name' => basename($mountPoint),
60
-			'path' => $path,
61
-			'type' => 'dir',
62
-			'backend' => $mountConfig['backend'],
63
-			'scope' => ( $isSystemMount ? 'system' : 'personal' ),
64
-			'permissions' => $permissions,
65
-			'id' => $mountConfig['id'],
66
-			'class' => $mountConfig['class']
67
-		);
68
-		return $entry;
69
-	}
58
+        $entry = array(
59
+            'name' => basename($mountPoint),
60
+            'path' => $path,
61
+            'type' => 'dir',
62
+            'backend' => $mountConfig['backend'],
63
+            'scope' => ( $isSystemMount ? 'system' : 'personal' ),
64
+            'permissions' => $permissions,
65
+            'id' => $mountConfig['id'],
66
+            'class' => $mountConfig['class']
67
+        );
68
+        return $entry;
69
+    }
70 70
 
71
-	/**
72
-	 * Returns the mount points visible for this user.
73
-	 *
74
-	 * @param array $params
75
-	 * @return \OC_OCS_Result share information
76
-	 */
77
-	public static function getUserMounts($params) {
78
-		$entries = array();
79
-		$user = \OC::$server->getUserSession()->getUser()->getUID();
71
+    /**
72
+     * Returns the mount points visible for this user.
73
+     *
74
+     * @param array $params
75
+     * @return \OC_OCS_Result share information
76
+     */
77
+    public static function getUserMounts($params) {
78
+        $entries = array();
79
+        $user = \OC::$server->getUserSession()->getUser()->getUID();
80 80
 
81
-		$mounts = \OC_Mount_Config::getAbsoluteMountPoints($user);
82
-		foreach($mounts as $mountPoint => $mount) {
83
-			$entries[] = self::formatMount($mountPoint, $mount);
84
-		}
81
+        $mounts = \OC_Mount_Config::getAbsoluteMountPoints($user);
82
+        foreach($mounts as $mountPoint => $mount) {
83
+            $entries[] = self::formatMount($mountPoint, $mount);
84
+        }
85 85
 
86
-		return new \OC_OCS_Result($entries);
87
-	}
86
+        return new \OC_OCS_Result($entries);
87
+    }
88 88
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/IdentifierTrait.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -28,76 +28,76 @@
 block discarded – undo
28 28
  */
29 29
 trait IdentifierTrait {
30 30
 
31
-	/** @var string */
32
-	protected $identifier;
31
+    /** @var string */
32
+    protected $identifier;
33 33
 
34
-	/** @var string[] */
35
-	protected $identifierAliases = [];
34
+    /** @var string[] */
35
+    protected $identifierAliases = [];
36 36
 
37
-	/** @var IdentifierTrait */
38
-	protected $deprecateTo = null;
37
+    /** @var IdentifierTrait */
38
+    protected $deprecateTo = null;
39 39
 
40
-	/**
41
-	 * @return string
42
-	 */
43
-	public function getIdentifier() {
44
-		return $this->identifier;
45
-	}
40
+    /**
41
+     * @return string
42
+     */
43
+    public function getIdentifier() {
44
+        return $this->identifier;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string $identifier
49
-	 * @return self
50
-	 */
51
-	public function setIdentifier($identifier) {
52
-		$this->identifier = $identifier;
53
-		$this->identifierAliases[] = $identifier;
54
-		return $this;
55
-	}
47
+    /**
48
+     * @param string $identifier
49
+     * @return self
50
+     */
51
+    public function setIdentifier($identifier) {
52
+        $this->identifier = $identifier;
53
+        $this->identifierAliases[] = $identifier;
54
+        return $this;
55
+    }
56 56
 
57
-	/**
58
-	 * @return string[]
59
-	 */
60
-	public function getIdentifierAliases() {
61
-		return $this->identifierAliases;
62
-	}
57
+    /**
58
+     * @return string[]
59
+     */
60
+    public function getIdentifierAliases() {
61
+        return $this->identifierAliases;
62
+    }
63 63
 
64
-	/**
65
-	 * @param string $alias
66
-	 * @return self
67
-	 */
68
-	public function addIdentifierAlias($alias) {
69
-		$this->identifierAliases[] = $alias;
70
-		return $this;
71
-	}
64
+    /**
65
+     * @param string $alias
66
+     * @return self
67
+     */
68
+    public function addIdentifierAlias($alias) {
69
+        $this->identifierAliases[] = $alias;
70
+        return $this;
71
+    }
72 72
 
73
-	/**
74
-	 * @return object|null
75
-	 */
76
-	public function getDeprecateTo() {
77
-		return $this->deprecateTo;
78
-	}
73
+    /**
74
+     * @return object|null
75
+     */
76
+    public function getDeprecateTo() {
77
+        return $this->deprecateTo;
78
+    }
79 79
 
80
-	/**
81
-	 * @param object $destinationObject
82
-	 * @return self
83
-	 */
84
-	public function deprecateTo($destinationObject) {
85
-		$this->deprecateTo = $destinationObject;
86
-		return $this;
87
-	}
80
+    /**
81
+     * @param object $destinationObject
82
+     * @return self
83
+     */
84
+    public function deprecateTo($destinationObject) {
85
+        $this->deprecateTo = $destinationObject;
86
+        return $this;
87
+    }
88 88
 
89
-	/**
90
-	 * @return array
91
-	 */
92
-	public function jsonSerializeIdentifier() {
93
-		$data = [
94
-			'identifier' => $this->identifier,
95
-			'identifierAliases' => $this->identifierAliases,
96
-		];
97
-		if ($this->deprecateTo) {
98
-			$data['deprecateTo'] = $this->deprecateTo->getIdentifier();
99
-		}
100
-		return $data;
101
-	}
89
+    /**
90
+     * @return array
91
+     */
92
+    public function jsonSerializeIdentifier() {
93
+        $data = [
94
+            'identifier' => $this->identifier,
95
+            'identifierAliases' => $this->identifierAliases,
96
+        ];
97
+        if ($this->deprecateTo) {
98
+            $data['deprecateTo'] = $this->deprecateTo->getIdentifier();
99
+        }
100
+        return $data;
101
+    }
102 102
 
103 103
 }
Please login to merge, or discard this patch.
apps/files_external/appinfo/update.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,6 +27,6 @@
 block discarded – undo
27 27
 
28 28
 // Migration to db config
29 29
 if (version_compare($installedVersion, '0.5.0', '<')) {
30
-	$migrator = $app->getContainer()->query('OCA\Files_External\Migration\StorageMigrator');
31
-	$migrator->migrateGlobal();
30
+    $migrator = $app->getContainer()->query('OCA\Files_External\Migration\StorageMigrator');
31
+    $migrator->migrateGlobal();
32 32
 }
Please login to merge, or discard this patch.
apps/files_external/appinfo/routes.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,40 +30,40 @@
 block discarded – undo
30 30
  * @var $this \OCP\Route\IRouter
31 31
  **/
32 32
 \OC_Mount_Config::$app->registerRoutes(
33
-	$this,
34
-	array(
35
-		'resources' => array(
36
-			'global_storages' => array('url' => '/globalstorages'),
37
-			'user_storages' => array('url' => '/userstorages'),
38
-			'user_global_storages' => array('url' => '/userglobalstorages'),
39
-		),
40
-		'routes' => array(
41
-			array(
42
-				'name' => 'Ajax#getSshKeys',
43
-				'url' => '/ajax/public_key.php',
44
-				'verb' => 'POST',
45
-				'requirements' => array()
46
-			),
47
-			[
48
-				'name' => 'Ajax#saveGlobalCredentials',
49
-				'url' => '/globalcredentials',
50
-				'verb' => 'POST',
51
-			],
52
-		)
53
-	)
33
+    $this,
34
+    array(
35
+        'resources' => array(
36
+            'global_storages' => array('url' => '/globalstorages'),
37
+            'user_storages' => array('url' => '/userstorages'),
38
+            'user_global_storages' => array('url' => '/userglobalstorages'),
39
+        ),
40
+        'routes' => array(
41
+            array(
42
+                'name' => 'Ajax#getSshKeys',
43
+                'url' => '/ajax/public_key.php',
44
+                'verb' => 'POST',
45
+                'requirements' => array()
46
+            ),
47
+            [
48
+                'name' => 'Ajax#saveGlobalCredentials',
49
+                'url' => '/globalcredentials',
50
+                'verb' => 'POST',
51
+            ],
52
+        )
53
+    )
54 54
 );
55 55
 
56 56
 $this->create('files_external_oauth1', 'ajax/oauth1.php')
57
-	->actionInclude('files_external/ajax/oauth1.php');
57
+    ->actionInclude('files_external/ajax/oauth1.php');
58 58
 $this->create('files_external_oauth2', 'ajax/oauth2.php')
59
-	->actionInclude('files_external/ajax/oauth2.php');
59
+    ->actionInclude('files_external/ajax/oauth2.php');
60 60
 
61 61
 
62 62
 $this->create('files_external_list_applicable', '/applicable')
63
-	->actionInclude('files_external/ajax/applicable.php');
63
+    ->actionInclude('files_external/ajax/applicable.php');
64 64
 
65 65
 \OCP\API::register('get',
66
-		'/apps/files_external/api/v1/mounts',
67
-		array('\OCA\Files_External\Lib\Api', 'getUserMounts'),
68
-		'files_external');
66
+        '/apps/files_external/api/v1/mounts',
67
+        array('\OCA\Files_External\Lib\Api', 'getUserMounts'),
68
+        'files_external');
69 69
 
Please login to merge, or discard this patch.
apps/files_external/appinfo/app.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 $l = \OC::$server->getL10N('files_external');
41 41
 
42 42
 \OCA\Files\App::getNavigationManager()->add([
43
-	"id" => 'extstoragemounts',
44
-	"appname" => 'files_external',
45
-	"script" => 'list.php',
46
-	"order" => 30,
47
-	"name" => $l->t('External storage')
43
+    "id" => 'extstoragemounts',
44
+    "appname" => 'files_external',
45
+    "script" => 'list.php',
46
+    "order" => 30,
47
+    "name" => $l->t('External storage')
48 48
 ]);
49 49
 
50 50
 $mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter');
Please login to merge, or discard this patch.
apps/systemtags/lib/Settings/Admin.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@
 block discarded – undo
28 28
 
29 29
 class Admin implements ISettings {
30 30
 
31
-	/**
32
-	 * @return TemplateResponse
33
-	 */
34
-	public function getForm() {
35
-		return new TemplateResponse('systemtags', 'admin', [], '');
36
-	}
31
+    /**
32
+     * @return TemplateResponse
33
+     */
34
+    public function getForm() {
35
+        return new TemplateResponse('systemtags', 'admin', [], '');
36
+    }
37 37
 
38
-	/**
39
-	 * @return string the section ID, e.g. 'sharing'
40
-	 */
41
-	public function getSection() {
42
-		return 'workflow';
43
-	}
38
+    /**
39
+     * @return string the section ID, e.g. 'sharing'
40
+     */
41
+    public function getSection() {
42
+        return 'workflow';
43
+    }
44 44
 
45
-	/**
46
-	 * @return int whether the form should be rather on the top or bottom of
47
-	 * the admin section. The forms are arranged in ascending order of the
48
-	 * priority values. It is required to return a value between 0 and 100.
49
-	 *
50
-	 * E.g.: 70
51
-	 */
52
-	public function getPriority() {
53
-		return 70;
54
-	}
45
+    /**
46
+     * @return int whether the form should be rather on the top or bottom of
47
+     * the admin section. The forms are arranged in ascending order of the
48
+     * priority values. It is required to return a value between 0 and 100.
49
+     *
50
+     * E.g.: 70
51
+     */
52
+    public function getPriority() {
53
+        return 70;
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
apps/files_sharing/ajax/shareinfo.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 OCP\JSON::checkAppEnabled('files_sharing');
31 31
 
32 32
 if (!isset($_GET['t'])) {
33
-	\OC_Response::setStatus(400); //400 Bad Request
34
-	exit;
33
+    \OC_Response::setStatus(400); //400 Bad Request
34
+    exit;
35 35
 }
36 36
 
37 37
 $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
38 38
 $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
39 39
 
40 40
 if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false) {
41
-	\OC_Response::setStatus(404); // 404 not found
42
-	exit;
41
+    \OC_Response::setStatus(404); // 404 not found
42
+    exit;
43 43
 }
44 44
 
45 45
 $token = $_GET['t'];
46 46
 
47 47
 $password = null;
48 48
 if (isset($_POST['password'])) {
49
-	$password = $_POST['password'];
49
+    $password = $_POST['password'];
50 50
 }
51 51
 
52 52
 $relativePath = null;
53 53
 if (isset($_GET['dir'])) {
54
-	$relativePath = $_GET['dir'];
54
+    $relativePath = $_GET['dir'];
55 55
 }
56 56
 
57 57
 $data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password);
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 
64 64
 $isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
65 65
 if (!$isWritable) {
66
-	// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
67
-	$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
68
-	\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
69
-		return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
70
-	});
71
-	\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
66
+    // FIXME: should not add storage wrappers outside of preSetup, need to find a better way
67
+    $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
68
+    \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
69
+        return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
70
+    });
71
+    \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
72 72
 }
73 73
 
74 74
 $rootInfo = \OC\Files\Filesystem::getFileInfo($path);
75 75
 $rootView = new \OC\Files\View('');
76 76
 
77 77
 if($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
78
-	OCP\JSON::error(array('data' => 'Share is not readable.'));
79
-	exit();
78
+    OCP\JSON::error(array('data' => 'Share is not readable.'));
79
+    exit();
80 80
 }
81 81
 
82 82
 /**
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
  * @return array
86 86
  */
87 87
 function getChildInfo($dir, $view, $sharePermissions) {
88
-	$children = $view->getDirectoryContent($dir->getPath());
89
-	$result = array();
90
-	foreach ($children as $child) {
91
-		$formatted = \OCA\Files\Helper::formatFileInfo($child);
92
-		if ($child->getType() === 'dir') {
93
-			$formatted['children'] = getChildInfo($child, $view, $sharePermissions);
94
-		}
95
-		$formatted['mtime'] = $formatted['mtime'] / 1000;
96
-		$formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
97
-		$result[] = $formatted;
98
-	}
99
-	return $result;
88
+    $children = $view->getDirectoryContent($dir->getPath());
89
+    $result = array();
90
+    foreach ($children as $child) {
91
+        $formatted = \OCA\Files\Helper::formatFileInfo($child);
92
+        if ($child->getType() === 'dir') {
93
+            $formatted['children'] = getChildInfo($child, $view, $sharePermissions);
94
+        }
95
+        $formatted['mtime'] = $formatted['mtime'] / 1000;
96
+        $formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
97
+        $result[] = $formatted;
98
+    }
99
+    return $result;
100 100
 }
101 101
 
102 102
 $result = \OCA\Files\Helper::formatFileInfo($rootInfo);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 if ($rootInfo->getType() === 'dir') {
108
-	$result['children'] = getChildInfo($rootInfo, $rootView, $share->getPermissions());
108
+    $result['children'] = getChildInfo($rootInfo, $rootView, $share->getPermissions());
109 109
 }
110 110
 
111 111
 OCP\JSON::success(array('data' => $result));
Please login to merge, or discard this patch.
apps/files_sharing/lib/ExpireSharesJob.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -29,49 +29,49 @@
 block discarded – undo
29 29
  */
30 30
 class ExpireSharesJob extends TimedJob {
31 31
 
32
-	/**
33
-	 * sets the correct interval for this timed job
34
-	 */
35
-	public function __construct() {
36
-		// Run once a day
37
-		$this->setInterval(24 * 60 * 60);
38
-	}
32
+    /**
33
+     * sets the correct interval for this timed job
34
+     */
35
+    public function __construct() {
36
+        // Run once a day
37
+        $this->setInterval(24 * 60 * 60);
38
+    }
39 39
 
40
-	/**
41
-	 * Makes the background job do its work
42
-	 *
43
-	 * @param array $argument unused argument
44
-	 */
45
-	public function run($argument) {
46
-		$connection = \OC::$server->getDatabaseConnection();
47
-		$logger = \OC::$server->getLogger();
40
+    /**
41
+     * Makes the background job do its work
42
+     *
43
+     * @param array $argument unused argument
44
+     */
45
+    public function run($argument) {
46
+        $connection = \OC::$server->getDatabaseConnection();
47
+        $logger = \OC::$server->getLogger();
48 48
 
49
-		//Current time
50
-		$now = new \DateTime();
51
-		$now = $now->format('Y-m-d H:i:s');
49
+        //Current time
50
+        $now = new \DateTime();
51
+        $now = $now->format('Y-m-d H:i:s');
52 52
 
53
-		/*
53
+        /*
54 54
 		 * Expire file link shares only (for now)
55 55
 		 */
56
-		$qb = $connection->getQueryBuilder();
57
-		$qb->select('id', 'file_source', 'uid_owner', 'item_type')
58
-			->from('share')
59
-			->where(
60
-				$qb->expr()->andX(
61
-					$qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)),
62
-					$qb->expr()->lte('expiration', $qb->expr()->literal($now)),
63
-					$qb->expr()->orX(
64
-						$qb->expr()->eq('item_type', $qb->expr()->literal('file')),
65
-						$qb->expr()->eq('item_type', $qb->expr()->literal('folder'))
66
-					)
67
-				)
68
-			);
56
+        $qb = $connection->getQueryBuilder();
57
+        $qb->select('id', 'file_source', 'uid_owner', 'item_type')
58
+            ->from('share')
59
+            ->where(
60
+                $qb->expr()->andX(
61
+                    $qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)),
62
+                    $qb->expr()->lte('expiration', $qb->expr()->literal($now)),
63
+                    $qb->expr()->orX(
64
+                        $qb->expr()->eq('item_type', $qb->expr()->literal('file')),
65
+                        $qb->expr()->eq('item_type', $qb->expr()->literal('folder'))
66
+                    )
67
+                )
68
+            );
69 69
 
70
-		$shares = $qb->execute();
71
-		while($share = $shares->fetch()) {
72
-			\OCP\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']);
73
-		}
74
-		$shares->closeCursor();
75
-	}
70
+        $shares = $qb->execute();
71
+        while($share = $shares->fetch()) {
72
+            \OCP\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']);
73
+        }
74
+        $shares->closeCursor();
75
+    }
76 76
 
77 77
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Exceptions/BrokenPath.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@
 block discarded – undo
27 27
  * Expected path with a different root
28 28
  * Possible Error Codes:
29 29
  * 10 - Path not relative to data/ and point to the users file directory
30
-
31 30
  */
32 31
 class BrokenPath extends \Exception {
33 32
 }
Please login to merge, or discard this patch.