Skip to content

Commit

Permalink
Allow upgrade migrations more time.
Browse files Browse the repository at this point in the history
The typical default of 30s is not sufficient for a 2.14.0 -> 2.14.1
migration.
  • Loading branch information
heathdutton committed Sep 6, 2018
1 parent 83056e4 commit 215762b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/bundles/CoreBundle/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,13 @@ public function updateDatabaseMigrationAction(Request $request)
$application = new Application($this->get('kernel'));
$application->setAutoExit(false);
$output = new BufferedOutput();

$minExecutionTime = 300;
$maxExecutionTime = (int) ini_get('max_execution_time');
if ($maxExecutionTime > 0 && $maxExecutionTime < $minExecutionTime) {
ini_set('max_execution_time', $minExecutionTime);
}

$result = $application->run($input, $output);
}

Expand Down
7 changes: 7 additions & 0 deletions app/bundles/CoreBundle/Controller/UpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ public function schemaAction()
$application = new Application($this->get('kernel'));
$application->setAutoExit(false);
$output = new BufferedOutput();

$minExecutionTime = 300;
$maxExecutionTime = (int) ini_get('max_execution_time');
if ($maxExecutionTime > 0 && $maxExecutionTime < $minExecutionTime) {
ini_set('max_execution_time', $minExecutionTime);
}

$result = $application->run($input, $output);

$outputBuffer = $output->fetch();
Expand Down
12 changes: 12 additions & 0 deletions upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ function apply_critical_migrations()

$success = true;

$minExecutionTime = 300;
$maxExecutionTime = (int) ini_get('max_execution_time');
if ($maxExecutionTime > 0 && $maxExecutionTime < $minExecutionTime) {
ini_set('max_execution_time', $minExecutionTime);
}

if ($criticalMigrations) {
foreach ($criticalMigrations as $version) {
if (!run_symfony_command('doctrine:migrations:migrate', ['--no-interaction', '--env=prod', '--no-debug', $version])) {
Expand All @@ -558,6 +564,12 @@ function apply_critical_migrations()
*/
function apply_migrations()
{
$minExecutionTime = 300;
$maxExecutionTime = (int) ini_get('max_execution_time');
if ($maxExecutionTime > 0 && $maxExecutionTime < $minExecutionTime) {
ini_set('max_execution_time', $minExecutionTime);
}

return run_symfony_command('doctrine:migrations:migrate', ['--no-interaction', '--env=prod', '--no-debug']);
}

Expand Down

0 comments on commit 215762b

Please sign in to comment.