Passed
Push — master ( 4e9cd2...bc8d14 )
by Roeland
19:16 queued 09:49
created
core/Command/Db/Migrations/ExecuteCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 			$olderVersions = $ms->getMigratedVersions();
79 79
 			$olderVersions[] = '0';
80 80
 			$olderVersions[] = 'prev';
81
-			if (in_array($version,  $olderVersions, true)) {
81
+			if (in_array($version, $olderVersions, true)) {
82 82
 				$output->writeln('<error>Can not go back to previous migration without debug enabled</error>');
83 83
 				return 1;
84 84
 			}
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -38,95 +38,95 @@
 block discarded – undo
38 38
 
39 39
 class ExecuteCommand extends Command implements CompletionAwareInterface {
40 40
 
41
-	/** @var IDBConnection */
42
-	private $connection;
43
-
44
-	/** @var IConfig */
45
-	private $config;
46
-
47
-	/** @var IAppManager */
48
-	protected $appManager;
49
-
50
-	/**
51
-	 * ExecuteCommand constructor.
52
-	 *
53
-	 * @param IDBConnection $connection
54
-	 * @param IConfig $config
55
-	 * @param IAppManager $appManager
56
-	 */
57
-	public function __construct(IDBConnection $connection, IAppManager $appManager, IConfig $config) {
58
-		$this->connection = $connection;
59
-		$this->config = $config;
60
-
61
-		parent::__construct();
62
-	}
63
-
64
-	protected function configure() {
65
-		$this
66
-			->setName('migrations:execute')
67
-			->setDescription('Execute a single migration version manually.')
68
-			->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on')
69
-			->addArgument('version', InputArgument::REQUIRED, 'The version to execute.', null);
70
-
71
-		parent::configure();
72
-	}
73
-
74
-	/**
75
-	 * @param InputInterface $input
76
-	 * @param OutputInterface $output
77
-	 * @return int
78
-	 */
79
-	public function execute(InputInterface $input, OutputInterface $output) {
80
-		$appName = $input->getArgument('app');
81
-		$ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output));
82
-		$version = $input->getArgument('version');
83
-
84
-		if ($this->config->getSystemValue('debug', false) === false) {
85
-			$olderVersions = $ms->getMigratedVersions();
86
-			$olderVersions[] = '0';
87
-			$olderVersions[] = 'prev';
88
-			if (in_array($version,  $olderVersions, true)) {
89
-				$output->writeln('<error>Can not go back to previous migration without debug enabled</error>');
90
-				return 1;
91
-			}
92
-		}
93
-
94
-
95
-		$ms->executeStep($version);
96
-		return 0;
97
-	}
98
-
99
-	/**
100
-	 * @param string $optionName
101
-	 * @param CompletionContext $context
102
-	 * @return string[]
103
-	 */
104
-	public function completeOptionValues($optionName, CompletionContext $context) {
105
-		return [];
106
-	}
107
-
108
-	/**
109
-	 * @param string $argumentName
110
-	 * @param CompletionContext $context
111
-	 * @return string[]
112
-	 */
113
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
114
-		if ($argumentName === 'app') {
115
-			$allApps = \OC_App::getAllApps();
116
-			return array_diff($allApps, \OC_App::getEnabledApps(true, true));
117
-		}
118
-
119
-		if ($argumentName === 'version') {
120
-			$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
121
-
122
-			$ms = new MigrationService($appName, $this->connection);
123
-			$migrations = $ms->getAvailableVersions();
124
-
125
-			array_unshift($migrations, 'next', 'latest');
126
-			return $migrations;
127
-		}
128
-
129
-		return [];
130
-	}
41
+    /** @var IDBConnection */
42
+    private $connection;
43
+
44
+    /** @var IConfig */
45
+    private $config;
46
+
47
+    /** @var IAppManager */
48
+    protected $appManager;
49
+
50
+    /**
51
+     * ExecuteCommand constructor.
52
+     *
53
+     * @param IDBConnection $connection
54
+     * @param IConfig $config
55
+     * @param IAppManager $appManager
56
+     */
57
+    public function __construct(IDBConnection $connection, IAppManager $appManager, IConfig $config) {
58
+        $this->connection = $connection;
59
+        $this->config = $config;
60
+
61
+        parent::__construct();
62
+    }
63
+
64
+    protected function configure() {
65
+        $this
66
+            ->setName('migrations:execute')
67
+            ->setDescription('Execute a single migration version manually.')
68
+            ->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on')
69
+            ->addArgument('version', InputArgument::REQUIRED, 'The version to execute.', null);
70
+
71
+        parent::configure();
72
+    }
73
+
74
+    /**
75
+     * @param InputInterface $input
76
+     * @param OutputInterface $output
77
+     * @return int
78
+     */
79
+    public function execute(InputInterface $input, OutputInterface $output) {
80
+        $appName = $input->getArgument('app');
81
+        $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output));
82
+        $version = $input->getArgument('version');
83
+
84
+        if ($this->config->getSystemValue('debug', false) === false) {
85
+            $olderVersions = $ms->getMigratedVersions();
86
+            $olderVersions[] = '0';
87
+            $olderVersions[] = 'prev';
88
+            if (in_array($version,  $olderVersions, true)) {
89
+                $output->writeln('<error>Can not go back to previous migration without debug enabled</error>');
90
+                return 1;
91
+            }
92
+        }
93
+
94
+
95
+        $ms->executeStep($version);
96
+        return 0;
97
+    }
98
+
99
+    /**
100
+     * @param string $optionName
101
+     * @param CompletionContext $context
102
+     * @return string[]
103
+     */
104
+    public function completeOptionValues($optionName, CompletionContext $context) {
105
+        return [];
106
+    }
107
+
108
+    /**
109
+     * @param string $argumentName
110
+     * @param CompletionContext $context
111
+     * @return string[]
112
+     */
113
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
114
+        if ($argumentName === 'app') {
115
+            $allApps = \OC_App::getAllApps();
116
+            return array_diff($allApps, \OC_App::getEnabledApps(true, true));
117
+        }
118
+
119
+        if ($argumentName === 'version') {
120
+            $appName = $context->getWordAtIndex($context->getWordIndex() - 1);
121
+
122
+            $ms = new MigrationService($appName, $this->connection);
123
+            $migrations = $ms->getAvailableVersions();
124
+
125
+            array_unshift($migrations, 'next', 'latest');
126
+            return $migrations;
127
+        }
128
+
129
+        return [];
130
+    }
131 131
 
132 132
 }
Please login to merge, or discard this patch.
lib/private/Migration/SimpleOutput.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -36,49 +36,49 @@
 block discarded – undo
36 36
  */
37 37
 class SimpleOutput implements IOutput {
38 38
 
39
-	/** @var ILogger */
40
-	private $logger;
41
-	private $appName;
39
+    /** @var ILogger */
40
+    private $logger;
41
+    private $appName;
42 42
 
43
-	public function __construct(ILogger $logger, $appName) {
44
-		$this->logger = $logger;
45
-		$this->appName = $appName;
46
-	}
43
+    public function __construct(ILogger $logger, $appName) {
44
+        $this->logger = $logger;
45
+        $this->appName = $appName;
46
+    }
47 47
 
48
-	/**
49
-	 * @param string $message
50
-	 * @since 9.1.0
51
-	 */
52
-	public function info($message) {
53
-		$this->logger->info($message, ['app' => $this->appName]);
54
-	}
48
+    /**
49
+     * @param string $message
50
+     * @since 9.1.0
51
+     */
52
+    public function info($message) {
53
+        $this->logger->info($message, ['app' => $this->appName]);
54
+    }
55 55
 
56
-	/**
57
-	 * @param string $message
58
-	 * @since 9.1.0
59
-	 */
60
-	public function warning($message) {
61
-		$this->logger->warning($message, ['app' => $this->appName]);
62
-	}
56
+    /**
57
+     * @param string $message
58
+     * @since 9.1.0
59
+     */
60
+    public function warning($message) {
61
+        $this->logger->warning($message, ['app' => $this->appName]);
62
+    }
63 63
 
64
-	/**
65
-	 * @param int $max
66
-	 * @since 9.1.0
67
-	 */
68
-	public function startProgress($max = 0) {
69
-	}
64
+    /**
65
+     * @param int $max
66
+     * @since 9.1.0
67
+     */
68
+    public function startProgress($max = 0) {
69
+    }
70 70
 
71
-	/**
72
-	 * @param int $step
73
-	 * @param string $description
74
-	 * @since 9.1.0
75
-	 */
76
-	public function advance($step = 1, $description = '') {
77
-	}
71
+    /**
72
+     * @param int $step
73
+     * @param string $description
74
+     * @since 9.1.0
75
+     */
76
+    public function advance($step = 1, $description = '') {
77
+    }
78 78
 
79
-	/**
80
-	 * @since 9.1.0
81
-	 */
82
-	public function finishProgress() {
83
-	}
79
+    /**
80
+     * @since 9.1.0
81
+     */
82
+    public function finishProgress() {
83
+    }
84 84
 }
Please login to merge, or discard this patch.
lib/private/DB/SchemaWrapper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @throws \Doctrine\DBAL\Schema\SchemaException
81 81
 	 */
82 82
 	public function getTable($tableName) {
83
-		return $this->schema->getTable($this->connection->getPrefix() . $tableName);
83
+		return $this->schema->getTable($this->connection->getPrefix().$tableName);
84 84
 	}
85 85
 
86 86
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return boolean
92 92
 	 */
93 93
 	public function hasTable($tableName) {
94
-		return $this->schema->hasTable($this->connection->getPrefix() . $tableName);
94
+		return $this->schema->hasTable($this->connection->getPrefix().$tableName);
95 95
 	}
96 96
 
97 97
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return \Doctrine\DBAL\Schema\Table
102 102
 	 */
103 103
 	public function createTable($tableName) {
104
-		return $this->schema->createTable($this->connection->getPrefix() . $tableName);
104
+		return $this->schema->createTable($this->connection->getPrefix().$tableName);
105 105
 	}
106 106
 
107 107
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function dropTable($tableName) {
127 127
 		$this->tablesToDelete[$tableName] = true;
128
-		return $this->schema->dropTable($this->connection->getPrefix() . $tableName);
128
+		return $this->schema->dropTable($this->connection->getPrefix().$tableName);
129 129
 	}
130 130
 
131 131
 	/**
Please login to merge, or discard this patch.
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -30,107 +30,107 @@
 block discarded – undo
30 30
 
31 31
 class SchemaWrapper implements ISchemaWrapper {
32 32
 
33
-	/** @var IDBConnection|Connection */
34
-	protected $connection;
35
-
36
-	/** @var Schema */
37
-	protected $schema;
38
-
39
-	/** @var array */
40
-	protected $tablesToDelete = [];
41
-
42
-	/**
43
-	 * @param IDBConnection $connection
44
-	 */
45
-	public function __construct(IDBConnection $connection) {
46
-		$this->connection = $connection;
47
-		$this->schema = $this->connection->createSchema();
48
-	}
49
-
50
-	public function getWrappedSchema() {
51
-		return $this->schema;
52
-	}
53
-
54
-	public function performDropTableCalls() {
55
-		foreach ($this->tablesToDelete as $tableName => $true) {
56
-			$this->connection->dropTable($tableName);
57
-			unset($this->tablesToDelete[$tableName]);
58
-		}
59
-	}
60
-
61
-	/**
62
-	 * Gets all table names
63
-	 *
64
-	 * @return array
65
-	 */
66
-	public function getTableNamesWithoutPrefix() {
67
-		$tableNames = $this->schema->getTableNames();
68
-		return array_map(function($tableName) {
69
-			if (strpos($tableName, $this->connection->getPrefix()) === 0) {
70
-				return substr($tableName, strlen($this->connection->getPrefix()));
71
-			}
72
-
73
-			return $tableName;
74
-		}, $tableNames);
75
-	}
76
-
77
-	// Overwritten methods
78
-
79
-	/**
80
-	 * @return array
81
-	 */
82
-	public function getTableNames() {
83
-		return $this->schema->getTableNames();
84
-	}
85
-
86
-	/**
87
-	 * @param string $tableName
88
-	 *
89
-	 * @return \Doctrine\DBAL\Schema\Table
90
-	 * @throws \Doctrine\DBAL\Schema\SchemaException
91
-	 */
92
-	public function getTable($tableName) {
93
-		return $this->schema->getTable($this->connection->getPrefix() . $tableName);
94
-	}
95
-
96
-	/**
97
-	 * Does this schema have a table with the given name?
98
-	 *
99
-	 * @param string $tableName
100
-	 *
101
-	 * @return boolean
102
-	 */
103
-	public function hasTable($tableName) {
104
-		return $this->schema->hasTable($this->connection->getPrefix() . $tableName);
105
-	}
106
-
107
-	/**
108
-	 * Creates a new table.
109
-	 *
110
-	 * @param string $tableName
111
-	 * @return \Doctrine\DBAL\Schema\Table
112
-	 */
113
-	public function createTable($tableName) {
114
-		return $this->schema->createTable($this->connection->getPrefix() . $tableName);
115
-	}
116
-
117
-	/**
118
-	 * Drops a table from the schema.
119
-	 *
120
-	 * @param string $tableName
121
-	 * @return \Doctrine\DBAL\Schema\Schema
122
-	 */
123
-	public function dropTable($tableName) {
124
-		$this->tablesToDelete[$tableName] = true;
125
-		return $this->schema->dropTable($this->connection->getPrefix() . $tableName);
126
-	}
127
-
128
-	/**
129
-	 * Gets all tables of this schema.
130
-	 *
131
-	 * @return \Doctrine\DBAL\Schema\Table[]
132
-	 */
133
-	public function getTables() {
134
-		return $this->schema->getTables();
135
-	}
33
+    /** @var IDBConnection|Connection */
34
+    protected $connection;
35
+
36
+    /** @var Schema */
37
+    protected $schema;
38
+
39
+    /** @var array */
40
+    protected $tablesToDelete = [];
41
+
42
+    /**
43
+     * @param IDBConnection $connection
44
+     */
45
+    public function __construct(IDBConnection $connection) {
46
+        $this->connection = $connection;
47
+        $this->schema = $this->connection->createSchema();
48
+    }
49
+
50
+    public function getWrappedSchema() {
51
+        return $this->schema;
52
+    }
53
+
54
+    public function performDropTableCalls() {
55
+        foreach ($this->tablesToDelete as $tableName => $true) {
56
+            $this->connection->dropTable($tableName);
57
+            unset($this->tablesToDelete[$tableName]);
58
+        }
59
+    }
60
+
61
+    /**
62
+     * Gets all table names
63
+     *
64
+     * @return array
65
+     */
66
+    public function getTableNamesWithoutPrefix() {
67
+        $tableNames = $this->schema->getTableNames();
68
+        return array_map(function($tableName) {
69
+            if (strpos($tableName, $this->connection->getPrefix()) === 0) {
70
+                return substr($tableName, strlen($this->connection->getPrefix()));
71
+            }
72
+
73
+            return $tableName;
74
+        }, $tableNames);
75
+    }
76
+
77
+    // Overwritten methods
78
+
79
+    /**
80
+     * @return array
81
+     */
82
+    public function getTableNames() {
83
+        return $this->schema->getTableNames();
84
+    }
85
+
86
+    /**
87
+     * @param string $tableName
88
+     *
89
+     * @return \Doctrine\DBAL\Schema\Table
90
+     * @throws \Doctrine\DBAL\Schema\SchemaException
91
+     */
92
+    public function getTable($tableName) {
93
+        return $this->schema->getTable($this->connection->getPrefix() . $tableName);
94
+    }
95
+
96
+    /**
97
+     * Does this schema have a table with the given name?
98
+     *
99
+     * @param string $tableName
100
+     *
101
+     * @return boolean
102
+     */
103
+    public function hasTable($tableName) {
104
+        return $this->schema->hasTable($this->connection->getPrefix() . $tableName);
105
+    }
106
+
107
+    /**
108
+     * Creates a new table.
109
+     *
110
+     * @param string $tableName
111
+     * @return \Doctrine\DBAL\Schema\Table
112
+     */
113
+    public function createTable($tableName) {
114
+        return $this->schema->createTable($this->connection->getPrefix() . $tableName);
115
+    }
116
+
117
+    /**
118
+     * Drops a table from the schema.
119
+     *
120
+     * @param string $tableName
121
+     * @return \Doctrine\DBAL\Schema\Schema
122
+     */
123
+    public function dropTable($tableName) {
124
+        $this->tablesToDelete[$tableName] = true;
125
+        return $this->schema->dropTable($this->connection->getPrefix() . $tableName);
126
+    }
127
+
128
+    /**
129
+     * Gets all tables of this schema.
130
+     *
131
+     * @return \Doctrine\DBAL\Schema\Table[]
132
+     */
133
+    public function getTables() {
134
+        return $this->schema->getTables();
135
+    }
136 136
 }
Please login to merge, or discard this patch.
lib/private/Encryption/Util.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$this->config = $config;
97 97
 
98 98
 		$this->excludedPaths[] = 'files_encryption';
99
-		$this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
99
+		$this->excludedPaths[] = 'appdata_'.$config->getSystemValue('instanceid', null);
100 100
 		$this->excludedPaths[] = 'files_external';
101 101
 	}
102 102
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	 * @throws EncryptionHeaderKeyExistsException if header key is already in use
137 137
 	 */
138 138
 	public function createHeader(array $headerData, IEncryptionModule $encryptionModule) {
139
-		$header = self::HEADER_START . ':' . self::HEADER_ENCRYPTION_MODULE_KEY . ':' . $encryptionModule->getId() . ':';
139
+		$header = self::HEADER_START.':'.self::HEADER_ENCRYPTION_MODULE_KEY.':'.$encryptionModule->getId().':';
140 140
 		foreach ($headerData as $key => $value) {
141 141
 			if (in_array($key, $this->ocHeaderKeys)) {
142 142
 				throw new EncryptionHeaderKeyExistsException($key);
143 143
 			}
144
-			$header .= $key . ':' . $value . ':';
144
+			$header .= $key.':'.$value.':';
145 145
 		}
146 146
 		$header .= self::HEADER_END;
147 147
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 				if ($c->getType() === 'dir') {
173 173
 					$dirList[] = $c->getPath();
174 174
 				} else {
175
-					$result[] =  $c->getPath();
175
+					$result[] = $c->getPath();
176 176
 				}
177 177
 			}
178 178
 
@@ -249,15 +249,15 @@  discard block
 block discarded – undo
249 249
 	public function stripPartialFileExtension($path) {
250 250
 		$extension = pathinfo($path, PATHINFO_EXTENSION);
251 251
 
252
-		if ( $extension === 'part') {
252
+		if ($extension === 'part') {
253 253
 
254 254
 			$newLength = strlen($path) - 5; // 5 = strlen(".part")
255 255
 			$fPath = substr($path, 0, $newLength);
256 256
 
257 257
 			// if path also contains a transaction id, we remove it too
258 258
 			$extension = pathinfo($fPath, PATHINFO_EXTENSION);
259
-			if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
260
-				$newLength = strlen($fPath) - strlen($extension) -1;
259
+			if (substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
260
+				$newLength = strlen($fPath) - strlen($extension) - 1;
261 261
 				$fPath = substr($fPath, 0, $newLength);
262 262
 			}
263 263
 			return $fPath;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		if (\OCP\App::isEnabled("files_external")) {
302 302
 			$mounts = \OC_Mount_Config::getSystemMountPoints();
303 303
 			foreach ($mounts as $mount) {
304
-				if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
304
+				if (strpos($path, '/files/'.$mount['mountpoint']) === 0) {
305 305
 					if ($this->isMountPointApplicableToUser($mount, $uid)) {
306 306
 						return true;
307 307
 					}
Please login to merge, or discard this patch.
Indentation   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -38,374 +38,374 @@
 block discarded – undo
38 38
 
39 39
 class Util {
40 40
 
41
-	const HEADER_START = 'HBEGIN';
42
-	const HEADER_END = 'HEND';
43
-	const HEADER_PADDING_CHAR = '-';
44
-
45
-	const HEADER_ENCRYPTION_MODULE_KEY = 'oc_encryption_module';
46
-
47
-	/**
48
-	 * block size will always be 8192 for a PHP stream
49
-	 * @see https://bugs.php.net/bug.php?id=21641
50
-	 * @var integer
51
-	 */
52
-	protected $headerSize = 8192;
53
-
54
-	/**
55
-	 * block size will always be 8192 for a PHP stream
56
-	 * @see https://bugs.php.net/bug.php?id=21641
57
-	 * @var integer
58
-	 */
59
-	protected $blockSize = 8192;
60
-
61
-	/** @var View */
62
-	protected $rootView;
63
-
64
-	/** @var array */
65
-	protected $ocHeaderKeys;
66
-
67
-	/** @var \OC\User\Manager */
68
-	protected $userManager;
69
-
70
-	/** @var IConfig */
71
-	protected $config;
72
-
73
-	/** @var array paths excluded from encryption */
74
-	protected $excludedPaths;
75
-
76
-	/** @var \OC\Group\Manager $manager */
77
-	protected $groupManager;
78
-
79
-	/**
80
-	 *
81
-	 * @param View $rootView
82
-	 * @param \OC\User\Manager $userManager
83
-	 * @param \OC\Group\Manager $groupManager
84
-	 * @param IConfig $config
85
-	 */
86
-	public function __construct(
87
-		View $rootView,
88
-		\OC\User\Manager $userManager,
89
-		\OC\Group\Manager $groupManager,
90
-		IConfig $config) {
91
-
92
-		$this->ocHeaderKeys = [
93
-			self::HEADER_ENCRYPTION_MODULE_KEY
94
-		];
95
-
96
-		$this->rootView = $rootView;
97
-		$this->userManager = $userManager;
98
-		$this->groupManager = $groupManager;
99
-		$this->config = $config;
100
-
101
-		$this->excludedPaths[] = 'files_encryption';
102
-		$this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
103
-		$this->excludedPaths[] = 'files_external';
104
-	}
105
-
106
-	/**
107
-	 * read encryption module ID from header
108
-	 *
109
-	 * @param array $header
110
-	 * @return string
111
-	 * @throws ModuleDoesNotExistsException
112
-	 */
113
-	public function getEncryptionModuleId(array $header = null) {
114
-		$id = '';
115
-		$encryptionModuleKey = self::HEADER_ENCRYPTION_MODULE_KEY;
116
-
117
-		if (isset($header[$encryptionModuleKey])) {
118
-			$id = $header[$encryptionModuleKey];
119
-		} elseif (isset($header['cipher'])) {
120
-			if (class_exists('\OCA\Encryption\Crypto\Encryption')) {
121
-				// fall back to default encryption if the user migrated from
122
-				// ownCloud <= 8.0 with the old encryption
123
-				$id = \OCA\Encryption\Crypto\Encryption::ID;
124
-			} else {
125
-				throw new ModuleDoesNotExistsException('Default encryption module missing');
126
-			}
127
-		}
128
-
129
-		return $id;
130
-	}
131
-
132
-	/**
133
-	 * create header for encrypted file
134
-	 *
135
-	 * @param array $headerData
136
-	 * @param IEncryptionModule $encryptionModule
137
-	 * @return string
138
-	 * @throws EncryptionHeaderToLargeException if header has to many arguments
139
-	 * @throws EncryptionHeaderKeyExistsException if header key is already in use
140
-	 */
141
-	public function createHeader(array $headerData, IEncryptionModule $encryptionModule) {
142
-		$header = self::HEADER_START . ':' . self::HEADER_ENCRYPTION_MODULE_KEY . ':' . $encryptionModule->getId() . ':';
143
-		foreach ($headerData as $key => $value) {
144
-			if (in_array($key, $this->ocHeaderKeys)) {
145
-				throw new EncryptionHeaderKeyExistsException($key);
146
-			}
147
-			$header .= $key . ':' . $value . ':';
148
-		}
149
-		$header .= self::HEADER_END;
150
-
151
-		if (strlen($header) > $this->getHeaderSize()) {
152
-			throw new EncryptionHeaderToLargeException();
153
-		}
154
-
155
-		$paddedHeader = str_pad($header, $this->headerSize, self::HEADER_PADDING_CHAR, STR_PAD_RIGHT);
156
-
157
-		return $paddedHeader;
158
-	}
159
-
160
-	/**
161
-	 * go recursively through a dir and collect all files and sub files.
162
-	 *
163
-	 * @param string $dir relative to the users files folder
164
-	 * @return array with list of files relative to the users files folder
165
-	 */
166
-	public function getAllFiles($dir) {
167
-		$result = [];
168
-		$dirList = [$dir];
169
-
170
-		while ($dirList) {
171
-			$dir = array_pop($dirList);
172
-			$content = $this->rootView->getDirectoryContent($dir);
173
-
174
-			foreach ($content as $c) {
175
-				if ($c->getType() === 'dir') {
176
-					$dirList[] = $c->getPath();
177
-				} else {
178
-					$result[] =  $c->getPath();
179
-				}
180
-			}
181
-
182
-		}
183
-
184
-		return $result;
185
-	}
186
-
187
-	/**
188
-	 * check if it is a file uploaded by the user stored in data/user/files
189
-	 * or a metadata file
190
-	 *
191
-	 * @param string $path relative to the data/ folder
192
-	 * @return boolean
193
-	 */
194
-	public function isFile($path) {
195
-		$parts = explode('/', Filesystem::normalizePath($path), 4);
196
-		if (isset($parts[2]) && $parts[2] === 'files') {
197
-			return true;
198
-		}
199
-		return false;
200
-	}
201
-
202
-	/**
203
-	 * return size of encryption header
204
-	 *
205
-	 * @return integer
206
-	 */
207
-	public function getHeaderSize() {
208
-		return $this->headerSize;
209
-	}
210
-
211
-	/**
212
-	 * return size of block read by a PHP stream
213
-	 *
214
-	 * @return integer
215
-	 */
216
-	public function getBlockSize() {
217
-		return $this->blockSize;
218
-	}
219
-
220
-	/**
221
-	 * get the owner and the path for the file relative to the owners files folder
222
-	 *
223
-	 * @param string $path
224
-	 * @return array
225
-	 * @throws \BadMethodCallException
226
-	 */
227
-	public function getUidAndFilename($path) {
228
-
229
-		$parts = explode('/', $path);
230
-		$uid = '';
231
-		if (count($parts) > 2) {
232
-			$uid = $parts[1];
233
-		}
234
-		if (!$this->userManager->userExists($uid)) {
235
-			throw new \BadMethodCallException(
236
-				'path needs to be relative to the system wide data folder and point to a user specific file'
237
-			);
238
-		}
239
-
240
-		$ownerPath = implode('/', array_slice($parts, 2));
241
-
242
-		return [$uid, Filesystem::normalizePath($ownerPath)];
243
-
244
-	}
245
-
246
-	/**
247
-	 * Remove .path extension from a file path
248
-	 * @param string $path Path that may identify a .part file
249
-	 * @return string File path without .part extension
250
-	 * @note this is needed for reusing keys
251
-	 */
252
-	public function stripPartialFileExtension($path) {
253
-		$extension = pathinfo($path, PATHINFO_EXTENSION);
254
-
255
-		if ( $extension === 'part') {
256
-
257
-			$newLength = strlen($path) - 5; // 5 = strlen(".part")
258
-			$fPath = substr($path, 0, $newLength);
259
-
260
-			// if path also contains a transaction id, we remove it too
261
-			$extension = pathinfo($fPath, PATHINFO_EXTENSION);
262
-			if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
263
-				$newLength = strlen($fPath) - strlen($extension) -1;
264
-				$fPath = substr($fPath, 0, $newLength);
265
-			}
266
-			return $fPath;
267
-
268
-		} else {
269
-			return $path;
270
-		}
271
-	}
272
-
273
-	public function getUserWithAccessToMountPoint($users, $groups) {
274
-		$result = [];
275
-		if (in_array('all', $users)) {
276
-			$users = $this->userManager->search('', null, null);
277
-			$result = array_map(function(IUser $user) {
278
-				return $user->getUID();
279
-			}, $users);
280
-		} else {
281
-			$result = array_merge($result, $users);
282
-
283
-			$groupManager = \OC::$server->getGroupManager();
284
-			foreach ($groups as $group) {
285
-				$groupObject = $groupManager->get($group);
286
-				if ($groupObject) {
287
-					$foundUsers = $groupObject->searchUsers('', -1, 0);
288
-					$userIds = [];
289
-					foreach ($foundUsers as $user) {
290
-						$userIds[] = $user->getUID();
291
-					}
292
-					$result = array_merge($result, $userIds);
293
-				}
294
-			}
295
-		}
296
-
297
-		return $result;
298
-	}
299
-
300
-	/**
301
-	 * check if the file is stored on a system wide mount point
302
-	 * @param string $path relative to /data/user with leading '/'
303
-	 * @param string $uid
304
-	 * @return boolean
305
-	 */
306
-	public function isSystemWideMountPoint($path, $uid) {
307
-		if (\OCP\App::isEnabled("files_external")) {
308
-			$mounts = \OC_Mount_Config::getSystemMountPoints();
309
-			foreach ($mounts as $mount) {
310
-				if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
311
-					if ($this->isMountPointApplicableToUser($mount, $uid)) {
312
-						return true;
313
-					}
314
-				}
315
-			}
316
-		}
317
-		return false;
318
-	}
319
-
320
-	/**
321
-	 * check if mount point is applicable to user
322
-	 *
323
-	 * @param array $mount contains $mount['applicable']['users'], $mount['applicable']['groups']
324
-	 * @param string $uid
325
-	 * @return boolean
326
-	 */
327
-	private function isMountPointApplicableToUser($mount, $uid) {
328
-		$acceptedUids = ['all', $uid];
329
-		// check if mount point is applicable for the user
330
-		$intersection = array_intersect($acceptedUids, $mount['applicable']['users']);
331
-		if (!empty($intersection)) {
332
-			return true;
333
-		}
334
-		// check if mount point is applicable for group where the user is a member
335
-		foreach ($mount['applicable']['groups'] as $gid) {
336
-			if ($this->groupManager->isInGroup($uid, $gid)) {
337
-				return true;
338
-			}
339
-		}
340
-		return false;
341
-	}
342
-
343
-	/**
344
-	 * check if it is a path which is excluded by ownCloud from encryption
345
-	 *
346
-	 * @param string $path
347
-	 * @return boolean
348
-	 */
349
-	public function isExcluded($path) {
350
-		$normalizedPath = Filesystem::normalizePath($path);
351
-		$root = explode('/', $normalizedPath, 4);
352
-		if (count($root) > 1) {
353
-
354
-			// detect alternative key storage root
355
-			$rootDir = $this->getKeyStorageRoot();
356
-			if ($rootDir !== '' &&
357
-				0 === strpos(
358
-					Filesystem::normalizePath($path),
359
-					Filesystem::normalizePath($rootDir)
360
-				)
361
-			) {
362
-				return true;
363
-			}
364
-
365
-
366
-			//detect system wide folders
367
-			if (in_array($root[1], $this->excludedPaths)) {
368
-				return true;
369
-			}
370
-
371
-			// detect user specific folders
372
-			if ($this->userManager->userExists($root[1])
373
-				&& in_array($root[2], $this->excludedPaths)) {
374
-
375
-				return true;
376
-			}
377
-		}
378
-		return false;
379
-	}
380
-
381
-	/**
382
-	 * check if recovery key is enabled for user
383
-	 *
384
-	 * @param string $uid
385
-	 * @return boolean
386
-	 */
387
-	public function recoveryEnabled($uid) {
388
-		$enabled = $this->config->getUserValue($uid, 'encryption', 'recovery_enabled', '0');
389
-
390
-		return $enabled === '1';
391
-	}
392
-
393
-	/**
394
-	 * set new key storage root
395
-	 *
396
-	 * @param string $root new key store root relative to the data folder
397
-	 */
398
-	public function setKeyStorageRoot($root) {
399
-		$this->config->setAppValue('core', 'encryption_key_storage_root', $root);
400
-	}
401
-
402
-	/**
403
-	 * get key storage root
404
-	 *
405
-	 * @return string key storage root
406
-	 */
407
-	public function getKeyStorageRoot() {
408
-		return $this->config->getAppValue('core', 'encryption_key_storage_root', '');
409
-	}
41
+    const HEADER_START = 'HBEGIN';
42
+    const HEADER_END = 'HEND';
43
+    const HEADER_PADDING_CHAR = '-';
44
+
45
+    const HEADER_ENCRYPTION_MODULE_KEY = 'oc_encryption_module';
46
+
47
+    /**
48
+     * block size will always be 8192 for a PHP stream
49
+     * @see https://bugs.php.net/bug.php?id=21641
50
+     * @var integer
51
+     */
52
+    protected $headerSize = 8192;
53
+
54
+    /**
55
+     * block size will always be 8192 for a PHP stream
56
+     * @see https://bugs.php.net/bug.php?id=21641
57
+     * @var integer
58
+     */
59
+    protected $blockSize = 8192;
60
+
61
+    /** @var View */
62
+    protected $rootView;
63
+
64
+    /** @var array */
65
+    protected $ocHeaderKeys;
66
+
67
+    /** @var \OC\User\Manager */
68
+    protected $userManager;
69
+
70
+    /** @var IConfig */
71
+    protected $config;
72
+
73
+    /** @var array paths excluded from encryption */
74
+    protected $excludedPaths;
75
+
76
+    /** @var \OC\Group\Manager $manager */
77
+    protected $groupManager;
78
+
79
+    /**
80
+     *
81
+     * @param View $rootView
82
+     * @param \OC\User\Manager $userManager
83
+     * @param \OC\Group\Manager $groupManager
84
+     * @param IConfig $config
85
+     */
86
+    public function __construct(
87
+        View $rootView,
88
+        \OC\User\Manager $userManager,
89
+        \OC\Group\Manager $groupManager,
90
+        IConfig $config) {
91
+
92
+        $this->ocHeaderKeys = [
93
+            self::HEADER_ENCRYPTION_MODULE_KEY
94
+        ];
95
+
96
+        $this->rootView = $rootView;
97
+        $this->userManager = $userManager;
98
+        $this->groupManager = $groupManager;
99
+        $this->config = $config;
100
+
101
+        $this->excludedPaths[] = 'files_encryption';
102
+        $this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
103
+        $this->excludedPaths[] = 'files_external';
104
+    }
105
+
106
+    /**
107
+     * read encryption module ID from header
108
+     *
109
+     * @param array $header
110
+     * @return string
111
+     * @throws ModuleDoesNotExistsException
112
+     */
113
+    public function getEncryptionModuleId(array $header = null) {
114
+        $id = '';
115
+        $encryptionModuleKey = self::HEADER_ENCRYPTION_MODULE_KEY;
116
+
117
+        if (isset($header[$encryptionModuleKey])) {
118
+            $id = $header[$encryptionModuleKey];
119
+        } elseif (isset($header['cipher'])) {
120
+            if (class_exists('\OCA\Encryption\Crypto\Encryption')) {
121
+                // fall back to default encryption if the user migrated from
122
+                // ownCloud <= 8.0 with the old encryption
123
+                $id = \OCA\Encryption\Crypto\Encryption::ID;
124
+            } else {
125
+                throw new ModuleDoesNotExistsException('Default encryption module missing');
126
+            }
127
+        }
128
+
129
+        return $id;
130
+    }
131
+
132
+    /**
133
+     * create header for encrypted file
134
+     *
135
+     * @param array $headerData
136
+     * @param IEncryptionModule $encryptionModule
137
+     * @return string
138
+     * @throws EncryptionHeaderToLargeException if header has to many arguments
139
+     * @throws EncryptionHeaderKeyExistsException if header key is already in use
140
+     */
141
+    public function createHeader(array $headerData, IEncryptionModule $encryptionModule) {
142
+        $header = self::HEADER_START . ':' . self::HEADER_ENCRYPTION_MODULE_KEY . ':' . $encryptionModule->getId() . ':';
143
+        foreach ($headerData as $key => $value) {
144
+            if (in_array($key, $this->ocHeaderKeys)) {
145
+                throw new EncryptionHeaderKeyExistsException($key);
146
+            }
147
+            $header .= $key . ':' . $value . ':';
148
+        }
149
+        $header .= self::HEADER_END;
150
+
151
+        if (strlen($header) > $this->getHeaderSize()) {
152
+            throw new EncryptionHeaderToLargeException();
153
+        }
154
+
155
+        $paddedHeader = str_pad($header, $this->headerSize, self::HEADER_PADDING_CHAR, STR_PAD_RIGHT);
156
+
157
+        return $paddedHeader;
158
+    }
159
+
160
+    /**
161
+     * go recursively through a dir and collect all files and sub files.
162
+     *
163
+     * @param string $dir relative to the users files folder
164
+     * @return array with list of files relative to the users files folder
165
+     */
166
+    public function getAllFiles($dir) {
167
+        $result = [];
168
+        $dirList = [$dir];
169
+
170
+        while ($dirList) {
171
+            $dir = array_pop($dirList);
172
+            $content = $this->rootView->getDirectoryContent($dir);
173
+
174
+            foreach ($content as $c) {
175
+                if ($c->getType() === 'dir') {
176
+                    $dirList[] = $c->getPath();
177
+                } else {
178
+                    $result[] =  $c->getPath();
179
+                }
180
+            }
181
+
182
+        }
183
+
184
+        return $result;
185
+    }
186
+
187
+    /**
188
+     * check if it is a file uploaded by the user stored in data/user/files
189
+     * or a metadata file
190
+     *
191
+     * @param string $path relative to the data/ folder
192
+     * @return boolean
193
+     */
194
+    public function isFile($path) {
195
+        $parts = explode('/', Filesystem::normalizePath($path), 4);
196
+        if (isset($parts[2]) && $parts[2] === 'files') {
197
+            return true;
198
+        }
199
+        return false;
200
+    }
201
+
202
+    /**
203
+     * return size of encryption header
204
+     *
205
+     * @return integer
206
+     */
207
+    public function getHeaderSize() {
208
+        return $this->headerSize;
209
+    }
210
+
211
+    /**
212
+     * return size of block read by a PHP stream
213
+     *
214
+     * @return integer
215
+     */
216
+    public function getBlockSize() {
217
+        return $this->blockSize;
218
+    }
219
+
220
+    /**
221
+     * get the owner and the path for the file relative to the owners files folder
222
+     *
223
+     * @param string $path
224
+     * @return array
225
+     * @throws \BadMethodCallException
226
+     */
227
+    public function getUidAndFilename($path) {
228
+
229
+        $parts = explode('/', $path);
230
+        $uid = '';
231
+        if (count($parts) > 2) {
232
+            $uid = $parts[1];
233
+        }
234
+        if (!$this->userManager->userExists($uid)) {
235
+            throw new \BadMethodCallException(
236
+                'path needs to be relative to the system wide data folder and point to a user specific file'
237
+            );
238
+        }
239
+
240
+        $ownerPath = implode('/', array_slice($parts, 2));
241
+
242
+        return [$uid, Filesystem::normalizePath($ownerPath)];
243
+
244
+    }
245
+
246
+    /**
247
+     * Remove .path extension from a file path
248
+     * @param string $path Path that may identify a .part file
249
+     * @return string File path without .part extension
250
+     * @note this is needed for reusing keys
251
+     */
252
+    public function stripPartialFileExtension($path) {
253
+        $extension = pathinfo($path, PATHINFO_EXTENSION);
254
+
255
+        if ( $extension === 'part') {
256
+
257
+            $newLength = strlen($path) - 5; // 5 = strlen(".part")
258
+            $fPath = substr($path, 0, $newLength);
259
+
260
+            // if path also contains a transaction id, we remove it too
261
+            $extension = pathinfo($fPath, PATHINFO_EXTENSION);
262
+            if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
263
+                $newLength = strlen($fPath) - strlen($extension) -1;
264
+                $fPath = substr($fPath, 0, $newLength);
265
+            }
266
+            return $fPath;
267
+
268
+        } else {
269
+            return $path;
270
+        }
271
+    }
272
+
273
+    public function getUserWithAccessToMountPoint($users, $groups) {
274
+        $result = [];
275
+        if (in_array('all', $users)) {
276
+            $users = $this->userManager->search('', null, null);
277
+            $result = array_map(function(IUser $user) {
278
+                return $user->getUID();
279
+            }, $users);
280
+        } else {
281
+            $result = array_merge($result, $users);
282
+
283
+            $groupManager = \OC::$server->getGroupManager();
284
+            foreach ($groups as $group) {
285
+                $groupObject = $groupManager->get($group);
286
+                if ($groupObject) {
287
+                    $foundUsers = $groupObject->searchUsers('', -1, 0);
288
+                    $userIds = [];
289
+                    foreach ($foundUsers as $user) {
290
+                        $userIds[] = $user->getUID();
291
+                    }
292
+                    $result = array_merge($result, $userIds);
293
+                }
294
+            }
295
+        }
296
+
297
+        return $result;
298
+    }
299
+
300
+    /**
301
+     * check if the file is stored on a system wide mount point
302
+     * @param string $path relative to /data/user with leading '/'
303
+     * @param string $uid
304
+     * @return boolean
305
+     */
306
+    public function isSystemWideMountPoint($path, $uid) {
307
+        if (\OCP\App::isEnabled("files_external")) {
308
+            $mounts = \OC_Mount_Config::getSystemMountPoints();
309
+            foreach ($mounts as $mount) {
310
+                if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
311
+                    if ($this->isMountPointApplicableToUser($mount, $uid)) {
312
+                        return true;
313
+                    }
314
+                }
315
+            }
316
+        }
317
+        return false;
318
+    }
319
+
320
+    /**
321
+     * check if mount point is applicable to user
322
+     *
323
+     * @param array $mount contains $mount['applicable']['users'], $mount['applicable']['groups']
324
+     * @param string $uid
325
+     * @return boolean
326
+     */
327
+    private function isMountPointApplicableToUser($mount, $uid) {
328
+        $acceptedUids = ['all', $uid];
329
+        // check if mount point is applicable for the user
330
+        $intersection = array_intersect($acceptedUids, $mount['applicable']['users']);
331
+        if (!empty($intersection)) {
332
+            return true;
333
+        }
334
+        // check if mount point is applicable for group where the user is a member
335
+        foreach ($mount['applicable']['groups'] as $gid) {
336
+            if ($this->groupManager->isInGroup($uid, $gid)) {
337
+                return true;
338
+            }
339
+        }
340
+        return false;
341
+    }
342
+
343
+    /**
344
+     * check if it is a path which is excluded by ownCloud from encryption
345
+     *
346
+     * @param string $path
347
+     * @return boolean
348
+     */
349
+    public function isExcluded($path) {
350
+        $normalizedPath = Filesystem::normalizePath($path);
351
+        $root = explode('/', $normalizedPath, 4);
352
+        if (count($root) > 1) {
353
+
354
+            // detect alternative key storage root
355
+            $rootDir = $this->getKeyStorageRoot();
356
+            if ($rootDir !== '' &&
357
+                0 === strpos(
358
+                    Filesystem::normalizePath($path),
359
+                    Filesystem::normalizePath($rootDir)
360
+                )
361
+            ) {
362
+                return true;
363
+            }
364
+
365
+
366
+            //detect system wide folders
367
+            if (in_array($root[1], $this->excludedPaths)) {
368
+                return true;
369
+            }
370
+
371
+            // detect user specific folders
372
+            if ($this->userManager->userExists($root[1])
373
+                && in_array($root[2], $this->excludedPaths)) {
374
+
375
+                return true;
376
+            }
377
+        }
378
+        return false;
379
+    }
380
+
381
+    /**
382
+     * check if recovery key is enabled for user
383
+     *
384
+     * @param string $uid
385
+     * @return boolean
386
+     */
387
+    public function recoveryEnabled($uid) {
388
+        $enabled = $this->config->getUserValue($uid, 'encryption', 'recovery_enabled', '0');
389
+
390
+        return $enabled === '1';
391
+    }
392
+
393
+    /**
394
+     * set new key storage root
395
+     *
396
+     * @param string $root new key store root relative to the data folder
397
+     */
398
+    public function setKeyStorageRoot($root) {
399
+        $this->config->setAppValue('core', 'encryption_key_storage_root', $root);
400
+    }
401
+
402
+    /**
403
+     * get key storage root
404
+     *
405
+     * @return string key storage root
406
+     */
407
+    public function getKeyStorageRoot() {
408
+        return $this->config->getAppValue('core', 'encryption_key_storage_root', '');
409
+    }
410 410
 
411 411
 }
Please login to merge, or discard this patch.
lib/private/Comments/ManagerFactory.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,33 +30,33 @@
 block discarded – undo
30 30
 
31 31
 class ManagerFactory implements ICommentsManagerFactory {
32 32
 
33
-	/**
34
-	 * Server container
35
-	 *
36
-	 * @var IServerContainer
37
-	 */
38
-	private $serverContainer;
33
+    /**
34
+     * Server container
35
+     *
36
+     * @var IServerContainer
37
+     */
38
+    private $serverContainer;
39 39
 
40
-	/**
41
-	 * Constructor for the comments manager factory
42
-	 *
43
-	 * @param IServerContainer $serverContainer server container
44
-	 */
45
-	public function __construct(IServerContainer $serverContainer) {
46
-		$this->serverContainer = $serverContainer;
47
-	}
40
+    /**
41
+     * Constructor for the comments manager factory
42
+     *
43
+     * @param IServerContainer $serverContainer server container
44
+     */
45
+    public function __construct(IServerContainer $serverContainer) {
46
+        $this->serverContainer = $serverContainer;
47
+    }
48 48
 
49
-	/**
50
-	 * creates and returns an instance of the ICommentsManager
51
-	 *
52
-	 * @return ICommentsManager
53
-	 * @since 9.0.0
54
-	 */
55
-	public function getManager() {
56
-		return new Manager(
57
-			$this->serverContainer->getDatabaseConnection(),
58
-			$this->serverContainer->getLogger(),
59
-			$this->serverContainer->getConfig()
60
-		);
61
-	}
49
+    /**
50
+     * creates and returns an instance of the ICommentsManager
51
+     *
52
+     * @return ICommentsManager
53
+     * @since 9.0.0
54
+     */
55
+    public function getManager() {
56
+        return new Manager(
57
+            $this->serverContainer->getDatabaseConnection(),
58
+            $this->serverContainer->getLogger(),
59
+            $this->serverContainer->getConfig()
60
+        );
61
+    }
62 62
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/CachingTree.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@
 block discarded – undo
24 24
 use Sabre\DAV\Tree;
25 25
 
26 26
 class CachingTree extends Tree {
27
-	/**
28
-	 * Store a node in the cache
29
-	 *
30
-	 * @param Node $node
31
-	 * @param null|string $path
32
-	 */
33
-	public function cacheNode(Node $node, $path = null) {
34
-		if (is_null($path)) {
35
-			$path = $node->getPath();
36
-		}
37
-		$this->cache[trim($path, '/')] = $node;
38
-	}
27
+    /**
28
+     * Store a node in the cache
29
+     *
30
+     * @param Node $node
31
+     * @param null|string $path
32
+     */
33
+    public function cacheNode(Node $node, $path = null) {
34
+        if (is_null($path)) {
35
+            $path = $node->getPath();
36
+        }
37
+        $this->cache[trim($path, '/')] = $node;
38
+    }
39 39
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Server.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
  * @see \Sabre\DAV\Server
34 34
  */
35 35
 class Server extends \Sabre\DAV\Server {
36
-	/** @var CachingTree $tree */
36
+    /** @var CachingTree $tree */
37 37
 
38
-	/**
39
-	 * @see \Sabre\DAV\Server
40
-	 */
41
-	public function __construct($treeOrNode = null) {
42
-		parent::__construct($treeOrNode);
43
-		self::$exposeVersion = false;
44
-		$this->enablePropfindDepthInfinity = true;
45
-	}
38
+    /**
39
+     * @see \Sabre\DAV\Server
40
+     */
41
+    public function __construct($treeOrNode = null) {
42
+        parent::__construct($treeOrNode);
43
+        self::$exposeVersion = false;
44
+        $this->enablePropfindDepthInfinity = true;
45
+    }
46 46
 }
Please login to merge, or discard this patch.
core/templates/error.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <div class="error">
2 2
 	<h2><?php p($l->t('Error')) ?></h2>
3 3
 	<ul>
4
-	<?php foreach($_["errors"] as $error):?>
4
+	<?php foreach ($_["errors"] as $error):?>
5 5
 		<li>
6 6
 			<p><?php p($error['error']) ?></p>
7
-			<?php if(isset($error['hint']) && $error['hint']): ?>
7
+			<?php if (isset($error['hint']) && $error['hint']): ?>
8 8
 				<p class='hint'><?php p($error['hint']) ?></p>
9
-			<?php endif;?>
9
+			<?php endif; ?>
10 10
 		</li>
11 11
 	<?php endforeach ?>
12 12
 	</ul>
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/lib/Activity/Provider.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,47 +31,47 @@
 block discarded – undo
31 31
 
32 32
 class Provider implements IProvider {
33 33
 
34
-	/** @var L10nFactory */
35
-	private $l10n;
34
+    /** @var L10nFactory */
35
+    private $l10n;
36 36
 
37
-	/** @var IURLGenerator */
38
-	private $urlGenerator;
37
+    /** @var IURLGenerator */
38
+    private $urlGenerator;
39 39
 
40
-	/** @var IManager */
41
-	private $activityManager;
40
+    /** @var IManager */
41
+    private $activityManager;
42 42
 
43
-	/**
44
-	 * @param L10nFactory $l10n
45
-	 * @param IURLGenerator $urlGenerator
46
-	 * @param IManager $activityManager
47
-	 */
48
-	public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
49
-		$this->urlGenerator = $urlGenerator;
50
-		$this->activityManager = $activityManager;
51
-		$this->l10n = $l10n;
52
-	}
43
+    /**
44
+     * @param L10nFactory $l10n
45
+     * @param IURLGenerator $urlGenerator
46
+     * @param IManager $activityManager
47
+     */
48
+    public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
49
+        $this->urlGenerator = $urlGenerator;
50
+        $this->activityManager = $activityManager;
51
+        $this->l10n = $l10n;
52
+    }
53 53
 
54
-	public function parse($language, IEvent $event, IEvent $previousEvent = null) {
55
-		if ($event->getApp() !== 'twofactor_backupcodes') {
56
-			throw new InvalidArgumentException();
57
-		}
54
+    public function parse($language, IEvent $event, IEvent $previousEvent = null) {
55
+        if ($event->getApp() !== 'twofactor_backupcodes') {
56
+            throw new InvalidArgumentException();
57
+        }
58 58
 
59
-		$l = $this->l10n->get('twofactor_backupcodes', $language);
59
+        $l = $this->l10n->get('twofactor_backupcodes', $language);
60 60
 
61
-		switch ($event->getSubject()) {
62
-			case 'codes_generated':
63
-				$event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
61
+        switch ($event->getSubject()) {
62
+            case 'codes_generated':
63
+                $event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
64 64
 
65
-				if ($this->activityManager->getRequirePNG()) {
66
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
67
-				} else {
68
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
69
-				}
70
-				break;
71
-			default:
72
-				throw new InvalidArgumentException();
73
-		}
74
-		return $event;
75
-	}
65
+                if ($this->activityManager->getRequirePNG()) {
66
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
67
+                } else {
68
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
69
+                }
70
+                break;
71
+            default:
72
+                throw new InvalidArgumentException();
73
+        }
74
+        return $event;
75
+    }
76 76
 
77 77
 }
Please login to merge, or discard this patch.