|
@@ -9,8 +9,9 @@
|
|
|
*/
|
|
|
|
|
|
require_once __DIR__.'/../../vendor/autoload.php';
|
|
|
-require_once 'install.lib.php';
|
|
|
-require_once '../inc/lib/api.lib.php';
|
|
|
+require_once __DIR__.'/../inc/lib/api.lib.php';
|
|
|
+require_once __DIR__.'/install.lib.php';
|
|
|
+$versionData = require_once __DIR__.'/version.php';
|
|
|
|
|
|
error_reporting(-1);
|
|
|
ini_set('display_errors', '1');
|
|
@@ -19,6 +20,8 @@ set_time_limit(0);
|
|
|
use Symfony\Component\Console\Output\Output;
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
use ChamiloLMS\Component\Console\Output\BufferedOutput;
|
|
|
+use Chash\Command\Installation\InstallCommand;
|
|
|
+use Chash\Command\Installation\UpgradeCommand;
|
|
|
|
|
|
$app = new Silex\Application();
|
|
|
|
|
@@ -99,8 +102,8 @@ $console->addCommands(
|
|
|
new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
|
|
|
|
|
|
// Chash commands.
|
|
|
- new Chash\Command\Installation\UpgradeCommand(),
|
|
|
- new Chash\Command\Installation\InstallCommand(),
|
|
|
+ new UpgradeCommand(),
|
|
|
+ new InstallCommand(),
|
|
|
|
|
|
new Chash\Command\Files\CleanCoursesFilesCommand(),
|
|
|
new Chash\Command\Files\CleanTempFolderCommand(),
|
|
@@ -250,14 +253,13 @@ $app->match('/check-database', function () use ($app) {
|
|
|
if ($form->isValid()) {
|
|
|
$parameters = $form->getData();
|
|
|
|
|
|
- /** @var \Chash\Command\Installation\InstallCommand $command */
|
|
|
+ /** @var InstallCommand $command */
|
|
|
$command = $app['console']->get('chamilo:install');
|
|
|
$command->setDatabaseSettings($parameters);
|
|
|
|
|
|
$connection = $command->getUserAccessConnectionToHost();
|
|
|
|
|
|
try {
|
|
|
- //$connect = $connection->connect();
|
|
|
$sm = $connection->getSchemaManager();
|
|
|
$databases = $sm->listDatabases();
|
|
|
|
|
@@ -281,7 +283,10 @@ $app->match('/check-database', function () use ($app) {
|
|
|
|
|
|
return $app->redirect($url);
|
|
|
} catch (Exception $e) {
|
|
|
- $app['session']->getFlashBag()->add('success', 'Connection error !'.$e->getMessage());
|
|
|
+ $app['session']->getFlashBag()->add(
|
|
|
+ 'success',
|
|
|
+ 'Connection error !'.$e->getMessage()
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -297,9 +302,9 @@ $app->match('/portal-settings', function () use ($app) {
|
|
|
/** @var Request $request */
|
|
|
$request = $app['request'];
|
|
|
|
|
|
- /** @var \Chash\Command\Installation\InstallCommand $command */
|
|
|
+ /** @var InstallCommand $command */
|
|
|
$command = $app['console']->get('chamilo:install');
|
|
|
- $builder = $app['form.factory']->createBuilder('form');
|
|
|
+ $builder = $app['form.factory']->createBuilder('form');
|
|
|
|
|
|
$data = $command->getPortalSettingsParams();
|
|
|
$data['institution_url']['attributes']['data'] = str_replace('main/install/', '', $request->getUriForPath('/'));
|
|
@@ -352,7 +357,7 @@ $app->match('/portal-settings', function () use ($app) {
|
|
|
$app->match('/admin-settings', function () use ($app) {
|
|
|
$request = $app['request'];
|
|
|
|
|
|
- /** @var Chash\Command\Installation\InstallCommand $command */
|
|
|
+ /** @var InstallCommand $command */
|
|
|
$command = $app['console']->get('chamilo:install');
|
|
|
|
|
|
$data = $command->getAdminSettingsParams();
|
|
@@ -418,7 +423,6 @@ $app->match('/resume', function () use ($app) {
|
|
|
)
|
|
|
);
|
|
|
} else {
|
|
|
-
|
|
|
$url = $app['url_generator']->generate('check-database');
|
|
|
|
|
|
return $app->redirect($url);
|
|
@@ -427,13 +431,13 @@ $app->match('/resume', function () use ($app) {
|
|
|
|
|
|
// Installation process.
|
|
|
|
|
|
-$app->match('/installing', function () use ($app) {
|
|
|
+$app->match('/installing', function () use ($app, $versionData) {
|
|
|
|
|
|
$portalSettings = $app['session']->get('portal_settings');
|
|
|
$adminSettings = $app['session']->get('admin_settings');
|
|
|
$databaseSettings = $app['session']->get('database_settings');
|
|
|
|
|
|
- /** @var Chash\Command\Installation\InstallCommand $command */
|
|
|
+ /** @var InstallCommand $command */
|
|
|
$command = $app['console']->get('chamilo:install');
|
|
|
|
|
|
$def = $command->getDefinition();
|
|
@@ -441,7 +445,7 @@ $app->match('/installing', function () use ($app) {
|
|
|
array(
|
|
|
'name',
|
|
|
'path' => realpath(__DIR__.'/../../').'/',
|
|
|
- 'version' => '1.10.0'
|
|
|
+ 'version' => $versionData['version']
|
|
|
),
|
|
|
$def
|
|
|
);
|
|
@@ -519,3 +523,5 @@ if (PHP_SAPI == 'cli') {
|
|
|
} else {
|
|
|
$app->run();
|
|
|
}
|
|
|
+
|
|
|
+
|