|
46 | 46 | use OC\AppFramework\Bootstrap\Coordinator; |
47 | 47 | use OC\Archive\TAR; |
48 | 48 | use OC\DB\Connection; |
| 49 | +use OC\DB\MigrationService; |
49 | 50 | use OC_App; |
50 | | -use OC_DB; |
51 | 51 | use OC_Helper; |
52 | 52 | use OCP\Http\Client\IClientService; |
53 | 53 | use OCP\IConfig; |
@@ -114,6 +114,11 @@ public function installApp(string $appId, bool $forceEnable = false): string { |
114 | 114 | } |
115 | 115 |
|
116 | 116 | $basedir = $app['path'].'/'.$appId; |
| 117 | + |
| 118 | + if (is_file($basedir . '/appinfo/database.xml')) { |
| 119 | + throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId); |
| 120 | + } |
| 121 | + |
117 | 122 | $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true); |
118 | 123 |
|
119 | 124 | $l = \OC::$server->getL10N('core'); |
@@ -152,16 +157,9 @@ public function installApp(string $appId, bool $forceEnable = false): string { |
152 | 157 | } |
153 | 158 |
|
154 | 159 | //install the database |
155 | | - if (is_file($basedir.'/appinfo/database.xml')) { |
156 | | - if (\OC::$server->getConfig()->getAppValue($info['id'], 'installed_version') === null) { |
157 | | - OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); |
158 | | - } else { |
159 | | - OC_DB::updateDbFromStructure($basedir.'/appinfo/database.xml'); |
160 | | - } |
161 | | - } else { |
162 | | - $ms = new \OC\DB\MigrationService($info['id'], \OC::$server->get(Connection::class)); |
163 | | - $ms->migrate('latest', true); |
164 | | - } |
| 160 | + $ms = new MigrationService($info['id'], \OC::$server->get(Connection::class)); |
| 161 | + $ms->migrate('latest', true); |
| 162 | + |
165 | 163 | if ($previousVersion) { |
166 | 164 | OC_App::executeRepairSteps($appId, $info['repair-steps']['post-migration']); |
167 | 165 | } |
@@ -601,20 +599,8 @@ public static function installShippedApp($app) { |
601 | 599 | $appPath = OC_App::getAppPath($app); |
602 | 600 | \OC_App::registerAutoloading($app, $appPath); |
603 | 601 |
|
604 | | - if (is_file("$appPath/appinfo/database.xml")) { |
605 | | - try { |
606 | | - OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); |
607 | | - } catch (TableExistsException $e) { |
608 | | - throw new HintException( |
609 | | - 'Failed to enable app ' . $app, |
610 | | - 'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer noopener">support channels</a>.', |
611 | | - 0, $e |
612 | | - ); |
613 | | - } |
614 | | - } else { |
615 | | - $ms = new \OC\DB\MigrationService($app, \OC::$server->get(Connection::class)); |
616 | | - $ms->migrate('latest', true); |
617 | | - } |
| 602 | + $ms = new MigrationService($app, \OC::$server->get(Connection::class)); |
| 603 | + $ms->migrate('latest', true); |
618 | 604 |
|
619 | 605 | //run appinfo/install.php |
620 | 606 | self::includeAppScript("$appPath/appinfo/install.php"); |
|
0 commit comments