diff --git a/services/FarmService.php b/services/FarmService.php index 67908ba..71e4811 100644 --- a/services/FarmService.php +++ b/services/FarmService.php @@ -573,6 +573,8 @@ function ($tableName) use ($link, $prefix) { $this->wiki->Query('UPDATE `' . $prefix . '__pages` SET body=CONCAT(body, "' . $this->wiki->config['yeswiki-farm-options'][$option]['content'] . '") WHERE tag="' . $this->wiki->config['yeswiki-farm-options'][$option]['page'] . '" AND latest="Y";'); } } + + $this->runMigrations($destfolder); } else { throw new \Exception('Le dossier ' . $this->wiki->config['yeswiki-farm-root-folder'] . ' n\'est pas accessible en écriture'); } @@ -598,6 +600,19 @@ function ($tableName) use ($link, $prefix) { } } + private function runMigrations($wikiFolder) + { + // we launch migrations if wiki has the feature + if (file_exists($wikiFolder . 'tools/autoupdate/services/MigrationService.php')) { + // ensure yeswicli is executable + chmod($wikiFolder . 'yeswicli', 0755); + $currentDir = getcwd(); + chdir($wikiFolder); + exec('./yeswicli migrate'); + chdir($currentDir); + } + } + private function resetSQLTransactionWhenError($link, $notExistingTables, $prefix) { mysqli_rollback($link); @@ -683,8 +698,7 @@ public function updateWiki($wiki) $config->write(); // execute post update - $output .= 'cd ' . $destfolder . ';chmod +x tools/autoupdate/commands/console;tools/autoupdate/commands/console update:postupdate 2>&1'; - $output .= shell_exec('cd ' . $destfolder . ';chmod +x tools/autoupdate/commands/console;tools/autoupdate/commands/console update:postupdate 2>&1'); + $this->runMigrations($destfolder); $output .= '
' . _t('FERME_WIKI') . $wiki . _t('FERME_UPDATED') . '
';