Minor - fix installation

pull/3890/head
Julio Montoya 4 years ago
parent c897b15316
commit 76d1e0acea
  1. 7
      public/main/inc/lib/database.lib.php
  2. 2
      public/main/install/index.php
  3. 8
      public/main/install/install.lib.php

@ -10,9 +10,6 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
/**
* Class Database.
*/
class Database
{
/**
@ -22,7 +19,7 @@ class Database
private static $connection;
/**
* Setup doctrine for the installation.
* Setup doctrine only for the installation.
*
* @param array $params
* @param string $entityRootPath
@ -355,7 +352,7 @@ class Database
exit;
} else {
error_log($e->getMessage());
api_not_allowed(false, get_lang('An error has occured. Please contact your system administrator.'));
api_not_allowed(false, get_lang('An error has occurred. Please contact your system administrator.'));
exit;
}
}

@ -634,6 +634,8 @@ if (isset($_POST['step2'])) {
$container = $kernel->getContainer();
Container::setContainer($container);
Container::setLegacyServices($container, false);
$manager = $container->get('doctrine')->getManager();
migrateSwitch($my_old_version, $manager);
upgradeWithContainer($container);

@ -2110,13 +2110,12 @@ function migrate(EntityManager $manager)
$debug = true;
$connection = $manager->getConnection();
$to = null; // if $to == null then schema will be migrated to latest version
//echo '<pre>';
//try {
// Loading migration configuration.
$config = new PhpFile('./migrations.php');
$dependency = DependencyFactory::fromConnection($config, new ExistingConnection($connection));
// Check if version table exists, use new version.
// Check if old "version" table exists from 1.11.x, use new version.
$schema = $manager->getConnection()->getSchemaManager();
$dropOldVersionTable = false;
if ($schema->tablesExist('version')) {
@ -2143,9 +2142,12 @@ function migrate(EntityManager $manager)
$planCalculator = $dependency->getMigrationPlanCalculator();
$migrations = $planCalculator->getMigrations();
$lastVersion = $migrations->getLast();
//var_dump($lastVersion->getVersion());
$plan = $dependency->getMigrationPlanCalculator()->getPlanUntilVersion($lastVersion->getVersion());
foreach ($plan->getItems() as $item) {
error_log("Version to be executed: ".$item->getVersion());
$item->getMigration()->setEntityManager($manager);
$item->getMigration()->setContainer(Container::$container);
}

Loading…
Cancel
Save