Completed
Push — master ( c65848...a5c801 )
by Blizzz
112:32 queued 99:32
created
lib/private/Archive/ZIP.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
 
34 34
 use Icewind\Streams\CallbackWrapper;
35 35
 
36
-class ZIP extends Archive{
36
+class ZIP extends Archive {
37 37
 	/**
38 38
 	 * @var \ZipArchive zip
39 39
 	 */
40
-	private $zip=null;
40
+	private $zip = null;
41 41
 	private $path;
42 42
 
43 43
 	/**
44 44
 	 * @param string $source
45 45
 	 */
46 46
 	function __construct($source) {
47
-		$this->path=$source;
48
-		$this->zip=new \ZipArchive();
49
-		if($this->zip->open($source, \ZipArchive::CREATE)) {
50
-		}else{
47
+		$this->path = $source;
48
+		$this->zip = new \ZipArchive();
49
+		if ($this->zip->open($source, \ZipArchive::CREATE)) {
50
+		} else {
51 51
 			\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, \OCP\Util::WARN);
52 52
 		}
53 53
 	}
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 * @param string $source either a local file or string data
66 66
 	 * @return bool
67 67
 	 */
68
-	function addFile($path, $source='') {
69
-		if($source and $source[0]=='/' and file_exists($source)) {
70
-			$result=$this->zip->addFile($source, $path);
71
-		}else{
72
-			$result=$this->zip->addFromString($path, $source);
68
+	function addFile($path, $source = '') {
69
+		if ($source and $source[0] == '/' and file_exists($source)) {
70
+			$result = $this->zip->addFile($source, $path);
71
+		} else {
72
+			$result = $this->zip->addFromString($path, $source);
73 73
 		}
74
-		if($result) {
75
-			$this->zip->close();//close and reopen to save the zip
74
+		if ($result) {
75
+			$this->zip->close(); //close and reopen to save the zip
76 76
 			$this->zip->open($this->path);
77 77
 		}
78 78
 		return $result;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @return boolean|null
85 85
 	 */
86 86
 	function rename($source, $dest) {
87
-		$source=$this->stripPath($source);
88
-		$dest=$this->stripPath($dest);
87
+		$source = $this->stripPath($source);
88
+		$dest = $this->stripPath($dest);
89 89
 		$this->zip->renameName($source, $dest);
90 90
 	}
91 91
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return int
95 95
 	 */
96 96
 	function filesize($path) {
97
-		$stat=$this->zip->statName($path);
97
+		$stat = $this->zip->statName($path);
98 98
 		return $stat['size'];
99 99
 	}
100 100
 	/**
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 	 * @return array
112 112
 	 */
113 113
 	function getFolder($path) {
114
-		$files=$this->getFiles();
115
-		$folderContent=array();
116
-		$pathLength=strlen($path);
117
-		foreach($files as $file) {
118
-			if(substr($file, 0, $pathLength)==$path and $file!=$path) {
119
-				if(strrpos(substr($file, 0, -1), '/')<=$pathLength) {
120
-					$folderContent[]=substr($file, $pathLength);
114
+		$files = $this->getFiles();
115
+		$folderContent = array();
116
+		$pathLength = strlen($path);
117
+		foreach ($files as $file) {
118
+			if (substr($file, 0, $pathLength) == $path and $file != $path) {
119
+				if (strrpos(substr($file, 0, -1), '/') <= $pathLength) {
120
+					$folderContent[] = substr($file, $pathLength);
121 121
 				}
122 122
 			}
123 123
 		}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @return array
129 129
 	 */
130 130
 	function getFiles() {
131
-		$fileCount=$this->zip->numFiles;
132
-		$files=array();
133
-		for($i=0;$i<$fileCount;$i++) {
134
-			$files[]=$this->zip->getNameIndex($i);
131
+		$fileCount = $this->zip->numFiles;
132
+		$files = array();
133
+		for ($i = 0; $i < $fileCount; $i++) {
134
+			$files[] = $this->zip->getNameIndex($i);
135 135
 		}
136 136
 		return $files;
137 137
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @return bool
168 168
 	 */
169 169
 	function fileExists($path) {
170
-		return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
170
+		return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false);
171 171
 	}
172 172
 	/**
173 173
 	 * remove a file or folder from the archive
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 * @return bool
176 176
 	 */
177 177
 	function remove($path) {
178
-		if($this->fileExists($path.'/')) {
178
+		if ($this->fileExists($path.'/')) {
179 179
 			return $this->zip->deleteName($path.'/');
180
-		}else{
180
+		} else {
181 181
 			return $this->zip->deleteName($path);
182 182
 		}
183 183
 	}
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * @return resource
189 189
 	 */
190 190
 	function getStream($path, $mode) {
191
-		if($mode=='r' or $mode=='rb') {
191
+		if ($mode == 'r' or $mode == 'rb') {
192 192
 			return $this->zip->getStream($path);
193 193
 		} else {
194 194
 			//since we can't directly get a writable stream,
195 195
 			//make a temp copy of the file and put it back
196 196
 			//in the archive when the stream is closed
197
-			if(strrpos($path, '.')!==false) {
198
-				$ext=substr($path, strrpos($path, '.'));
199
-			}else{
200
-				$ext='';
197
+			if (strrpos($path, '.') !== false) {
198
+				$ext = substr($path, strrpos($path, '.'));
199
+			} else {
200
+				$ext = '';
201 201
 			}
202
-			$tmpFile=\OCP\Files::tmpFile($ext);
203
-			if($this->fileExists($path)) {
202
+			$tmpFile = \OCP\Files::tmpFile($ext);
203
+			if ($this->fileExists($path)) {
204 204
 				$this->extractFile($path, $tmpFile);
205 205
 			}
206 206
 			$handle = fopen($tmpFile, $mode);
207
-			return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
207
+			return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
208 208
 				$this->writeBack($tmpFile, $path);
209 209
 			});
210 210
 		}
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	 * @return string
224 224
 	 */
225 225
 	private function stripPath($path) {
226
-		if(!$path || $path[0]=='/') {
226
+		if (!$path || $path[0] == '/') {
227 227
 			return substr($path, 1);
228
-		}else{
228
+		} else {
229 229
 			return $path;
230 230
 		}
231 231
 	}
Please login to merge, or discard this patch.
lib/private/Archive/Archive.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param string $source either a local file or string data
50 50
 	 * @return bool
51 51
 	 */
52
-	abstract function addFile($path, $source='');
52
+	abstract function addFile($path, $source = '');
53 53
 	/**
54 54
 	 * rename a file or folder in the archive
55 55
 	 * @param string $source
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function addRecursive($path, $source) {
128 128
 		$dh = opendir($source);
129
-		if(is_resource($dh)) {
129
+		if (is_resource($dh)) {
130 130
 			$this->addFolder($path);
131 131
 			while (($file = readdir($dh)) !== false) {
132
-				if($file=='.' or $file=='..') {
132
+				if ($file == '.' or $file == '..') {
133 133
 					continue;
134 134
 				}
135
-				if(is_dir($source.'/'.$file)) {
135
+				if (is_dir($source.'/'.$file)) {
136 136
 					$this->addRecursive($path.'/'.$file, $source.'/'.$file);
137
-				}else{
137
+				} else {
138 138
 					$this->addFile($path.'/'.$file, $source.'/'.$file);
139 139
 				}
140 140
 			}
Please login to merge, or discard this patch.
lib/private/Migration/BackgroundRepair.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function execute($jobList, ILogger $logger = null) {
59 59
 		// add an interval of 15 mins
60
-		$this->setInterval(15*60);
60
+		$this->setInterval(15 * 60);
61 61
 
62 62
 		$this->jobList = $jobList;
63 63
 		$this->logger = $logger;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		try {
91 91
 			$repair->addStep($step);
92 92
 		} catch (\Exception $ex) {
93
-			$this->logger->logException($ex,[
93
+			$this->logger->logException($ex, [
94 94
 				'app' => 'migration'
95 95
 			]);
96 96
 
Please login to merge, or discard this patch.
lib/private/Command/QueueBus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		if ($command instanceof ICommand) {
56 56
 			// ensure the command can be serialized
57 57
 			$serialized = serialize($command);
58
-			if(strlen($serialized) > 4000) {
58
+			if (strlen($serialized) > 4000) {
59 59
 				throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
60 60
 			}
61 61
 			$unserialized = unserialize($serialized);
Please login to merge, or discard this patch.
lib/private/Command/FileAccess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 trait FileAccess {
28
-	protected function setupFS(IUser $user){
28
+	protected function setupFS(IUser $user) {
29 29
 		\OC_Util::setupFS($user->getUID());
30 30
 	}
31 31
 
Please login to merge, or discard this patch.
lib/private/Template/JSConfigHelper.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			$apps = $this->appManager->getEnabledAppsForUser($this->currentUser);
109 109
 		}
110 110
 
111
-		foreach($apps as $app) {
111
+		foreach ($apps as $app) {
112 112
 			$apps_paths[$app] = \OC_App::getAppWebPath($app);
113 113
 		}
114 114
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 		$outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes';
122 122
 
123 123
 		$countOfDataLocation = 0;
124
-		$dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation);
125
-		if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) {
124
+		$dataLocation = str_replace(\OC::$SERVERROOT.'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation);
125
+		if ($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) {
126 126
 			$dataLocation = false;
127 127
 		}
128 128
 
@@ -144,61 +144,61 @@  discard block
 block discarded – undo
144 144
 			"datepickerFormatDate" => json_encode($this->l->l('jsdate', null)),
145 145
 			'nc_lastLogin' => $lastConfirmTimestamp,
146 146
 			"dayNames" =>  json_encode([
147
-				(string)$this->l->t('Sunday'),
148
-				(string)$this->l->t('Monday'),
149
-				(string)$this->l->t('Tuesday'),
150
-				(string)$this->l->t('Wednesday'),
151
-				(string)$this->l->t('Thursday'),
152
-				(string)$this->l->t('Friday'),
153
-				(string)$this->l->t('Saturday')
147
+				(string) $this->l->t('Sunday'),
148
+				(string) $this->l->t('Monday'),
149
+				(string) $this->l->t('Tuesday'),
150
+				(string) $this->l->t('Wednesday'),
151
+				(string) $this->l->t('Thursday'),
152
+				(string) $this->l->t('Friday'),
153
+				(string) $this->l->t('Saturday')
154 154
 			]),
155 155
 			"dayNamesShort" =>  json_encode([
156
-				(string)$this->l->t('Sun.'),
157
-				(string)$this->l->t('Mon.'),
158
-				(string)$this->l->t('Tue.'),
159
-				(string)$this->l->t('Wed.'),
160
-				(string)$this->l->t('Thu.'),
161
-				(string)$this->l->t('Fri.'),
162
-				(string)$this->l->t('Sat.')
156
+				(string) $this->l->t('Sun.'),
157
+				(string) $this->l->t('Mon.'),
158
+				(string) $this->l->t('Tue.'),
159
+				(string) $this->l->t('Wed.'),
160
+				(string) $this->l->t('Thu.'),
161
+				(string) $this->l->t('Fri.'),
162
+				(string) $this->l->t('Sat.')
163 163
 			]),
164 164
 			"dayNamesMin" =>  json_encode([
165
-				(string)$this->l->t('Su'),
166
-				(string)$this->l->t('Mo'),
167
-				(string)$this->l->t('Tu'),
168
-				(string)$this->l->t('We'),
169
-				(string)$this->l->t('Th'),
170
-				(string)$this->l->t('Fr'),
171
-				(string)$this->l->t('Sa')
165
+				(string) $this->l->t('Su'),
166
+				(string) $this->l->t('Mo'),
167
+				(string) $this->l->t('Tu'),
168
+				(string) $this->l->t('We'),
169
+				(string) $this->l->t('Th'),
170
+				(string) $this->l->t('Fr'),
171
+				(string) $this->l->t('Sa')
172 172
 			]),
173 173
 			"monthNames" => json_encode([
174
-				(string)$this->l->t('January'),
175
-				(string)$this->l->t('February'),
176
-				(string)$this->l->t('March'),
177
-				(string)$this->l->t('April'),
178
-				(string)$this->l->t('May'),
179
-				(string)$this->l->t('June'),
180
-				(string)$this->l->t('July'),
181
-				(string)$this->l->t('August'),
182
-				(string)$this->l->t('September'),
183
-				(string)$this->l->t('October'),
184
-				(string)$this->l->t('November'),
185
-				(string)$this->l->t('December')
174
+				(string) $this->l->t('January'),
175
+				(string) $this->l->t('February'),
176
+				(string) $this->l->t('March'),
177
+				(string) $this->l->t('April'),
178
+				(string) $this->l->t('May'),
179
+				(string) $this->l->t('June'),
180
+				(string) $this->l->t('July'),
181
+				(string) $this->l->t('August'),
182
+				(string) $this->l->t('September'),
183
+				(string) $this->l->t('October'),
184
+				(string) $this->l->t('November'),
185
+				(string) $this->l->t('December')
186 186
 			]),
187 187
 			"monthNamesShort" => json_encode([
188
-				(string)$this->l->t('Jan.'),
189
-				(string)$this->l->t('Feb.'),
190
-				(string)$this->l->t('Mar.'),
191
-				(string)$this->l->t('Apr.'),
192
-				(string)$this->l->t('May.'),
193
-				(string)$this->l->t('Jun.'),
194
-				(string)$this->l->t('Jul.'),
195
-				(string)$this->l->t('Aug.'),
196
-				(string)$this->l->t('Sep.'),
197
-				(string)$this->l->t('Oct.'),
198
-				(string)$this->l->t('Nov.'),
199
-				(string)$this->l->t('Dec.')
188
+				(string) $this->l->t('Jan.'),
189
+				(string) $this->l->t('Feb.'),
190
+				(string) $this->l->t('Mar.'),
191
+				(string) $this->l->t('Apr.'),
192
+				(string) $this->l->t('May.'),
193
+				(string) $this->l->t('Jun.'),
194
+				(string) $this->l->t('Jul.'),
195
+				(string) $this->l->t('Aug.'),
196
+				(string) $this->l->t('Sep.'),
197
+				(string) $this->l->t('Oct.'),
198
+				(string) $this->l->t('Nov.'),
199
+				(string) $this->l->t('Dec.')
200 200
 			]),
201
-			"firstDay" => json_encode($this->l->l('firstday', null)) ,
201
+			"firstDay" => json_encode($this->l->l('firstday', null)),
202 202
 			"oc_config" => json_encode([
203 203
 				'session_lifetime'	=> min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')),
204 204
 				'session_keepalive'	=> $this->config->getSystemValue('session_keepalive', true),
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		if ($this->currentUser !== null) {
241 241
 			$array['oc_userconfig'] = json_encode([
242 242
 				'avatar' => [
243
-					'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0),
243
+					'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0),
244 244
 				]
245 245
 			]);
246 246
 		}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 		// Echo it
254 254
 		foreach ($array as  $setting => $value) {
255
-			$result .= 'var '. $setting . '='. $value . ';' . PHP_EOL;
255
+			$result .= 'var '.$setting.'='.$value.';'.PHP_EOL;
256 256
 		}
257 257
 
258 258
 		return $result;
Please login to merge, or discard this patch.
lib/private/Template/Base.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param \OCP\IL10N $l10n
45 45
 	 * @param \OC_Defaults $theme
46 46
 	 */
47
-	public function __construct($template, $requestToken, $l10n, $theme ) {
47
+	public function __construct($template, $requestToken, $l10n, $theme) {
48 48
 		$this->vars = array();
49 49
 		$this->vars['requesttoken'] = $requestToken;
50 50
 		$this->l10n = $l10n;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) {
63 63
 		// Check if the app is in the app folder or in the root
64
-		if( file_exists($app_dir.'/templates/' )) {
64
+		if (file_exists($app_dir.'/templates/')) {
65 65
 			return [
66 66
 				$serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/',
67 67
 				$app_dir.'/templates/',
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * If the key existed before, it will be overwritten
98 98
 	 */
99
-	public function assign( $key, $value) {
99
+	public function assign($key, $value) {
100 100
 		$this->vars[$key] = $value;
101 101
 		return true;
102 102
 	}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	 * exists, the value will be appended. It can be accessed via
112 112
 	 * $_[$key][$position] in the template.
113 113
 	 */
114
-	public function append( $key, $value ) {
115
-		if( array_key_exists( $key, $this->vars )) {
114
+	public function append($key, $value) {
115
+		if (array_key_exists($key, $this->vars)) {
116 116
 			$this->vars[$key][] = $value;
117 117
 		}
118
-		else{
119
-			$this->vars[$key] = array( $value );
118
+		else {
119
+			$this->vars[$key] = array($value);
120 120
 		}
121 121
 	}
122 122
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function printPage() {
130 130
 		$data = $this->fetchPage();
131
-		if( $data === false ) {
131
+		if ($data === false) {
132 132
 			return false;
133 133
 		}
134
-		else{
134
+		else {
135 135
 			print $data;
136 136
 			return true;
137 137
 		}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 		$l = $this->l10n;
165 165
 		$theme = $this->theme;
166 166
 
167
-		if( !is_null($additionalParams)) {
168
-			$_ = array_merge( $additionalParams, $this->vars );
167
+		if (!is_null($additionalParams)) {
168
+			$_ = array_merge($additionalParams, $this->vars);
169 169
 		}
170 170
 
171 171
 		// Include
Please login to merge, or discard this patch.
lib/private/Template/ResourceNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
41 41
 	 * @return string
42 42
 	 */
43 43
 	public function getResourcePath() {
44
-		return $this->webPath . '/' . $this->resource;
44
+		return $this->webPath.'/'.$this->resource;
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
lib/private/Template/TemplateFileLocator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param string[] $dirs
34 34
 	 */
35
-	public function __construct( $dirs ) {
35
+	public function __construct($dirs) {
36 36
 		$this->dirs = $dirs;
37 37
 	}
38 38
 
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @return string
42 42
 	 * @throws \Exception
43 43
 	 */
44
-	public function find( $template ) {
44
+	public function find($template) {
45 45
 		if ($template === '') {
46 46
 			throw new \InvalidArgumentException('Empty template name');
47 47
 		}
48 48
 
49
-		foreach($this->dirs as $dir) {
49
+		foreach ($this->dirs as $dir) {
50 50
 			$file = $dir.$template.'.php';
51 51
 			if (is_file($file)) {
52 52
 				$this->path = $dir;
Please login to merge, or discard this patch.