summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-06-02 14:22:04 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-07-05 13:01:19 +0200
commit3969a6b1ebae547a575329fb53d61dc8dbffb217 (patch)
treed5754e4e0ae17979dfdce5037fc1ae0a493505d6 /lib/private
parent194ef1a1715038c2193cee65a74372f07bc4eee6 (diff)
downloadnextcloud-server-3969a6b1ebae547a575329fb53d61dc8dbffb217.tar.gz
nextcloud-server-3969a6b1ebae547a575329fb53d61dc8dbffb217.zip
Use autoloading instead of require_once from a different dir
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/DB/MigrationService.php18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index c81fe0f4332..65157299ddc 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -58,7 +58,7 @@ class MigrationService {
* @param IOutput|null $output
* @throws \Exception
*/
- function __construct($appName, IDBConnection $connection, IOutput $output = null, AppLocator $appLocator = null) {
+ public function __construct($appName, IDBConnection $connection, IOutput $output = null, AppLocator $appLocator = null) {
$this->appName = $appName;
$this->connection = $connection;
$this->output = $output;
@@ -74,21 +74,16 @@ class MigrationService {
$appLocator = new AppLocator();
}
$appPath = $appLocator->getAppPath($appName);
- $this->migrationsPath = "$appPath/appinfo/Migrations";
- $this->migrationsNamespace = "OCA\\$appName\\Migrations";
+ $namespace = \OCP\AppFramework\App::buildAppNamespace($appName);
+ $this->migrationsPath = "$appPath/lib/Migration";
+ $this->migrationsNamespace = $namespace . '\\Migration';
}
- if (!is_dir($this->migrationsPath)) {
- if (!mkdir($this->migrationsPath)) {
- throw new \Exception("Could not create migration folder \"{$this->migrationsPath}\"");
- };
+ if (!is_dir($this->migrationsPath) && !mkdir($this->migrationsPath)) {
+ throw new \Exception("Could not create migration folder \"{$this->migrationsPath}\"");
}
}
- private static function requireOnce($file) {
- require_once $file;
- }
-
/**
* Returns the name of the app for which this migration is executed
*
@@ -180,7 +175,6 @@ class MigrationService {
$migrations = [];
foreach ($files as $file) {
- static::requireOnce($file);
$className = basename($file, '.php');
$version = (string) substr($className, 7);
if ($version === '0') {