Skip to content

Commit

Permalink
Merge pull request #28391 from owncloud/stable10-e6819356b4c3bfe9e453…
Browse files Browse the repository at this point in the history
…8c34b0692ad4fd2dc972

[stable10] Load the app in the migration service. This allows executi…
  • Loading branch information
Vincent Petry authored Jul 17, 2017
2 parents 68dc241 + 9c81d0d commit af4db97
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class MigrationService {
* @param IOutput|null $output
* @throws \Exception
*/
function __construct($appName, IDBConnection $connection, IOutput $output = null, AppLocator $appLocator = null) {
function __construct($appName,
IDBConnection $connection,
IOutput $output = null,
AppLocator $appLocator = null) {
$this->appName = $appName;
$this->connection = $connection;
$this->output = $output;
Expand All @@ -81,6 +84,9 @@ function __construct($appName, IDBConnection $connection, IOutput $output = null
throw new \Exception("Could not create migration folder \"{$this->migrationsPath}\"");
};
}

// load the app so that app code can be used during migrations
\OC_App::loadApp($this->appName);
}

private static function requireOnce($file) {
Expand Down Expand Up @@ -196,6 +202,7 @@ protected function findMigrations() {

/**
* @param string $to
* @return array
*/
private function getMigrationsToExecute($to) {
$knownMigrations = $this->getMigratedVersions();
Expand All @@ -215,7 +222,9 @@ private function getMigrationsToExecute($to) {
}

/**
* @param string $m
* @param string[] $knownMigrations
* @return bool
*/
private function shallBeExecuted($m, $knownMigrations) {
if (in_array($m, $knownMigrations)) {
Expand Down Expand Up @@ -315,6 +324,7 @@ private function getCurrentVersion() {
}

/**
* @param string $version
* @return string
*/
private function getClass($version) {
Expand Down

0 comments on commit af4db97

Please sign in to comment.