Web installer. Inspired by Sylius.
To run the installer on existing setup, you need to update parameters.yml file:
# ...
session_handler: ~
installed: ~
If you are using distribution package, you will be redirected to installer page automatically.
Otherwise, following installation instructions offered:
$ git clone https://github.com/chamilo/chamilo-lms.git
$ cd chamilo-lms
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
$ php app/console chamilo:install
To add additional actions to the installation process you may use event listeners. Currently only "onFinish" installer event dispatched.
Example:
services:
installer.listener.finish.event:
class: Acme\Bundle\MyBundle\EventListener\MyListener
tags:
- { name: kernel.event_listener, event: installer.finish, method: onFinish }
<?php
namespace Acme\Bundle\MyBundle\EventListener;
class MyListener
{
public function onFinish()
{
// do something
}
}
To provide demo fixtures for your bundle just place them in "YourBundle\Data\Demo" directory.
To add additional install scripts during install process you can use install.php files in your bundles and packages. This install files will be run before last clear cache during installation.
This file must be started with @ChamiloScript
annotation with script label which will be shown during web install process.
Example:
<?php
/**
* @ChamiloScript("Your script label")
*/
// here you can add additional install logic
The following variables are available in installer script:
$container
- Symfony2 DI container$commandExecutor
- An instance of CommandExecutor class. You can use it to execute Symfony console commandsAll outputs from installer script will be logged in chamilo_install.log file or will be shown in console in you use console installer.
In some cases you may need to launch PHP scripts in context of Platform. It means that you need an access to Symfony DI container. Examples of such cases may be some installation or maintenance sctipts. To achieve this you can use chamilo:platform:run-script
command.
Each script file must be started with @ChamiloScript
annotation. For example:
<?php
/**
* @ChamiloScript("Your script label")
*/
// here you can write some PHP code
The following variables are available in a script:
$container
- Symfony2 DI container$commandExecutor
- An instance of CommandExecutor class. You can use it to execute Symfony console commands