Passed
Push — master ( 61a02b...010b07 )
by Roeland
19:08 queued 08:59
created
apps/files_external/lib/Lib/Backend/FTP.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@
 block discarded – undo
33 33
 
34 34
 class FTP extends Backend {
35 35
 
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, Password $legacyAuth) {
39
-		$this
40
-			->setIdentifier('ftp')
41
-			->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
43
-			->setText($l->t('FTP'))
44
-			->addParameters([
45
-				new DefinitionParameter('host', $l->t('Host')),
46
-				(new DefinitionParameter('root', $l->t('Remote subfolder')))
47
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
-				(new DefinitionParameter('secure', $l->t('Secure ftps://')))
49
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
50
-			])
51
-			->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
52
-			->setLegacyAuthMechanism($legacyAuth)
53
-		;
54
-	}
38
+    public function __construct(IL10N $l, Password $legacyAuth) {
39
+        $this
40
+            ->setIdentifier('ftp')
41
+            ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
43
+            ->setText($l->t('FTP'))
44
+            ->addParameters([
45
+                new DefinitionParameter('host', $l->t('Host')),
46
+                (new DefinitionParameter('root', $l->t('Remote subfolder')))
47
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
+                (new DefinitionParameter('secure', $l->t('Secure ftps://')))
49
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
50
+            ])
51
+            ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
52
+            ->setLegacyAuthMechanism($legacyAuth)
53
+        ;
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/DAV.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@
 block discarded – undo
33 33
 
34 34
 class DAV extends Backend {
35 35
 
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, Password $legacyAuth) {
39
-		$this
40
-			->setIdentifier('dav')
41
-			->addIdentifierAlias('\OC\Files\Storage\DAV') // legacy compat
42
-			->setStorageClass('\OC\Files\Storage\DAV')
43
-			->setText($l->t('WebDAV'))
44
-			->addParameters([
45
-				new DefinitionParameter('host', $l->t('URL')),
46
-				(new DefinitionParameter('root', $l->t('Remote subfolder')))
47
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
-				(new DefinitionParameter('secure', $l->t('Secure https://')))
49
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
50
-			])
51
-			->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
52
-			->setLegacyAuthMechanism($legacyAuth)
53
-		;
54
-	}
38
+    public function __construct(IL10N $l, Password $legacyAuth) {
39
+        $this
40
+            ->setIdentifier('dav')
41
+            ->addIdentifierAlias('\OC\Files\Storage\DAV') // legacy compat
42
+            ->setStorageClass('\OC\Files\Storage\DAV')
43
+            ->setText($l->t('WebDAV'))
44
+            ->addParameters([
45
+                new DefinitionParameter('host', $l->t('URL')),
46
+                (new DefinitionParameter('root', $l->t('Remote subfolder')))
47
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
+                (new DefinitionParameter('secure', $l->t('Secure https://')))
49
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
50
+            ])
51
+            ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
52
+            ->setLegacyAuthMechanism($legacyAuth)
53
+        ;
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Local.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@
 block discarded – undo
31 31
 
32 32
 class Local extends Backend {
33 33
 
34
-	public function __construct(IL10N $l, NullMechanism $legacyAuth) {
35
-		$this
36
-			->setIdentifier('local')
37
-			->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat
38
-			->setStorageClass('\OC\Files\Storage\Local')
39
-			->setText($l->t('Local'))
40
-			->addParameters([
41
-				new DefinitionParameter('datadir', $l->t('Location')),
42
-			])
43
-			->setAllowedVisibility(BackendService::VISIBILITY_ADMIN)
44
-			->setPriority(BackendService::PRIORITY_DEFAULT + 50)
45
-			->addAuthScheme(AuthMechanism::SCHEME_NULL)
46
-			->setLegacyAuthMechanism($legacyAuth)
47
-		;
48
-	}
34
+    public function __construct(IL10N $l, NullMechanism $legacyAuth) {
35
+        $this
36
+            ->setIdentifier('local')
37
+            ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat
38
+            ->setStorageClass('\OC\Files\Storage\Local')
39
+            ->setText($l->t('Local'))
40
+            ->addParameters([
41
+                new DefinitionParameter('datadir', $l->t('Location')),
42
+            ])
43
+            ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN)
44
+            ->setPriority(BackendService::PRIORITY_DEFAULT + 50)
45
+            ->addAuthScheme(AuthMechanism::SCHEME_NULL)
46
+            ->setLegacyAuthMechanism($legacyAuth)
47
+        ;
48
+    }
49 49
 
50 50
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/AmazonS3.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,32 +33,32 @@
 block discarded – undo
33 33
 
34 34
 class AmazonS3 extends Backend {
35 35
 
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, AccessKey $legacyAuth) {
39
-		$this
40
-			->setIdentifier('amazons3')
41
-			->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
43
-			->setText($l->t('Amazon S3'))
44
-			->addParameters([
45
-				new DefinitionParameter('bucket', $l->t('Bucket')),
46
-				(new DefinitionParameter('hostname', $l->t('Hostname')))
47
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
-				(new DefinitionParameter('port', $l->t('Port')))
49
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
50
-				(new DefinitionParameter('region', $l->t('Region')))
51
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
-				(new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
53
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
54
-				(new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
55
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
56
-				(new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))
57
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
58
-			])
59
-			->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY)
60
-			->setLegacyAuthMechanism($legacyAuth)
61
-		;
62
-	}
38
+    public function __construct(IL10N $l, AccessKey $legacyAuth) {
39
+        $this
40
+            ->setIdentifier('amazons3')
41
+            ->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
43
+            ->setText($l->t('Amazon S3'))
44
+            ->addParameters([
45
+                new DefinitionParameter('bucket', $l->t('Bucket')),
46
+                (new DefinitionParameter('hostname', $l->t('Hostname')))
47
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
48
+                (new DefinitionParameter('port', $l->t('Port')))
49
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
50
+                (new DefinitionParameter('region', $l->t('Region')))
51
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
52
+                (new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
53
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
54
+                (new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
55
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
56
+                (new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))
57
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
58
+            ])
59
+            ->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY)
60
+            ->setLegacyAuthMechanism($legacyAuth)
61
+        ;
62
+    }
63 63
 
64 64
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/SFTP.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@
 block discarded – undo
29 29
 
30 30
 class SFTP extends Backend {
31 31
 
32
-	public function __construct(IL10N $l, Password $legacyAuth) {
33
-		$this
34
-			->setIdentifier('sftp')
35
-			->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
36
-			->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
37
-			->setText($l->t('SFTP'))
38
-			->addParameters([
39
-				new DefinitionParameter('host', $l->t('Host')),
40
-				(new DefinitionParameter('root', $l->t('Root')))
41
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
42
-			])
43
-			->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
44
-			->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
45
-			->setLegacyAuthMechanism($legacyAuth)
46
-		;
47
-	}
32
+    public function __construct(IL10N $l, Password $legacyAuth) {
33
+        $this
34
+            ->setIdentifier('sftp')
35
+            ->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
36
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
37
+            ->setText($l->t('SFTP'))
38
+            ->addParameters([
39
+                new DefinitionParameter('host', $l->t('Host')),
40
+                (new DefinitionParameter('root', $l->t('Root')))
41
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
42
+            ])
43
+            ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
44
+            ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY)
45
+            ->setLegacyAuthMechanism($legacyAuth)
46
+        ;
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
lib/private/Memcache/ArrayCache.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -27,133 +27,133 @@
 block discarded – undo
27 27
 use OCP\IMemcache;
28 28
 
29 29
 class ArrayCache extends Cache implements IMemcache {
30
-	/** @var array Array with the cached data */
31
-	protected $cachedData = array();
30
+    /** @var array Array with the cached data */
31
+    protected $cachedData = array();
32 32
 
33
-	use CADTrait;
33
+    use CADTrait;
34 34
 
35
-	/**
36
-	 * {@inheritDoc}
37
-	 */
38
-	public function get($key) {
39
-		if ($this->hasKey($key)) {
40
-			return $this->cachedData[$key];
41
-		}
42
-		return null;
43
-	}
35
+    /**
36
+     * {@inheritDoc}
37
+     */
38
+    public function get($key) {
39
+        if ($this->hasKey($key)) {
40
+            return $this->cachedData[$key];
41
+        }
42
+        return null;
43
+    }
44 44
 
45
-	/**
46
-	 * {@inheritDoc}
47
-	 */
48
-	public function set($key, $value, $ttl = 0) {
49
-		$this->cachedData[$key] = $value;
50
-		return true;
51
-	}
45
+    /**
46
+     * {@inheritDoc}
47
+     */
48
+    public function set($key, $value, $ttl = 0) {
49
+        $this->cachedData[$key] = $value;
50
+        return true;
51
+    }
52 52
 
53
-	/**
54
-	 * {@inheritDoc}
55
-	 */
56
-	public function hasKey($key) {
57
-		return isset($this->cachedData[$key]);
58
-	}
53
+    /**
54
+     * {@inheritDoc}
55
+     */
56
+    public function hasKey($key) {
57
+        return isset($this->cachedData[$key]);
58
+    }
59 59
 
60
-	/**
61
-	 * {@inheritDoc}
62
-	 */
63
-	public function remove($key) {
64
-		unset($this->cachedData[$key]);
65
-		return true;
66
-	}
60
+    /**
61
+     * {@inheritDoc}
62
+     */
63
+    public function remove($key) {
64
+        unset($this->cachedData[$key]);
65
+        return true;
66
+    }
67 67
 
68
-	/**
69
-	 * {@inheritDoc}
70
-	 */
71
-	public function clear($prefix = '') {
72
-		if ($prefix === '') {
73
-			$this->cachedData = [];
74
-			return true;
75
-		}
68
+    /**
69
+     * {@inheritDoc}
70
+     */
71
+    public function clear($prefix = '') {
72
+        if ($prefix === '') {
73
+            $this->cachedData = [];
74
+            return true;
75
+        }
76 76
 
77
-		foreach ($this->cachedData as $key => $value) {
78
-			if (strpos($key, $prefix) === 0) {
79
-				$this->remove($key);
80
-			}
81
-		}
82
-		return true;
83
-	}
77
+        foreach ($this->cachedData as $key => $value) {
78
+            if (strpos($key, $prefix) === 0) {
79
+                $this->remove($key);
80
+            }
81
+        }
82
+        return true;
83
+    }
84 84
 
85
-	/**
86
-	 * Set a value in the cache if it's not already stored
87
-	 *
88
-	 * @param string $key
89
-	 * @param mixed $value
90
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
91
-	 * @return bool
92
-	 */
93
-	public function add($key, $value, $ttl = 0) {
94
-		// since this cache is not shared race conditions aren't an issue
95
-		if ($this->hasKey($key)) {
96
-			return false;
97
-		} else {
98
-			return $this->set($key, $value, $ttl);
99
-		}
100
-	}
85
+    /**
86
+     * Set a value in the cache if it's not already stored
87
+     *
88
+     * @param string $key
89
+     * @param mixed $value
90
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
91
+     * @return bool
92
+     */
93
+    public function add($key, $value, $ttl = 0) {
94
+        // since this cache is not shared race conditions aren't an issue
95
+        if ($this->hasKey($key)) {
96
+            return false;
97
+        } else {
98
+            return $this->set($key, $value, $ttl);
99
+        }
100
+    }
101 101
 
102
-	/**
103
-	 * Increase a stored number
104
-	 *
105
-	 * @param string $key
106
-	 * @param int $step
107
-	 * @return int | bool
108
-	 */
109
-	public function inc($key, $step = 1) {
110
-		$oldValue = $this->get($key);
111
-		if (is_int($oldValue)) {
112
-			$this->set($key, $oldValue + $step);
113
-			return $oldValue + $step;
114
-		} else {
115
-			$success = $this->add($key, $step);
116
-			return $success ? $step : false;
117
-		}
118
-	}
102
+    /**
103
+     * Increase a stored number
104
+     *
105
+     * @param string $key
106
+     * @param int $step
107
+     * @return int | bool
108
+     */
109
+    public function inc($key, $step = 1) {
110
+        $oldValue = $this->get($key);
111
+        if (is_int($oldValue)) {
112
+            $this->set($key, $oldValue + $step);
113
+            return $oldValue + $step;
114
+        } else {
115
+            $success = $this->add($key, $step);
116
+            return $success ? $step : false;
117
+        }
118
+    }
119 119
 
120
-	/**
121
-	 * Decrease a stored number
122
-	 *
123
-	 * @param string $key
124
-	 * @param int $step
125
-	 * @return int | bool
126
-	 */
127
-	public function dec($key, $step = 1) {
128
-		$oldValue = $this->get($key);
129
-		if (is_int($oldValue)) {
130
-			$this->set($key, $oldValue - $step);
131
-			return $oldValue - $step;
132
-		} else {
133
-			return false;
134
-		}
135
-	}
120
+    /**
121
+     * Decrease a stored number
122
+     *
123
+     * @param string $key
124
+     * @param int $step
125
+     * @return int | bool
126
+     */
127
+    public function dec($key, $step = 1) {
128
+        $oldValue = $this->get($key);
129
+        if (is_int($oldValue)) {
130
+            $this->set($key, $oldValue - $step);
131
+            return $oldValue - $step;
132
+        } else {
133
+            return false;
134
+        }
135
+    }
136 136
 
137
-	/**
138
-	 * Compare and set
139
-	 *
140
-	 * @param string $key
141
-	 * @param mixed $old
142
-	 * @param mixed $new
143
-	 * @return bool
144
-	 */
145
-	public function cas($key, $old, $new) {
146
-		if ($this->get($key) === $old) {
147
-			return $this->set($key, $new);
148
-		} else {
149
-			return false;
150
-		}
151
-	}
137
+    /**
138
+     * Compare and set
139
+     *
140
+     * @param string $key
141
+     * @param mixed $old
142
+     * @param mixed $new
143
+     * @return bool
144
+     */
145
+    public function cas($key, $old, $new) {
146
+        if ($this->get($key) === $old) {
147
+            return $this->set($key, $new);
148
+        } else {
149
+            return false;
150
+        }
151
+    }
152 152
 
153
-	/**
154
-	 * {@inheritDoc}
155
-	 */
156
-	static public function isAvailable() {
157
-		return true;
158
-	}
153
+    /**
154
+     * {@inheritDoc}
155
+     */
156
+    static public function isAvailable() {
157
+        return true;
158
+    }
159 159
 }
Please login to merge, or discard this patch.
lib/private/Share/Helper.php 1 patch
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -33,263 +33,263 @@
 block discarded – undo
33 33
 
34 34
 class Helper extends \OC\Share\Constants {
35 35
 
36
-	/**
37
-	 * Generate a unique target for the item
38
-	 * @param string $itemType
39
-	 * @param string $itemSource
40
-	 * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
41
-	 * @param string $shareWith User or group the item is being shared with
42
-	 * @param string $uidOwner User that is the owner of shared item
43
-	 * @param string $suggestedTarget The suggested target originating from a reshare (optional)
44
-	 * @param int $groupParent The id of the parent group share (optional)
45
-	 * @throws \Exception
46
-	 * @return string Item target
47
-	 */
48
-	public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedTarget = null, $groupParent = null) {
49
-		// FIXME: $uidOwner and $groupParent seems to be unused
50
-		$backend = \OC\Share\Share::getBackend($itemType);
51
-		if ($shareType === self::SHARE_TYPE_LINK || $shareType === self::SHARE_TYPE_REMOTE) {
52
-			if (isset($suggestedTarget)) {
53
-				return $suggestedTarget;
54
-			}
55
-			return $backend->generateTarget($itemSource, false);
56
-		} else {
57
-			if ($shareType == self::SHARE_TYPE_USER) {
58
-				// Share with is a user, so set share type to user and groups
59
-				$shareType = self::$shareTypeUserAndGroups;
60
-			}
36
+    /**
37
+     * Generate a unique target for the item
38
+     * @param string $itemType
39
+     * @param string $itemSource
40
+     * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
41
+     * @param string $shareWith User or group the item is being shared with
42
+     * @param string $uidOwner User that is the owner of shared item
43
+     * @param string $suggestedTarget The suggested target originating from a reshare (optional)
44
+     * @param int $groupParent The id of the parent group share (optional)
45
+     * @throws \Exception
46
+     * @return string Item target
47
+     */
48
+    public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedTarget = null, $groupParent = null) {
49
+        // FIXME: $uidOwner and $groupParent seems to be unused
50
+        $backend = \OC\Share\Share::getBackend($itemType);
51
+        if ($shareType === self::SHARE_TYPE_LINK || $shareType === self::SHARE_TYPE_REMOTE) {
52
+            if (isset($suggestedTarget)) {
53
+                return $suggestedTarget;
54
+            }
55
+            return $backend->generateTarget($itemSource, false);
56
+        } else {
57
+            if ($shareType == self::SHARE_TYPE_USER) {
58
+                // Share with is a user, so set share type to user and groups
59
+                $shareType = self::$shareTypeUserAndGroups;
60
+            }
61 61
 
62
-			// Check if suggested target exists first
63
-			if (!isset($suggestedTarget)) {
64
-				$suggestedTarget = $itemSource;
65
-			}
66
-			if ($shareType == self::SHARE_TYPE_GROUP) {
67
-				$target = $backend->generateTarget($suggestedTarget, false);
68
-			} else {
69
-				$target = $backend->generateTarget($suggestedTarget, $shareWith);
70
-			}
62
+            // Check if suggested target exists first
63
+            if (!isset($suggestedTarget)) {
64
+                $suggestedTarget = $itemSource;
65
+            }
66
+            if ($shareType == self::SHARE_TYPE_GROUP) {
67
+                $target = $backend->generateTarget($suggestedTarget, false);
68
+            } else {
69
+                $target = $backend->generateTarget($suggestedTarget, $shareWith);
70
+            }
71 71
 
72
-			return $target;
73
-		}
74
-	}
72
+            return $target;
73
+        }
74
+    }
75 75
 
76
-	/**
77
-	 * Delete all reshares and group share children of an item
78
-	 * @param int $parent Id of item to delete
79
-	 * @param bool $excludeParent If true, exclude the parent from the delete (optional)
80
-	 * @param string $uidOwner The user that the parent was shared with (optional)
81
-	 * @param int $newParent new parent for the childrens
82
-	 * @param bool $excludeGroupChildren exclude group children elements
83
-	 */
84
-	public static function delete($parent, $excludeParent = false, $uidOwner = null, $newParent = null, $excludeGroupChildren = false) {
85
-		$ids = array($parent);
86
-		$deletedItems = array();
87
-		$changeParent = array();
88
-		$parents = array($parent);
89
-		while (!empty($parents)) {
90
-			$parents = "'".implode("','", $parents)."'";
91
-			// Check the owner on the first search of reshares, useful for
92
-			// finding and deleting the reshares by a single user of a group share
93
-			$params = array();
94
-			if (count($ids) == 1 && isset($uidOwner)) {
95
-				// FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach
96
-				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
97
-					'`item_target`, `file_target`, `parent` ' .
98
-					'FROM `*PREFIX*share` ' .
99
-					'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? ';
100
-				$params[] = $uidOwner;
101
-			} else {
102
-				$queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
103
-					'`item_target`, `file_target`, `parent`, `uid_owner` ' .
104
-					'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') ';
105
-			}
106
-			if ($excludeGroupChildren) {
107
-				$queryString .= ' AND `share_type` != ?';
108
-				$params[] = self::$shareTypeGroupUserUnique;
109
-			}
110
-			$query = \OC_DB::prepare($queryString);
111
-			$result = $query->execute($params);
112
-			// Reset parents array, only go through loop again if items are found
113
-			$parents = array();
114
-			while ($item = $result->fetchRow()) {
115
-				$tmpItem = array(
116
-					'id' => $item['id'],
117
-					'shareWith' => $item['share_with'],
118
-					'itemTarget' => $item['item_target'],
119
-					'itemType' => $item['item_type'],
120
-					'shareType' => (int)$item['share_type'],
121
-				);
122
-				if (isset($item['file_target'])) {
123
-					$tmpItem['fileTarget'] = $item['file_target'];
124
-				}
125
-				// if we have a new parent for the child we remember the child
126
-				// to update the parent, if not we add it to the list of items
127
-				// which should be deleted
128
-				if ($newParent !== null) {
129
-					$changeParent[] = $item['id'];
130
-				} else {
131
-					$deletedItems[] = $tmpItem;
132
-					$ids[] = $item['id'];
133
-					$parents[] = $item['id'];
134
-				}
135
-			}
136
-		}
137
-		if ($excludeParent) {
138
-			unset($ids[0]);
139
-		}
76
+    /**
77
+     * Delete all reshares and group share children of an item
78
+     * @param int $parent Id of item to delete
79
+     * @param bool $excludeParent If true, exclude the parent from the delete (optional)
80
+     * @param string $uidOwner The user that the parent was shared with (optional)
81
+     * @param int $newParent new parent for the childrens
82
+     * @param bool $excludeGroupChildren exclude group children elements
83
+     */
84
+    public static function delete($parent, $excludeParent = false, $uidOwner = null, $newParent = null, $excludeGroupChildren = false) {
85
+        $ids = array($parent);
86
+        $deletedItems = array();
87
+        $changeParent = array();
88
+        $parents = array($parent);
89
+        while (!empty($parents)) {
90
+            $parents = "'".implode("','", $parents)."'";
91
+            // Check the owner on the first search of reshares, useful for
92
+            // finding and deleting the reshares by a single user of a group share
93
+            $params = array();
94
+            if (count($ids) == 1 && isset($uidOwner)) {
95
+                // FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach
96
+                $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
97
+                    '`item_target`, `file_target`, `parent` ' .
98
+                    'FROM `*PREFIX*share` ' .
99
+                    'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? ';
100
+                $params[] = $uidOwner;
101
+            } else {
102
+                $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' .
103
+                    '`item_target`, `file_target`, `parent`, `uid_owner` ' .
104
+                    'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') ';
105
+            }
106
+            if ($excludeGroupChildren) {
107
+                $queryString .= ' AND `share_type` != ?';
108
+                $params[] = self::$shareTypeGroupUserUnique;
109
+            }
110
+            $query = \OC_DB::prepare($queryString);
111
+            $result = $query->execute($params);
112
+            // Reset parents array, only go through loop again if items are found
113
+            $parents = array();
114
+            while ($item = $result->fetchRow()) {
115
+                $tmpItem = array(
116
+                    'id' => $item['id'],
117
+                    'shareWith' => $item['share_with'],
118
+                    'itemTarget' => $item['item_target'],
119
+                    'itemType' => $item['item_type'],
120
+                    'shareType' => (int)$item['share_type'],
121
+                );
122
+                if (isset($item['file_target'])) {
123
+                    $tmpItem['fileTarget'] = $item['file_target'];
124
+                }
125
+                // if we have a new parent for the child we remember the child
126
+                // to update the parent, if not we add it to the list of items
127
+                // which should be deleted
128
+                if ($newParent !== null) {
129
+                    $changeParent[] = $item['id'];
130
+                } else {
131
+                    $deletedItems[] = $tmpItem;
132
+                    $ids[] = $item['id'];
133
+                    $parents[] = $item['id'];
134
+                }
135
+            }
136
+        }
137
+        if ($excludeParent) {
138
+            unset($ids[0]);
139
+        }
140 140
 
141
-		if (!empty($changeParent)) {
142
-			$idList = "'".implode("','", $changeParent)."'";
143
-			$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` IN ('.$idList.')');
144
-			$query->execute(array($newParent));
145
-		}
141
+        if (!empty($changeParent)) {
142
+            $idList = "'".implode("','", $changeParent)."'";
143
+            $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` IN ('.$idList.')');
144
+            $query->execute(array($newParent));
145
+        }
146 146
 
147
-		if (!empty($ids)) {
148
-			$idList = "'".implode("','", $ids)."'";
149
-			$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `id` IN ('.$idList.')');
150
-			$query->execute();
151
-		}
147
+        if (!empty($ids)) {
148
+            $idList = "'".implode("','", $ids)."'";
149
+            $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `id` IN ('.$idList.')');
150
+            $query->execute();
151
+        }
152 152
 
153
-		return $deletedItems;
154
-	}
153
+        return $deletedItems;
154
+    }
155 155
 
156
-	/**
157
-	 * get default expire settings defined by the admin
158
-	 * @return array contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
159
-	 */
160
-	public static function getDefaultExpireSetting() {
156
+    /**
157
+     * get default expire settings defined by the admin
158
+     * @return array contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
159
+     */
160
+    public static function getDefaultExpireSetting() {
161 161
 
162
-		$config = \OC::$server->getConfig();
162
+        $config = \OC::$server->getConfig();
163 163
 
164
-		$defaultExpireSettings = array('defaultExpireDateSet' => false);
164
+        $defaultExpireSettings = array('defaultExpireDateSet' => false);
165 165
 
166
-		// get default expire settings
167
-		$defaultExpireDate = $config->getAppValue('core', 'shareapi_default_expire_date', 'no');
168
-		if ($defaultExpireDate === 'yes') {
169
-			$enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no');
170
-			$defaultExpireSettings['defaultExpireDateSet'] = true;
171
-			$defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
172
-			$defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes';
173
-		}
166
+        // get default expire settings
167
+        $defaultExpireDate = $config->getAppValue('core', 'shareapi_default_expire_date', 'no');
168
+        if ($defaultExpireDate === 'yes') {
169
+            $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no');
170
+            $defaultExpireSettings['defaultExpireDateSet'] = true;
171
+            $defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
172
+            $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes';
173
+        }
174 174
 
175
-		return $defaultExpireSettings;
176
-	}
175
+        return $defaultExpireSettings;
176
+    }
177 177
 
178
-	public static function calcExpireDate() {
179
-		$expireAfter = \OC\Share\Share::getExpireInterval() * 24 * 60 * 60;
180
-		$expireAt = time() + $expireAfter;
181
-		$date = new \DateTime();
182
-		$date->setTimestamp($expireAt);
183
-		$date->setTime(0, 0, 0);
184
-		//$dateString = $date->format('Y-m-d') . ' 00:00:00';
178
+    public static function calcExpireDate() {
179
+        $expireAfter = \OC\Share\Share::getExpireInterval() * 24 * 60 * 60;
180
+        $expireAt = time() + $expireAfter;
181
+        $date = new \DateTime();
182
+        $date->setTimestamp($expireAt);
183
+        $date->setTime(0, 0, 0);
184
+        //$dateString = $date->format('Y-m-d') . ' 00:00:00';
185 185
 
186
-		return $date;
186
+        return $date;
187 187
 
188
-	}
188
+    }
189 189
 
190
-	/**
191
-	 * calculate expire date
192
-	 * @param array $defaultExpireSettings contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
193
-	 * @param int $creationTime timestamp when the share was created
194
-	 * @param int $userExpireDate expire timestamp set by the user
195
-	 * @return mixed integer timestamp or False
196
-	 */
197
-	public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) {
190
+    /**
191
+     * calculate expire date
192
+     * @param array $defaultExpireSettings contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
193
+     * @param int $creationTime timestamp when the share was created
194
+     * @param int $userExpireDate expire timestamp set by the user
195
+     * @return mixed integer timestamp or False
196
+     */
197
+    public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) {
198 198
 
199
-		$expires = false;
200
-		$defaultExpires = null;
199
+        $expires = false;
200
+        $defaultExpires = null;
201 201
 
202
-		if (!empty($defaultExpireSettings['defaultExpireDateSet'])) {
203
-			$defaultExpires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400;
204
-		}
202
+        if (!empty($defaultExpireSettings['defaultExpireDateSet'])) {
203
+            $defaultExpires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400;
204
+        }
205 205
 
206 206
 
207
-		if (isset($userExpireDate)) {
208
-			// if the admin decided to enforce the default expire date then we only take
209
-			// the user defined expire date of it is before the default expire date
210
-			if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
211
-				$expires = min($userExpireDate, $defaultExpires);
212
-			} else {
213
-				$expires = $userExpireDate;
214
-			}
215
-		} else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
216
-			$expires = $defaultExpires;
217
-		}
207
+        if (isset($userExpireDate)) {
208
+            // if the admin decided to enforce the default expire date then we only take
209
+            // the user defined expire date of it is before the default expire date
210
+            if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
211
+                $expires = min($userExpireDate, $defaultExpires);
212
+            } else {
213
+                $expires = $userExpireDate;
214
+            }
215
+        } else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
216
+            $expires = $defaultExpires;
217
+        }
218 218
 
219
-		return $expires;
220
-	}
219
+        return $expires;
220
+    }
221 221
 
222
-	/**
223
-	 * Strips away a potential file names and trailing slashes:
224
-	 * - http://localhost
225
-	 * - http://localhost/
226
-	 * - http://localhost/index.php
227
-	 * - http://localhost/index.php/s/{shareToken}
228
-	 *
229
-	 * all return: http://localhost
230
-	 *
231
-	 * @param string $remote
232
-	 * @return string
233
-	 */
234
-	protected static function fixRemoteURL($remote) {
235
-		$remote = str_replace('\\', '/', $remote);
236
-		if ($fileNamePosition = strpos($remote, '/index.php')) {
237
-			$remote = substr($remote, 0, $fileNamePosition);
238
-		}
239
-		$remote = rtrim($remote, '/');
222
+    /**
223
+     * Strips away a potential file names and trailing slashes:
224
+     * - http://localhost
225
+     * - http://localhost/
226
+     * - http://localhost/index.php
227
+     * - http://localhost/index.php/s/{shareToken}
228
+     *
229
+     * all return: http://localhost
230
+     *
231
+     * @param string $remote
232
+     * @return string
233
+     */
234
+    protected static function fixRemoteURL($remote) {
235
+        $remote = str_replace('\\', '/', $remote);
236
+        if ($fileNamePosition = strpos($remote, '/index.php')) {
237
+            $remote = substr($remote, 0, $fileNamePosition);
238
+        }
239
+        $remote = rtrim($remote, '/');
240 240
 
241
-		return $remote;
242
-	}
241
+        return $remote;
242
+    }
243 243
 
244
-	/**
245
-	 * split user and remote from federated cloud id
246
-	 *
247
-	 * @param string $id
248
-	 * @return string[]
249
-	 * @throws HintException
250
-	 */
251
-	public static function splitUserRemote($id) {
252
-		try {
253
-			$cloudId = \OC::$server->getCloudIdManager()->resolveCloudId($id);
254
-			return [$cloudId->getUser(), $cloudId->getRemote()];
255
-		} catch (\InvalidArgumentException $e) {
256
-			$l = \OC::$server->getL10N('core');
257
-			$hint = $l->t('Invalid Federated Cloud ID');
258
-			throw new HintException('Invalid Federated Cloud ID', $hint, 0, $e);
259
-		}
260
-	}
244
+    /**
245
+     * split user and remote from federated cloud id
246
+     *
247
+     * @param string $id
248
+     * @return string[]
249
+     * @throws HintException
250
+     */
251
+    public static function splitUserRemote($id) {
252
+        try {
253
+            $cloudId = \OC::$server->getCloudIdManager()->resolveCloudId($id);
254
+            return [$cloudId->getUser(), $cloudId->getRemote()];
255
+        } catch (\InvalidArgumentException $e) {
256
+            $l = \OC::$server->getL10N('core');
257
+            $hint = $l->t('Invalid Federated Cloud ID');
258
+            throw new HintException('Invalid Federated Cloud ID', $hint, 0, $e);
259
+        }
260
+    }
261 261
 
262
-	/**
263
-	 * check if two federated cloud IDs refer to the same user
264
-	 *
265
-	 * @param string $user1
266
-	 * @param string $server1
267
-	 * @param string $user2
268
-	 * @param string $server2
269
-	 * @return bool true if both users and servers are the same
270
-	 */
271
-	public static function isSameUserOnSameServer($user1, $server1, $user2, $server2) {
272
-		$normalizedServer1 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server1));
273
-		$normalizedServer2 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server2));
262
+    /**
263
+     * check if two federated cloud IDs refer to the same user
264
+     *
265
+     * @param string $user1
266
+     * @param string $server1
267
+     * @param string $user2
268
+     * @param string $server2
269
+     * @return bool true if both users and servers are the same
270
+     */
271
+    public static function isSameUserOnSameServer($user1, $server1, $user2, $server2) {
272
+        $normalizedServer1 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server1));
273
+        $normalizedServer2 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server2));
274 274
 
275
-		if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
276
-			// FIXME this should be a method in the user management instead
277
-			\OCP\Util::emitHook(
278
-					'\OCA\Files_Sharing\API\Server2Server',
279
-					'preLoginNameUsedAsUserName',
280
-					array('uid' => &$user1)
281
-			);
282
-			\OCP\Util::emitHook(
283
-					'\OCA\Files_Sharing\API\Server2Server',
284
-					'preLoginNameUsedAsUserName',
285
-					array('uid' => &$user2)
286
-			);
275
+        if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
276
+            // FIXME this should be a method in the user management instead
277
+            \OCP\Util::emitHook(
278
+                    '\OCA\Files_Sharing\API\Server2Server',
279
+                    'preLoginNameUsedAsUserName',
280
+                    array('uid' => &$user1)
281
+            );
282
+            \OCP\Util::emitHook(
283
+                    '\OCA\Files_Sharing\API\Server2Server',
284
+                    'preLoginNameUsedAsUserName',
285
+                    array('uid' => &$user2)
286
+            );
287 287
 
288
-			if ($user1 === $user2) {
289
-				return true;
290
-			}
291
-		}
288
+            if ($user1 === $user2) {
289
+                return true;
290
+            }
291
+        }
292 292
 
293
-		return false;
294
-	}
293
+        return false;
294
+    }
295 295
 }
Please login to merge, or discard this patch.
core/Command/User/Info.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
 use Symfony\Component\Console\Output\OutputInterface;
35 35
 
36 36
 class Info extends Base {
37
-	/** @var IUserManager */
38
-	protected $userManager;
39
-	/** @var IGroupManager */
40
-	protected $groupManager;
37
+    /** @var IUserManager */
38
+    protected $userManager;
39
+    /** @var IGroupManager */
40
+    protected $groupManager;
41 41
 
42
-	/**
43
-	 * @param IUserManager $userManager
44
-	 * @param IGroupManager $groupManager
45
-	 */
46
-	public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
47
-		$this->userManager = $userManager;
48
-		$this->groupManager = $groupManager;
49
-		parent::__construct();
50
-	}
42
+    /**
43
+     * @param IUserManager $userManager
44
+     * @param IGroupManager $groupManager
45
+     */
46
+    public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
47
+        $this->userManager = $userManager;
48
+        $this->groupManager = $groupManager;
49
+        parent::__construct();
50
+    }
51 51
 
52
-	protected function configure() {
53
-		$this
54
-			->setName('user:info')
55
-			->setDescription('show user info')
56
-			->addArgument(
57
-				'user',
58
-				InputArgument::REQUIRED,
59
-				'user to show'
60
-			)->addOption(
61
-				'output',
62
-				null,
63
-				InputOption::VALUE_OPTIONAL,
64
-				'Output format (plain, json or json_pretty, default is plain)',
65
-				$this->defaultOutputFormat
66
-			);
67
-	}
52
+    protected function configure() {
53
+        $this
54
+            ->setName('user:info')
55
+            ->setDescription('show user info')
56
+            ->addArgument(
57
+                'user',
58
+                InputArgument::REQUIRED,
59
+                'user to show'
60
+            )->addOption(
61
+                'output',
62
+                null,
63
+                InputOption::VALUE_OPTIONAL,
64
+                'Output format (plain, json or json_pretty, default is plain)',
65
+                $this->defaultOutputFormat
66
+            );
67
+    }
68 68
 
69
-	protected function execute(InputInterface $input, OutputInterface $output) {
70
-		$user = $this->userManager->get($input->getArgument('user'));
71
-		if (is_null($user)) {
72
-			$output->writeln('<error>user not found</error>');
73
-			return 1;
74
-		}
75
-		$groups = $this->groupManager->getUserGroupIds($user);
76
-		$data = [
77
-			'user_id' => $user->getUID(),
78
-			'display_name' => $user->getDisplayName(),
79
-			'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
80
-			'cloud_id' => $user->getCloudId(),
81
-			'enabled' => $user->isEnabled(),
82
-			'groups' => $groups,
83
-			'quota' => $user->getQuota(),
84
-			'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
85
-			'user_directory' => $user->getHome(),
86
-			'backend' => $user->getBackendClassName()
87
-		];
88
-		$this->writeArrayInOutputFormat($input, $output, $data);
89
-	}
69
+    protected function execute(InputInterface $input, OutputInterface $output) {
70
+        $user = $this->userManager->get($input->getArgument('user'));
71
+        if (is_null($user)) {
72
+            $output->writeln('<error>user not found</error>');
73
+            return 1;
74
+        }
75
+        $groups = $this->groupManager->getUserGroupIds($user);
76
+        $data = [
77
+            'user_id' => $user->getUID(),
78
+            'display_name' => $user->getDisplayName(),
79
+            'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
80
+            'cloud_id' => $user->getCloudId(),
81
+            'enabled' => $user->isEnabled(),
82
+            'groups' => $groups,
83
+            'quota' => $user->getQuota(),
84
+            'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
85
+            'user_directory' => $user->getHome(),
86
+            'backend' => $user->getBackendClassName()
87
+        ];
88
+        $this->writeArrayInOutputFormat($input, $output, $data);
89
+    }
90 90
 }
Please login to merge, or discard this patch.
core/Command/App/ListApps.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -34,109 +34,109 @@
 block discarded – undo
34 34
 
35 35
 class ListApps extends Base {
36 36
 
37
-	/** @var IAppManager */
38
-	protected $manager;
39
-
40
-	/**
41
-	 * @param IAppManager $manager
42
-	 */
43
-	public function __construct(IAppManager $manager) {
44
-		parent::__construct();
45
-		$this->manager = $manager;
46
-	}
47
-
48
-	protected function configure() {
49
-		parent::configure();
50
-
51
-		$this
52
-			->setName('app:list')
53
-			->setDescription('List all available apps')
54
-			->addOption(
55
-				'shipped',
56
-				null,
57
-				InputOption::VALUE_REQUIRED,
58
-				'true - limit to shipped apps only, false - limit to non-shipped apps only'
59
-			)
60
-		;
61
-	}
62
-
63
-	protected function execute(InputInterface $input, OutputInterface $output) {
64
-		if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
65
-			$shippedFilter = $input->getOption('shipped') === 'true';
66
-		} else {
67
-			$shippedFilter = null;
68
-		}
37
+    /** @var IAppManager */
38
+    protected $manager;
39
+
40
+    /**
41
+     * @param IAppManager $manager
42
+     */
43
+    public function __construct(IAppManager $manager) {
44
+        parent::__construct();
45
+        $this->manager = $manager;
46
+    }
47
+
48
+    protected function configure() {
49
+        parent::configure();
50
+
51
+        $this
52
+            ->setName('app:list')
53
+            ->setDescription('List all available apps')
54
+            ->addOption(
55
+                'shipped',
56
+                null,
57
+                InputOption::VALUE_REQUIRED,
58
+                'true - limit to shipped apps only, false - limit to non-shipped apps only'
59
+            )
60
+        ;
61
+    }
62
+
63
+    protected function execute(InputInterface $input, OutputInterface $output) {
64
+        if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
65
+            $shippedFilter = $input->getOption('shipped') === 'true';
66
+        } else {
67
+            $shippedFilter = null;
68
+        }
69 69
 		
70
-		$apps = \OC_App::getAllApps();
71
-		$enabledApps = $disabledApps = [];
72
-		$versions = \OC_App::getAppVersions();
73
-
74
-		//sort enabled apps above disabled apps
75
-		foreach ($apps as $app) {
76
-			if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
77
-				continue;
78
-			}
79
-			if ($this->manager->isInstalled($app)) {
80
-				$enabledApps[] = $app;
81
-			} else {
82
-				$disabledApps[] = $app;
83
-			}
84
-		}
85
-
86
-		$apps = ['enabled' => [], 'disabled' => []];
87
-
88
-		sort($enabledApps);
89
-		foreach ($enabledApps as $app) {
90
-			$apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
91
-		}
92
-
93
-		sort($disabledApps);
94
-		foreach ($disabledApps as $app) {
95
-			$apps['disabled'][$app] = null;
96
-		}
97
-
98
-		$this->writeAppList($input, $output, $apps);
99
-	}
100
-
101
-	/**
102
-	 * @param InputInterface $input
103
-	 * @param OutputInterface $output
104
-	 * @param array $items
105
-	 */
106
-	protected function writeAppList(InputInterface $input, OutputInterface $output, $items) {
107
-		switch ($input->getOption('output')) {
108
-			case self::OUTPUT_FORMAT_PLAIN:
109
-				$output->writeln('Enabled:');
110
-				parent::writeArrayInOutputFormat($input, $output, $items['enabled']);
111
-
112
-				$output->writeln('Disabled:');
113
-				parent::writeArrayInOutputFormat($input, $output, $items['disabled']);
114
-			break;
115
-
116
-			default:
117
-				parent::writeArrayInOutputFormat($input, $output, $items);
118
-			break;
119
-		}
120
-	}
121
-
122
-	/**
123
-	 * @param string $optionName
124
-	 * @param CompletionContext $completionContext
125
-	 * @return array
126
-	 */
127
-	public function completeOptionValues($optionName, CompletionContext $completionContext) {
128
-		if ($optionName === 'shipped') {
129
-			return ['true', 'false'];
130
-		}
131
-		return [];
132
-	}
133
-
134
-	/**
135
-	 * @param string $argumentName
136
-	 * @param CompletionContext $context
137
-	 * @return string[]
138
-	 */
139
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
140
-		return [];
141
-	}
70
+        $apps = \OC_App::getAllApps();
71
+        $enabledApps = $disabledApps = [];
72
+        $versions = \OC_App::getAppVersions();
73
+
74
+        //sort enabled apps above disabled apps
75
+        foreach ($apps as $app) {
76
+            if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
77
+                continue;
78
+            }
79
+            if ($this->manager->isInstalled($app)) {
80
+                $enabledApps[] = $app;
81
+            } else {
82
+                $disabledApps[] = $app;
83
+            }
84
+        }
85
+
86
+        $apps = ['enabled' => [], 'disabled' => []];
87
+
88
+        sort($enabledApps);
89
+        foreach ($enabledApps as $app) {
90
+            $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
91
+        }
92
+
93
+        sort($disabledApps);
94
+        foreach ($disabledApps as $app) {
95
+            $apps['disabled'][$app] = null;
96
+        }
97
+
98
+        $this->writeAppList($input, $output, $apps);
99
+    }
100
+
101
+    /**
102
+     * @param InputInterface $input
103
+     * @param OutputInterface $output
104
+     * @param array $items
105
+     */
106
+    protected function writeAppList(InputInterface $input, OutputInterface $output, $items) {
107
+        switch ($input->getOption('output')) {
108
+            case self::OUTPUT_FORMAT_PLAIN:
109
+                $output->writeln('Enabled:');
110
+                parent::writeArrayInOutputFormat($input, $output, $items['enabled']);
111
+
112
+                $output->writeln('Disabled:');
113
+                parent::writeArrayInOutputFormat($input, $output, $items['disabled']);
114
+            break;
115
+
116
+            default:
117
+                parent::writeArrayInOutputFormat($input, $output, $items);
118
+            break;
119
+        }
120
+    }
121
+
122
+    /**
123
+     * @param string $optionName
124
+     * @param CompletionContext $completionContext
125
+     * @return array
126
+     */
127
+    public function completeOptionValues($optionName, CompletionContext $completionContext) {
128
+        if ($optionName === 'shipped') {
129
+            return ['true', 'false'];
130
+        }
131
+        return [];
132
+    }
133
+
134
+    /**
135
+     * @param string $argumentName
136
+     * @param CompletionContext $context
137
+     * @return string[]
138
+     */
139
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
140
+        return [];
141
+    }
142 142
 }
Please login to merge, or discard this patch.