Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] Load the app in the migration service. This allows executi… #28391

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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