Adding installer bundle

1.10.x
Julio Montoya 10 years ago
parent f3bbe99fb9
commit 3a8602699d
  1. 18
      app/AppKernel.php
  2. 19
      app/bootstrap.php.cache
  3. 9
      app/config/routing.yml
  4. 21
      app/config/security.yml
  5. 39
      composer.json
  6. 1
      src/ChamiloLMS/CoreBundle/Entity/Comment.php
  7. 1
      src/ChamiloLMS/CoreBundle/Entity/Message.php
  8. 1
      src/ChamiloLMS/CoreBundle/Entity/MessageMetadata.php
  9. 1
      src/ChamiloLMS/CoreBundle/Entity/Thread.php
  10. 1
      src/ChamiloLMS/CoreBundle/Entity/ThreadMetadata.php
  11. 95
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadAdminUserData.php
  12. 86
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadGroupData.php
  13. 21
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadPageData.php
  14. 33
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadPortalData.php
  15. 20
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadSettingsData.php
  16. 51
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadUserData.php
  17. 20
      src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadUserFieldData.php
  18. 357
      src/ChamiloLMS/CoreBundle/Migrations/Schema/v10/Core.php
  19. 209
      src/ChamiloLMS/CoreBundle/Migrations/Schema/v10/Extra.php
  20. 231
      src/ChamiloLMS/CourseBundle/Migrations/Schema/v10/CourseBundle.php
  21. 35
      src/ChamiloLMS/InstallerBundle/ChamiloLMSInstallerBundle.php
  22. 249
      src/ChamiloLMS/InstallerBundle/CommandExecutor.php
  23. 18
      src/ChamiloLMS/InstallerBundle/DependencyInjection/ChamiloLMSInstallerExtension.php
  24. 30
      src/ChamiloLMS/InstallerBundle/DependencyInjection/Compiler/InstallerPass.php
  25. 42
      src/ChamiloLMS/InstallerBundle/DependencyInjection/Configuration.php
  26. 87
      src/ChamiloLMS/InstallerBundle/EventListener/RequestListener.php
  27. 78
      src/ChamiloLMS/InstallerBundle/Form/Type/Configuration/DatabaseType.php
  28. 104
      src/ChamiloLMS/InstallerBundle/Form/Type/Configuration/MailerType.php
  29. 44
      src/ChamiloLMS/InstallerBundle/Form/Type/Configuration/SystemType.php
  30. 52
      src/ChamiloLMS/InstallerBundle/Form/Type/ConfigurationType.php
  31. 106
      src/ChamiloLMS/InstallerBundle/Form/Type/SetupType.php
  32. 13
      src/ChamiloLMS/InstallerBundle/InstallerEvents.php
  33. 69
      src/ChamiloLMS/InstallerBundle/Persister/YamlPersister.php
  34. 35
      src/ChamiloLMS/InstallerBundle/Process/InstallerScenario.php
  35. 128
      src/ChamiloLMS/InstallerBundle/Process/Step/AbstractStep.php
  36. 60
      src/ChamiloLMS/InstallerBundle/Process/Step/ConfigureStep.php
  37. 15
      src/ChamiloLMS/InstallerBundle/Process/Step/FinalStep.php
  38. 89
      src/ChamiloLMS/InstallerBundle/Process/Step/InstallationStep.php
  39. 43
      src/ChamiloLMS/InstallerBundle/Process/Step/SchemaStep.php
  40. 80
      src/ChamiloLMS/InstallerBundle/Process/Step/SetupStep.php
  41. 34
      src/ChamiloLMS/InstallerBundle/Process/Step/WelcomeStep.php
  42. 99
      src/ChamiloLMS/InstallerBundle/README.md
  43. 175
      src/ChamiloLMS/InstallerBundle/Requirement/ExtensionsRequirements.php
  44. 60
      src/ChamiloLMS/InstallerBundle/Requirement/FilesystemRequirements.php
  45. 62
      src/ChamiloLMS/InstallerBundle/Requirement/Requirement.php
  46. 43
      src/ChamiloLMS/InstallerBundle/Requirement/RequirementCollection.php
  47. 113
      src/ChamiloLMS/InstallerBundle/Requirement/SettingsRequirements.php
  48. 39
      src/ChamiloLMS/InstallerBundle/Requirement/SyliusRequirements.php
  49. 40
      src/ChamiloLMS/InstallerBundle/Resources/config/form.yml
  50. 7
      src/ChamiloLMS/InstallerBundle/Resources/config/routing.yml
  51. 31
      src/ChamiloLMS/InstallerBundle/Resources/config/services.yml
  52. 60
      src/ChamiloLMS/InstallerBundle/Resources/translations/messages.de.yml
  53. 93
      src/ChamiloLMS/InstallerBundle/Resources/translations/messages.en.yml
  54. 57
      src/ChamiloLMS/InstallerBundle/Resources/translations/messages.es.yml
  55. 58
      src/ChamiloLMS/InstallerBundle/Resources/translations/messages.fr.yml
  56. 63
      src/ChamiloLMS/InstallerBundle/Resources/translations/requirements.de.yml
  57. 57
      src/ChamiloLMS/InstallerBundle/Resources/translations/requirements.en.yml
  58. 63
      src/ChamiloLMS/InstallerBundle/Resources/translations/requirements.es.yml
  59. 63
      src/ChamiloLMS/InstallerBundle/Resources/translations/requirements.fr.yml
  60. 24
      src/ChamiloLMS/InstallerBundle/Resources/views/Form/fields.html.twig
  61. 61
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/configure.html.twig
  62. 28
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/final.html.twig
  63. 88
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/installation.html.twig
  64. 62
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/schema.html.twig
  65. 25
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/setup.html.twig
  66. 20
      src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/welcome.html.twig
  67. 124
      src/ChamiloLMS/InstallerBundle/Resources/views/layout.html.twig
  68. 32
      src/ChamiloLMS/InstallerBundle/Resources/views/progress.html.twig
  69. 84
      src/ChamiloLMS/InstallerBundle/ScriptExecutor.php
  70. 214
      src/ChamiloLMS/InstallerBundle/ScriptManager.php
  71. 12
      src/ChamiloLMS/InstallerBundle/Validator/Constraints/DatabaseConnection.php
  72. 30
      src/ChamiloLMS/InstallerBundle/Validator/Constraints/DatabaseConnectionValidator.php

@ -11,6 +11,13 @@ class AppKernel extends Kernel
public function registerBundles()
{
$bundles = array(
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
// Symfony standard edition
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
@ -124,16 +131,25 @@ class AppKernel extends Kernel
new FOS\MessageBundle\FOSMessageBundle(),
// Chamilo
new ChamiloLMS\InstallerBundle\ChamiloLMSInstallerBundle(),
new ChamiloLMS\CoreBundle\ChamiloLMSCoreBundle(),
new ChamiloLMS\CourseBundle\ChamiloLMSCourseBundle(),
new ChamiloLMS\InstallerBundle\ChamiloLMSInstallerBundle(),
new ChamiloLMS\MessageBundle\ChamiloLMSMessageBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new ChamiloLMS\NotebookBundle\ChamiloLMSNotebookBundle(),
new APY\DataGridBundle\APYDataGridBundle(),
new JMS\TranslationBundle\JMSTranslationBundle(),
//new FOS\RestBundle\FOSRestBundle(),
//new JMS\SerializerBundle\JMSSerializerBundle($this),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Sp\BowerBundle\SpBowerBundle(),
new Oro\Bundle\MigrationBundle\OroMigrationBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
//$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle(),
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();

@ -1981,6 +1981,9 @@ if (self::SCOPE_PROTOTYPE === $scope) {
throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id));
}
$id = strtolower($id);
if ('service_container'=== $id) {
return;
}
if (self::SCOPE_CONTAINER !== $scope) {
if (!isset($this->scopedServices[$scope])) {
throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id));
@ -2001,6 +2004,9 @@ unset($this->services[$id]);
public function has($id)
{
$id = strtolower($id);
if ('service_container'=== $id) {
return true;
}
return isset($this->services[$id])
|| array_key_exists($id, $this->services)
|| isset($this->aliases[$id])
@ -2013,6 +2019,9 @@ foreach (array(false, true) as $strtolower) {
if ($strtolower) {
$id = strtolower($id);
}
if ('service_container'=== $id) {
return $this;
}
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
}
@ -2061,6 +2070,9 @@ return $service;
public function initialized($id)
{
$id = strtolower($id);
if ('service_container'=== $id) {
return true;
}
return isset($this->services[$id]) || array_key_exists($id, $this->services);
}
public function getServiceIds()
@ -2072,6 +2084,7 @@ if (preg_match('/^get(.+)Service$/', $method->name, $match)) {
$ids[] = self::underscore($match[1]);
}
}
$ids[] ='service_container';
return array_unique(array_merge($ids, array_keys($this->services)));
}
public function enterScope($name)
@ -2244,11 +2257,11 @@ protected $booted = false;
protected $name;
protected $startTime;
protected $loadClassCache;
const VERSION ='2.5.2';
const VERSION_ID ='20502';
const VERSION ='2.5.3';
const VERSION_ID ='20503';
const MAJOR_VERSION ='2';
const MINOR_VERSION ='5';
const RELEASE_VERSION ='2';
const RELEASE_VERSION ='3';
const EXTRA_VERSION ='';
public function __construct($environment, $debug)
{

@ -51,8 +51,15 @@ logout:
path: /logout
login_check:
path: /login_check
path: /administration/login_check
# Always at the end
core_bundle:
resource: "@ChamiloLMSCoreBundle/Resources/config/routing.yml"
chamilolms_installer:
resource: "@ChamiloLMSInstallerBundle/Resources/config/routing.yml"
sylius_settings:
resource: @SyliusSettingsBundle/Resources/config/routing.yml
prefix: /settings

@ -34,17 +34,22 @@ security:
pattern: ^/(_(profiler|wdt)|css|images|js|admin/_(wdt|profiler)|api/_(wdt|profiler))/
security: false
install:
pattern: ^/installer
security: false
anonymous: true
admin:
pattern: /admin(.*)
pattern: /administration(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /login
login_path: /administration/login
use_forward: false
check_path: /admin/login_check
check_path: /administration/login_check
failure_path: null
logout:
path: /admin/logout
path: /administration/logout
anonymous: true
main:
@ -72,14 +77,14 @@ security:
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
# Admin login page needs to be access without credential
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/administration/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/administration/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/administration/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs
- { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
- { path: ^/administration/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
- { path: ^/profile/, role: IS_AUTHENTICATED_FULLY }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }

@ -10,7 +10,8 @@
"autoload": {
"psr-0": {
"": "src/"
"": "src/",
"Oro\\Bundle": "src/"
},
"classmap": [
"main/auth",
@ -27,7 +28,6 @@
]
},
"minimum-stability": "stable",
"repositories": [
{
"type": "package",
@ -43,28 +43,38 @@
{
"type": "vcs",
"url": "https://github.com/jmontoyaa/AdminThemeBundle"
},
{
"type": "vcs",
"url": "https://github.com/jmontoyaa/MigrationBundle.git"
}
],
"require": {
"php": ">=5.3.3",
"ext-intl": "*",
"ext-gd": "*",
"ext-curl": "*",
"twig/twig": "~1.12",
"twig/extensions": "~1.0",
"symfony/symfony": "~2.5",
"symfony/symfony": "~2.3",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.3",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0.0",
"sensio/framework-extra-bundle": "~2.3",
"sensio/generator-bundle": "~2.3",
"jms/security-extra-bundle": "~1.5",
"jms/di-extra-bundle": "~1.4",
"jms/serializer-bundle": "~0.11",
"jms/serializer-bundle": "~0.12",
"doctrine/orm": "~2.4",
"doctrine/doctrine-bundle": "~1.2",
"doctrine/doctrine-bundle": "1.3.*@dev",
"doctrine/doctrine-migrations-bundle": "~2.0@dev",
"doctrine/migrations": "~1.0@dev",
"doctrine/doctrine-fixtures-bundle": "~2.2",
@ -97,7 +107,6 @@
"sonata-project/timeline-bundle": "~2.2@dev",
"sonata-project/classification-bundle": "~2.2@dev",
"sonata-project/ecommerce": "dev-develop",
"sonata-project/comment-bundle": "~2.2@dev",
"friendsofsymfony/comment-bundle": "~2.0@dev",
@ -128,13 +137,23 @@
"zendframework/zend-filter": "2.3.*@dev",
"jbroadway/urlify": "1.0.0-stable",
"composer/composer": "1.0.*@dev",
"composer/composer": "1.0.0-alpha8",
"liip/theme-bundle": "1.0.*@dev",
"chamilo/chash" : "dev-master",
"white-october/pagerfanta-bundle": "dev-master"
"white-october/pagerfanta-bundle": "dev-master",
"sylius/resource-bundle": "dev-master",
"sylius/resource": "dev-master",
"sylius/resource": "dev-master",
"apy/datagrid-bundle": "dev-master",
"jms/translation-bundle": "dev-master",
"sylius/flow-bundle": "0.11.*@dev",
"sylius/settings-bundle": "dev-master",
"sp/bower-bundle": "dev-master",
"jmontoyaa/migration-bundle":"dev-master"
},
"require-dev": {
"jjanvier/crowdin-bundle": "dev-master",
"akeneo/crowdin-api": "1.0.*@dev",
"elao/web-profiler-extra-bundle" : "~2.3@dev",
"lexik/maintenance-bundle": "dev-master"
},

@ -7,6 +7,7 @@ use FOS\CommentBundle\Entity\Comment as BaseComment;
/**
* @ORM\Entity
* @ORM\Table(name="comment")
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class Comment extends BaseComment

@ -8,6 +8,7 @@ use FOS\MessageBundle\Entity\Message as BaseMessage;
use Avanzu\AdminThemeBundle\Model\MessageInterface as ThemeMessage;
/**
* @ORM\Table(name="message")
* @ORM\Entity
*/
class Message extends BaseMessage implements ThemeMessage

@ -8,6 +8,7 @@ use FOS\MessageBundle\Model\MessageInterface;
use FOS\MessageBundle\Model\ParticipantInterface;
/**
* @ORM\Table(name="message_metadata")
* @ORM\Entity
*/
class MessageMetadata extends BaseMessageMetadata

@ -7,6 +7,7 @@ use FOS\MessageBundle\Entity\Thread as BaseThread;
/**
* @ORM\Entity
* @ORM\Table(name="thread")
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class Thread extends BaseThread

@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
use FOS\MessageBundle\Entity\ThreadMetadata as BaseThreadMetadata;
/**
* @ORM\Table(name="thread_metadata")
* @ORM\Entity
*/
class ThreadMetadata extends BaseThreadMetadata

@ -0,0 +1,95 @@
<?php
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
class LoadAdminUserData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
const DEFAULT_ADMIN_USERNAME = 'admin';
const DEFAULT_ADMIN_EMAIL = 'admin@example.com';
private $container;
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 2;
}
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* @param ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$manager = $this->getUserManager();
$faker = $this->getFaker();
// Creating admin user.
$admin = $manager->createUser();
$admin->setUsername('admin');
$admin->setUserId(1);
$admin->setFirstname('Jane');
$admin->setLastname('Doe');
$admin->setEmail($faker->safeEmail);
$admin->setPlainPassword('admin');
$admin->setEnabled(true);
$admin->setSuperAdmin(true);
$admin->setLocked(false);
$manager->updateUser($admin);
}
/**
* @return \FOS\UserBundle\Model\UserManagerInterface
*/
public function getUserManager()
{
return $this->container->get('fos_user.user_manager');
}
/**
* @return \FOS\UserBundle\Entity\GroupManager
*/
public function getGroupManager()
{
return $this->container->get('fos_user.group_manager');
}
/**
* @return \Faker\Generator
*/
public function getFaker()
{
return $this->container->get('faker.generator');
}
}

@ -0,0 +1,86 @@
<?php
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
class LoadGroupData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 1;
}
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* @param ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$groupManager = $this->getGroupManager();
// Creating groups
$studentGroup = $groupManager->createGroup('students');
$studentGroup->addRole('ROLE_STUDENT');
$groupManager->updateGroup($studentGroup);
$teacherGroup = $groupManager->createGroup('teachers');
$teacherGroup->addRole('ROLE_TEACHER');
$groupManager->updateGroup($teacherGroup);
}
/**
* @return \FOS\UserBundle\Model\UserManagerInterface
*/
public function getUserManager()
{
return $this->container->get('fos_user.user_manager');
}
/**
* @return \FOS\UserBundle\Entity\GroupManager
*/
public function getGroupManager()
{
return $this->container->get('fos_user.group_manager');
}
/**
* @return \Faker\Generator
*/
public function getFaker()
{
return $this->container->get('faker.generator');
}
}

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
@ -13,14 +13,29 @@ use Sonata\PageBundle\Model\PageInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Orm\ContentRepositoryTest;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
class LoadPageData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadPageData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 3;
return 6;
}
public function setContainer(ContainerInterface $container = null)

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use ChamiloLMS\CoreBundle\Entity\CourseCategory;
use ChamiloLMS\CoreBundle\Entity\CourseField;
@ -25,21 +25,33 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Finder\Finder;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
/**
* Class LoadPortalData
* @package ChamiloLMS\CoreBundle\DataFixtures\ORM
*/
class LoadPortalData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadPortalData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
/**
* @return int
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 2;
return 5;
}
/**
@ -131,8 +143,10 @@ class LoadPortalData extends AbstractFixture implements ContainerAwareInterface,
$manager->persist($lang);
}
$adminUser = $this->getUserManager()->findUserByUsername('admin');
// Ids used
$adminUserId = $this->getReference('admin-user')->getId();
$adminUserId = $adminUser->getId();
$accessUrlId = 1;
$accessUrl = new AccessUrl();
@ -275,4 +289,13 @@ class LoadPortalData extends AbstractFixture implements ContainerAwareInterface,
{
return $this->container->get('faker.generator');
}
/**
* @return \FOS\UserBundle\Model\UserManagerInterface
*/
public function getUserManager()
{
return $this->container->get('fos_user.user_manager');
}
}

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use ChamiloLMS\CoreBundle\Entity\SettingsCurrent;
use ChamiloLMS\CoreBundle\Entity\SettingsOptions;
@ -14,21 +14,33 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Finder\Finder;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
/**
* Class LoadSettingsData
* @package ChamiloLMS\CoreBundle\DataFixtures\ORM
*/
class LoadSettingsData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadSettingsData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
/**
* @return int
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 4;
return 7;
}
/**

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
@ -9,14 +9,29 @@ use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
class LoadUserData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadUserData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
function getOrder()
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 1;
return 3;
}
/**
@ -36,32 +51,8 @@ class LoadUserData extends AbstractFixture implements ContainerAwareInterface, O
$groupManager = $this->getGroupManager();
$faker = $this->getFaker();
// Creating groups
$studentGroup = $groupManager->createGroup('students');
$studentGroup->addRole('ROLE_STUDENT');
$groupManager->updateGroup($studentGroup);
$teacherGroup = $groupManager->createGroup('teachers');
$teacherGroup->addRole('ROLE_TEACHER');
$groupManager->updateGroup($teacherGroup);
// Creating admin user.
$admin = $manager->createUser();
$admin->setUsername('admin');
$admin->setUserId(1);
$admin->setFirstname('Jane');
$admin->setLastname('Doe');
$admin->setEmail($faker->safeEmail);
$admin->setPlainPassword('admin');
$admin->setEnabled(true);
$admin->setSuperAdmin(true);
$admin->setLocked(false);
$manager->updateUser($admin);
$this->addReference('admin-user', $admin);
$studentGroup = $groupManager->findGroupByName('students');
$teacherGroup = $groupManager->findGroupByName('teachers');
// Creating student user.

@ -1,6 +1,6 @@
<?php
namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
namespace ChamiloLMS\CoreBundle\Migrations\Data\ORM;
use ChamiloLMS\CoreBundle\Entity\UserField;
use ChamiloLMS\CoreBundle\Entity\UserFieldOptions;
@ -12,21 +12,33 @@ use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
/**
* Class LoadUserFieldData
* @package ChamiloLMS\CoreBundle\DataFixtures\ORM
*/
class LoadUserFieldData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadUserFieldData extends AbstractFixture implements
ContainerAwareInterface,
OrderedFixtureInterface,
VersionedFixtureInterface
{
private $container;
/**
* @return int
* {@inheritdoc}
*/
public function getVersion()
{
return '1.0';
}
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 5;
return 4;
}
/**

@ -0,0 +1,357 @@
<?php
namespace ChamiloLMS\CoreBundle\Migrations\Schema\v10;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\MigrationBundle\Migration\OrderedMigrationInterface;
class Core implements Migration, OrderedMigrationInterface
{
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 1;
}
public function up(Schema $schema, QueryBag $queries)
{
$queries->addQuery("CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, username_canonical VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', credentials_expired TINYINT(1) NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, date_of_birth DATETIME DEFAULT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, website VARCHAR(64) DEFAULT NULL, biography VARCHAR(1000) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(64) DEFAULT NULL, phone VARCHAR(64) DEFAULT NULL, facebook_uid VARCHAR(255) DEFAULT NULL, facebook_name VARCHAR(255) DEFAULT NULL, facebook_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', twitter_uid VARCHAR(255) DEFAULT NULL, twitter_name VARCHAR(255) DEFAULT NULL, twitter_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', gplus_uid VARCHAR(255) DEFAULT NULL, gplus_name VARCHAR(255) DEFAULT NULL, gplus_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', token VARCHAR(255) DEFAULT NULL, two_step_code VARCHAR(255) DEFAULT NULL, user_id INT DEFAULT NULL, auth_source VARCHAR(50) DEFAULT NULL, status INT DEFAULT NULL, official_code VARCHAR(40) DEFAULT NULL, picture_uri VARCHAR(250) DEFAULT NULL, creator_id INT DEFAULT NULL, competences LONGTEXT DEFAULT NULL, diplomas LONGTEXT DEFAULT NULL, openarea LONGTEXT DEFAULT NULL, teach LONGTEXT DEFAULT NULL, productions VARCHAR(250) DEFAULT NULL, chatcall_user_id INT DEFAULT NULL, chatcall_date DATETIME DEFAULT NULL, chatcall_text VARCHAR(50) DEFAULT NULL, language VARCHAR(40) DEFAULT NULL, registration_date DATETIME NOT NULL, expiration_date DATETIME DEFAULT NULL, active TINYINT(1) NOT NULL, openid VARCHAR(255) DEFAULT NULL, theme VARCHAR(255) DEFAULT NULL, hr_dept_id SMALLINT DEFAULT NULL, isActive VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, emailCanonical VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D64992FC23A8 (username_canonical), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_accessurl (user_id INT NOT NULL, access_url_id INT NOT NULL, INDEX IDX_DD3D6AB5A76ED395 (user_id), INDEX IDX_DD3D6AB573444FD5 (access_url_id), PRIMARY KEY(user_id, access_url_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE jury_members (id INT AUTO_INCREMENT NOT NULL, jury_id INT DEFAULT NULL, user_id INT DEFAULT NULL, role_id INT DEFAULT NULL, INDEX IDX_CCB37077E560103C (jury_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE branch_transaction_data (id BIGINT AUTO_INCREMENT NOT NULL, data LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_online (login_id INT AUTO_INCREMENT NOT NULL, login_user_id INT NOT NULL, login_date DATETIME NOT NULL, login_ip VARCHAR(39) NOT NULL, course VARCHAR(40) DEFAULT NULL, session_id INT NOT NULL, access_url_id INT NOT NULL, INDEX login_user_id (login_user_id), INDEX course (course), INDEX session_id (session_id), INDEX idx_trackonline_uat (login_user_id, access_url_id, login_date), PRIMARY KEY(login_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE search_engine_ref (id INT AUTO_INCREMENT NOT NULL, course_code VARCHAR(40) NOT NULL, tool_id VARCHAR(100) NOT NULL, ref_id_high_level INT NOT NULL, ref_id_second_level INT DEFAULT NULL, search_did INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE promotion (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, career_id INT NOT NULL, status INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_module (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, image VARCHAR(100) DEFAULT NULL, row_module INT NOT NULL, column_module INT NOT NULL, position VARCHAR(20) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, picture_uri VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, visibility INT NOT NULL, updated_on VARCHAR(255) NOT NULL, created_on VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_rel_user (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, c_id INT DEFAULT NULL, group_id INT DEFAULT NULL, relation_type INT NOT NULL, status INT NOT NULL, role VARCHAR(60) DEFAULT NULL, tutor_id INT DEFAULT NULL, sort INT DEFAULT NULL, user_course_cat INT DEFAULT NULL, legal_agreement INT DEFAULT NULL, INDEX IDX_92CFD9FEA76ED395 (user_id), INDEX IDX_92CFD9FE91D79BD3 (c_id), INDEX IDX_92CFD9FEFE54D947 (group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_rel_user_audit (id INT NOT NULL, rev INT NOT NULL, user_id INT DEFAULT NULL, c_id INT DEFAULT NULL, group_id INT DEFAULT NULL, relation_type INT DEFAULT NULL, status INT DEFAULT NULL, role VARCHAR(60) DEFAULT NULL, tutor_id INT DEFAULT NULL, sort INT DEFAULT NULL, user_course_cat INT DEFAULT NULL, legal_agreement INT DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_rel_course (id INT AUTO_INCREMENT NOT NULL, id_session INT DEFAULT NULL, c_id INT DEFAULT NULL, nbr_users INT NOT NULL, INDEX IDX_12D110D3ED97CA4 (id_session), INDEX IDX_12D110D391D79BD3 (c_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_rel_course_audit (id INT NOT NULL, rev INT NOT NULL, id_session INT DEFAULT NULL, c_id INT DEFAULT NULL, nbr_users INT DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_session (id INT AUTO_INCREMENT NOT NULL, access_url_id INT NOT NULL, session_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE curriculum_item (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, title VARCHAR(255) DEFAULT NULL, score INT NOT NULL, max_repeat INT NOT NULL, INDEX IDX_5A9A424112469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE question_field (id INT AUTO_INCREMENT NOT NULL, field_type INT NOT NULL, field_variable VARCHAR(64) NOT NULL, field_display_text VARCHAR(64) DEFAULT NULL, field_default_value LONGTEXT DEFAULT NULL, field_order INT DEFAULT NULL, field_visible TINYINT(1) DEFAULT NULL, field_changeable TINYINT(1) DEFAULT NULL, field_filter TINYINT(1) DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_result (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, evaluation_id INT NOT NULL, created_at DATETIME NOT NULL, score DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE personal_agenda (id INT AUTO_INCREMENT NOT NULL, user INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, text LONGTEXT DEFAULT NULL, date DATETIME DEFAULT NULL, enddate DATETIME DEFAULT NULL, course VARCHAR(255) DEFAULT NULL, parent_event_id INT DEFAULT NULL, all_day INT NOT NULL, INDEX idx_personal_agenda_user (user), INDEX idx_personal_agenda_parent (parent_event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_field (id INT AUTO_INCREMENT NOT NULL, field_type INT NOT NULL, field_variable VARCHAR(64) NOT NULL, field_display_text VARCHAR(64) DEFAULT NULL, field_default_value LONGTEXT DEFAULT NULL, field_order INT DEFAULT NULL, field_visible TINYINT(1) DEFAULT NULL, field_changeable TINYINT(1) DEFAULT NULL, field_filter TINYINT(1) DEFAULT NULL, field_loggeable INT DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_request (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(40) NOT NULL, user_id INT NOT NULL, directory VARCHAR(40) DEFAULT NULL, db_name VARCHAR(40) DEFAULT NULL, course_language VARCHAR(20) DEFAULT NULL, title VARCHAR(250) DEFAULT NULL, description LONGTEXT DEFAULT NULL, category_code VARCHAR(40) DEFAULT NULL, tutor_name VARCHAR(200) DEFAULT NULL, visual_code VARCHAR(40) DEFAULT NULL, request_date DATETIME NOT NULL, objetives LONGTEXT DEFAULT NULL, target_audience LONGTEXT DEFAULT NULL, status INT NOT NULL, info INT NOT NULL, exemplary_content INT NOT NULL, UNIQUE INDEX code (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE shared_survey_question_option (question_option_id INT AUTO_INCREMENT NOT NULL, question_id INT NOT NULL, survey_id INT NOT NULL, option_text LONGTEXT NOT NULL, sort INT NOT NULL, PRIMARY KEY(question_option_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE settings_current (id INT AUTO_INCREMENT NOT NULL, variable VARCHAR(255) DEFAULT NULL, subkey VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, category VARCHAR(255) DEFAULT NULL, selected_value VARCHAR(255) DEFAULT NULL, title VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, scope VARCHAR(50) DEFAULT NULL, subkeytext VARCHAR(255) DEFAULT NULL, access_url INT NOT NULL, access_url_changeable INT NOT NULL, access_url_locked INT NOT NULL, INDEX access_url (access_url), INDEX idx_settings_current_au_cat (access_url, category), UNIQUE INDEX unique_setting (variable, subkey, category, access_url), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_evaluation_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, external_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE grade_model (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, default_lowest_eval_exclude TINYINT(1) DEFAULT NULL, default_external_eval TINYINT(1) DEFAULT NULL, default_external_eval_prefix VARCHAR(140) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_course (id INT AUTO_INCREMENT NOT NULL, usergroup_id INT NOT NULL, course_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_field_options (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, option_value LONGTEXT DEFAULT NULL, option_display_text VARCHAR(64) DEFAULT NULL, option_order INT DEFAULT NULL, priority INT DEFAULT NULL, priority_message VARCHAR(255) DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill_profile (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE personal_agenda_repeat (cal_id INT AUTO_INCREMENT NOT NULL, cal_type VARCHAR(20) DEFAULT NULL, cal_end INT DEFAULT NULL, cal_frequency INT DEFAULT NULL, cal_days VARCHAR(7) DEFAULT NULL, PRIMARY KEY(cal_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_evaluation (id INT AUTO_INCREMENT NOT NULL, name LONGTEXT NOT NULL, description LONGTEXT DEFAULT NULL, user_id INT NOT NULL, course_code VARCHAR(40) DEFAULT NULL, category_id INT DEFAULT NULL, created_at DATETIME NOT NULL, weight DOUBLE PRECISION NOT NULL, max DOUBLE PRECISION NOT NULL, visible INT NOT NULL, type VARCHAR(40) NOT NULL, locked INT NOT NULL, evaluation_type_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(250) DEFAULT NULL, code VARCHAR(40) NOT NULL, directory VARCHAR(40) DEFAULT NULL, course_language VARCHAR(20) DEFAULT NULL, description LONGTEXT DEFAULT NULL, category_code VARCHAR(40) DEFAULT NULL, visibility TINYINT(1) DEFAULT NULL, show_score INT DEFAULT NULL, tutor_name VARCHAR(200) DEFAULT NULL, visual_code VARCHAR(40) DEFAULT NULL, department_name VARCHAR(30) DEFAULT NULL, department_url VARCHAR(180) DEFAULT NULL, disk_quota BIGINT DEFAULT NULL, last_visit DATETIME DEFAULT NULL, last_edit DATETIME DEFAULT NULL, creation_date DATETIME DEFAULT NULL, expiration_date DATETIME DEFAULT NULL, target_course_code VARCHAR(40) DEFAULT NULL, subscribe TINYINT(1) DEFAULT NULL, unsubscribe TINYINT(1) DEFAULT NULL, registration_code VARCHAR(255) DEFAULT NULL, legal LONGTEXT DEFAULT NULL, activate_legal INT DEFAULT NULL, add_teachers_to_sessions_courses TINYINT(1) DEFAULT NULL, course_type_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_169E6FB977153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_audit (id INT NOT NULL, rev INT NOT NULL, title VARCHAR(250) DEFAULT NULL, code VARCHAR(40) DEFAULT NULL, directory VARCHAR(40) DEFAULT NULL, course_language VARCHAR(20) DEFAULT NULL, description LONGTEXT DEFAULT NULL, category_code VARCHAR(40) DEFAULT NULL, visibility TINYINT(1) DEFAULT NULL, show_score INT DEFAULT NULL, tutor_name VARCHAR(200) DEFAULT NULL, visual_code VARCHAR(40) DEFAULT NULL, department_name VARCHAR(30) DEFAULT NULL, department_url VARCHAR(180) DEFAULT NULL, disk_quota BIGINT DEFAULT NULL, last_visit DATETIME DEFAULT NULL, last_edit DATETIME DEFAULT NULL, creation_date DATETIME DEFAULT NULL, expiration_date DATETIME DEFAULT NULL, target_course_code VARCHAR(40) DEFAULT NULL, subscribe TINYINT(1) DEFAULT NULL, unsubscribe TINYINT(1) DEFAULT NULL, registration_code VARCHAR(255) DEFAULT NULL, legal LONGTEXT DEFAULT NULL, activate_legal INT DEFAULT NULL, add_teachers_to_sessions_courses TINYINT(1) DEFAULT NULL, course_type_id INT DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_tree (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, tool_id INT NOT NULL, session_path_id INT NOT NULL, course_id INT DEFAULT NULL, session_id INT DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, lft INT DEFAULT NULL, lvl INT DEFAULT NULL, rgt INT DEFAULT NULL, root INT DEFAULT NULL, INDEX IDX_714F5EF6727ACA70 (parent_id), INDEX IDX_714F5EF68F7B22CC (tool_id), INDEX IDX_714F5EF6CBB4D431 (session_path_id), INDEX IDX_714F5EF6591CC992 (course_id), INDEX IDX_714F5EF6613FECDF (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE question_score_name (id INT AUTO_INCREMENT NOT NULL, question_score_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, score VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_13EF60F832993751 (score), UNIQUE INDEX UNIQ_13EF60F86DE44026 (description), INDEX IDX_13EF60F871E3BA5D (question_score_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_user (id INT AUTO_INCREMENT NOT NULL, access_url_id INT NOT NULL, user_id INT NOT NULL, INDEX idx_access_url_rel_user_user (user_id), INDEX idx_access_url_rel_user_access_url (access_url_id), INDEX idx_access_url_rel_user_access_url_user (user_id, access_url_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill_rel_profile (id INT AUTO_INCREMENT NOT NULL, skill_id INT NOT NULL, profile_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE notification (id BIGINT AUTO_INCREMENT NOT NULL, dest_user_id INT NOT NULL, dest_mail VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, sender_id INT NOT NULL, content VARCHAR(255) DEFAULT NULL, send_freq SMALLINT DEFAULT NULL, created_at DATETIME NOT NULL, sent_at DATETIME DEFAULT NULL, INDEX mail_notify_sent_index (sent_at), INDEX mail_notify_freq_index (sent_at, send_freq, created_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE block (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, path VARCHAR(255) NOT NULL, controller VARCHAR(100) NOT NULL, active TINYINT(1) NOT NULL, UNIQUE INDEX path (path), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_course_ranking (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, session_id INT NOT NULL, url_id INT NOT NULL, accesses INT NOT NULL, total_score INT NOT NULL, users INT NOT NULL, creation_date DATETIME NOT NULL, INDEX idx_tcc_cid (c_id), INDEX idx_tcc_sid (session_id), INDEX idx_tcc_urlid (url_id), INDEX idx_tcc_creation_date (creation_date), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE event_sent (id INT AUTO_INCREMENT NOT NULL, user_from INT NOT NULL, user_to INT DEFAULT NULL, event_type_name VARCHAR(100) DEFAULT NULL, INDEX event_name_index (event_type_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE branch_transaction_status (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_attempt_coeff (id INT AUTO_INCREMENT NOT NULL, attempt_id INT NOT NULL, marks_coeff DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_question (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_id INT NOT NULL, usergroup_id INT NOT NULL, coefficient DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE extra_field_option_rel_field_option (id INT AUTO_INCREMENT NOT NULL, field_id INT DEFAULT NULL, field_option_id INT DEFAULT NULL, related_field_option_id INT DEFAULT NULL, role_id INT DEFAULT NULL, UNIQUE INDEX idx (field_id, role_id, field_option_id, related_field_option_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE shared_survey_question (question_id INT AUTO_INCREMENT NOT NULL, survey_id INT NOT NULL, survey_question LONGTEXT NOT NULL, survey_question_comment LONGTEXT NOT NULL, type VARCHAR(250) NOT NULL, display VARCHAR(10) NOT NULL, sort INT NOT NULL, code VARCHAR(40) NOT NULL, max_value INT NOT NULL, PRIMARY KEY(question_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) DEFAULT NULL, date_start DATE DEFAULT NULL, date_end DATE DEFAULT NULL, access_url_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, code VARCHAR(40) NOT NULL, parent_id VARCHAR(40) DEFAULT NULL, tree_pos INT DEFAULT NULL, children_count SMALLINT DEFAULT NULL, auth_course_child VARCHAR(100) DEFAULT NULL, auth_cat_child VARCHAR(100) DEFAULT NULL, INDEX parent_id (parent_id), INDEX tree_pos (tree_pos), UNIQUE INDEX code (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_linkeval_log (id INT AUTO_INCREMENT NOT NULL, id_linkeval_log INT NOT NULL, name LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, weight SMALLINT DEFAULT NULL, visible TINYINT(1) DEFAULT NULL, type VARCHAR(20) NOT NULL, user_id_log INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE tag (id INT AUTO_INCREMENT NOT NULL, tag VARCHAR(255) NOT NULL, field_id INT NOT NULL, count INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_login (login_id INT AUTO_INCREMENT NOT NULL, login_user_id INT NOT NULL, login_date DATETIME NOT NULL, login_ip VARCHAR(39) NOT NULL, logout_date DATETIME DEFAULT NULL, INDEX login_user_id (login_user_id), PRIMARY KEY(login_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_field_options (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, option_value LONGTEXT DEFAULT NULL, option_display_text VARCHAR(255) DEFAULT NULL, option_order INT DEFAULT NULL, priority INT DEFAULT NULL, priority_message VARCHAR(255) DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_course (id INT AUTO_INCREMENT NOT NULL, c_id INT DEFAULT NULL, access_url_id INT DEFAULT NULL, INDEX IDX_8E97FC0891D79BD3 (c_id), INDEX IDX_8E97FC0873444FD5 (access_url_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_course_audit (id INT NOT NULL, rev INT NOT NULL, c_id INT DEFAULT NULL, access_url_id INT DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_usergroup (id INT AUTO_INCREMENT NOT NULL, group_id INT NOT NULL, subgroup_id INT NOT NULL, relation_type INT NOT NULL, INDEX usergroup_rel_usergroup_group_id (group_id), INDEX usergroup_rel_usergroup_subgroup_id (subgroup_id), INDEX usergroup_rel_usergroup_relation_type (relation_type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE personal_agenda_repeat_not (cal_id INT NOT NULL, cal_date INT NOT NULL, PRIMARY KEY(cal_id, cal_date)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_api_key (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, api_key VARCHAR(32) NOT NULL, api_service VARCHAR(10) NOT NULL, api_end_point LONGTEXT DEFAULT NULL, created_date DATETIME DEFAULT NULL, validity_start_date DATETIME DEFAULT NULL, validity_end_date DATETIME DEFAULT NULL, description LONGTEXT DEFAULT NULL, INDEX idx_user_api_keys_user (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE career (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, status INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE announcement_rel_group (id INT AUTO_INCREMENT NOT NULL, group_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_course_access (course_access_id BIGINT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, login_course_date DATETIME NOT NULL, logout_course_date DATETIME DEFAULT NULL, counter INT NOT NULL, session_id INT NOT NULL, c_id INT NOT NULL, INDEX user_id (user_id), INDEX login_course_date (login_course_date), INDEX c_id (c_id), INDEX session_id (session_id), PRIMARY KEY(course_access_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE question_score (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_rel_course_vote (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, user_id INT NOT NULL, session_id INT NOT NULL, url_id INT NOT NULL, vote INT NOT NULL, INDEX idx_ucv_cid (c_id), INDEX idx_ucv_uid (user_id), INDEX idx_ucv_cuid (user_id, c_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE specific_field (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(1) NOT NULL, name VARCHAR(200) NOT NULL, UNIQUE INDEX unique_specific_field__code (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_uploads (upload_id INT AUTO_INCREMENT NOT NULL, upload_user_id INT DEFAULT NULL, upload_date DATETIME NOT NULL, upload_cours_id VARCHAR(40) NOT NULL, upload_work_id INT NOT NULL, upload_session_id INT NOT NULL, INDEX upload_user_id (upload_user_id), INDEX upload_cours_id (upload_cours_id), INDEX upload_session_id (upload_session_id), PRIMARY KEY(upload_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE branch_transaction (id BIGINT NOT NULL, transaction_id BIGINT NOT NULL, branch_id INT NOT NULL, action VARCHAR(20) DEFAULT NULL, item_id VARCHAR(36) DEFAULT NULL, dest_id VARCHAR(36) DEFAULT NULL, status_id TINYINT(1) NOT NULL, time_insert DATETIME NOT NULL, time_update DATETIME NOT NULL, PRIMARY KEY(id, transaction_id, branch_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_rel_course_rel_user (id INT AUTO_INCREMENT NOT NULL, id_session INT NOT NULL, c_id INT NOT NULL, id_user INT NOT NULL, visibility INT NOT NULL, status INT NOT NULL, legal_agreement INT DEFAULT NULL, INDEX idx_session_rel_course_rel_user_id_user (id_user), INDEX idx_session_rel_course_rel_user_course_id (c_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE system_template (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(250) NOT NULL, comment LONGTEXT NOT NULL, image VARCHAR(250) NOT NULL, content LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE jury (id INT AUTO_INCREMENT NOT NULL, branch_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, opening_date DATETIME DEFAULT NULL, closure_date DATETIME DEFAULT NULL, opening_user_id INT DEFAULT NULL, closure_user_id INT DEFAULT NULL, exercise_id INT NOT NULL, INDEX IDX_1335B02CDCD6CC49 (branch_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_rel_user (id BIGINT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, friend_user_id INT NOT NULL, relation_type INT NOT NULL, last_edit DATETIME DEFAULT NULL, INDEX idx_user_rel_user__user (user_id), INDEX idx_user_rel_user__friend_user (friend_user_id), INDEX idx_user_rel_user__user_friend_user (user_id, friend_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE event_email_template (id INT AUTO_INCREMENT NOT NULL, message LONGTEXT DEFAULT NULL, subject VARCHAR(255) DEFAULT NULL, event_type_name VARCHAR(255) DEFAULT NULL, activated TINYINT(1) NOT NULL, language_id INT DEFAULT NULL, INDEX event_name_index (event_type_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE language (id INT AUTO_INCREMENT NOT NULL, original_name VARCHAR(255) DEFAULT NULL, english_name VARCHAR(255) DEFAULT NULL, isocode VARCHAR(10) DEFAULT NULL, available TINYINT(1) NOT NULL, parent_id TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_field (id INT AUTO_INCREMENT NOT NULL, field_type INT NOT NULL, field_variable VARCHAR(64) NOT NULL, field_display_text VARCHAR(64) DEFAULT NULL, field_default_value LONGTEXT DEFAULT NULL, field_order INT DEFAULT NULL, field_visible TINYINT(1) DEFAULT NULL, field_changeable TINYINT(1) DEFAULT NULL, field_filter TINYINT(1) DEFAULT NULL, field_loggeable INT DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_stored_values_stack (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, sco_id INT NOT NULL, stack_order INT NOT NULL, course_id VARCHAR(40) NOT NULL, sv_key VARCHAR(64) NOT NULL, sv_value LONGTEXT NOT NULL, UNIQUE INDEX user_id_2 (user_id, sco_id, course_id, sv_key, stack_order), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_attempt_jury (id INT AUTO_INCREMENT NOT NULL, exe_id INT DEFAULT NULL, question_id INT DEFAULT NULL, score DOUBLE PRECISION DEFAULT NULL, jury_member_id INT DEFAULT NULL, question_score_name_id INT DEFAULT NULL, INDEX IDX_977B4A18B5A18F57 (exe_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_field_values (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, tms DATETIME NOT NULL, user_id VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, session_id INT NOT NULL, field_value LONGTEXT DEFAULT NULL, INDEX idx_session_field_values_session_id (session_id), INDEX idx_session_field_values_field_id (field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_lastaccess (access_id BIGINT AUTO_INCREMENT NOT NULL, access_user_id INT DEFAULT NULL, access_date DATETIME NOT NULL, c_id INT NOT NULL, access_tool VARCHAR(30) DEFAULT NULL, access_session_id INT DEFAULT NULL, INDEX access_c_id_user_id (c_id, access_user_id), INDEX access_user_id (access_user_id), INDEX access_cours_code (c_id), INDEX access_session_id (access_session_id), PRIMARY KEY(access_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session (id INT AUTO_INCREMENT NOT NULL, id_coach INT DEFAULT NULL, name VARCHAR(150) NOT NULL, nbr_courses SMALLINT DEFAULT NULL, nbr_users INT DEFAULT NULL, nbr_classes INT DEFAULT NULL, session_admin_id INT DEFAULT NULL, visibility INT NOT NULL, session_category_id INT DEFAULT NULL, promotion_id INT DEFAULT NULL, display_start_date DATETIME NOT NULL, display_end_date DATETIME NOT NULL, access_start_date DATETIME NOT NULL, access_end_date DATETIME NOT NULL, coach_access_start_date DATETIME NOT NULL, coach_access_end_date DATETIME NOT NULL, INDEX IDX_D044D5D4D1DC2CFC (id_coach), INDEX idx_id_session_admin_id (session_admin_id), UNIQUE INDEX name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_audit (id INT NOT NULL, rev INT NOT NULL, id_coach INT DEFAULT NULL, name VARCHAR(150) DEFAULT NULL, nbr_courses SMALLINT DEFAULT NULL, nbr_users INT DEFAULT NULL, nbr_classes INT DEFAULT NULL, session_admin_id INT DEFAULT NULL, visibility INT DEFAULT NULL, session_category_id INT DEFAULT NULL, promotion_id INT DEFAULT NULL, display_start_date DATETIME DEFAULT NULL, display_end_date DATETIME DEFAULT NULL, access_start_date DATETIME DEFAULT NULL, access_end_date DATETIME DEFAULT NULL, coach_access_start_date DATETIME DEFAULT NULL, coach_access_end_date DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_certificate (id BIGINT AUTO_INCREMENT NOT NULL, cat_id INT NOT NULL, user_id INT NOT NULL, score_certificate DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, path_certificate LONGTEXT DEFAULT NULL, INDEX idx_gradebook_certificate_category_id (cat_id), INDEX idx_gradebook_certificate_user_id (user_id), INDEX idx_gradebook_certificate_category_id_user_id (cat_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE sys_announcement (id INT AUTO_INCREMENT NOT NULL, date_start DATETIME NOT NULL, date_end DATETIME NOT NULL, visible_teacher TINYINT(1) NOT NULL, visible_student TINYINT(1) NOT NULL, visible_guest TINYINT(1) NOT NULL, title VARCHAR(250) NOT NULL, content LONGTEXT NOT NULL, lang VARCHAR(70) DEFAULT NULL, access_url_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_downloads (down_id INT AUTO_INCREMENT NOT NULL, down_user_id INT DEFAULT NULL, down_date DATETIME NOT NULL, c_id INT NOT NULL, down_doc_path VARCHAR(255) NOT NULL, down_session_id INT NOT NULL, INDEX down_session_id (down_session_id), PRIMARY KEY(down_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE branch_sync_log (id BIGINT AUTO_INCREMENT NOT NULL, transaction_id BIGINT NOT NULL, import_time DATETIME DEFAULT NULL, message LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_default (default_id INT AUTO_INCREMENT NOT NULL, default_user_id INT NOT NULL, default_cours_code VARCHAR(40) NOT NULL, default_date DATETIME NOT NULL, default_event_type VARCHAR(255) NOT NULL, default_value_type VARCHAR(255) NOT NULL, default_value LONGTEXT NOT NULL, c_id INT DEFAULT NULL, session_id INT DEFAULT NULL, PRIMARY KEY(default_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE curriculum_rel_user (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, user_id INT NOT NULL, score INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE settings_options (id INT AUTO_INCREMENT NOT NULL, variable VARCHAR(255) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, display_text VARCHAR(255) NOT NULL, UNIQUE INDEX id (id), UNIQUE INDEX unique_setting_option (variable, value), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_rel_event_type (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, event_type_name VARCHAR(255) NOT NULL, INDEX event_name_index (event_type_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE specific_field_values (id INT AUTO_INCREMENT NOT NULL, course_code VARCHAR(40) NOT NULL, tool_id VARCHAR(100) NOT NULL, ref_id INT NOT NULL, field_id INT NOT NULL, value VARCHAR(200) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill_rel_gradebook (id INT AUTO_INCREMENT NOT NULL, gradebook_id INT NOT NULL, skill_id INT NOT NULL, type VARCHAR(10) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill_rel_skill (id INT AUTO_INCREMENT NOT NULL, skill_id INT NOT NULL, parent_id INT NOT NULL, relation_type INT NOT NULL, level INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, translation_var VARCHAR(40) DEFAULT NULL, description LONGTEXT DEFAULT NULL, props LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_rel_user (id_session INT NOT NULL, id_user INT NOT NULL, relation_type INT NOT NULL, moved_to INT DEFAULT NULL, moved_status INT DEFAULT NULL, moved_at DATETIME NOT NULL, INDEX idx_session_rel_user_id_user_moved (id_user, moved_to), PRIMARY KEY(id_session, id_user, relation_type)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, short_code VARCHAR(100) NOT NULL, description LONGTEXT NOT NULL, access_url_id INT NOT NULL, icon VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_field_values (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, tms DATETIME NOT NULL, user_id VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, author_id VARCHAR(255) NOT NULL, field_value LONGTEXT DEFAULT NULL, INDEX user_id (user_id, field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_friend_relation_type (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_field_options (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, option_value LONGTEXT DEFAULT NULL, option_display_text VARCHAR(255) DEFAULT NULL, option_order INT DEFAULT NULL, priority INT DEFAULT NULL, priority_message VARCHAR(255) DEFAULT NULL, tms DATETIME NOT NULL, INDEX idx_session_field_options_field_id (field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE session_path (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_links (links_id INT AUTO_INCREMENT NOT NULL, links_user_id INT DEFAULT NULL, links_date DATETIME NOT NULL, c_id INT NOT NULL, links_link_id INT NOT NULL, links_session_id INT NOT NULL, INDEX links_user_id (links_user_id), INDEX links_session_id (links_session_id), PRIMARY KEY(links_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_course_category (id INT AUTO_INCREMENT NOT NULL, access_url_id INT NOT NULL, course_category_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_course_category (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, title LONGTEXT NOT NULL, sort INT DEFAULT NULL, INDEX idx_user_c_cat_uid (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE ext_log_entries (id INT AUTO_INCREMENT NOT NULL, action VARCHAR(255) DEFAULT NULL, logged_at DATETIME DEFAULT NULL, object_id VARCHAR(64) DEFAULT NULL, object_class VARCHAR(255) DEFAULT NULL, version INT DEFAULT NULL, data VARCHAR(255) DEFAULT NULL, username VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_exercices (exe_id INT AUTO_INCREMENT NOT NULL, exe_user_id INT DEFAULT NULL, exe_date DATETIME NOT NULL, exe_exo_id INT NOT NULL, exe_result DOUBLE PRECISION NOT NULL, exe_weighting DOUBLE PRECISION NOT NULL, c_id INT NOT NULL, status VARCHAR(20) NOT NULL, data_tracking LONGTEXT NOT NULL, start_date DATETIME NOT NULL, steps_counter SMALLINT NOT NULL, session_id INT NOT NULL, orig_lp_id INT NOT NULL, orig_lp_item_id INT NOT NULL, exe_duration INT NOT NULL, expired_time_control DATETIME NOT NULL, orig_lp_item_view_id INT NOT NULL, questions_to_check LONGTEXT NOT NULL, jury_score DOUBLE PRECISION NOT NULL, jury_id INT NOT NULL, INDEX IDX_B62B03F2B9773F9E (exe_exo_id), INDEX IDX_B62B03F2F6A6790 (exe_user_id), PRIMARY KEY(exe_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_stored_values (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, sco_id INT NOT NULL, course_id VARCHAR(40) NOT NULL, sv_key VARCHAR(64) NOT NULL, sv_value LONGTEXT NOT NULL, UNIQUE INDEX user_id_2 (user_id, sco_id, course_id, sv_key), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE tool (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_hotspot (hotspot_id INT AUTO_INCREMENT NOT NULL, hotspot_user_id INT NOT NULL, hotspot_exe_id INT NOT NULL, hotspot_question_id INT NOT NULL, hotspot_answer_id INT NOT NULL, hotspot_correct TINYINT(1) NOT NULL, hotspot_coordinate LONGTEXT NOT NULL, c_id INT NOT NULL, INDEX hotspot_user_id (hotspot_user_id), INDEX hotspot_exe_id (hotspot_exe_id), INDEX hotspot_question_id (hotspot_question_id), PRIMARY KEY(hotspot_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE question_field_values (id INT AUTO_INCREMENT NOT NULL, question_id INT NOT NULL, field_id INT NOT NULL, tms DATETIME NOT NULL, user_id VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, field_value LONGTEXT DEFAULT NULL, INDEX IDX_83093BA61E27F6BF (question_id), INDEX idx_question_field_values_field_id (field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE templates (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(100) NOT NULL, description VARCHAR(250) NOT NULL, course_code VARCHAR(40) NOT NULL, user_id INT NOT NULL, ref_doc INT NOT NULL, image VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE admin (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX user_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_session (id INT AUTO_INCREMENT NOT NULL, usergroup_id INT NOT NULL, session_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_result_log (id INT AUTO_INCREMENT NOT NULL, id_result INT NOT NULL, user_id INT NOT NULL, evaluation_id INT NOT NULL, created_at DATETIME NOT NULL, score DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_rel_usergroup (id INT AUTO_INCREMENT NOT NULL, access_url_id INT NOT NULL, usergroup_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE skill_rel_user (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, skill_id INT NOT NULL, acquired_skill_at DATETIME NOT NULL, assigned_by INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE shared_survey (survey_id INT AUTO_INCREMENT NOT NULL, code VARCHAR(20) DEFAULT NULL, title LONGTEXT DEFAULT NULL, subtitle LONGTEXT DEFAULT NULL, author VARCHAR(250) DEFAULT NULL, lang VARCHAR(20) DEFAULT NULL, template VARCHAR(20) DEFAULT NULL, intro LONGTEXT DEFAULT NULL, surveythanks LONGTEXT DEFAULT NULL, creation_date DATETIME NOT NULL, course_code VARCHAR(40) NOT NULL, UNIQUE INDEX id (survey_id), PRIMARY KEY(survey_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_link (id INT AUTO_INCREMENT NOT NULL, type INT NOT NULL, ref_id INT NOT NULL, user_id INT NOT NULL, course_code VARCHAR(40) NOT NULL, category_id INT NOT NULL, created_at DATETIME NOT NULL, weight DOUBLE PRECISION NOT NULL, visible INT NOT NULL, locked INT NOT NULL, evaluation_type_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_field_values (id INT AUTO_INCREMENT NOT NULL, field_id INT NOT NULL, tms DATETIME NOT NULL, user_id VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, course_code VARCHAR(255) NOT NULL, field_value LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_access (access_id INT AUTO_INCREMENT NOT NULL, access_user_id INT DEFAULT NULL, access_date DATETIME NOT NULL, c_id INT NOT NULL, access_tool VARCHAR(30) DEFAULT NULL, access_session_id INT NOT NULL, INDEX access_user_id (access_user_id), INDEX access_cid_user (c_id, access_user_id), INDEX access_session_id (access_session_id), PRIMARY KEY(access_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE sys_calendar (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, access_url_id INT NOT NULL, all_day INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_rel_tag (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE legal (legal_id INT NOT NULL, language_id INT NOT NULL, date INT NOT NULL, content LONGTEXT DEFAULT NULL, type INT NOT NULL, changes LONGTEXT NOT NULL, version INT DEFAULT NULL, PRIMARY KEY(legal_id, language_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_session_path (id INT AUTO_INCREMENT NOT NULL, session_path_id INT DEFAULT NULL, user_id INT DEFAULT NULL, status VARCHAR(100) DEFAULT NULL, percentage INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url (id INT AUTO_INCREMENT NOT NULL, url VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, active INT NOT NULL, created_by INT NOT NULL, tms DATETIME NOT NULL, url_type TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE access_url_audit (id INT NOT NULL, rev INT NOT NULL, url VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, active INT DEFAULT NULL, created_by INT DEFAULT NULL, tms DATETIME DEFAULT NULL, url_type TINYINT(1) DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_user (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usergroup_id INT DEFAULT NULL, INDEX IDX_739515A9A76ED395 (user_id), INDEX IDX_739515A9D2112630 (usergroup_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE grade_components (id INT AUTO_INCREMENT NOT NULL, percentage VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, acronym VARCHAR(255) NOT NULL, prefix VARCHAR(255) DEFAULT NULL, count_elements INT DEFAULT NULL, exclusions INT DEFAULT NULL, grade_model_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE usergroup_rel_tag (id INT AUTO_INCREMENT NOT NULL, tag_id INT NOT NULL, usergroup_id INT NOT NULL, INDEX usergroup_rel_tag_usergroup_id (usergroup_id), INDEX usergroup_rel_tag_tag_id (tag_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_score_display (id INT AUTO_INCREMENT NOT NULL, score DOUBLE PRECISION NOT NULL, display VARCHAR(40) NOT NULL, category_id INT NOT NULL, score_color_percent DOUBLE PRECISION NOT NULL, INDEX category_id (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_item_property (id INT AUTO_INCREMENT NOT NULL, course_id INT NOT NULL, item_property_id INT NOT NULL, title VARCHAR(255) DEFAULT NULL, content LONGTEXT DEFAULT NULL, progress INT NOT NULL, lastedit_date DATETIME NOT NULL, lastedit_user_id INT NOT NULL, session_id INT NOT NULL, INDEX course_id (course_id, item_property_id, session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_attempt (id INT AUTO_INCREMENT NOT NULL, exe_id INT DEFAULT NULL, user_id INT NOT NULL, question_id INT NOT NULL, answer LONGTEXT NOT NULL, teacher_comment LONGTEXT NOT NULL, marks DOUBLE PRECISION NOT NULL, position INT DEFAULT NULL, tms DATETIME NOT NULL, session_id INT NOT NULL, c_id INT NOT NULL, filename VARCHAR(255) DEFAULT NULL, INDEX exe_id (exe_id), INDEX user_id (user_id), INDEX question_id (question_id), INDEX session_id (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_attempt_recording (id INT AUTO_INCREMENT NOT NULL, exe_id INT NOT NULL, question_id INT NOT NULL, marks INT NOT NULL, insert_date DATETIME NOT NULL, author INT NOT NULL, teacher_comment LONGTEXT NOT NULL, session_id INT NOT NULL, INDEX exe_id (exe_id), INDEX question_id (question_id), INDEX session_id (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE curriculum_category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, c_id INT DEFAULT NULL, session_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, max_score INT NOT NULL, min_chars TINYINT(1) NOT NULL, lvl INT NOT NULL, lft INT NOT NULL, rgt INT NOT NULL, root INT DEFAULT NULL, INDEX IDX_FC94C785727ACA70 (parent_id), INDEX IDX_FC94C78591D79BD3 (c_id), INDEX IDX_FC94C785613FECDF (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE chat (id INT AUTO_INCREMENT NOT NULL, from_user INT DEFAULT NULL, to_user INT DEFAULT NULL, message LONGTEXT NOT NULL, sent DATETIME NOT NULL, recd INT NOT NULL, INDEX idx_chat_to_user (to_user), INDEX idx_chat_from_user (from_user), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE course_field (id INT AUTO_INCREMENT NOT NULL, field_type INT NOT NULL, field_variable VARCHAR(64) NOT NULL, field_display_text VARCHAR(64) DEFAULT NULL, field_default_value LONGTEXT DEFAULT NULL, field_order INT DEFAULT NULL, field_visible TINYINT(1) DEFAULT NULL, field_changeable TINYINT(1) DEFAULT NULL, field_filter TINYINT(1) DEFAULT NULL, field_loggeable INT DEFAULT NULL, tms DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE gradebook_category (id INT AUTO_INCREMENT NOT NULL, name LONGTEXT NOT NULL, description LONGTEXT DEFAULT NULL, user_id INT NOT NULL, course_code VARCHAR(40) DEFAULT NULL, parent_id INT DEFAULT NULL, weight DOUBLE PRECISION NOT NULL, visible TINYINT(1) NOT NULL, certif_min_score INT DEFAULT NULL, session_id INT DEFAULT NULL, document_id INT DEFAULT NULL, locked INT NOT NULL, default_lowest_eval_exclude TINYINT(1) DEFAULT NULL, grade_model_id INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE curriculum_item_rel_user (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, item_id INT NOT NULL, order_id TINYINT(1) NOT NULL, description VARCHAR(255) NOT NULL, INDEX IDX_514721FFA76ED395 (user_id), INDEX IDX_514721FF126F525E (item_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE track_e_hotpotatoes (id INT AUTO_INCREMENT NOT NULL, exe_name VARCHAR(255) NOT NULL, exe_user_id INT DEFAULT NULL, exe_date DATETIME NOT NULL, c_id INT NOT NULL, exe_result SMALLINT NOT NULL, exe_weighting SMALLINT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE branch_sync (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, access_url_id INT NOT NULL, branch_name VARCHAR(250) DEFAULT NULL, branch_ip VARCHAR(40) DEFAULT NULL, latitude NUMERIC(10, 0) DEFAULT NULL, longitude NUMERIC(10, 0) DEFAULT NULL, dwn_speed INT DEFAULT NULL, up_speed INT DEFAULT NULL, delay INT DEFAULT NULL, admin_mail VARCHAR(250) DEFAULT NULL, admin_name VARCHAR(250) DEFAULT NULL, admin_phone VARCHAR(250) DEFAULT NULL, last_sync_trans_id BIGINT DEFAULT NULL, last_sync_trans_date DATETIME DEFAULT NULL, last_sync_type VARCHAR(20) DEFAULT NULL, ssl_pub_key VARCHAR(250) DEFAULT NULL, branch_type VARCHAR(250) DEFAULT NULL, lft INT DEFAULT NULL, rgt INT DEFAULT NULL, lvl INT DEFAULT NULL, root INT DEFAULT NULL, INDEX IDX_F62F45ED727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("ALTER TABLE user_accessurl ADD CONSTRAINT FK_DD3D6AB5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE user_accessurl ADD CONSTRAINT FK_DD3D6AB573444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)");
$queries->addQuery("ALTER TABLE jury_members ADD CONSTRAINT FK_CCB37077E560103C FOREIGN KEY (jury_id) REFERENCES jury (id)");
$queries->addQuery("ALTER TABLE course_rel_user ADD CONSTRAINT FK_92CFD9FEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE course_rel_user ADD CONSTRAINT FK_92CFD9FE91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE session_rel_course ADD CONSTRAINT FK_12D110D3ED97CA4 FOREIGN KEY (id_session) REFERENCES session (id)");
$queries->addQuery("ALTER TABLE session_rel_course ADD CONSTRAINT FK_12D110D391D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE curriculum_item ADD CONSTRAINT FK_5A9A424112469DE2 FOREIGN KEY (category_id) REFERENCES curriculum_category (id)");
$queries->addQuery("ALTER TABLE session_tree ADD CONSTRAINT FK_714F5EF6727ACA70 FOREIGN KEY (parent_id) REFERENCES session_tree (id) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE session_tree ADD CONSTRAINT FK_714F5EF68F7B22CC FOREIGN KEY (tool_id) REFERENCES tool (id)");
$queries->addQuery("ALTER TABLE session_tree ADD CONSTRAINT FK_714F5EF6CBB4D431 FOREIGN KEY (session_path_id) REFERENCES session_path (id)");
$queries->addQuery("ALTER TABLE session_tree ADD CONSTRAINT FK_714F5EF6591CC992 FOREIGN KEY (course_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE session_tree ADD CONSTRAINT FK_714F5EF6613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
$queries->addQuery("ALTER TABLE question_score_name ADD CONSTRAINT FK_13EF60F871E3BA5D FOREIGN KEY (question_score_id) REFERENCES question_score (id)");
$queries->addQuery("ALTER TABLE access_url_rel_course ADD CONSTRAINT FK_8E97FC0891D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE access_url_rel_course ADD CONSTRAINT FK_8E97FC0873444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)");
$queries->addQuery("ALTER TABLE jury ADD CONSTRAINT FK_1335B02CDCD6CC49 FOREIGN KEY (branch_id) REFERENCES branch_sync (id)");
$queries->addQuery("ALTER TABLE track_attempt_jury ADD CONSTRAINT FK_977B4A18B5A18F57 FOREIGN KEY (exe_id) REFERENCES track_e_exercices (exe_id)");
$queries->addQuery("ALTER TABLE session ADD CONSTRAINT FK_D044D5D4D1DC2CFC FOREIGN KEY (id_coach) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE track_e_exercices ADD CONSTRAINT FK_B62B03F2F6A6790 FOREIGN KEY (exe_user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE usergroup_rel_user ADD CONSTRAINT FK_739515A9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE usergroup_rel_user ADD CONSTRAINT FK_739515A9D2112630 FOREIGN KEY (usergroup_id) REFERENCES usergroup (id)");
$queries->addQuery("ALTER TABLE curriculum_category ADD CONSTRAINT FK_FC94C785727ACA70 FOREIGN KEY (parent_id) REFERENCES curriculum_category (id) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE curriculum_category ADD CONSTRAINT FK_FC94C78591D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE curriculum_category ADD CONSTRAINT FK_FC94C785613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
$queries->addQuery("ALTER TABLE curriculum_item_rel_user ADD CONSTRAINT FK_514721FFA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE curriculum_item_rel_user ADD CONSTRAINT FK_514721FF126F525E FOREIGN KEY (item_id) REFERENCES curriculum_item (id)");
$queries->addQuery("ALTER TABLE branch_sync ADD CONSTRAINT FK_F62F45ED727ACA70 FOREIGN KEY (parent_id) REFERENCES branch_sync (id) ON DELETE SET NULL");
}
public function down(Schema $schema)
{
$queries->addQuery("ALTER TABLE user_accessurl DROP FOREIGN KEY FK_DD3D6AB5A76ED395");
$queries->addQuery("ALTER TABLE fos_user_user_group DROP FOREIGN KEY FK_B3C77447A76ED395");
$queries->addQuery("ALTER TABLE course_rel_user DROP FOREIGN KEY FK_92CFD9FEA76ED395");
$queries->addQuery("ALTER TABLE session DROP FOREIGN KEY FK_D044D5D4D1DC2CFC");
$queries->addQuery("ALTER TABLE track_e_exercices DROP FOREIGN KEY FK_B62B03F2F6A6790");
$queries->addQuery("ALTER TABLE usergroup_rel_user DROP FOREIGN KEY FK_739515A9A76ED395");
$queries->addQuery("ALTER TABLE curriculum_item_rel_user DROP FOREIGN KEY FK_514721FFA76ED395");
$queries->addQuery("ALTER TABLE curriculum_item_rel_user DROP FOREIGN KEY FK_514721FF126F525E");
$queries->addQuery("ALTER TABLE course_rel_user DROP FOREIGN KEY FK_92CFD9FE91D79BD3");
$queries->addQuery("ALTER TABLE session_rel_course DROP FOREIGN KEY FK_12D110D391D79BD3");
$queries->addQuery("ALTER TABLE session_tree DROP FOREIGN KEY FK_714F5EF6591CC992");
$queries->addQuery("ALTER TABLE access_url_rel_course DROP FOREIGN KEY FK_8E97FC0891D79BD3");
$queries->addQuery("ALTER TABLE curriculum_category DROP FOREIGN KEY FK_FC94C78591D79BD3");
$queries->addQuery("ALTER TABLE session_tree DROP FOREIGN KEY FK_714F5EF6727ACA70");
$queries->addQuery("ALTER TABLE question_score_name DROP FOREIGN KEY FK_13EF60F871E3BA5D");
$queries->addQuery("ALTER TABLE jury_members DROP FOREIGN KEY FK_CCB37077E560103C");
$queries->addQuery("ALTER TABLE session_rel_course DROP FOREIGN KEY FK_12D110D3ED97CA4");
$queries->addQuery("ALTER TABLE session_tree DROP FOREIGN KEY FK_714F5EF6613FECDF");
$queries->addQuery("ALTER TABLE curriculum_category DROP FOREIGN KEY FK_FC94C785613FECDF");
$queries->addQuery("ALTER TABLE session_tree DROP FOREIGN KEY FK_714F5EF6CBB4D431");
$queries->addQuery("ALTER TABLE track_attempt_jury DROP FOREIGN KEY FK_977B4A18B5A18F57");
$queries->addQuery("ALTER TABLE session_tree DROP FOREIGN KEY FK_714F5EF68F7B22CC");
$queries->addQuery("ALTER TABLE usergroup_rel_user DROP FOREIGN KEY FK_739515A9D2112630");
$queries->addQuery("ALTER TABLE user_accessurl DROP FOREIGN KEY FK_DD3D6AB573444FD5");
$queries->addQuery("ALTER TABLE access_url_rel_course DROP FOREIGN KEY FK_8E97FC0873444FD5");
$queries->addQuery("ALTER TABLE curriculum_item DROP FOREIGN KEY FK_5A9A424112469DE2");
$queries->addQuery("ALTER TABLE curriculum_category DROP FOREIGN KEY FK_FC94C785727ACA70");
$queries->addQuery("ALTER TABLE jury DROP FOREIGN KEY FK_1335B02CDCD6CC49");
$queries->addQuery("ALTER TABLE branch_sync DROP FOREIGN KEY FK_F62F45ED727ACA70");
$queries->addQuery("DROP TABLE user");
$queries->addQuery("DROP TABLE user_accessurl");
$queries->addQuery("DROP TABLE fos_user_user_group");
$queries->addQuery("DROP TABLE user_audit");
$queries->addQuery("DROP TABLE jury_members");
$queries->addQuery("DROP TABLE branch_transaction_data");
$queries->addQuery("DROP TABLE track_e_online");
$queries->addQuery("DROP TABLE search_engine_ref");
$queries->addQuery("DROP TABLE promotion");
$queries->addQuery("DROP TABLE course_module");
$queries->addQuery("DROP TABLE groups");
$queries->addQuery("DROP TABLE course_rel_user");
$queries->addQuery("DROP TABLE course_rel_user_audit");
$queries->addQuery("DROP TABLE session_rel_course");
$queries->addQuery("DROP TABLE session_rel_course_audit");
$queries->addQuery("DROP TABLE access_url_rel_session");
$queries->addQuery("DROP TABLE curriculum_item");
$queries->addQuery("DROP TABLE question_field");
$queries->addQuery("DROP TABLE gradebook_result");
$queries->addQuery("DROP TABLE personal_agenda");
$queries->addQuery("DROP TABLE session_field");
$queries->addQuery("DROP TABLE course_request");
$queries->addQuery("DROP TABLE shared_survey_question_option");
$queries->addQuery("DROP TABLE settings_current");
$queries->addQuery("DROP TABLE gradebook_evaluation_type");
$queries->addQuery("DROP TABLE grade_model");
$queries->addQuery("DROP TABLE usergroup_rel_course");
$queries->addQuery("DROP TABLE user_field_options");
$queries->addQuery("DROP TABLE skill_profile");
$queries->addQuery("DROP TABLE personal_agenda_repeat");
$queries->addQuery("DROP TABLE gradebook_evaluation");
$queries->addQuery("DROP TABLE course");
$queries->addQuery("DROP TABLE course_audit");
$queries->addQuery("DROP TABLE session_tree");
$queries->addQuery("DROP TABLE question_score_name");
$queries->addQuery("DROP TABLE access_url_rel_user");
$queries->addQuery("DROP TABLE skill_rel_profile");
$queries->addQuery("DROP TABLE notification");
$queries->addQuery("DROP TABLE block");
$queries->addQuery("DROP TABLE track_course_ranking");
$queries->addQuery("DROP TABLE event_sent");
$queries->addQuery("DROP TABLE branch_transaction_status");
$queries->addQuery("DROP TABLE track_e_attempt_coeff");
$queries->addQuery("DROP TABLE usergroup_rel_question");
$queries->addQuery("DROP TABLE extra_field_option_rel_field_option");
$queries->addQuery("DROP TABLE shared_survey_question");
$queries->addQuery("DROP TABLE session_category");
$queries->addQuery("DROP TABLE course_category");
$queries->addQuery("DROP TABLE gradebook_linkeval_log");
$queries->addQuery("DROP TABLE tag");
$queries->addQuery("DROP TABLE track_e_login");
$queries->addQuery("DROP TABLE Comment");
$queries->addQuery("DROP TABLE course_field_options");
$queries->addQuery("DROP TABLE access_url_rel_course");
$queries->addQuery("DROP TABLE access_url_rel_course_audit");
$queries->addQuery("DROP TABLE usergroup_rel_usergroup");
$queries->addQuery("DROP TABLE personal_agenda_repeat_not");
$queries->addQuery("DROP TABLE user_api_key");
$queries->addQuery("DROP TABLE career");
$queries->addQuery("DROP TABLE announcement_rel_group");
$queries->addQuery("DROP TABLE track_e_course_access");
$queries->addQuery("DROP TABLE question_score");
$queries->addQuery("DROP TABLE user_rel_course_vote");
$queries->addQuery("DROP TABLE specific_field");
$queries->addQuery("DROP TABLE track_e_uploads");
$queries->addQuery("DROP TABLE branch_transaction");
$queries->addQuery("DROP TABLE session_rel_course_rel_user");
$queries->addQuery("DROP TABLE system_template");
$queries->addQuery("DROP TABLE jury");
$queries->addQuery("DROP TABLE user_rel_user");
$queries->addQuery("DROP TABLE event_email_template");
$queries->addQuery("DROP TABLE language");
$queries->addQuery("DROP TABLE user_field");
$queries->addQuery("DROP TABLE track_stored_values_stack");
$queries->addQuery("DROP TABLE track_attempt_jury");
$queries->addQuery("DROP TABLE session_field_values");
$queries->addQuery("DROP TABLE track_e_lastaccess");
$queries->addQuery("DROP TABLE session");
$queries->addQuery("DROP TABLE session_audit");
$queries->addQuery("DROP TABLE gradebook_certificate");
$queries->addQuery("DROP TABLE sys_announcement");
$queries->addQuery("DROP TABLE track_e_downloads");
$queries->addQuery("DROP TABLE branch_sync_log");
$queries->addQuery("DROP TABLE track_e_default");
$queries->addQuery("DROP TABLE curriculum_rel_user");
$queries->addQuery("DROP TABLE settings_options");
$queries->addQuery("DROP TABLE user_rel_event_type");
$queries->addQuery("DROP TABLE specific_field_values");
$queries->addQuery("DROP TABLE skill_rel_gradebook");
$queries->addQuery("DROP TABLE skill_rel_skill");
$queries->addQuery("DROP TABLE course_type");
$queries->addQuery("DROP TABLE session_rel_user");
$queries->addQuery("DROP TABLE skill");
$queries->addQuery("DROP TABLE user_field_values");
$queries->addQuery("DROP TABLE user_friend_relation_type");
$queries->addQuery("DROP TABLE session_field_options");
$queries->addQuery("DROP TABLE session_path");
$queries->addQuery("DROP TABLE track_e_links");
$queries->addQuery("DROP TABLE access_url_rel_course_category");
$queries->addQuery("DROP TABLE user_course_category");
$queries->addQuery("DROP TABLE ext_log_entries");
$queries->addQuery("DROP TABLE track_e_exercices");
$queries->addQuery("DROP TABLE track_stored_values");
$queries->addQuery("DROP TABLE tool");
$queries->addQuery("DROP TABLE track_e_hotspot");
$queries->addQuery("DROP TABLE question_field_values");
$queries->addQuery("DROP TABLE usergroup");
$queries->addQuery("DROP TABLE templates");
$queries->addQuery("DROP TABLE admin");
$queries->addQuery("DROP TABLE usergroup_rel_session");
$queries->addQuery("DROP TABLE gradebook_result_log");
$queries->addQuery("DROP TABLE access_url_rel_usergroup");
$queries->addQuery("DROP TABLE skill_rel_user");
$queries->addQuery("DROP TABLE shared_survey");
$queries->addQuery("DROP TABLE gradebook_link");
$queries->addQuery("DROP TABLE course_field_values");
$queries->addQuery("DROP TABLE track_e_access");
$queries->addQuery("DROP TABLE sys_calendar");
$queries->addQuery("DROP TABLE user_rel_tag");
$queries->addQuery("DROP TABLE legal");
$queries->addQuery("DROP TABLE user_session_path");
$queries->addQuery("DROP TABLE access_url");
$queries->addQuery("DROP TABLE access_url_audit");
$queries->addQuery("DROP TABLE usergroup_rel_user");
$queries->addQuery("DROP TABLE grade_components");
$queries->addQuery("DROP TABLE usergroup_rel_tag");
$queries->addQuery("DROP TABLE gradebook_score_display");
$queries->addQuery("DROP TABLE track_e_item_property");
$queries->addQuery("DROP TABLE track_e_attempt");
$queries->addQuery("DROP TABLE track_e_attempt_recording");
$queries->addQuery("DROP TABLE curriculum_category");
$queries->addQuery("DROP TABLE chat");
$queries->addQuery("DROP TABLE course_field");
$queries->addQuery("DROP TABLE gradebook_category");
$queries->addQuery("DROP TABLE curriculum_item_rel_user");
$queries->addQuery("DROP TABLE track_e_hotpotatoes");
$queries->addQuery("DROP TABLE branch_sync");
$queries->addQuery("DROP TABLE c_quiz_question");
}
}

@ -0,0 +1,209 @@
<?php
namespace ChamiloLMS\CoreBundle\Migrations\Schema\v10;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
use Oro\Bundle\MigrationBundle\Migration\OrderedMigrationInterface;
class Extra implements Migration, OrderedMigrationInterface
{
/**
* {@inheritdoc}
*/
public function getOrder()
{
return 2;
}
public function up(Schema $schema, QueryBag $queries)
{
$queries->addQuery("CREATE TABLE page__page (id INT AUTO_INCREMENT NOT NULL, site_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, target_id INT DEFAULT NULL, route_name VARCHAR(255) NOT NULL, page_alias VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, decorate TINYINT(1) NOT NULL, edited TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, slug LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, custom_url LONGTEXT DEFAULT NULL, request_method VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, meta_keyword VARCHAR(255) DEFAULT NULL, meta_description VARCHAR(255) DEFAULT NULL, javascript LONGTEXT DEFAULT NULL, stylesheet LONGTEXT DEFAULT NULL, raw_headers LONGTEXT DEFAULT NULL, template VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_2FAE39EDF6BD1646 (site_id), INDEX IDX_2FAE39ED727ACA70 (parent_id), INDEX IDX_2FAE39ED158E0B66 (target_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__page_audit (id INT NOT NULL, rev INT NOT NULL, site_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, target_id INT DEFAULT NULL, route_name VARCHAR(255) DEFAULT NULL, page_alias VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, decorate TINYINT(1) DEFAULT NULL, edited TINYINT(1) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, slug LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, custom_url LONGTEXT DEFAULT NULL, request_method VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, meta_keyword VARCHAR(255) DEFAULT NULL, meta_description VARCHAR(255) DEFAULT NULL, javascript LONGTEXT DEFAULT NULL, stylesheet LONGTEXT DEFAULT NULL, raw_headers LONGTEXT DEFAULT NULL, template VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__snapshot (id INT AUTO_INCREMENT NOT NULL, site_id INT DEFAULT NULL, page_id INT DEFAULT NULL, route_name VARCHAR(255) NOT NULL, page_alias VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, decorate TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, url LONGTEXT DEFAULT NULL, parent_id INT DEFAULT NULL, target_id INT DEFAULT NULL, content LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', publication_date_start DATETIME DEFAULT NULL, publication_date_end DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_3963EF9AF6BD1646 (site_id), INDEX IDX_3963EF9AC4663E4 (page_id), INDEX idx_snapshot_dates_enabled (publication_date_start, publication_date_end, enabled), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__snapshot_audit (id INT NOT NULL, rev INT NOT NULL, site_id INT DEFAULT NULL, page_id INT DEFAULT NULL, route_name VARCHAR(255) DEFAULT NULL, page_alias VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, decorate TINYINT(1) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, url LONGTEXT DEFAULT NULL, parent_id INT DEFAULT NULL, target_id INT DEFAULT NULL, content LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', publication_date_start DATETIME DEFAULT NULL, publication_date_end DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__site (id INT AUTO_INCREMENT NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, relative_path VARCHAR(255) DEFAULT NULL, host VARCHAR(255) NOT NULL, enabled_from DATETIME DEFAULT NULL, enabled_to DATETIME DEFAULT NULL, is_default TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, locale VARCHAR(6) DEFAULT NULL, title VARCHAR(64) DEFAULT NULL, meta_keywords VARCHAR(255) DEFAULT NULL, meta_description VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__site_audit (id INT NOT NULL, rev INT NOT NULL, enabled TINYINT(1) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, relative_path VARCHAR(255) DEFAULT NULL, host VARCHAR(255) DEFAULT NULL, enabled_from DATETIME DEFAULT NULL, enabled_to DATETIME DEFAULT NULL, is_default TINYINT(1) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, locale VARCHAR(6) DEFAULT NULL, title VARCHAR(64) DEFAULT NULL, meta_keywords VARCHAR(255) DEFAULT NULL, meta_description VARCHAR(255) DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__bloc (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, page_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(64) NOT NULL, settings LONGTEXT NOT NULL COMMENT '(DC2Type:json)', enabled TINYINT(1) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_FCDC1A97727ACA70 (parent_id), INDEX IDX_FCDC1A97C4663E4 (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE page__bloc_audit (id INT NOT NULL, rev INT NOT NULL, parent_id INT DEFAULT NULL, page_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(64) DEFAULT NULL, settings LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', enabled TINYINT(1) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__gallery_audit (id INT NOT NULL, rev INT NOT NULL, name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, default_format VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__media (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(64) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__media_audit (id INT NOT NULL, rev INT NOT NULL, name VARCHAR(255) DEFAULT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, provider_name VARCHAR(255) DEFAULT NULL, provider_status INT DEFAULT NULL, provider_reference VARCHAR(255) DEFAULT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(64) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__gallery_media (id INT AUTO_INCREMENT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_80D4C5414E7AF8F (gallery_id), INDEX IDX_80D4C541EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE media__gallery_media_audit (id INT NOT NULL, rev INT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE news__post (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, author_id INT DEFAULT NULL, collection_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, abstract LONGTEXT NOT NULL, content LONGTEXT NOT NULL, raw_content LONGTEXT NOT NULL, content_formatter VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, publication_date_start DATETIME DEFAULT NULL, comments_enabled TINYINT(1) NOT NULL, comments_close_at DATETIME DEFAULT NULL, comments_default_status INT NOT NULL, comments_count INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_7D109BC83DA5256D (image_id), INDEX IDX_7D109BC8F675F31B (author_id), INDEX IDX_7D109BC8514956FD (collection_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE news__post_tag (post_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_682B20514B89032C (post_id), INDEX IDX_682B2051BAD26311 (tag_id), PRIMARY KEY(post_id, tag_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE news__post_audit (id INT NOT NULL, rev INT NOT NULL, image_id INT DEFAULT NULL, author_id INT DEFAULT NULL, collection_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, abstract LONGTEXT DEFAULT NULL, content LONGTEXT DEFAULT NULL, raw_content LONGTEXT DEFAULT NULL, content_formatter VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, publication_date_start DATETIME DEFAULT NULL, comments_enabled TINYINT(1) DEFAULT NULL, comments_close_at DATETIME DEFAULT NULL, comments_default_status INT DEFAULT NULL, comments_count INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE news__comment (id INT AUTO_INCREMENT NOT NULL, post_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, message LONGTEXT NOT NULL, status INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A90210404B89032C (post_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE news__comment_audit (id INT NOT NULL, rev INT NOT NULL, post_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, message LONGTEXT DEFAULT NULL, status INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE notification__message (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL COMMENT '(DC2Type:json)', state INT NOT NULL, restart_count INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, started_at DATETIME DEFAULT NULL, completed_at DATETIME DEFAULT NULL, INDEX idx_state (state), INDEX idx_created_at (created_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE notification__message_audit (id INT NOT NULL, rev INT NOT NULL, type VARCHAR(255) DEFAULT NULL, body LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', state INT DEFAULT NULL, restart_count INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, started_at DATETIME DEFAULT NULL, completed_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__collection (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AEA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__collection_audit (id INT NOT NULL, rev INT NOT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__tag (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__tag_audit (id INT NOT NULL, rev INT NOT NULL, name VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_43629B36727ACA70 (parent_id), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE classification__category_audit (id INT NOT NULL, rev INT NOT NULL, parent_id INT DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE comment__thread (id VARCHAR(255) NOT NULL, category_id INT DEFAULT NULL, permalink VARCHAR(255) NOT NULL, is_commentable TINYINT(1) NOT NULL, num_comments INT NOT NULL, last_comment_at DATETIME DEFAULT NULL, average_note DOUBLE PRECISION DEFAULT NULL, INDEX IDX_3B60C91012469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE comment__thread_audit (id VARCHAR(255) NOT NULL, rev INT NOT NULL, category_id INT DEFAULT NULL, permalink VARCHAR(255) DEFAULT NULL, is_commentable TINYINT(1) DEFAULT NULL, num_comments INT DEFAULT NULL, last_comment_at DATETIME DEFAULT NULL, average_note DOUBLE PRECISION DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE comment__comment (id INT AUTO_INCREMENT NOT NULL, thread_id VARCHAR(255) DEFAULT NULL, body LONGTEXT NOT NULL, ancestors VARCHAR(1024) NOT NULL, depth INT NOT NULL, created_at DATETIME NOT NULL, state INT NOT NULL, author_name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, note DOUBLE PRECISION DEFAULT NULL, private TINYINT(1) DEFAULT NULL, INDEX IDX_FD78D017E2904019 (thread_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE comment__comment_audit (id INT NOT NULL, rev INT NOT NULL, thread_id VARCHAR(255) DEFAULT NULL, body LONGTEXT DEFAULT NULL, ancestors VARCHAR(1024) DEFAULT NULL, depth INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, state INT DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, note DOUBLE PRECISION DEFAULT NULL, private TINYINT(1) DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE timeline__action_component (id INT AUTO_INCREMENT NOT NULL, action_id INT DEFAULT NULL, component_id INT DEFAULT NULL, type VARCHAR(255) NOT NULL, text VARCHAR(255) DEFAULT NULL, INDEX IDX_6ACD1B169D32F035 (action_id), INDEX IDX_6ACD1B16E2ABAFFF (component_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE timeline__component (id INT AUTO_INCREMENT NOT NULL, model VARCHAR(255) NOT NULL, identifier LONGTEXT NOT NULL COMMENT '(DC2Type:array)', hash VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_1B2F01CDD1B862B8 (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE timeline__timeline (id INT AUTO_INCREMENT NOT NULL, action_id INT DEFAULT NULL, subject_id INT DEFAULT NULL, context VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_FFBC6AD59D32F035 (action_id), INDEX IDX_FFBC6AD523EDC87 (subject_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE timeline__action (id INT AUTO_INCREMENT NOT NULL, verb VARCHAR(255) NOT NULL, status_current VARCHAR(255) NOT NULL, status_wanted VARCHAR(255) NOT NULL, duplicate_key VARCHAR(255) DEFAULT NULL, duplicate_priority INT DEFAULT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE fos_group (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', UNIQUE INDEX UNIQ_4B019DDB5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE fos_group_audit (id INT NOT NULL, rev INT NOT NULL, name VARCHAR(255) DEFAULT NULL, roles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE fos_user_user_group (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_B3C77447A76ED395 (user_id), INDEX IDX_B3C77447FE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE user_audit (id INT NOT NULL, rev INT NOT NULL, username VARCHAR(255) DEFAULT NULL, username_canonical VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) DEFAULT NULL, salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) DEFAULT NULL, expired TINYINT(1) DEFAULT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', credentials_expired TINYINT(1) DEFAULT NULL, credentials_expire_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, date_of_birth DATETIME DEFAULT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, website VARCHAR(64) DEFAULT NULL, biography VARCHAR(1000) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(64) DEFAULT NULL, phone VARCHAR(64) DEFAULT NULL, facebook_uid VARCHAR(255) DEFAULT NULL, facebook_name VARCHAR(255) DEFAULT NULL, facebook_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', twitter_uid VARCHAR(255) DEFAULT NULL, twitter_name VARCHAR(255) DEFAULT NULL, twitter_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', gplus_uid VARCHAR(255) DEFAULT NULL, gplus_name VARCHAR(255) DEFAULT NULL, gplus_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', token VARCHAR(255) DEFAULT NULL, two_step_code VARCHAR(255) DEFAULT NULL, user_id INT DEFAULT NULL, auth_source VARCHAR(50) DEFAULT NULL, status INT DEFAULT NULL, official_code VARCHAR(40) DEFAULT NULL, picture_uri VARCHAR(250) DEFAULT NULL, creator_id INT DEFAULT NULL, competences LONGTEXT DEFAULT NULL, diplomas LONGTEXT DEFAULT NULL, openarea LONGTEXT DEFAULT NULL, teach LONGTEXT DEFAULT NULL, productions VARCHAR(250) DEFAULT NULL, chatcall_user_id INT DEFAULT NULL, chatcall_date DATETIME DEFAULT NULL, chatcall_text VARCHAR(50) DEFAULT NULL, language VARCHAR(40) DEFAULT NULL, registration_date DATETIME DEFAULT NULL, expiration_date DATETIME DEFAULT NULL, active TINYINT(1) DEFAULT NULL, openid VARCHAR(255) DEFAULT NULL, theme VARCHAR(255) DEFAULT NULL, hr_dept_id SMALLINT DEFAULT NULL, isActive VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, emailCanonical VARCHAR(255) DEFAULT NULL, revtype VARCHAR(4) NOT NULL, PRIMARY KEY(id, rev)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE message (id INT AUTO_INCREMENT NOT NULL, thread_id INT DEFAULT NULL, sender_id INT DEFAULT NULL, body LONGTEXT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_B6BD307FE2904019 (thread_id), INDEX IDX_B6BD307FF624B39D (sender_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE thread_metadata (id INT AUTO_INCREMENT NOT NULL, thread_id INT DEFAULT NULL, participant_id INT DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, last_participant_message_date DATETIME DEFAULT NULL, last_message_date DATETIME DEFAULT NULL, INDEX IDX_40A577C8E2904019 (thread_id), INDEX IDX_40A577C89D1C3019 (participant_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE comment (id INT AUTO_INCREMENT NOT NULL, thread_id INT DEFAULT NULL, body LONGTEXT NOT NULL, ancestors VARCHAR(1024) NOT NULL, depth INT NOT NULL, created_at DATETIME NOT NULL, state INT NOT NULL, INDEX IDX_9474526CE2904019 (thread_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE thread (id INT AUTO_INCREMENT NOT NULL, subject VARCHAR(255) NOT NULL, createdAt DATETIME NOT NULL, isSpam TINYINT(1) NOT NULL, createdBy_id INT DEFAULT NULL, INDEX IDX_31204C833174800F (createdBy_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE message_metadata (id INT AUTO_INCREMENT NOT NULL, message_id INT DEFAULT NULL, participant_id INT DEFAULT NULL, is_read TINYINT(1) NOT NULL, INDEX IDX_4632F005537A1329 (message_id), INDEX IDX_4632F0059D1C3019 (participant_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE migrations (id INT AUTO_INCREMENT NOT NULL, bundle VARCHAR(250) NOT NULL, version VARCHAR(250) NOT NULL, loaded_at DATETIME NOT NULL, INDEX idx_oro_migrations (bundle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE migrations_data (id INT AUTO_INCREMENT NOT NULL, class_name VARCHAR(255) NOT NULL, version VARCHAR(255) DEFAULT NULL, loaded_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE sylius_settings_parameter (id INT AUTO_INCREMENT NOT NULL, namespace VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, value LONGTEXT DEFAULT NULL COMMENT '(DC2Type:object)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE revisions (id INT AUTO_INCREMENT NOT NULL, timestamp DATETIME NOT NULL, username VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE acl_classes (id INT UNSIGNED AUTO_INCREMENT NOT NULL, class_type VARCHAR(200) NOT NULL, UNIQUE INDEX UNIQ_69DD750638A36066 (class_type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE acl_security_identities (id INT UNSIGNED AUTO_INCREMENT NOT NULL, identifier VARCHAR(200) NOT NULL, username TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8835EE78772E836AF85E0677 (identifier, username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE acl_object_identities (id INT UNSIGNED AUTO_INCREMENT NOT NULL, parent_object_identity_id INT UNSIGNED DEFAULT NULL, class_id INT UNSIGNED NOT NULL, object_identifier VARCHAR(100) NOT NULL, entries_inheriting TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_9407E5494B12AD6EA000B10 (object_identifier, class_id), INDEX IDX_9407E54977FA751A (parent_object_identity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE acl_object_identity_ancestors (object_identity_id INT UNSIGNED NOT NULL, ancestor_id INT UNSIGNED NOT NULL, INDEX IDX_825DE2993D9AB4A6 (object_identity_id), INDEX IDX_825DE299C671CEA1 (ancestor_id), PRIMARY KEY(object_identity_id, ancestor_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE acl_entries (id INT UNSIGNED AUTO_INCREMENT NOT NULL, class_id INT UNSIGNED NOT NULL, object_identity_id INT UNSIGNED DEFAULT NULL, security_identity_id INT UNSIGNED NOT NULL, field_name VARCHAR(50) DEFAULT NULL, ace_order SMALLINT UNSIGNED NOT NULL, mask INT NOT NULL, granting TINYINT(1) NOT NULL, granting_strategy VARCHAR(30) NOT NULL, audit_success TINYINT(1) NOT NULL, audit_failure TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_46C8B806EA000B103D9AB4A64DEF17BCE4289BF4 (class_id, object_identity_id, field_name, ace_order), INDEX IDX_46C8B806EA000B103D9AB4A6DF9183C9 (class_id, object_identity_id, security_identity_id), INDEX IDX_46C8B806EA000B10 (class_id), INDEX IDX_46C8B8063D9AB4A6 (object_identity_id), INDEX IDX_46C8B806DF9183C9 (security_identity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39EDF6BD1646 FOREIGN KEY (site_id) REFERENCES page__site (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39ED727ACA70 FOREIGN KEY (parent_id) REFERENCES page__page (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39ED158E0B66 FOREIGN KEY (target_id) REFERENCES page__page (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__snapshot ADD CONSTRAINT FK_3963EF9AF6BD1646 FOREIGN KEY (site_id) REFERENCES page__site (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__snapshot ADD CONSTRAINT FK_3963EF9AC4663E4 FOREIGN KEY (page_id) REFERENCES page__page (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__bloc ADD CONSTRAINT FK_FCDC1A97727ACA70 FOREIGN KEY (parent_id) REFERENCES page__bloc (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE page__bloc ADD CONSTRAINT FK_FCDC1A97C4663E4 FOREIGN KEY (page_id) REFERENCES page__page (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id)");
$queries->addQuery("ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)");
$queries->addQuery("ALTER TABLE news__post ADD CONSTRAINT FK_7D109BC83DA5256D FOREIGN KEY (image_id) REFERENCES media__media (id)");
$queries->addQuery("ALTER TABLE news__post ADD CONSTRAINT FK_7D109BC8F675F31B FOREIGN KEY (author_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE news__post ADD CONSTRAINT FK_7D109BC8514956FD FOREIGN KEY (collection_id) REFERENCES classification__collection (id)");
$queries->addQuery("ALTER TABLE news__post_tag ADD CONSTRAINT FK_682B20514B89032C FOREIGN KEY (post_id) REFERENCES news__post (id)");
$queries->addQuery("ALTER TABLE news__post_tag ADD CONSTRAINT FK_682B2051BAD26311 FOREIGN KEY (tag_id) REFERENCES classification__tag (id)");
$queries->addQuery("ALTER TABLE news__comment ADD CONSTRAINT FK_A90210404B89032C FOREIGN KEY (post_id) REFERENCES news__post (id)");
$queries->addQuery("ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36727ACA70 FOREIGN KEY (parent_id) REFERENCES classification__category (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE comment__thread ADD CONSTRAINT FK_3B60C91012469DE2 FOREIGN KEY (category_id) REFERENCES classification__category (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE comment__comment ADD CONSTRAINT FK_FD78D017E2904019 FOREIGN KEY (thread_id) REFERENCES comment__thread (id)");
$queries->addQuery("ALTER TABLE timeline__action_component ADD CONSTRAINT FK_6ACD1B169D32F035 FOREIGN KEY (action_id) REFERENCES timeline__action (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE timeline__action_component ADD CONSTRAINT FK_6ACD1B16E2ABAFFF FOREIGN KEY (component_id) REFERENCES timeline__component (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE timeline__timeline ADD CONSTRAINT FK_FFBC6AD59D32F035 FOREIGN KEY (action_id) REFERENCES timeline__action (id)");
$queries->addQuery("ALTER TABLE timeline__timeline ADD CONSTRAINT FK_FFBC6AD523EDC87 FOREIGN KEY (subject_id) REFERENCES timeline__component (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447FE54D947 FOREIGN KEY (group_id) REFERENCES fos_group (id) ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE2904019 FOREIGN KEY (thread_id) REFERENCES thread (id)");
$queries->addQuery("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE thread_metadata ADD CONSTRAINT FK_40A577C8E2904019 FOREIGN KEY (thread_id) REFERENCES thread (id)");
$queries->addQuery("ALTER TABLE thread_metadata ADD CONSTRAINT FK_40A577C89D1C3019 FOREIGN KEY (participant_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE comment ADD CONSTRAINT FK_9474526CE2904019 FOREIGN KEY (thread_id) REFERENCES thread (id)");
$queries->addQuery("ALTER TABLE thread ADD CONSTRAINT FK_31204C833174800F FOREIGN KEY (createdBy_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE message_metadata ADD CONSTRAINT FK_4632F005537A1329 FOREIGN KEY (message_id) REFERENCES message (id)");
$queries->addQuery("ALTER TABLE message_metadata ADD CONSTRAINT FK_4632F0059D1C3019 FOREIGN KEY (participant_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE acl_object_identities ADD CONSTRAINT FK_9407E54977FA751A FOREIGN KEY (parent_object_identity_id) REFERENCES acl_object_identities (id)");
$queries->addQuery("ALTER TABLE acl_object_identity_ancestors ADD CONSTRAINT FK_825DE2993D9AB4A6 FOREIGN KEY (object_identity_id) REFERENCES acl_object_identities (id) ON UPDATE CASCADE ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE acl_object_identity_ancestors ADD CONSTRAINT FK_825DE299C671CEA1 FOREIGN KEY (ancestor_id) REFERENCES acl_object_identities (id) ON UPDATE CASCADE ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE acl_entries ADD CONSTRAINT FK_46C8B806EA000B10 FOREIGN KEY (class_id) REFERENCES acl_classes (id) ON UPDATE CASCADE ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE acl_entries ADD CONSTRAINT FK_46C8B8063D9AB4A6 FOREIGN KEY (object_identity_id) REFERENCES acl_object_identities (id) ON UPDATE CASCADE ON DELETE CASCADE");
$queries->addQuery("ALTER TABLE acl_entries ADD CONSTRAINT FK_46C8B806DF9183C9 FOREIGN KEY (security_identity_id) REFERENCES acl_security_identities (id) ON UPDATE CASCADE ON DELETE CASCADE");
}
public function down(Schema $schema, QueryBag $queries)
{
$queries->addQuery("ALTER TABLE page__page DROP FOREIGN KEY FK_2FAE39ED727ACA70");
$queries->addQuery("ALTER TABLE page__page DROP FOREIGN KEY FK_2FAE39ED158E0B66");
$queries->addQuery("ALTER TABLE page__snapshot DROP FOREIGN KEY FK_3963EF9AC4663E4");
$queries->addQuery("ALTER TABLE page__bloc DROP FOREIGN KEY FK_FCDC1A97C4663E4");
$queries->addQuery("ALTER TABLE page__page DROP FOREIGN KEY FK_2FAE39EDF6BD1646");
$queries->addQuery("ALTER TABLE page__snapshot DROP FOREIGN KEY FK_3963EF9AF6BD1646");
$queries->addQuery("ALTER TABLE page__bloc DROP FOREIGN KEY FK_FCDC1A97727ACA70");
$queries->addQuery("ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F");
$queries->addQuery("ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75");
$queries->addQuery("ALTER TABLE news__post DROP FOREIGN KEY FK_7D109BC83DA5256D");
$queries->addQuery("ALTER TABLE classification__collection DROP FOREIGN KEY FK_A406B56AEA9FDD75");
$queries->addQuery("ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36EA9FDD75");
$queries->addQuery("ALTER TABLE news__post_tag DROP FOREIGN KEY FK_682B20514B89032C");
$queries->addQuery("ALTER TABLE news__comment DROP FOREIGN KEY FK_A90210404B89032C");
$queries->addQuery("ALTER TABLE news__post DROP FOREIGN KEY FK_7D109BC8514956FD");
$queries->addQuery("ALTER TABLE news__post_tag DROP FOREIGN KEY FK_682B2051BAD26311");
$queries->addQuery("ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36727ACA70");
$queries->addQuery("ALTER TABLE comment__thread DROP FOREIGN KEY FK_3B60C91012469DE2");
$queries->addQuery("ALTER TABLE comment__comment DROP FOREIGN KEY FK_FD78D017E2904019");
$queries->addQuery("ALTER TABLE timeline__action_component DROP FOREIGN KEY FK_6ACD1B16E2ABAFFF");
$queries->addQuery("ALTER TABLE timeline__timeline DROP FOREIGN KEY FK_FFBC6AD523EDC87");
$queries->addQuery("ALTER TABLE timeline__action_component DROP FOREIGN KEY FK_6ACD1B169D32F035");
$queries->addQuery("ALTER TABLE timeline__timeline DROP FOREIGN KEY FK_FFBC6AD59D32F035");
$queries->addQuery("ALTER TABLE fos_user_user_group DROP FOREIGN KEY FK_B3C77447FE54D947");
$queries->addQuery("ALTER TABLE message_metadata DROP FOREIGN KEY FK_4632F005537A1329");
$queries->addQuery("ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE2904019");
$queries->addQuery("ALTER TABLE thread_metadata DROP FOREIGN KEY FK_40A577C8E2904019");
$queries->addQuery("ALTER TABLE comment DROP FOREIGN KEY FK_9474526CE2904019");
$queries->addQuery("ALTER TABLE acl_entries DROP FOREIGN KEY FK_46C8B806EA000B10");
$queries->addQuery("ALTER TABLE acl_entries DROP FOREIGN KEY FK_46C8B806DF9183C9");
$queries->addQuery("ALTER TABLE acl_object_identities DROP FOREIGN KEY FK_9407E54977FA751A");
$queries->addQuery("ALTER TABLE acl_object_identity_ancestors DROP FOREIGN KEY FK_825DE2993D9AB4A6");
$queries->addQuery("ALTER TABLE acl_object_identity_ancestors DROP FOREIGN KEY FK_825DE299C671CEA1");
$queries->addQuery("ALTER TABLE acl_entries DROP FOREIGN KEY FK_46C8B8063D9AB4A6");
//$queries->addQuery("CREATE TABLE oro_migrations (id INT AUTO_INCREMENT NOT NULL, bundle VARCHAR(250) NOT NULL, version VARCHAR(250) NOT NULL, loaded_at DATETIME NOT NULL, INDEX idx_oro_migrations (bundle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
//$queries->addQuery("CREATE TABLE oro_migrations_data (id INT AUTO_INCREMENT NOT NULL, class_name VARCHAR(255) NOT NULL, loaded_at DATETIME NOT NULL, version VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("DROP TABLE page__page");
$queries->addQuery("DROP TABLE page__page_audit");
$queries->addQuery("DROP TABLE page__snapshot");
$queries->addQuery("DROP TABLE page__snapshot_audit");
$queries->addQuery("DROP TABLE page__site");
$queries->addQuery("DROP TABLE page__site_audit");
$queries->addQuery("DROP TABLE page__bloc");
$queries->addQuery("DROP TABLE page__bloc_audit");
$queries->addQuery("DROP TABLE media__gallery");
$queries->addQuery("DROP TABLE media__gallery_audit");
$queries->addQuery("DROP TABLE media__media");
$queries->addQuery("DROP TABLE media__media_audit");
$queries->addQuery("DROP TABLE media__gallery_media");
$queries->addQuery("DROP TABLE media__gallery_media_audit");
$queries->addQuery("DROP TABLE news__post");
$queries->addQuery("DROP TABLE news__post_tag");
$queries->addQuery("DROP TABLE news__post_audit");
$queries->addQuery("DROP TABLE news__comment");
$queries->addQuery("DROP TABLE news__comment_audit");
$queries->addQuery("DROP TABLE notification__message");
$queries->addQuery("DROP TABLE notification__message_audit");
$queries->addQuery("DROP TABLE classification__collection");
$queries->addQuery("DROP TABLE classification__collection_audit");
$queries->addQuery("DROP TABLE classification__tag");
$queries->addQuery("DROP TABLE classification__tag_audit");
$queries->addQuery("DROP TABLE classification__category");
$queries->addQuery("DROP TABLE classification__category_audit");
$queries->addQuery("DROP TABLE comment__thread");
$queries->addQuery("DROP TABLE comment__thread_audit");
$queries->addQuery("DROP TABLE comment__comment");
$queries->addQuery("DROP TABLE comment__comment_audit");
$queries->addQuery("DROP TABLE timeline__action_component");
$queries->addQuery("DROP TABLE timeline__component");
$queries->addQuery("DROP TABLE timeline__timeline");
$queries->addQuery("DROP TABLE timeline__action");
$queries->addQuery("DROP TABLE fos_group");
$queries->addQuery("DROP TABLE fos_group_audit");
$queries->addQuery("DROP TABLE fos_user_user_group");
$queries->addQuery("DROP TABLE user_audit");
$queries->addQuery("DROP TABLE message");
$queries->addQuery("DROP TABLE thread_metadata");
$queries->addQuery("DROP TABLE comment");
$queries->addQuery("DROP TABLE thread");
$queries->addQuery("DROP TABLE message_metadata");
$queries->addQuery("DROP TABLE migrations");
$queries->addQuery("DROP TABLE migrations_data");
$queries->addQuery("DROP TABLE sylius_settings_parameter");
$queries->addQuery("DROP TABLE revisions");
$queries->addQuery("DROP TABLE acl_classes");
$queries->addQuery("DROP TABLE acl_security_identities");
$queries->addQuery("DROP TABLE acl_object_identities");
$queries->addQuery("DROP TABLE acl_object_identity_ancestors");
$queries->addQuery("DROP TABLE acl_entries");
}
}

@ -0,0 +1,231 @@
<?php
namespace ChamiloLMS\CourseBundle\Migrations\Schema\v10;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
class CourseBundle implements Migration
{
public function up(Schema $schema, QueryBag $queries)
{
$queries->addPostQuery("CREATE TABLE c_quiz_question (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question LONGTEXT NOT NULL, description LONGTEXT DEFAULT NULL, ponderation DOUBLE PRECISION NOT NULL, position INT NOT NULL, type TINYINT(1) NOT NULL, picture VARCHAR(50) DEFAULT NULL, level INT NOT NULL, extra VARCHAR(255) DEFAULT NULL, question_code VARCHAR(10) DEFAULT NULL, parent_id INT NOT NULL, INDEX idx_c_q_qst_cpt (c_id, parent_id, type), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_group_info (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, name VARCHAR(100) DEFAULT NULL, category_id INT NOT NULL, description LONGTEXT DEFAULT NULL, max_student INT NOT NULL, doc_state TINYINT(1) NOT NULL, calendar_state TINYINT(1) NOT NULL, work_state TINYINT(1) NOT NULL, announcements_state TINYINT(1) NOT NULL, forum_state TINYINT(1) NOT NULL, wiki_state TINYINT(1) NOT NULL, chat_state TINYINT(1) NOT NULL, secret_directory VARCHAR(255) DEFAULT NULL, self_registration_allowed TINYINT(1) NOT NULL, self_unregistration_allowed TINYINT(1) NOT NULL, session_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_notification (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, forum_id INT NOT NULL, thread_id INT NOT NULL, post_id INT NOT NULL, INDEX user_id (user_id), INDEX forum_id (forum_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_wiki (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, page_id INT NOT NULL, reflink VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, user_id INT NOT NULL, group_id INT DEFAULT NULL, dtime DATETIME NOT NULL, addlock INT NOT NULL, editlock INT NOT NULL, visibility INT NOT NULL, addlock_disc INT NOT NULL, visibility_disc INT NOT NULL, ratinglock_disc INT NOT NULL, assignment INT NOT NULL, comment LONGTEXT NOT NULL, progress LONGTEXT NOT NULL, score INT DEFAULT NULL, version INT DEFAULT NULL, is_editing INT NOT NULL, time_edit DATETIME NOT NULL, hits INT DEFAULT NULL, linksto LONGTEXT NOT NULL, tag LONGTEXT NOT NULL, user_ip VARCHAR(39) NOT NULL, session_id INT DEFAULT NULL, INDEX reflink (reflink), INDEX group_id (group_id), INDEX page_id (page_id), INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_course_setting (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, variable VARCHAR(255) NOT NULL, subkey VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, category VARCHAR(255) DEFAULT NULL, value VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, comment VARCHAR(255) DEFAULT NULL, subkeytext VARCHAR(255) DEFAULT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_permission_task (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, task_id INT NOT NULL, tool VARCHAR(250) NOT NULL, action VARCHAR(250) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_dropbox_category (iid INT AUTO_INCREMENT NOT NULL, cat_id INT NOT NULL, c_id INT NOT NULL, cat_name LONGTEXT NOT NULL, received TINYINT(1) NOT NULL, sent TINYINT(1) NOT NULL, user_id INT NOT NULL, session_id INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_wiki_discuss (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, publication_id INT NOT NULL, userc_id INT NOT NULL, comment LONGTEXT NOT NULL, p_score VARCHAR(255) DEFAULT NULL, dtime DATETIME NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_dropbox_file (iid INT AUTO_INCREMENT NOT NULL, uploader_id INT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, filename VARCHAR(250) NOT NULL, filesize INT NOT NULL, title VARCHAR(250) DEFAULT NULL, description VARCHAR(250) DEFAULT NULL, author VARCHAR(250) DEFAULT NULL, upload_date DATETIME NOT NULL, last_upload_date DATETIME NOT NULL, cat_id INT NOT NULL, session_id INT NOT NULL, INDEX IDX_4D71B46C16678C77 (uploader_id), INDEX session_id (session_id), UNIQUE INDEX UN_filename (filename), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_rel_question (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_id INT NOT NULL, exercice_id INT NOT NULL, question_order INT NOT NULL, INDEX idx_cqrq_id (question_id), INDEX idx_cqrq_cidexid (c_id, exercice_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_calendar_event (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, parent_event_id INT DEFAULT NULL, session_id INT NOT NULL, all_day INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_rating (iid INT AUTO_INCREMENT NOT NULL, rating_id INT NOT NULL, c_id INT NOT NULL, blog_id INT NOT NULL, rating_type VARCHAR(100) NOT NULL, item_id INT NOT NULL, user_id INT NOT NULL, rating INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_category (iid BIGINT AUTO_INCREMENT NOT NULL, parent_id BIGINT DEFAULT NULL, c_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, lft INT NOT NULL, lvl INT NOT NULL, rgt INT NOT NULL, root INT DEFAULT NULL, visibility INT NOT NULL, INDEX IDX_2AF3F510727ACA70 (parent_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_thematic (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, display_order INT NOT NULL, active TINYINT(1) NOT NULL, session_id INT NOT NULL, INDEX active (active, session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, survey_id INT NOT NULL, code VARCHAR(20) DEFAULT NULL, title LONGTEXT DEFAULT NULL, subtitle LONGTEXT DEFAULT NULL, author VARCHAR(20) DEFAULT NULL, lang VARCHAR(20) DEFAULT NULL, avail_from DATE DEFAULT NULL, avail_till DATE DEFAULT NULL, is_shared VARCHAR(1) DEFAULT NULL, template VARCHAR(20) DEFAULT NULL, intro LONGTEXT DEFAULT NULL, surveythanks LONGTEXT DEFAULT NULL, creation_date DATETIME NOT NULL, invited INT NOT NULL, answered INT NOT NULL, invite_mail LONGTEXT NOT NULL, reminder_mail LONGTEXT NOT NULL, mail_subject VARCHAR(255) NOT NULL, anonymous VARCHAR(255) NOT NULL, access_condition LONGTEXT DEFAULT NULL, shuffle TINYINT(1) NOT NULL, one_question_per_page TINYINT(1) NOT NULL, survey_version VARCHAR(255) NOT NULL, parent_id INT NOT NULL, survey_type INT NOT NULL, show_form_profile INT NOT NULL, form_fields LONGTEXT NOT NULL, session_id INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_announcement_attachment (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, size INT NOT NULL, announcement_id INT NOT NULL, filename VARCHAR(255) NOT NULL, UNIQUE INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, lp_type INT NOT NULL, name VARCHAR(255) NOT NULL, ref LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, path LONGTEXT NOT NULL, force_commit TINYINT(1) NOT NULL, default_view_mod VARCHAR(32) NOT NULL, default_encoding VARCHAR(32) NOT NULL, display_order INT NOT NULL, content_maker LONGTEXT NOT NULL, content_local VARCHAR(32) NOT NULL, content_license LONGTEXT NOT NULL, prevent_reinit TINYINT(1) NOT NULL, js_lib LONGTEXT NOT NULL, debug TINYINT(1) NOT NULL, theme VARCHAR(255) NOT NULL, preview_image VARCHAR(255) NOT NULL, author VARCHAR(255) NOT NULL, session_id INT NOT NULL, prerequisite INT NOT NULL, hide_toc_frame TINYINT(1) NOT NULL, seriousgame_mode TINYINT(1) NOT NULL, use_max_score INT NOT NULL, autolunch INT NOT NULL, created_on DATETIME NOT NULL, modified_on DATETIME NOT NULL, publicated_on DATETIME NOT NULL, expired_on DATETIME NOT NULL, category_id INT NOT NULL, max_attempts INT NOT NULL, subscribe_users INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_order (iid BIGINT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, session_id INT NOT NULL, exercise_id INT NOT NULL, exercise_order INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_iv_objective (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id BIGINT NOT NULL, lp_iv_id BIGINT NOT NULL, order_id INT NOT NULL, objective_id VARCHAR(255) NOT NULL, score_raw DOUBLE PRECISION NOT NULL, score_max DOUBLE PRECISION NOT NULL, score_min DOUBLE PRECISION NOT NULL, status VARCHAR(32) NOT NULL, INDEX lp_iv_id (lp_iv_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_dropbox_person (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, file_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_announcement (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, title LONGTEXT DEFAULT NULL, content LONGTEXT DEFAULT NULL, end_date DATE DEFAULT NULL, display_order INT NOT NULL, email_sent TINYINT(1) DEFAULT NULL, session_id INT DEFAULT NULL, INDEX session_id (session_id), UNIQUE INDEX iid (iid), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey_answer (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, answer_id INT NOT NULL, survey_id INT NOT NULL, question_id INT NOT NULL, option_id LONGTEXT NOT NULL, value INT NOT NULL, user VARCHAR(250) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_thread_qualify (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, thread_id INT NOT NULL, qualify DOUBLE PRECISION NOT NULL, qualify_user_id INT DEFAULT NULL, qualify_time DATETIME DEFAULT NULL, session_id INT DEFAULT NULL, INDEX user_id (user_id, thread_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_post (iid INT AUTO_INCREMENT NOT NULL, post_id INT NOT NULL, c_id INT NOT NULL, title VARCHAR(250) NOT NULL, full_text LONGTEXT NOT NULL, date_creation DATETIME NOT NULL, blog_id INT NOT NULL, author_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_group_category (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, doc_state TINYINT(1) NOT NULL, calendar_state TINYINT(1) NOT NULL, work_state TINYINT(1) NOT NULL, announcements_state TINYINT(1) NOT NULL, forum_state TINYINT(1) NOT NULL, wiki_state TINYINT(1) NOT NULL, chat_state TINYINT(1) NOT NULL, max_student INT NOT NULL, self_reg_allowed TINYINT(1) NOT NULL, self_unreg_allowed TINYINT(1) NOT NULL, groups_per_user INT NOT NULL, display_order INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_forum (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, forum_id INT NOT NULL, forum_title VARCHAR(255) NOT NULL, forum_comment LONGTEXT DEFAULT NULL, forum_threads INT DEFAULT NULL, forum_posts INT DEFAULT NULL, forum_last_post INT DEFAULT NULL, forum_category INT DEFAULT NULL, allow_anonymous INT DEFAULT NULL, allow_edit INT DEFAULT NULL, approval_direct_post VARCHAR(20) DEFAULT NULL, allow_attachments INT DEFAULT NULL, allow_new_threads INT DEFAULT NULL, default_view VARCHAR(20) DEFAULT NULL, forum_of_group VARCHAR(20) DEFAULT NULL, forum_group_public_private VARCHAR(20) DEFAULT NULL, forum_order INT DEFAULT NULL, locked INT NOT NULL, session_id INT NOT NULL, forum_image VARCHAR(255) NOT NULL, start_time DATETIME NOT NULL, end_time DATETIME NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_item (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, lp_id INT NOT NULL, item_type VARCHAR(32) NOT NULL, ref LONGTEXT NOT NULL, title VARCHAR(511) NOT NULL, description VARCHAR(511) NOT NULL, path LONGTEXT NOT NULL, min_score DOUBLE PRECISION NOT NULL, max_score DOUBLE PRECISION DEFAULT NULL, mastery_score DOUBLE PRECISION DEFAULT NULL, parent_item_id INT NOT NULL, previous_item_id INT NOT NULL, next_item_id INT NOT NULL, display_order INT NOT NULL, prerequisite LONGTEXT DEFAULT NULL, parameters LONGTEXT DEFAULT NULL, launch_data LONGTEXT NOT NULL, max_time_allowed VARCHAR(13) DEFAULT NULL, terms LONGTEXT DEFAULT NULL, search_did INT DEFAULT NULL, audio VARCHAR(250) DEFAULT NULL, INDEX lp_id (lp_id), INDEX idx_c_lp_item_cid_lp_id (c_id, lp_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_group_rel_user (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, group_id INT NOT NULL, status INT NOT NULL, role VARCHAR(50) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_view (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, lp_id INT NOT NULL, user_id INT NOT NULL, view_count INT NOT NULL, last_item INT NOT NULL, progress INT DEFAULT NULL, session_id INT NOT NULL, INDEX lp_id (lp_id), INDEX user_id (user_id), INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_link_category (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, category_title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, display_order INT NOT NULL, session_id INT DEFAULT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, sound VARCHAR(255) DEFAULT NULL, type TINYINT(1) NOT NULL, random INT NOT NULL, random_answers TINYINT(1) NOT NULL, active TINYINT(1) NOT NULL, results_disabled INT NOT NULL, access_condition LONGTEXT DEFAULT NULL, max_attempt INT NOT NULL, start_time DATETIME NOT NULL, end_time DATETIME NOT NULL, feedback_type INT NOT NULL, expired_time INT NOT NULL, session_id INT DEFAULT NULL, propagate_neg INT NOT NULL, review_answers INT NOT NULL, random_by_category INT NOT NULL, text_when_finished LONGTEXT DEFAULT NULL, display_category_name INT NOT NULL, pass_percentage INT DEFAULT NULL, autolaunch INT DEFAULT NULL, end_button INT NOT NULL, email_notification_template LONGTEXT DEFAULT NULL, email_notification_template_to_user LONGTEXT DEFAULT NULL, model_type INT DEFAULT NULL, question_selection_type INT DEFAULT NULL, hide_question_title INT DEFAULT NULL, score_type_model INT DEFAULT NULL, global_category_id INT DEFAULT NULL, on_success_message LONGTEXT DEFAULT NULL, on_failed_message LONGTEXT DEFAULT NULL, notify_user_by_email INT DEFAULT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_rel_category (iid BIGINT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, category_id INT NOT NULL, exercise_id INT NOT NULL, count_questions INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_tool_intro (iid INT AUTO_INCREMENT NOT NULL, id VARCHAR(50) NOT NULL, c_id INT NOT NULL, session_id INT NOT NULL, intro_text LONGTEXT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_attachment (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, size INT NOT NULL, post_id INT NOT NULL, filename VARCHAR(255) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_category (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, name VARCHAR(255) NOT NULL, position INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_task (iid INT AUTO_INCREMENT NOT NULL, task_id INT NOT NULL, c_id INT NOT NULL, blog_id INT NOT NULL, title VARCHAR(250) NOT NULL, description LONGTEXT NOT NULL, color VARCHAR(10) NOT NULL, system_task TINYINT(1) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_wiki_conf (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, page_id INT NOT NULL, task LONGTEXT NOT NULL, feedback1 LONGTEXT NOT NULL, feedback2 LONGTEXT NOT NULL, feedback3 LONGTEXT NOT NULL, fprogress1 VARCHAR(3) NOT NULL, fprogress2 VARCHAR(3) NOT NULL, fprogress3 VARCHAR(3) NOT NULL, max_size INT DEFAULT NULL, max_text INT DEFAULT NULL, max_version INT DEFAULT NULL, startdate_assig DATETIME NOT NULL, enddate_assig DATETIME NOT NULL, delayedsubmit INT NOT NULL, INDEX page_id (page_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_attendance_sheet (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, user_id INT NOT NULL, attendance_calendar_id INT NOT NULL, presence TINYINT(1) NOT NULL, INDEX presence (presence), UNIQUE INDEX c_id (c_id, user_id, attendance_calendar_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_calendar_event_repeat (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, cal_id INT NOT NULL, cal_type VARCHAR(20) DEFAULT NULL, cal_end INT DEFAULT NULL, cal_frequency INT DEFAULT NULL, cal_days VARCHAR(7) DEFAULT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_calendar_event_repeat_not (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, cal_id INT NOT NULL, cal_date INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_calendar_event_attachment (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, size INT NOT NULL, agenda_id INT NOT NULL, filename VARCHAR(255) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_student_publication_rel_document (iid INT AUTO_INCREMENT NOT NULL, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_answer (iid BIGINT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_id INT NOT NULL, answer LONGTEXT NOT NULL, correct INT DEFAULT NULL, comment LONGTEXT DEFAULT NULL, ponderation DOUBLE PRECISION NOT NULL, position INT NOT NULL, hotspot_coordinates LONGTEXT DEFAULT NULL, hotspot_type VARCHAR(100) DEFAULT NULL, destination LONGTEXT NOT NULL, answer_code VARCHAR(10) DEFAULT NULL, INDEX idx_cqa_qid (question_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_category (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, cat_id INT NOT NULL, cat_title VARCHAR(255) NOT NULL, cat_comment LONGTEXT DEFAULT NULL, cat_order INT NOT NULL, locked INT NOT NULL, session_id INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_course_description (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, title VARCHAR(255) DEFAULT NULL, content LONGTEXT DEFAULT NULL, session_id INT DEFAULT NULL, description_type TINYINT(1) NOT NULL, progress INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_question_rel_category (iid INT AUTO_INCREMENT NOT NULL, category_id BIGINT NOT NULL, question_id INT NOT NULL, c_id INT NOT NULL, INDEX IDX_A468585C12469DE2 (category_id), INDEX IDX_A468585C1E27F6BF (question_id), INDEX idx_c_q_qst_r_cat_qc (iid, question_id, c_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_rel_user (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, blog_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_thematic_advance (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, thematic_id INT NOT NULL, attendance_id INT NOT NULL, content LONGTEXT DEFAULT NULL, start_date DATETIME NOT NULL, duration INT NOT NULL, done_advance TINYINT(1) NOT NULL, INDEX thematic_id (thematic_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_attendance_result (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, attendance_id INT NOT NULL, score INT NOT NULL, INDEX attendance_id (attendance_id), INDEX user_id (user_id), UNIQUE INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_document (iid INT AUTO_INCREMENT NOT NULL, id INT NOT NULL, c_id INT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, filetype VARCHAR(255) NOT NULL, size INT NOT NULL, readonly TINYINT(1) NOT NULL, session_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_item_property (iid INT AUTO_INCREMENT NOT NULL, to_user_id INT DEFAULT NULL, c_id INT NOT NULL, to_group_id INT DEFAULT NULL, id_session INT NOT NULL, id INT NOT NULL, tool VARCHAR(100) NOT NULL, insert_user_id INT NOT NULL, insert_date DATETIME NOT NULL, lastedit_date DATETIME NOT NULL, ref INT NOT NULL, lastedit_type VARCHAR(100) NOT NULL, lastedit_user_id INT NOT NULL, visibility TINYINT(1) NOT NULL, start_visible DATETIME DEFAULT NULL, end_visible DATETIME DEFAULT NULL, INDEX IDX_1D84C18129F6EE60 (to_user_id), INDEX IDX_1D84C18191D79BD3 (c_id), INDEX IDX_1D84C181330D47E9 (to_group_id), INDEX IDX_1D84C181ED97CA4 (id_session), INDEX idx_item_property_toolref (tool, ref), INDEX idx_item_property_tooliuid (tool, insert_user_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_attendance (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, name LONGTEXT NOT NULL, description LONGTEXT DEFAULT NULL, active TINYINT(1) NOT NULL, attendance_qualify_title VARCHAR(255) DEFAULT NULL, attendance_qualify_max INT NOT NULL, attendance_weight DOUBLE PRECISION NOT NULL, session_id INT NOT NULL, locked INT NOT NULL, INDEX session_id (session_id), INDEX active (active), UNIQUE INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_online_connected (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, user_id INT NOT NULL, last_connection DATETIME NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_thematic_plan (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, thematic_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, description_type INT NOT NULL, INDEX thematic_id (thematic_id, description_type), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_glossary (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, glossary_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, display_order INT DEFAULT NULL, session_id INT DEFAULT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_iv_interaction (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id BIGINT NOT NULL, order_id INT NOT NULL, lp_iv_id BIGINT NOT NULL, interaction_id VARCHAR(255) NOT NULL, interaction_type VARCHAR(255) NOT NULL, weighting DOUBLE PRECISION NOT NULL, completion_time VARCHAR(16) NOT NULL, correct_responses LONGTEXT NOT NULL, student_response LONGTEXT NOT NULL, result VARCHAR(255) NOT NULL, latency VARCHAR(16) NOT NULL, INDEX lp_iv_id (lp_iv_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_group_rel_tutor (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, group_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_wiki_mailcue (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, type LONGTEXT NOT NULL, group_id INT DEFAULT NULL, session_id INT DEFAULT NULL, INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey_question (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_id INT NOT NULL, survey_id INT NOT NULL, survey_question LONGTEXT NOT NULL, survey_question_comment LONGTEXT NOT NULL, type VARCHAR(250) NOT NULL, display VARCHAR(10) NOT NULL, sort INT NOT NULL, shared_question_id INT DEFAULT NULL, max_value INT DEFAULT NULL, survey_group_pri INT NOT NULL, survey_group_sec1 INT NOT NULL, survey_group_sec2 INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_task_rel_user (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, blog_id INT NOT NULL, user_id INT NOT NULL, task_id INT NOT NULL, target_date DATE NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey_question_option (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_option_id INT NOT NULL, question_id INT NOT NULL, survey_id INT NOT NULL, option_text LONGTEXT NOT NULL, sort INT NOT NULL, value INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_dropbox_feedback (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, feedback_id INT NOT NULL, file_id INT NOT NULL, author_user_id INT NOT NULL, feedback LONGTEXT NOT NULL, feedback_date DATETIME NOT NULL, INDEX file_id (file_id), INDEX author_user_id (author_user_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_thread_qualify_log (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, thread_id INT NOT NULL, qualify DOUBLE PRECISION NOT NULL, qualify_user_id INT DEFAULT NULL, qualify_time DATETIME DEFAULT NULL, session_id INT DEFAULT NULL, INDEX user_id (user_id, thread_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_mailcue (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, thread_id INT NOT NULL, post_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_attendance_sheet_log (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, attendance_id INT NOT NULL, lastedit_date DATETIME NOT NULL, lastedit_type VARCHAR(200) NOT NULL, lastedit_user_id INT NOT NULL, calendar_date_value DATETIME DEFAULT NULL, UNIQUE INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey_group (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, name VARCHAR(20) NOT NULL, description VARCHAR(255) NOT NULL, survey_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_dropbox_post (iid INT AUTO_INCREMENT NOT NULL, dest_user_id INT NOT NULL, file_id INT NOT NULL, c_id INT NOT NULL, feedback_date DATETIME NOT NULL, feedback LONGTEXT DEFAULT NULL, cat_id INT NOT NULL, session_id INT NOT NULL, INDEX IDX_9B64EEF17737EAA1 (dest_user_id), INDEX IDX_9B64EEF193CB796C (file_id), INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_online_link (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, name VARCHAR(50) NOT NULL, url VARCHAR(100) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, blog_id INT NOT NULL, blog_name VARCHAR(250) NOT NULL, blog_subtitle VARCHAR(250) DEFAULT NULL, date_creation DATETIME NOT NULL, visibility TINYINT(1) NOT NULL, session_id INT DEFAULT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_student_publication_rel_user (iid INT AUTO_INCREMENT NOT NULL, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_post (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, post_id INT NOT NULL, post_title VARCHAR(250) DEFAULT NULL, post_text LONGTEXT DEFAULT NULL, thread_id INT DEFAULT NULL, forum_id INT DEFAULT NULL, poster_id INT DEFAULT NULL, poster_name VARCHAR(100) DEFAULT NULL, post_date DATETIME DEFAULT NULL, post_notification TINYINT(1) DEFAULT NULL, post_parent_id INT DEFAULT NULL, visible TINYINT(1) DEFAULT NULL, INDEX poster_id (poster_id), INDEX forum_id (forum_id), INDEX idx_forum_post_thread_id (thread_id), INDEX idx_forum_post_visible (visible), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_lp_item_view (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id BIGINT NOT NULL, lp_item_id INT NOT NULL, lp_view_id INT NOT NULL, view_count INT NOT NULL, start_time INT NOT NULL, total_time INT NOT NULL, score DOUBLE PRECISION NOT NULL, status VARCHAR(32) NOT NULL, suspend_data LONGTEXT DEFAULT NULL, lesson_location LONGTEXT DEFAULT NULL, core_exit VARCHAR(32) NOT NULL, max_score VARCHAR(8) DEFAULT NULL, INDEX lp_item_id (lp_item_id), INDEX lp_view_id (lp_view_id), INDEX idx_c_lp_item_view_cid_lp_view_id_lp_item_id (c_id, lp_view_id, lp_item_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_student_publication (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, url VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, filename VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, author VARCHAR(255) DEFAULT NULL, active TINYINT(1) DEFAULT NULL, accepted TINYINT(1) DEFAULT NULL, post_group_id INT NOT NULL, sent_date DATETIME NOT NULL, filetype VARCHAR(255) NOT NULL, has_properties INT NOT NULL, view_properties TINYINT(1) DEFAULT NULL, qualification DOUBLE PRECISION NOT NULL, date_of_qualification DATETIME NOT NULL, parent_id INT NOT NULL, qualificator_id INT NOT NULL, weight DOUBLE PRECISION NOT NULL, session_id INT NOT NULL, user_id INT NOT NULL, allow_text_assignment INT NOT NULL, contains_file INT NOT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_comment (iid INT AUTO_INCREMENT NOT NULL, comment_id INT NOT NULL, c_id INT NOT NULL, title VARCHAR(250) NOT NULL, comment LONGTEXT NOT NULL, author_id INT NOT NULL, date_creation DATETIME NOT NULL, blog_id INT NOT NULL, post_id INT NOT NULL, task_id INT DEFAULT NULL, parent_comment_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_forum_thread (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, thread_id INT NOT NULL, thread_title VARCHAR(255) DEFAULT NULL, forum_id INT DEFAULT NULL, thread_replies INT DEFAULT NULL, thread_poster_id INT DEFAULT NULL, thread_poster_name VARCHAR(100) DEFAULT NULL, thread_views INT DEFAULT NULL, thread_last_post INT DEFAULT NULL, thread_date DATETIME DEFAULT NULL, thread_sticky TINYINT(1) DEFAULT NULL, locked INT NOT NULL, session_id INT DEFAULT NULL, thread_title_qualify VARCHAR(255) DEFAULT NULL, thread_qualify_max DOUBLE PRECISION NOT NULL, thread_close_date DATETIME DEFAULT NULL, thread_weight DOUBLE PRECISION NOT NULL, INDEX idx_forum_thread_forum_id (forum_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_permission_group (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, group_id INT NOT NULL, tool VARCHAR(250) NOT NULL, action VARCHAR(250) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_survey_invitation (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, survey_invitation_id INT NOT NULL, survey_code VARCHAR(20) NOT NULL, user VARCHAR(250) NOT NULL, invitation_code VARCHAR(250) NOT NULL, invitation_date DATETIME NOT NULL, reminder_date DATETIME NOT NULL, answered INT NOT NULL, session_id INT NOT NULL, group_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_blog_attachment (iid INT AUTO_INCREMENT NOT NULL, id INT DEFAULT NULL, c_id INT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, size INT NOT NULL, post_id INT NOT NULL, filename VARCHAR(255) NOT NULL, blog_id INT NOT NULL, comment_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_tool (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, name VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, custom_icon VARCHAR(255) DEFAULT NULL, visibility TINYINT(1) DEFAULT NULL, admin VARCHAR(255) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, added_tool TINYINT(1) DEFAULT NULL, target VARCHAR(255) NOT NULL, category VARCHAR(20) NOT NULL, session_id INT DEFAULT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_8456658091D79BD3 (c_id), INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_link (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, url LONGTEXT NOT NULL, title VARCHAR(150) DEFAULT NULL, description LONGTEXT DEFAULT NULL, category_id INT DEFAULT NULL, display_order INT NOT NULL, on_homepage VARCHAR(100) NOT NULL, target VARCHAR(10) DEFAULT NULL, session_id INT DEFAULT NULL, INDEX session_id (session_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_quiz_question_option (iid BIGINT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, question_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, position INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_student_publication_assignment (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, expires_on DATETIME NOT NULL, ends_on DATETIME NOT NULL, add_to_calendar TINYINT(1) NOT NULL, enable_qualification TINYINT(1) NOT NULL, publication_id INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_attendance_calendar (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, attendance_id INT NOT NULL, date_time DATETIME NOT NULL, done_attendance TINYINT(1) NOT NULL, INDEX attendance_id (attendance_id), INDEX done_attendance (done_attendance), UNIQUE INDEX c_id (c_id, id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_permission_user (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, id INT NOT NULL, user_id INT NOT NULL, tool VARCHAR(250) NOT NULL, action VARCHAR(250) NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_student_publication_comment (iid INT AUTO_INCREMENT NOT NULL, work_id INT NOT NULL, c_id INT NOT NULL, comment LONGTEXT DEFAULT NULL, user_id INT NOT NULL, sent_at DATETIME NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("CREATE TABLE c_chat_connected (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, user_id INT NOT NULL, last_connection DATETIME NOT NULL, session_id INT NOT NULL, to_group_id INT NOT NULL, INDEX char_connected_index (user_id, session_id, to_group_id), PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$queries->addQuery("ALTER TABLE c_dropbox_file ADD CONSTRAINT FK_4D71B46C16678C77 FOREIGN KEY (uploader_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE c_quiz_category ADD CONSTRAINT FK_2AF3F510727ACA70 FOREIGN KEY (parent_id) REFERENCES c_quiz_category (iid) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category ADD CONSTRAINT FK_A468585C12469DE2 FOREIGN KEY (category_id) REFERENCES c_quiz_category (iid)");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category ADD CONSTRAINT FK_A468585C1E27F6BF FOREIGN KEY (question_id) REFERENCES c_quiz_question (iid)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18129F6EE60 FOREIGN KEY (to_user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18191D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181ED97CA4 FOREIGN KEY (id_session) REFERENCES session (id)");
$queries->addQuery("ALTER TABLE c_dropbox_post ADD CONSTRAINT FK_9B64EEF17737EAA1 FOREIGN KEY (dest_user_id) REFERENCES user (id)");
$queries->addQuery("ALTER TABLE c_dropbox_post ADD CONSTRAINT FK_9B64EEF193CB796C FOREIGN KEY (file_id) REFERENCES c_dropbox_file (iid)");
$queries->addQuery("ALTER TABLE c_tool ADD CONSTRAINT FK_8456658091D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE c_tool DROP FOREIGN KEY FK_8456658091D79BD3");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181ED97CA4");
$queries->addQuery("ALTER TABLE c_dropbox_post DROP FOREIGN KEY FK_9B64EEF193CB796C");
$queries->addQuery("ALTER TABLE c_quiz_category DROP FOREIGN KEY FK_2AF3F510727ACA70");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category DROP FOREIGN KEY FK_A468585C12469DE2");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category DROP FOREIGN KEY FK_A468585C1E27F6BF");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181330D47E9");
$queries->addQuery("ALTER TABLE c_quiz_category ADD CONSTRAINT FK_2AF3F510727ACA70 FOREIGN KEY (parent_id) REFERENCES c_quiz_category (iid) ON DELETE SET NULL");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category ADD CONSTRAINT FK_A468585C12469DE2 FOREIGN KEY (category_id) REFERENCES c_quiz_category (iid)");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category ADD CONSTRAINT FK_A468585C1E27F6BF FOREIGN KEY (question_id) REFERENCES c_quiz_question (iid)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)");
$queries->addQuery("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181ED97CA4 FOREIGN KEY (id_session) REFERENCES session (id)");
$queries->addQuery("ALTER TABLE c_dropbox_post ADD CONSTRAINT FK_9B64EEF193CB796C FOREIGN KEY (file_id) REFERENCES c_dropbox_file (iid)");
$queries->addQuery("ALTER TABLE c_tool ADD CONSTRAINT FK_8456658091D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
$queries->addQuery("ALTER TABLE course_rel_user ADD CONSTRAINT FK_92CFD9FEFE54D947 FOREIGN KEY (group_id) REFERENCES c_group_info (iid)");
$queries->addQuery("ALTER TABLE question_field_values ADD CONSTRAINT FK_83093BA61E27F6BF FOREIGN KEY (question_id) REFERENCES c_quiz_question (iid)");
}
public function down(Schema $schema, QueryBag $queries)
{
$queries->addQuery("ALTER TABLE c_dropbox_file DROP FOREIGN KEY FK_4D71B46C16678C77");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C18129F6EE60");
$queries->addQuery("ALTER TABLE c_dropbox_post DROP FOREIGN KEY FK_9B64EEF17737EAA1");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C18191D79BD3");
$queries->addQuery("ALTER TABLE c_dropbox_post DROP FOREIGN KEY FK_9B64EEF193CB796C");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181330D47E9");
$queries->addQuery("ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181ED97CA4");
$queries->addQuery("ALTER TABLE c_quiz_category DROP FOREIGN KEY FK_2AF3F510727ACA70");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category DROP FOREIGN KEY FK_A468585C12469DE2");
$queries->addQuery("ALTER TABLE c_quiz_question_rel_category DROP FOREIGN KEY FK_A468585C1E27F6BF");
$queries->addQuery("ALTER TABLE c_tool DROP FOREIGN KEY FK_8456658091D79BD3");
$queries->addQuery("ALTER TABLE course_rel_user DROP FOREIGN KEY FK_92CFD9FEFE54D947");
$queries->addQuery("ALTER TABLE question_field_values DROP FOREIGN KEY FK_83093BA61E27F6BF");
$queries->addQuery("DROP TABLE c_forum_notification");
$queries->addQuery("DROP TABLE c_wiki");
$queries->addQuery("DROP TABLE c_course_setting");
$queries->addQuery("DROP TABLE c_permission_task");
$queries->addQuery("DROP TABLE c_dropbox_category");
$queries->addQuery("DROP TABLE c_wiki_discuss");
$queries->addQuery("DROP TABLE c_dropbox_file");
$queries->addQuery("DROP TABLE c_quiz_rel_question");
$queries->addQuery("DROP TABLE c_calendar_event");
$queries->addQuery("DROP TABLE c_blog_rating");
$queries->addQuery("DROP TABLE c_quiz_category");
$queries->addQuery("DROP TABLE c_thematic");
$queries->addQuery("DROP TABLE c_survey");
$queries->addQuery("DROP TABLE c_announcement_attachment");
$queries->addQuery("DROP TABLE c_lp");
$queries->addQuery("DROP TABLE c_quiz_order");
$queries->addQuery("DROP TABLE c_lp_iv_objective");
$queries->addQuery("DROP TABLE c_dropbox_person");
$queries->addQuery("DROP TABLE c_announcement");
$queries->addQuery("DROP TABLE c_survey_answer");
$queries->addQuery("DROP TABLE c_forum_thread_qualify");
$queries->addQuery("DROP TABLE c_blog_post");
$queries->addQuery("DROP TABLE c_group_category");
$queries->addQuery("DROP TABLE c_forum_forum");
$queries->addQuery("DROP TABLE c_lp_item");
$queries->addQuery("DROP TABLE c_group_rel_user");
$queries->addQuery("DROP TABLE c_lp_view");
$queries->addQuery("DROP TABLE c_link_category");
$queries->addQuery("DROP TABLE c_quiz");
$queries->addQuery("DROP TABLE c_quiz_rel_category");
$queries->addQuery("DROP TABLE c_tool_intro");
$queries->addQuery("DROP TABLE c_forum_attachment");
$queries->addQuery("DROP TABLE c_lp_category");
$queries->addQuery("DROP TABLE c_blog_task");
$queries->addQuery("DROP TABLE c_wiki_conf");
$queries->addQuery("DROP TABLE c_attendance_sheet");
$queries->addQuery("DROP TABLE c_calendar_event_repeat");
$queries->addQuery("DROP TABLE c_calendar_event_repeat_not");
$queries->addQuery("DROP TABLE c_calendar_event_attachment");
$queries->addQuery("DROP TABLE c_student_publication_rel_document");
$queries->addQuery("DROP TABLE c_quiz_answer");
$queries->addQuery("DROP TABLE c_forum_category");
$queries->addQuery("DROP TABLE c_course_description");
$queries->addQuery("DROP TABLE c_quiz_question_rel_category");
$queries->addQuery("DROP TABLE c_blog_rel_user");
$queries->addQuery("DROP TABLE c_thematic_advance");
$queries->addQuery("DROP TABLE c_attendance_result");
$queries->addQuery("DROP TABLE c_document");
$queries->addQuery("DROP TABLE c_item_property");
$queries->addQuery("DROP TABLE c_attendance");
$queries->addQuery("DROP TABLE c_online_connected");
$queries->addQuery("DROP TABLE c_thematic_plan");
$queries->addQuery("DROP TABLE c_glossary");
$queries->addQuery("DROP TABLE c_lp_iv_interaction");
$queries->addQuery("DROP TABLE c_group_rel_tutor");
$queries->addQuery("DROP TABLE c_wiki_mailcue");
$queries->addQuery("DROP TABLE c_survey_question");
$queries->addQuery("DROP TABLE c_blog_task_rel_user");
$queries->addQuery("DROP TABLE c_survey_question_option");
$queries->addQuery("DROP TABLE c_dropbox_feedback");
$queries->addQuery("DROP TABLE c_forum_thread_qualify_log");
$queries->addQuery("DROP TABLE c_forum_mailcue");
$queries->addQuery("DROP TABLE c_attendance_sheet_log");
$queries->addQuery("DROP TABLE c_survey_group");
$queries->addQuery("DROP TABLE c_dropbox_post");
$queries->addQuery("DROP TABLE c_online_link");
$queries->addQuery("DROP TABLE c_blog");
$queries->addQuery("DROP TABLE c_student_publication_rel_user");
$queries->addQuery("DROP TABLE c_forum_post");
$queries->addQuery("DROP TABLE c_lp_item_view");
$queries->addQuery("DROP TABLE c_student_publication");
$queries->addQuery("DROP TABLE c_blog_comment");
$queries->addQuery("DROP TABLE c_forum_thread");
$queries->addQuery("DROP TABLE c_permission_group");
$queries->addQuery("DROP TABLE c_survey_invitation");
$queries->addQuery("DROP TABLE c_blog_attachment");
$queries->addQuery("DROP TABLE c_tool");
$queries->addQuery("DROP TABLE c_link");
$queries->addQuery("DROP TABLE c_quiz_question_option");
$queries->addQuery("DROP TABLE c_student_publication_assignment");
$queries->addQuery("DROP TABLE c_attendance_calendar");
$queries->addQuery("DROP TABLE c_permission_user");
$queries->addQuery("DROP TABLE c_student_publication_comment");
$queries->addQuery("DROP TABLE c_chat_connected");
$queries->addQuery("DROP TABLE c_group_info");
}
}

@ -2,9 +2,10 @@
namespace ChamiloLMS\InstallerBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\Console\Application;
use ChamiloLMS\InstallerBundle\Command\InstallCommand;
use ChamiloLMS\InstallerBundle\DependencyInjection\Compiler\InstallerPass;
/**
* Class ChamiloLMSInstallerBundle
@ -13,34 +14,12 @@ use ChamiloLMS\InstallerBundle\Command\InstallCommand;
class ChamiloLMSInstallerBundle extends Bundle
{
/**
* @param Application $application
* {@inheritdoc}
*/
public function registerCommands(Application $application)
public function build(ContainerBuilder $container)
{
$application->addCommands(array(
// DBAL Commands.
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
// Migrations Commands.
new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
// Chash commands.
//new UpgradeCommand(),
new InstallCommand(),
new \Chash\Command\Installation\InstallCommand(),
parent::build($container);
new \Chash\Command\Files\CleanCoursesFilesCommand(),
new \Chash\Command\Files\CleanTempFolderCommand(),
new \Chash\Command\Files\CleanConfigFilesCommand(),
new \Chash\Command\Files\MailConfCommand(),
new \Chash\Command\Files\SetPermissionsAfterInstallCommand(),
new \Chash\Command\Files\GenerateTempFileStructureCommand()
));
$container->addCompilerPass(new InstallerPass());
}
}

@ -0,0 +1,249 @@
<?php
namespace ChamiloLMS\InstallerBundle;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\Process\ProcessBuilder;
use Oro\Bundle\CacheBundle\Manager\OroDataCacheManager;
use Oro\Bundle\InstallerBundle\Process\PhpExecutableFinder;
class CommandExecutor
{
/**
* @var string|null
*/
protected $env;
/**
* @var OutputInterface
*/
protected $output;
/**
* @var Application
*/
protected $application;
/**
* @var OroDataCacheManager
*/
protected $dataCacheManager;
/**
* @var int
*/
protected $lastCommandExitCode;
/**
* @var int
*/
protected $defaultTimeout = 300;
/**
* Constructor
*
* @param string|null $env
* @param OutputInterface $output
* @param Application $application
* @param OroDataCacheManager $dataCacheManager
*/
public function __construct(
$env,
OutputInterface $output,
Application $application,
OroDataCacheManager $dataCacheManager = null
) {
$this->env = $env;
$this->output = $output;
$this->application = $application;
$this->dataCacheManager = $dataCacheManager;
}
/**
* Launches a command.
* If '--process-isolation' parameter is specified the command will be launched as a separate process.
* In this case you can parameter '--process-timeout' to set the process timeout
* in seconds. Default timeout is 300 seconds.
* If '--ignore-errors' parameter is specified any errors are ignored;
* otherwise, an exception is raises if an error happened.
*
* @param string $command
* @param array $params
* @return CommandExecutor
* @throws \RuntimeException if command failed and '--ignore-errors' parameter is not specified
*/
public function runCommand($command, $params = [])
{
$params = array_merge(
[
'command' => $command
],
$params
);
if ($this->env && $this->env !== 'dev') {
$params['--env'] = $this->env;
}
$ignoreErrors = false;
if (array_key_exists('--ignore-errors', $params)) {
$ignoreErrors = true;
unset($params['--ignore-errors']);
}
if (array_key_exists('--process-isolation', $params)) {
unset($params['--process-isolation']);
$pb = new ProcessBuilder();
$pb
->add($this->getPhp())
->add($_SERVER['argv'][0]);
if (array_key_exists('--process-timeout', $params)) {
$pb->setTimeout($params['--process-timeout']);
unset($params['--process-timeout']);
} else {
$pb->setTimeout($this->defaultTimeout);
}
foreach ($params as $name => $val) {
$this->processParameter($pb, $name, $val);
}
$process = $pb
->inheritEnvironmentVariables(true)
->getProcess();
$output = $this->output;
$process->run(
function ($type, $data) use ($output) {
$output->write($data);
}
);
$this->lastCommandExitCode = $process->getExitCode();
// synchronize all data caches
if ($this->dataCacheManager) {
$this->dataCacheManager->sync();
}
} else {
$this->application->setAutoExit(false);
$this->lastCommandExitCode = $this->application->run(new ArrayInput($params), $this->output);
}
$this->processResult($ignoreErrors);
return $this;
}
/**
* Gets an exit code of last executed command
*
* @return int
*/
public function getLastCommandExitCode()
{
return $this->lastCommandExitCode;
}
/**
* @param bool $ignoreErrors
* @throws \RuntimeException
*/
protected function processResult($ignoreErrors)
{
if (0 !== $this->lastCommandExitCode) {
if ($ignoreErrors) {
$this->output->writeln(
sprintf(
'<error>The command terminated with an exit code: %u.</error>',
$this->lastCommandExitCode
)
);
} else {
throw new \RuntimeException(
sprintf('The command terminated with an exit code: %u.', $this->lastCommandExitCode)
);
}
}
}
/**
* @param ProcessBuilder $pb
* @param string $name
* @param array|string|null $value
*/
protected function processParameter(ProcessBuilder $pb, $name, $value)
{
if ($name && '-' === $name[0]) {
if ($value === true) {
$this->addParameter($pb, $name);
} else {
$this->addParameter($pb, $name, $value);
}
} else {
$this->addParameter($pb, $value);
}
}
/**
* @param ProcessBuilder $pb
* @param string $name
* @param array|string|null $value
*/
protected function addParameter(ProcessBuilder $pb, $name, $value = null)
{
$parameters = array();
if (null !== $value) {
if (is_array($value)) {
foreach ($value as $item) {
$parameters[] = sprintf('%s=%s', $name, $item);
}
} else {
$parameters[] = sprintf('%s=%s', $name, $value);
}
} else {
$parameters[] = $name;
}
foreach ($parameters as $parameter) {
$pb->add($parameter);
}
}
/**
* Finds the PHP executable.
*
* @return string
* @throws FileNotFoundException
*/
protected function getPhp()
{
$phpFinder = new PhpExecutableFinder();
$phpPath = $phpFinder->find();
if (!$phpPath) {
throw new FileNotFoundException('The PHP executable could not be found.');
}
return $phpPath;
}
/**
* @return int
*/
public function getDefaultTimeout()
{
return $this->defaultTimeout;
}
/**
* @param int $defaultTimeout
*/
public function setDefaultTimeout($defaultTimeout)
{
$this->defaultTimeout = $defaultTimeout;
}
}

@ -0,0 +1,18 @@
<?php
namespace ChamiloLMS\InstallerBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader;
class ChamiloLMSInstallerExtension extends Extension
{
public function load(array $config, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$loader->load('form.yml');
}
}

@ -0,0 +1,30 @@
<?php
namespace ChamiloLMS\InstallerBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class InstallerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
// we have to add installer listener even if the application is already installed
// this is required because we are clearing the cache on the last installation step
// and as the result the login page is appeared instead of the final installer page
//if ($container->hasParameter('installed') && $container->getParameter('installed')) {
// return;
//}
$listener = $container->getDefinition('kernel.listener.install.event');
$listener->addTag(
'kernel.event_listener',
array(
'priority' => 10,
'event' => 'kernel.request',
'method' => 'onRequest'
)
);
}
}

@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('chamilo_installer')
->addDefaultsIfNotSet()
->children()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->arrayNode('user')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->isRequired()->end()
->end()
->end()
->end()
->end()
->end()
;
return $treeBuilder;
}
}

@ -0,0 +1,87 @@
<?php
namespace ChamiloLMS\InstallerBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
class RequestListener
{
/**
* @var Router
*/
protected $router;
/**
* Installed flag
*
* @var bool
*/
protected $installed;
/**
* Debug flag
*
* @var bool
*/
protected $debug;
/**
*
*/
public function __construct(RouterInterface $router, $installed, $debug = false)
{
$this->router = $router;
$this->installed = $installed;
$this->debug = $debug;
}
public function onRequest(GetResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
return;
}
if (!$this->installed) {
$allowedRoutes = array(
'chamilo_installer_flow',
'sylius_flow_display',
'sylius_flow_forward',
);
if ($this->debug) {
$allowedRoutes = array_merge(
$allowedRoutes,
array(
'_wdt',
'_profiler',
'_profiler_search',
'_profiler_search_bar',
'_profiler_search_results',
'_profiler_router',
)
);
}
if (!in_array($event->getRequest()->get('_route'), $allowedRoutes)) {
$event->setResponse(new RedirectResponse($event->getRequest()->getBasePath() . '/install.php'));
}
$event->stopPropagation();
} else {
// allow open the installer even if the application is already installed
// this is required because we are clearing the cache on the last installation step
// and as the result the login page is appeared instead of the final installer page
if ($event->getRequest()->attributes->get('scenarioAlias') === 'chamilo_installer' &&
(
$event->getRequest()->attributes->get('_route') === 'sylius_flow_forward' ||
$event->getRequest()->attributes->get('_route') === 'sylius_flow_display'
)
) {
$event->stopPropagation();
}
}
}
}

@ -0,0 +1,78 @@
<?php
namespace ChamiloLMS\InstallerBundle\Form\Type\Configuration;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
class DatabaseType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'chamilo_installer_database_host',
'text',
array(
'label' => 'form.configuration.database.host',
'constraints' => array(
new Assert\NotBlank(),
),
)
)
->add(
'chamilo_installer_database_port',
'integer',
array(
'label' => 'form.configuration.database.port',
'required' => false,
'constraints' => array(
new Assert\Type(array('type' => 'integer')),
),
)
)
->add(
'chamilo_installer_database_name',
'text',
array(
'label' => 'form.configuration.database.name',
'constraints' => array(
new Assert\NotBlank(),
),
)
)
->add(
'chamilo_installer_database_user',
'text',
array(
'label' => 'form.configuration.database.user',
'constraints' => array(
new Assert\NotBlank(),
),
)
)
->add(
'chamilo_installer_database_password',
'password',
array(
'label' => 'form.configuration.database.password',
'required' => false,
)
)
->add(
'chamilo_installer_database_drop_full',
'checkbox',
array(
'label' => 'form.configuration.database.drop_full',
'required' => false,
'data' => false,
)
);
}
public function getName()
{
return 'chamilo_installer_configuration_database';
}
}

@ -0,0 +1,104 @@
<?php
namespace ChamiloLMS\InstallerBundle\Form\Type\Configuration;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class MailerType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'chamilo_installer_mailer_transport',
'choice',
array(
'label' => 'form.configuration.mailer.transport',
'preferred_choices' => array('mail'),
'choices' => array(
'mail' => 'PHP mail',
'smtp' => 'SMTP',
'sendmail' => 'sendmail',
),
'constraints' => array(
new Assert\NotBlank(),
),
//'client_validation' => false,
)
)
->add(
'chamilo_installer_mailer_host',
'text',
array(
'label' => 'form.configuration.mailer.host',
'constraints' => array(
new Assert\NotBlank(array('groups' => array('SMTP'))),
),
)
)
->add(
'chamilo_installer_mailer_port',
'integer',
array(
'label' => 'form.configuration.mailer.port',
'required' => false,
'constraints' => array(
new Assert\Type(array('groups' => array('SMTP'), 'type' => 'integer')),
),
)
)
->add(
'chamilo_installer_mailer_encryption',
'choice',
array(
'label' => 'form.configuration.mailer.encryption',
'required' => false,
'preferred_choices' => array(''),
'choices' => array(
'' => 'None',
'ssl' => 'SSL',
'tls' => 'TLS',
),
//'client_validation' => false,
)
)
->add(
'chamilo_installer_mailer_user',
'text',
array(
'label' => 'form.configuration.mailer.user',
'required' => false,
)
)
->add(
'chamilo_installer_mailer_password',
'password',
array(
'label' => 'configuration.mailer.password',
'required' => false,
)
);
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'validation_groups' => function (FormInterface $form) {
$data = $form->getData();
return 'smtp' == $data['chamilo_installer_mailer_transport']
? array('Default', 'SMTP')
: array('Default');
},
));
}
public function getName()
{
return 'chamilo_installer_configuration_mailer';
}
}

@ -0,0 +1,44 @@
<?php
namespace ChamiloLMS\InstallerBundle\Form\Type\Configuration;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
class SystemType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'chamilo_installer_locale',
'locale',
array(
'label' => 'form.configuration.system.locale',
'preferred_choices' => array('en'),
'constraints' => array(
new Assert\NotBlank(),
new Assert\Locale(),
),
//'client_validation' => false,
)
)
->add(
'chamilo_installer_secret',
'text',
array(
'label' => 'form.configuration.system.secret',
'data' => md5(uniqid()),
'constraints' => array(
new Assert\NotBlank(),
)
)
);
}
public function getName()
{
return 'chamilo_installer_configuration_system';
}
}

@ -0,0 +1,52 @@
<?php
namespace ChamiloLMS\InstallerBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use ChamiloLMS\InstallerBundle\Validator\Constraints as Assert;
class ConfigurationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'database',
'chamilo_installer_configuration_database',
array(
'label' => 'form.configuration.database.header',
'constraints' => array(
new Assert\DatabaseConnection(),
),
)
)
->add(
'mailer',
'chamilo_installer_configuration_mailer',
array(
'label' => 'form.configuration.mailer.header'
)
)
/*->add(
'websocket',
'chamilo_installer_configuration_websocket',
array(
'label' => 'form.configuration.websocket.header'
)
)*/
->add(
'system',
'chamilo_installer_configuration_system',
array(
'label' => 'form.configuration.system.header'
)
);
}
public function getName()
{
return 'chamilo_installer_configuration';
}
}

@ -0,0 +1,106 @@
<?php
namespace ChamiloLMS\InstallerBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints as Assert;
class SetupType extends AbstractType
{
protected $dataClass;
public function __construct($dataClass)
{
$this->dataClass = $dataClass;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'company_name',
'text',
array(
'label' => 'form.setup.company_name',
'mapped' => false,
'constraints' => array(
new Assert\NotBlank(),
new Assert\Length(array('max' => 15))
),
)
)
->add(
'company_title',
'text',
array(
'label' => 'form.setup.company_title',
'mapped' => false,
'required' => false,
)
)
->add(
'username',
'text',
array(
'label' => 'form.setup.username',
)
)
->add(
'plainPassword',
'repeated',
array(
'type' => 'password',
'invalid_message' => 'The password fields must match.',
'first_options' => array('label' => 'form.setup.password'),
'second_options' => array('label' => 'form.setup.password_re'),
)
)
->add(
'email',
'email',
array(
'label' => 'form.setup.email',
)
)
->add(
'firstName',
'text',
array(
'label' => 'form.setup.firstname',
)
)
->add(
'lastName',
'text',
array(
'label' => 'form.setup.lastname',
)
)
->add(
'loadFixtures',
'checkbox',
array(
'label' => 'form.setup.load_fixtures',
'required' => false,
'mapped' => false,
)
);
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(
array(
'data_class' => $this->dataClass,
'validation_groups' => array('Registration', 'Default'),
)
);
}
public function getName()
{
return 'chamilo_installer_setup';
}
}

@ -0,0 +1,13 @@
<?php
namespace ChamiloLMS\InstallerBundle;
final class InstallerEvents
{
/**
* The installer.finish event is thrown upon complete of a final step of the installation process.
*
* @var string
*/
const FINISH = 'installer.finish';
}

@ -0,0 +1,69 @@
<?php
namespace ChamiloLMS\InstallerBundle\Persister;
use Symfony\Component\Yaml\Yaml;
class YamlPersister
{
/**
* Path to parameters.yml file
*
* @var string
*/
protected $paramFile;
/**
* @param string $dir Path to parameters storage directory
* @param string $env Current environment
*/
public function __construct($dir, $env)
{
if (file_exists($file = $dir . '/parameters_' . $env . '.yml')) {
$this->paramFile = $file;
} elseif (file_exists($dir . '/parameters_' . $env . '.yml.dist')) {
$this->paramFile = $dir . '/parameters_' . $env . '.yml';
} else {
$this->paramFile = $dir . '/parameters.yml';
}
}
public function parse()
{
$data = Yaml::parse($this->paramFile);
if (!is_array($data) || !isset($data['parameters'])) {
return array();
}
$parameters = array();
foreach ($data['parameters'] as $key => $value) {
$section = explode('_', $key);
$section = isset($section[1]) ? $section[0] : 'system';
if (!isset($parameters[$section])) {
$parameters[$section] = array();
}
$parameters[$section]['chamilo_installer_' . $key] = $value;
}
return $parameters;
}
public function dump(array $data)
{
$parameters = array();
foreach ($data as $section) {
foreach ($section as $key => $value) {
$parameters[str_replace('chamilo_installer_', '', $key)] = $value;
}
}
if (false === file_put_contents($this->paramFile, Yaml::dump(array('parameters' => $parameters)))) {
throw new \RuntimeException(sprintf('Failed to write to %s.', $this->paramFile));
}
}
}

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Process;
use Sylius\Bundle\FlowBundle\Process\Builder\ProcessBuilderInterface;
use Sylius\Bundle\FlowBundle\Process\Scenario\ProcessScenarioInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class InstallerScenario extends ContainerAware implements ProcessScenarioInterface
{
/**
* {@inheritdoc}
*/
public function build(ProcessBuilderInterface $builder)
{
$builder
->add('welcome', new Step\WelcomeStep())
->add('configure', new Step\ConfigureStep())
->add('schema', new Step\SchemaStep())
->add('setup', new Step\SetupStep())
->add('installation', new Step\InstallationStep())
->add('final', new Step\FinalStep())
->setRedirect('homepage')
;
}
}

@ -0,0 +1,128 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use ChamiloLMS\InstallerBundle\CommandExecutor;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Console\Output\StreamOutput;
use Sylius\Bundle\FlowBundle\Process\Step\ControllerStep;
abstract class AbstractStep extends ControllerStep
{
/**
* @var Application
*/
protected $application;
/**
* @var StreamOutput
*/
protected $output;
/**
*
* @param string $command
* @param array $params
* @return mixed
*/
protected function handleAjaxAction($command, $params = array())
{
$exitCode = $this->runCommand($command, $params);
return $this->getRequest()->isXmlHttpRequest()
? new JsonResponse(array('result' => true, 'exitCode' => $exitCode))
: $this->redirect(
$this->generateUrl(
'sylius_flow_display',
array(
'scenarioAlias' => 'chamilo_installer',
'stepName' => $this->getName(),
)
)
);
}
/**
* Execute Symfony2 command
*
* @param string $command Command name (for example, "cache:clear")
* @param array $params [optional] Additional command parameters, like "--force" etc
* @return int an executed command exit code
* @throws \Exception
* @throws \RuntimeException
*/
protected function runCommand($command, $params = array())
{
$application = $this->getApplication();
$output = $this->getOutput();
$commandExecutor = new CommandExecutor(
$application->getKernel()->getEnvironment(),
$output,
$application
);
$output->writeln('');
$output->writeln(sprintf('[%s] Launching "%s" command', date('Y-m-d H:i:s'), $command));
error_log(sprintf('[%s] Launching "%s" command', date('Y-m-d H:i:s'), $command));
error_log($command);
error_log(print_r($params, 1));
$mem = (int)memory_get_usage() / (1024 * 1024);
$time = time();
$result = null;
try {
$commandExecutor->runCommand($command, $params);
$result = $commandExecutor->getLastCommandExitCode();
} catch (\RuntimeException $ex) {
$result = $ex;
error_log($ex->getMessage());
}
$output->writeln('');
$output->writeln(
sprintf(
'Command "%s" executed in %u second(s), memory usage: %.2fMb',
$command,
time() - $time,
(int)memory_get_usage() / (1024 * 1024) - $mem
)
);
$output->writeln('');
// check for any error
if ($result instanceof \RuntimeException) {
throw $result;
}
return $result;
}
/**
* @return Application
*/
protected function getApplication()
{
if (!$this->application) {
$this->application = new Application($this->get('kernel'));
$this->application->setAutoExit(false);
}
return $this->application;
}
/**
* @return StreamOutput
*/
protected function getOutput()
{
if (!$this->output) {
$this->output = new StreamOutput(
fopen($this->container->getParameter('kernel.logs_dir') . DIRECTORY_SEPARATOR . 'chamilo_install.log', 'a+')
);
}
return $this->output;
}
}

@ -0,0 +1,60 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
class ConfigureStep extends AbstractStep
{
public function displayAction(ProcessContextInterface $context)
{
if ($this->container->hasParameter('installed') && $this->container->getParameter('installed')) {
return $this->redirect($this->generateUrl('home'));
}
return $this->render(
'ChamiloLMSInstallerBundle:Process/Step:configure.html.twig',
array(
'form' => $this->createConfigurationForm()->createView()
)
);
}
public function forwardAction(ProcessContextInterface $context)
{
set_time_limit(600);
$form = $this->createConfigurationForm();
$form->handleRequest($this->getRequest());
if ($form->isValid()) {
$data = $form->getData();
$context->getStorage()->set(
'fullDatabase',
$form->has('database') &&
$form->get('database')->has('chamilo_installer_database_drop_full') &&
$form->get('database')->get('chamilo_installer_database_drop_full')->getData()
);
$this->get('chamilo_installer.yaml_persister')->dump($data);
return $this->complete();
}
return $this->render(
'ChamiloLMSInstallerBundle:Process/Step:configure.html.twig',
array(
'form' => $form->createView()
)
);
}
protected function createConfigurationForm()
{
$data = $this->get('chamilo_installer.yaml_persister')->parse();
return $this->createForm('chamilo_installer_configuration', empty($data) ? null : $data);
}
}

@ -0,0 +1,15 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
class FinalStep extends AbstractStep
{
public function displayAction(ProcessContextInterface $context)
{
$this->complete();
return $this->render('ChamiloLMSInstallerBundle:Process/Step:final.html.twig');
}
}

@ -0,0 +1,89 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use ChamiloLMS\InstallerBundle\InstallerEvents;
use ChamiloLMS\InstallerBundle\CommandExecutor;
use ChamiloLMS\InstallerBundle\ScriptExecutor;
class InstallationStep extends AbstractStep
{
public function displayAction(ProcessContextInterface $context)
{
set_time_limit(900);
$action = $this->getRequest()->query->get('action');
switch ($action) {
case 'fixtures':
return $this->handleAjaxAction('oro:migration:data:load', array('--fixtures-type' => 'demo'));
case 'navigation':
return $this->handleAjaxAction('oro:navigation:init');
// case 'js-routing':
// return $this->handleAjaxAction('fos:js-routing:dump', array('--target' => 'js/routes.js'));
case 'localization':
//return $this->handleAjaxAction('oro:localization:dump');
case 'assets':
/*return $this->handleAjaxAction(
'oro:assets:install',
array('target' => './', '--exclude' => ['OroInstallerBundle'])
);*/
return $this->handleAjaxAction(
'assets:install',
array('target' => '../web')
);
case 'assetic':
return $this->handleAjaxAction('assetic:dump');
case 'translation':
//return $this->handleAjaxAction('oro:translation:dump');
case 'requirejs':
//return $this->handleAjaxAction('oro:requirejs:build', array('--ignore-errors' => true));
case 'finish':
$this->get('event_dispatcher')->dispatch(InstallerEvents::FINISH);
// everything was fine - update installed flag in parameters.yml
$dumper = $this->get('chamilo_installer.yaml_persister');
$params = $dumper->parse();
$params['system']['installed'] = date('c');
$dumper->dump($params);
// launch 'cache:clear' to set installed flag in DI container
// suppress warning: ini_set(): A session is active. You cannot change the session
// module's ini settings at this time
error_reporting(E_ALL ^ E_WARNING);
return $this->handleAjaxAction('cache:clear');
}
// check if we have package installation step
if (strpos($action, 'installerScript-') !== false) {
$scriptFile = $this->container->get('chamilo_installer.script_manager')->getScriptFileByKey(
str_replace('installerScript-', '', $action)
);
$scriptExecutor = new ScriptExecutor(
$this->getOutput(),
$this->container,
new CommandExecutor(
$this->container->getParameter('kernel.environment'),
$this->getOutput(),
$this->getApplication()
)
);
$scriptExecutor->runScript($scriptFile);
return new JsonResponse(array('result' => true));
}
return $this->render(
'ChamiloLMSInstallerBundle:Process/Step:installation.html.twig',
array(
'loadFixtures' => $context->getStorage()->get('loadFixtures'),
'installerScripts' => $this
->container
->get('chamilo_installer.script_manager')
->getScriptLabels(),
)
);
}
}

@ -0,0 +1,43 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
class SchemaStep extends AbstractStep
{
public function displayAction(ProcessContextInterface $context)
{
set_time_limit(600);
switch ($this->getRequest()->query->get('action')) {
case 'cache':
// suppress warning: ini_set(): A session is active. You cannot change the session
// module's ini settings at this time
error_reporting(E_ALL ^ E_WARNING);
return $this->handleAjaxAction('cache:clear', array('--no-optional-warmers' => true));
/*case 'clear-config':
return $this->handleAjaxAction('oro:entity-config:cache:clear', array('--no-warmup' => true));*/
/*case 'clear-extend':
return $this->handleAjaxAction('oro:entity-extend:cache:clear', array('--no-warmup' => true));*/
case 'schema-drop':
return $this->handleAjaxAction(
'doctrine:schema:drop',
array('--force' => true, '--full-database' => $context->getStorage()->get('fullDatabase', false))
);
case 'schema-update':
return $this->handleAjaxAction('oro:migration:load', array('--force' => true));
case 'fixtures':
return $this->handleAjaxAction(
'oro:migration:data:load',
array('--no-interaction' => true)
);
/*case 'workflows':
return $this->handleAjaxAction('oro:workflow:definitions:load');
case 'processes':
return $this->handleAjaxAction('oro:process:configuration:load');*/
}
return $this->render('ChamiloLMSInstallerBundle:Process/Step:schema.html.twig');
}
}

@ -0,0 +1,80 @@
<?php
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use ChamiloLMS\CoreBundle\Migrations\Data\ORM\LoadAdminUserData;
//use Oro\Bundle\ConfigBundle\Config\ConfigManager;
use Application\Sonata\UserBundle\Entity\User;
class SetupStep extends AbstractStep
{
public function displayAction(ProcessContextInterface $context)
{
$form = $this->createForm('chamilo_installer_setup');
/** @var ConfigManager $configManager */
//$configManager = $this->get('oro_config.global');
//$form->get('company_name')->setData($configManager->get('oro_ui.application_name'));
//$form->get('company_title')->setData($configManager->get('oro_ui.application_title'));
return $this->render(
'ChamiloLMSInstallerBundle:Process/Step:setup.html.twig',
array(
'form' => $form->createView()
)
);
}
public function forwardAction(ProcessContextInterface $context)
{
$adminUser = $this
->getDoctrine()
->getRepository('ApplicationSonataUserBundle:User')
->findOneBy(array('username' => LoadAdminUserData::DEFAULT_ADMIN_USERNAME));
if (!$adminUser) {
throw new \RuntimeException("Admin user wasn't loaded in fixtures.");
}
$form = $this->createForm('chamilo_installer_setup');
$form->setData($adminUser);
$form->handleRequest($this->getRequest());
if ($form->isValid()) {
// pass "load demo fixtures" flag to the next step
$context->getStorage()->set(
'loadFixtures',
$form->has('loadFixtures') && $form->get('loadFixtures')->getData()
);
$this->get('fos_user.user_manager')->updateUser($adminUser);
// update company name and title if specified
/** @var ConfigManager $configManager */
/*
$configManager = $this->get('oro_config.global');
$defaultCompanyName = $configManager->get('oro_ui.application_name');
$defaultCompanyTitle = $configManager->get('oro_ui.application_title');
$companyName = $form->get('company_name')->getData();
$companyTitle = $form->get('company_title')->getData();
if (!empty($companyName) && $companyName !== $defaultCompanyName) {
$configManager->set('oro_ui.application_name', $companyName);
}
if (!empty($companyTitle) && $companyTitle !== $defaultCompanyTitle) {
$configManager->set('oro_ui.application_title', $companyTitle);
}
$configManager->flush();
*/
return $this->complete();
}
return $this->render(
'ChamiloLMSInstallerBundle:Process/Step:setup.html.twig',
array(
'form' => $form->createView()
)
);
}
}

@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Process\Step;
use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use Sylius\Bundle\FlowBundle\Process\Step\ControllerStep;
class WelcomeStep extends ControllerStep
{
/**
* {@inheritdoc}
*/
public function displayAction(ProcessContextInterface $context)
{
return $this->render('ChamiloLMSInstallerBundle:Process/Step:welcome.html.twig');
}
/**
* {@inheritdoc}
*/
public function forwardAction(ProcessContextInterface $context)
{
return $this->complete();
}
}

@ -0,0 +1,99 @@
InstallerBundle
==================
Web installer. Inspired by [Sylius](https://github.com/Sylius/SyliusInstallerBundle).
To run the installer on existing setup, you need to update parameters.yml file:
``` yaml
# ...
session_handler: ~
installed: ~
```
## Usage ##
If you are using distribution package, you will be redirected to installer page automatically.
Otherwise, following installation instructions offered:
``` bash
$ 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
```
## Events ##
To add additional actions to the installation process you may use event listeners.
Currently only "onFinish" installer event dispatched.
Example:
``` yaml
services:
installer.listener.finish.event:
class: Acme\Bundle\MyBundle\EventListener\MyListener
tags:
- { name: kernel.event_listener, event: installer.finish, method: onFinish }
```
``` php
<?php
namespace Acme\Bundle\MyBundle\EventListener;
class MyListener
{
public function onFinish()
{
// do something
}
}
```
## Sample data ##
To provide demo fixtures for your bundle just place them in "YourBundle\Data\Demo" directory.
## Additional install files in bundles and packages ##
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
<?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](./CommandExecutor.php) class. You can use it to execute Symfony console commands
All outputs from installer script will be logged in chamilo_install.log file or will be shown in console in you use console installer.
## Launching plain PHP script in Chamilo context ##
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
<?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](./CommandExecutor.php) class. You can use it to execute Symfony console commands

@ -0,0 +1,175 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
use ReflectionExtension;
use Symfony\Component\Translation\TranslatorInterface;
class ExtensionsRequirements extends RequirementCollection
{
public function __construct(TranslatorInterface $translator)
{
parent::__construct($translator->trans('sylius.extensions', array(), 'requirements'));
$on = $translator->trans('sylius.extensions.on', array(), 'requirements');
$off = $translator->trans('sylius.extensions.off', array(), 'requirements');
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
$this
->add(new Requirement(
$translator->trans('sylius.extensions.json_encode', array(), 'requirements'),
$status = function_exists('json_encode'),
$on,
$status ? $on : $off,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'JSON'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.session_start', array(), 'requirements'),
$status = function_exists('session_start'),
$on,
$status ? $on : $off,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'session'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.ctype', array(), 'requirements'),
$status = function_exists('ctype_alpha'),
$on,
$status ? $on : $off,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'ctype'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.token_get_all', array(), 'requirements'),
$status = function_exists('token_get_all'),
$on,
$status ? $on : $off,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'JSON'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.simplexml_import_dom', array(), 'requirements'),
$status = function_exists('simplexml_import_dom'),
$on,
$status ? $on : $off,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'SimpleXML'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.apc', array(), 'requirements'),
!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='),
'>=3.0.17',
phpversion('apc'),
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'APC (>=3.0.17)'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.pcre', array(), 'requirements'),
null !== $pcreVersion && $pcreVersion > 8.0,
'>=8.0',
$pcreVersion,
true,
$translator->trans('sylius.extensions.help', array('%extension%' => 'PCRE (>=8.0)'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.php_xml', array(), 'requirements'),
$status = class_exists('DomDocument'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'PHP-XML'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.mbstring', array(), 'requirements'),
$status = function_exists('mb_strlen'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'mbstring'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.iconv', array(), 'requirements'),
$status = function_exists('iconv'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'iconv'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.intl', array(), 'requirements'),
$status = class_exists('Locale'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'intl'), 'requirements')
))
;
if (class_exists('Locale')) {
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
$reflector = new ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
$version = $matches[1];
}
$this->add(new Requirement(
$translator->trans('sylius.extensions.icu', array(), 'requirements'),
version_compare($version, '4.0', '>='),
'4.0',
$version,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'ICU (>=4.0)'), 'requirements')
));
}
$status = (function_exists('apc_store') && ini_get('apc.enabled'))
|| function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
|| function_exists('xcache_set')
;
$this
->add(new Requirement(
$translator->trans('sylius.extensions.accelerator', array(), 'requirements'),
$status,
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.accelerator.help', array(), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.pdo', array(), 'requirements'),
$status = class_exists('PDO'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'PDO'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.extensions.gd', array(), 'requirements'),
$status = defined('GD_VERSION'),
$on,
$status ? $on : $off,
false,
$translator->trans('sylius.extensions.help', array('%extension%' => 'gd'), 'requirements')
))
;
}
}

@ -0,0 +1,60 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
use Symfony\Component\Translation\TranslatorInterface;
class FilesystemRequirements extends RequirementCollection
{
public function __construct(TranslatorInterface $translator, $root)
{
parent::__construct($translator->trans('sylius.filesystem', array(), 'requirements'));
$exists = $translator->trans('sylius.filesystem.exists', array(), 'requirements');
$notExists = $translator->trans('sylius.filesystem.not_exists', array(), 'requirements');
$writable = $translator->trans('sylius.filesystem.writable', array(), 'requirements');
$notWritable = $translator->trans('sylius.filesystem.not_writable', array(), 'requirements');
$this
->add(new Requirement(
$translator->trans('sylius.filesystem.vendors', array(), 'requirements'),
$status = is_dir($root.'/../vendor'),
$exists,
$status ? $exists : $notExists
))
->add(new Requirement(
$translator->trans('sylius.filesystem.cache', array(), 'requirements'),
$status = is_writable($root.'/cache'),
$translator->trans('sylius.filesystem.writable', array(), 'requirements'),
$status ? $translator->trans('sylius.filesystem.writable', array(), 'requirements') : $translator->trans('sylius.filesystem.not_writable', array(), 'requirements'),
true,
$translator->trans('sylius.filesystem.cache.help', array('%path%' => $root.'/cache'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.filesystem.logs', array(), 'requirements'),
$status = is_writable($root.'/logs'),
$writable,
$status ? $writable : $notWritable,
true,
$translator->trans('sylius.filesystem.logs.help', array('%path%' => $root.'/logs'), 'requirements')
))
->add(new Requirement(
$translator->trans('sylius.filesystem.parameters', array(), 'requirements'),
$status = is_writable($root.'/config/parameters.yml'),
$writable,
$status ? $writable : $notWritable,
true,
$translator->trans('sylius.filesystem.parameters.help', array('%path%' => $root.'/config/parameters.yml'), 'requirements')
))
;
}
}

@ -0,0 +1,62 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
class Requirement
{
protected $label;
protected $fulfilled;
protected $expected;
protected $actual;
protected $help;
protected $required;
public function __construct($label, $fulfilled, $expected, $actual, $required = true, $help = null)
{
$this->label = $label;
$this->fulfilled = (Boolean) $fulfilled;
$this->expected = $expected;
$this->actual = $actual;
$this->required = (Boolean) $required;
$this->help = $help;
}
public function getLabel()
{
return $this->label;
}
public function isFulfilled()
{
return $this->fulfilled;
}
public function getExpected()
{
return $this->expected;
}
public function getActual()
{
return $this->actual;
}
public function isRequired()
{
return $this->required;
}
public function getHelp()
{
return $this->help;
}
}

@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
use ArrayIterator;
use IteratorAggregate;
class RequirementCollection implements IteratorAggregate
{
protected $label;
protected $requirements = array();
public function __construct($label)
{
$this->label = $label;
}
public function getLabel()
{
return $this->label;
}
public function getIterator()
{
return new ArrayIterator($this->requirements);
}
public function add(Requirement $requirement)
{
$this->requirements[] = $requirement;
return $this;
}
}

@ -0,0 +1,113 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
use DateTimeZone;
use Symfony\Component\Translation\TranslatorInterface;
class SettingsRequirements extends RequirementCollection
{
const REQUIRED_PHP_VERSION = '5.3.3';
public function __construct(TranslatorInterface $translator)
{
parent::__construct($translator->trans('sylius.settings', array(), 'requirements'));
$on = $translator->trans('sylius.settings.on', array(), 'requirements');
$off = $translator->trans('sylius.settings.off', array(), 'requirements');
$this
->add(new Requirement(
$translator->trans('sylius.settings.version', array(), 'requirements'),
version_compare(phpversion(), self::REQUIRED_PHP_VERSION, '>='),
'>='.self::REQUIRED_PHP_VERSION,
phpversion()
))
->add(new Requirement(
$translator->trans('sylius.settings.version_recommanded', array(), 'requirements'),
version_compare(phpversion(), '5.3.8', '>='),
'>=5.3.8',
phpversion(),
false
))
/*->add(new Requirement(
$translator->trans('sylius.settings.timezone', array(), 'requirements'),
$this->isOn('date.timezone'),
$translator->trans('sylius.settings.any', array(), 'requirements'),
ini_get('date.timezone')
))*/
;
if (version_compare(phpversion(), self::REQUIRED_PHP_VERSION, '>=')) {
$this->add(new Requirement(
$translator->trans('sylius.settings.timezone_deprecated', array(), 'requirements'),
in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers()),
$translator->trans('sylius.settings.non_deprecated', array(), 'requirements'),
date_default_timezone_get(),
true,
$translator->trans('sylius.settings.timezone_deprecated.help', array('%timezone%' => date_default_timezone_get()), 'requirements')
));
}
$this
->add(new Requirement(
$translator->trans('sylius.settings.detect_unicode', array(), 'requirements'),
!$this->isOn('detect_unicode'),
$on,
ini_get('detect_unicode'),
false
))
->add(new Requirement(
$translator->trans('sylius.settings.detect_unicode', array(), 'requirements'),
!$this->isOn('detect_unicode'),
$on,
ini_get('detect_unicode'),
false
))
->add(new Requirement(
$translator->trans('sylius.settings.short_open_tag', array(), 'requirements'),
!$this->isOn('short_open_tag'),
$off,
ini_get('short_open_tag'),
false
))
->add(new Requirement(
$translator->trans('sylius.settings.magic_quotes_gpc', array(), 'requirements'),
!$this->isOn('magic_quotes_gpc'),
$off,
ini_get('magic_quotes_gpc'),
false
))
->add(new Requirement(
$translator->trans('sylius.settings.register_globals', array(), 'requirements'),
!$this->isOn('register_globals'),
$off,
ini_get('register_globals'),
false
))
->add(new Requirement(
$translator->trans('sylius.settings.session.auto_start', array(), 'requirements'),
!$this->isOn('session.auto_start'),
$off,
ini_get('session.auto_start'),
false
))
;
}
private function isOn($key)
{
$value = ini_get($key);
return false != $value && 'off' !== $value;
}
}

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ChamiloLMS\InstallerBundle\Requirement;
use ArrayIterator;
use IteratorAggregate;
class SyliusRequirements implements IteratorAggregate
{
protected $collections = array();
public function __construct(array $requirementCollections)
{
foreach ($requirementCollections as $requirementCollection) {
$this->add($requirementCollection);
}
}
public function getIterator()
{
return new ArrayIterator($this->collections);
}
public function add(RequirementCollection $collection)
{
$this->collections[] = $collection;
return $this;
}
}

@ -0,0 +1,40 @@
parameters:
chamilo_installer.form.type.configuration.class: ChamiloLMS\InstallerBundle\Form\Type\ConfigurationType
chamilo_installer.form.type.configuration.database.class: ChamiloLMS\InstallerBundle\Form\Type\Configuration\DatabaseType
chamilo_installer.form.type.configuration.mailer.class: ChamiloLMS\InstallerBundle\Form\Type\Configuration\MailerType
chamilo_installer.form.type.configuration.system.class: ChamiloLMS\InstallerBundle\Form\Type\Configuration\SystemType
# chamilo_installer.form.type.configuration.ws.class: ChamiloLMS\InstallerBundle\Form\Type\Configuration\WebsocketType
chamilo_installer.form.type.setup.class: ChamiloLMS\InstallerBundle\Form\Type\SetupType
services:
chamilo_installer.form.type.configuration:
class: %chamilo_installer.form.type.configuration.class%
tags:
- { name: form.type, alias: chamilo_installer_configuration }
chamilo_installer.form.type.configuration.database:
class: %chamilo_installer.form.type.configuration.database.class%
tags:
- { name: form.type, alias: chamilo_installer_configuration_database }
chamilo_installer.form.type.configuration.mailer:
class: %chamilo_installer.form.type.configuration.mailer.class%
tags:
- { name: form.type, alias: chamilo_installer_configuration_mailer }
chamilo_installer.form.type.configuration.system:
class: %chamilo_installer.form.type.configuration.system.class%
tags:
- { name: form.type, alias: chamilo_installer_configuration_system }
# chamilo_installer.form.type.configuration.websocket:
# class: %chamilo_installer.form.type.configuration.ws.class%
# tags:
# - { name: form.type, alias: chamilo_installer_configuration_websocket }
chamilo_installer.form.type.setup:
class: %chamilo_installer.form.type.setup.class%
arguments:
- Application\Sonata\UserBundle\Entity\User
tags:
- { name: form.type, alias: chamilo_installer_setup }

@ -0,0 +1,7 @@
chamilo_installer_flow:
pattern: /installer
defaults: { _controller: sylius.controller.process:startAction, scenarioAlias: 'chamilo_installer' }
chamilo_flow_bundle:
resource: @SyliusFlowBundle/Resources/config/routing.yml
prefix: /installer

@ -0,0 +1,31 @@
parameters:
chamilo_installer.scenario.class: ChamiloLMS\InstallerBundle\Process\InstallerScenario
chamilo_installer.yaml_persister.class: ChamiloLMS\InstallerBundle\Persister\YamlPersister
chamilo_installer.listener.request.class: ChamiloLMS\InstallerBundle\EventListener\RequestListener
chamilo_installer.script_manager.class: ChamiloLMS\InstallerBundle\ScriptManager
services:
chamilo_installer.scenario:
class: %chamilo_installer.scenario.class%
calls:
- [ setContainer, ["@service_container"] ]
tags:
- { name: sylius.process.scenario, alias: chamilo_installer }
chamilo_installer.yaml_persister:
class: %chamilo_installer.yaml_persister.class%
arguments:
- %kernel.root_dir%/config
- %kernel.environment%
kernel.listener.install.event:
class: %chamilo_installer.listener.request.class%
arguments:
- "@router"
- %installed%
- %kernel.debug%
chamilo_installer.script_manager:
class: %chamilo_installer.script_manager.class%
arguments:
- @kernel

@ -0,0 +1,60 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
flashes:
installed: Chamilo wurde erfolgreich installiert.
form:
configuration:
database:
0: Datenbankverbindung
driver:
0: Datenbanktreiber
microsoft_sql_server: Microsoft SQL Server
mysql: MySQL
oracle: Oracle
postgresql: PostgreSQL
sqlite: SQLite
host: Datenbankserver
name: Datenbankname
password: Datenbank Passwort
port: Datenbank Port
user: Datenbankbenutzer
locale:
0: Lokale Einstellungen
currency: Währung
locale: Gebietsschema
mailer:
0: E-Mail Einstellungen
host: E-Mail Host
password: E-Mail Passwort
transport:
0: Transport
gmail: Google Mail
mail: E-Mail
sendmail: Sendmail
smtp: SMTP
user: E-Mail Benutzer
setup:
email: E-Mail
load_fixtures: Testdaten laden
plain_password: Passwort
username: Benutzername
process:
step:
check:
button:
back: Zurück
install: Installieren
next: Weiter
header: 'Überprüfen der Systemvoraussetzungen <small>Chamilo installer</small>'
table:
current: Aktuell
required: Benötigt
status: Status
configure:
header: 'Einstellungen <small>Chamilo installer</small>'
setup:
header: 'Administration Einstellungen <small>Chamilo installer</small>'
welcome:
content: '<p>Willkommen beim Chamilo installer.</p>'
header: 'Willkommen <small>Chamilo installer</small>'

@ -0,0 +1,93 @@
flashes:
installed: Chamilo has been successfully installed.
form:
configuration:
database:
header: Database connection
driver:
0: Driver
microsoft_sql_server: Microsoft SQL Server
mysql: MySQL
oracle: Oracle
postgresql: PostgreSQL
sqlite: SQLite
host: Host
name: Name
password: Password
port: Port
user: User
drop_full: Drop Full Database
locale:
header: Locale settings
currency: Currency
locale: Locale
mailer:
header: Mailer settings
host: Host
password: Password
transport:
0: Transport
gmail: Gmail
mail: Mail
sendmail: Sendmail
smtp: SMTP
user: User
system:
header: System settings
secret: Secret
locale: Locale
setup:
email: Email
company_name: Company short name
company_title: Company name
username: Username
firstname: First name
lastname: Last name
password: Password
password_re: Re-enter password
load_fixtures: Load Sample Data
process:
step:
welcome:
content: <p>Welcome to Chamilo installer.</p>
header: Welcome <small>Chamilo installer</small>
check:
header: System requirements check
configure:
header: Configuration
schema:
header: Database initialization
cache: Clear cache before database initialization
clear-config: Clear entities cache
clear-extend: Clear extended entities data
schema-drop: Drop current schema
schema-update: Schema update
fixtures: Load fixtures
workflows: Load workflow definitions
processes: Load processes configuration
setup:
header: Administration setup
installation:
header: Installation
fixtures: Load sample data
navigation: Init navigation
js-routing: Dump JS routing
localization: Dump localization
assets: Install assets
assetic: Dump assetic
translation: Prepare translations
requirejs: Optimize JS resources (optional)
finish: Clear cache to finalize installation
final:
header: Finish
greeting: Success!!!
content: You are now ready to start using Chamilo.<br>For help please join our community <a href="http://www.chamilo.org/forums">forums</a>.
button:
back: Back
next: Next
install: Install
finish: Launch application
operation: Operation
status: Status

@ -0,0 +1,57 @@
flashes:
installed: Chamilo se ha instalado correctamente.
form:
configuration:
database:
0: Conexión con la base de datos.
driver:
0: Driver
microsoft_sql_server: Microsoft SQL Server
mysql: MySQL
oracle: Oracle
postgresql: PostgreSQL
sqlite: SQLite
host: Servidor
name: Nombre
password: Contraseña
port: Puerto
user: Usuario
locale:
0: Configuración del idioma
currency: Moneda
locale: Idioma
mailer:
0: Configuración de Mailer
host: Servidor
password: Contraseña
transport:
0: Transporte
gmail: Gmail
mail: Correo
sendmail: Sendmail
smtp: SMTP
user: Usuario
setup:
email: Correo electrónico
load_fixtures: Cargar datos de prueba
plain_password: Contraseña
username: Nombre de usuario
process:
step:
check:
button:
back: Atrás
install: Instalar
next: Siguiente
header: 'Comprobar requisitos del sistema <small>instalador de Chamilo</small>'
table:
current: Actual
required: Requerido
status: Estado
configure:
header: 'Configuración <small>instalador de Chamilo</small>'
setup:
header: 'Configuración de administración <small>instalador de Chamilo</small>'
welcome:
content: '<p>Bienvenido al instalador de Chamilo.</p>'
header: 'Bienvenido <small>instalador de Chamilo</small>'

@ -0,0 +1,58 @@
flashes:
installed: Chamilo a été installé avec succès.
form:
configuration:
database:
0: Connexion à la base de données
driver:
0: Pilote
microsoft_sql_server: Microsoft SQL Server
mysql: MySQL
oracle: Oracle
postgresql: PostgreSQL
sqlite: SQLite
host: Serveur
name: Nom
password: Mot de passe
port: Port
user: Utilisateur
locale:
0: Paramètres régionaux
currency: Devise
locale: Paramètre régional
mailer:
0: "Paramètres pour l'envoi d'e-mail"
host: Serveur
password: Mot de passe
transport:
0: Transport
gmail: Gmail
mail: Mail
sendmail: Sendmail
smtp: SMTP
user: Utilisateur
setup:
email: E-mail
load_fixtures: Charger les données de test
plain_password: Mot de passe
username: Identifiant
process:
step:
check:
button:
back: Retour
install: Installer
next: Suivant
header: 'Vérification de la configuration système requise <small>Installateur Chamilo</small>'
table:
current: Courant
required: obligatoire
status: statut
configure:
header: 'Configuration <small>Installateur Chamilo</small>'
setup:
header: "Configuration de l'administration <small>Installateur Chamilo</small>"
welcome:
content: "<p>Bienvenue sur l'installateur Chamilo.</p>"
header: 'Bienvenue <small>Installateur Chamilo</small>'
:

@ -0,0 +1,63 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
extensions:
0: Erweiterungen
accelerator:
0: Accelerator
help: Installiere und aktiviere einen PHP Accelerator wie zum Beispiel APC (Dringend empfohlen).
apc: APC
ctype: Ctype
gd: GD
help: 'Installiere und aktiviere die %extension% Erweiterung.'
iconv: Iconv
icu: ICU
intl: Intl
json_encode: JSON
mbstring: Multibyte String
"off": false
"on": true
pcre: PCRE
pdo: PDO
php_xml: PHP-XML
session_start: Session
simplexml_import_dom: SimpleXML
token_get_all: Tokenizer
filesystem:
0: Dateisystem
cache:
0: Cache
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
exists: Existiert
logs:
0: Logs
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
not_exists: Existiert nicht
not_writable: Schreibgeschützt
parameters:
0: parameters.yml
help:
To set permissions run: 'sudo chmod a+w %path%'
vendors: vendors
writable: Beschreibbar
settings:
0: PHP Version und Einstellungen
any: Jeder
detect_unicode: detect_unicode
magic_quotes_gpc: magic_quotes_gpc
non_deprecated: Nicht veraltet
"off": false
"on": true
register_globals: register_globals
session:
auto_start: session.auto_start
short_open_tag: short_open_tag
timezone: timezone
timezone_deprecated:
0: Veraltete Zeitzone
help: 'Zeituone %timezone% ist veraltet. Korriegiere die php.ini Datei (Liste der veralteten Zeitzonen: http://php.net/manual/en/timezones.others.php).'
version: PHP Version
version_recommanded: Empfohlene PHP Version

@ -0,0 +1,57 @@
sylius:
extensions:
0: extensions
accelerator:
0: Accelerator
help: Install and enable a PHP accelerator like APC (highly recommended).
apc: APC
ctype: Ctype
gd: GD
help: Install and enable the %extension% extension.
iconv: Iconv
icu: ICU
intl: Intl
json_encode: JSON
mbstring: Multibyte String
off: off
on: on
pcre: PCRE
pdo: PDO
php_xml: PHP-XML
session_start: Session
simplexml_import_dom: SimpleXML
token_get_all: Tokenizer
filesystem:
0: file system
cache:
0: cache
help: To set permissions run: sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%
exists: exists
logs:
0: logs
help: To set permissions run: sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%
not_exists: not exists
not_writable: not writable
parameters:
0: parameters.yml
help: To set permissions run: sudo chmod a+w %path%
vendors: vendors
writable: writable
settings:
0: PHP version and settings
any: any
detect_unicode: detect_unicode
magic_quotes_gpc: magic_quotes_gpc
non_deprecated: non deprecated
off: off
on: on
register_globals: register_globals
session:
auto_start: session.auto_start
short_open_tag: short_open_tag
timezone: timezone
timezone_deprecated:
0: Deprecated timezone
help: Timezone %timezone% is deprecated. Fix your php.ini file (list of deprecated timezones http://php.net/manual/en/timezones.others.php).
version: PHP version
version_recommanded: Recommended PHP version

@ -0,0 +1,63 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
extensions:
0: Extensiones
accelerator:
0: Acelerador
help: Instala y activa un acelerador PHP como APC (altamente recomendado).
apc: APC
ctype: Ctype
gd: GD
help: 'Instala y activa la extensión %extension%.'
iconv: Iconv
icu: ICU
intl: Intl
json_encode: JSON
mbstring: Multibyte String
"off": false
"on": true
pcre: PCRE
pdo: PDO
php_xml: PHP-XML
session_start: Sesión
simplexml_import_dom: SimpleXML
token_get_all: Tokenizer
filesystem:
0: sistema de ficheros
cache:
0: cache
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
exists: Existe
logs:
0: logs
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
not_exists: No existe
not_writable: Sin permisos de escritura
parameters:
0: parameters.yml
help:
To set permissions run: 'sudo chmod a+w %path%'
vendors: Vendors
writable: Con permisos de escritura
settings:
0: Versión de PHP y configuración
any: Cualquiera
detect_unicode: detect_unicode
magic_quotes_gpc: magic_quotes_gpc
non_deprecated: No obsoleto
"off": false
"on": true
register_globals: register_globals
session:
auto_start: session.auto_start
short_open_tag: short_open_tag
timezone: Zona horaria
timezone_deprecated:
0: Zona horaria obsoleta
help: 'La zona horaria %timezone% está obsoleta. Arregla tu fichero php.ini (Lista de zonas horarias obsoletas http://php.net/manual/en/timezones.others.php).'
version: Versión de PHP
version_recommanded: Versión de PHP recomendada

@ -0,0 +1,63 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
extensions:
0: extensions
accelerator:
0: Accélérateur
help: Installer et activer un accélérateur PHP comme APC (fortement recommandé).
apc: APC
ctype: CType
gd: GD
help: "Installer et activer l'extension %extension%."
iconv: Iconv
icu: ICU
intl: Intl
json_encode: JSON
mbstring: Chaîne de caractères multi-octets
"off": false
"on": true
pcre: PCRE
pdo: PDO
php_xml: PHP-XML
session_start: Session
simplexml_import_dom: SimpleXML
token_get_all: Analyseur de code PHP
filesystem:
0: système de fichiers
cache:
0: cache
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
exists: Existe
logs:
0: Logs
help:
To set permissions run: 'sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX %path% & sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx %path%'
not_exists: "N'existe pas"
not_writable: pas accessible en écriture
parameters:
0: parameters.yml
help:
To set permissions run: 'sudo chmod a+w %path%'
vendors: vendors
writable: accessible en écriture
settings:
0: Version de PHP et paramètres
any: "N'importe quel"
detect_unicode: detect_unicode
magic_quotes_gpc: magic_quotes_gpc
non_deprecated: Non obsolète
"off": false
"on": true
register_globals: register_globals
session:
auto_start: session.auto_start
short_open_tag: short_open_tag
timezone: fuseau horaire
timezone_deprecated:
0: Fuseau horaire obsolète
help: 'Le fuseau horaire %timezone% est déconseillé. Corrigez votre fichier php.ini (liste des fuseaux horaires obsolètes http://php.net/manual/fr/timezones.others.php).'
version: Version de PHP
version_recommanded: Version de PHP recommandée

@ -0,0 +1,24 @@
{% extends 'OroFormBundle:Form:fields.html.twig' %}
{% block _oro_installer_configuration_mailer_oro_installer_mailer_transport_row %}
<script type="text/javascript">
$(function () {
var con = $('#oro_installer_configuration_mailer');
checkTransport();
con.find('.control-group:first select').change(checkTransport);
function checkTransport() {
if (con.find('.control-group:first select').val() != 'smtp') {
con.find('.control-group:not(:first)').hide()
.find('input').attr('disabled', 'disabled');
} else {
con.find('.control-group:not(:first)').show()
.find('input').attr('disabled', null);
}
}
});
</script>
{{ block('form_row') }}
{% endblock %}

@ -0,0 +1,61 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% use 'ChamiloLMSInstallerBundle::progress.html.twig' %}
{% set step = 'configure' %}
{% block title %}
{% autoescape false %}
{{ 'process.step.configure.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{% block form_errors %}
{% spaceless %}
{% if errors|length > 0 %}
<div class="alert alert-warning" role="alert">
<ul>
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endspaceless %}
{% endblock form_errors %}
{% block content %}
<div>
<form action="{{ path('sylius_flow_forward', { scenarioAlias: 'chamilo_installer', stepName: 'configure'}) }}" method="post">
{{ form_errors(form) }}
<div class="row">
<div class="box">
<h3 class="sub-title">{{ form.database.vars.label|trans }}</h3>
{{ form_widget(form.database) }}
</div>
<div class="box">
<h3 class="sub-title">{{ form.mailer.vars.label|trans }}</h3>
{{ form_widget(form.mailer) }}
</div>
</div>
<div class="row">
<div class="box">
<h3 class="sub-title">{{ form.system.vars.label|trans }}</h3>
{{ form_widget(form.system) }}
</div>
{{ form_rest(form) }}
</div>
<div class="form-actions">
<div class="pull-right">
<a href="{{ app.request.basePath }}/install.php" class="btn btn-default back">{{ 'process.button.back'|trans }}</a>
<button class="btn btn-primary button next" type="submit">{{ 'process.button.next'|trans }}</button>
</div>
</div>
</form>
</div>
{% endblock %}

@ -0,0 +1,28 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% use 'ChamiloLMSInstallerBundle::progress.html.twig' %}
{% set step = 'final' %}
{% block title %}
{% autoescape false %}
{{ 'process.step.final.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{% block content %}
<div class="page-title">
<h2>{{ 'process.step.final.header'|trans }}</h2>
</div>
<div class="well">
<p>{{ 'process.step.final.content'|trans|raw }}</p>
</div>
<div class="button-set">
<a href="{{ path('home') }}" class="btn btn-success btn-lg" target="_blank">{{ 'process.button.finish'|trans }}</a>
</div>
{% endblock %}
{% block javascript %}
{{ parent() }}
{% endblock javascript %}

@ -0,0 +1,88 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% use 'ChamiloLMSInstallerBundle::progress.html.twig' %}
{#{% set step, platformSteps = 'administration', ['navigation', 'js-routing', 'localization', 'assets', 'assetic', 'translation', 'requirejs'] %}#}
{% set step, platformSteps = 'administration', [ 'assets', 'assetic'] %}
{% if loadFixtures %}
{% set platformSteps = ['fixtures']|merge(platformSteps) %}
{% endif %}
{% set steps = platformSteps %}
{% if installerScripts is not empty %}
{% for stepName in installerScripts|keys %}
{% set steps = steps|merge(['installerScript-' ~ stepName]) %}
{% endfor %}
{% endif %}
{% set steps = steps|merge(['finish']) %}
{% block title %}
{% autoescape false %}
{{ 'process.step.installation.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{% block content %}
<div class="page-title">
<h2>{{ 'process.step.installation.header'|trans }}</h2>
</div>
<div class="well">
<table class="table">
<col width="75%" valign="top">
<col width="25%" valign="top">
<thead>
<tr>
<th>{{ 'process.operation'|trans }}</th>
<th>{{ 'process.status'|trans }}</th>
</tr>
</thead>
<tbody>
{% for step in platformSteps %}
<tr>
<td><span id="step-{{ step }}"></span>{{ ('process.step.installation.' ~ step)|trans }}</td>
<td>&nbsp;</td>
</tr>
{% endfor %}
{% if installerScripts is not empty %}
{% for stepKey, stepLabel in installerScripts %}
<tr>
<td><span id="step-installerScript-{{ stepKey }}"></span>{{ stepLabel|trans }}</td>
<td>&nbsp;</td>
</tr>
{% endfor %}
{% endif %}
<tr>
<td><span id="step-finish"></span>{{ 'process.step.installation.finish'|trans }}</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="button-set">
<div class="pull-right">
<a href="{{ path('sylius_flow_display', { scenarioAlias: 'chamilo_installer', stepName: 'configure' }) }}" class="btn btn-default back disabled">
<span>{{ 'process.button.back'|trans }}</span>
</a>
<a href="javascript: void(0)" class="btn btn-primary next primary disabled">
<span>{{ 'process.button.next'|trans }}</span>
</a>
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
{{ parent() }}
<script type="text/javascript">
$(function() {
ajaxQueue(
[{% for step in steps %}'{{ step }}'{{ loop.last ? '' : ', ' }}{% endfor %}],
'{{ path('sylius_flow_forward', { scenarioAlias: 'chamilo_installer', stepName: 'installation' }) }}'
);
});
</script>
{% endblock javascript %}

@ -0,0 +1,62 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% use 'ChamiloLMSInstallerBundle::progress.html.twig' %}
{#{% set step, steps = 'schema', ['cache', 'schema-drop', 'clear-config', 'clear-extend', 'schema-update', 'workflows', 'processes', 'fixtures'] %}#}
{% set step, steps = 'schema', ['cache', 'schema-drop', 'schema-update', 'fixtures'] %}
{% block title %}
{% autoescape false %}
{{ 'process.step.schema.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{% block content %}
<div class="page-title">
<h2>{{ 'process.step.schema.header'|trans }}</h2>
</div>
<div>
<table class="table table-striped">
<col width="75%" valign="top">
<col width="25%" valign="top">
<thead>
<tr>
<th>{{ 'process.operation'|trans }}</th>
<th>{{ 'process.status'|trans }}</th>
</tr>
</thead>
<tbody>
{% for step in steps %}
<tr>
<td><span id="step-{{ step }}"></span>{{ ('process.step.schema.' ~ step)|trans }}</td>
<td>&nbsp;</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="button-set">
<div class="pull-right">
<a href="{{ path('sylius_flow_display', { scenarioAlias: 'chamilo_installer', stepName: 'configure' }) }}" class="btn btn-default back disabled">
{{ 'process.button.back'|trans }}
</a>
<a href="javascript: void(0)" class="btn btn-primary next primary disabled">
{{ 'process.button.next'|trans }}
</a>
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
{{ parent() }}
<script type="text/javascript">
$(function() {
ajaxQueue(
[{% for step in steps %}'{{ step}}'{{ loop.last ? '' : ', ' }}{% endfor %}],
'{{ path('sylius_flow_forward', { scenarioAlias: 'chamilo_installer', stepName: 'schema' }) }}'
);
});
</script>
{% endblock javascript %}

@ -0,0 +1,25 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% set step = 'setup' %}
{% block title %}
{% autoescape false %}
{{ 'process.step.setup.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{% block content %}
<div class="page-header">
<h2>{{ 'process.step.setup.header'|trans|raw }}</h2>
</div>
<form action="{{ path('sylius_flow_forward', {'scenarioAlias': 'chamilo_installer', 'stepName': 'setup'}) }}" method="post" class="form-horizontal">
<div>{{ form_widget(form) }}</div>
<div class="form-actions">
<a href="{{ path('sylius_flow_display', {'scenarioAlias': 'chamilo_installer', 'stepName': 'configure'}) }}" class="btn btn-default btn-lg"><i class="icon-chevron-left"></i>
{{ 'process.button.back'|trans }}</a> &nbsp;
<button class="btn btn-lg btn-primary" type="submit">
<i class="icon-magic"></i> {{ 'process.button.install'|trans }}
</button>
</div>
</form>
{% endblock %}

@ -0,0 +1,20 @@
{% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %}
{% use 'ChamiloLMSInstallerBundle::progress.html.twig' %}
{% block content %}
{% set step = 'welcome' %}
{% block title %}
{% autoescape false %}
{{ 'process.step.setup.header'|trans }} - {{ parent() }}
{% endautoescape %}
{% endblock %}
{{ 'process.step.welcome.content'|trans|raw }}
<div class="form-actions">
<a href="{{ path('sylius_flow_forward', {'scenarioAlias': 'chamilo_installer', 'stepName': 'welcome'}) }}" class="btn btn-lg btn-primary">
{{ 'process.step.check.button.install'|trans }} <i class="icon-chevron-right"></i>
</a>
</div>
{% endblock %}

@ -0,0 +1,124 @@
<!doctype html>
<!--[if IE 7 ]><html class="no-js ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="no-js ie ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]><html class="no-js ie ie9" lang="en"> <![endif]-->
<!--[if (gte IE 10)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{% block title %}{{ 'title'|trans }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block stylesheets %}
{% endblock %}
{% stylesheets
"@bootstrap_css" %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% javascripts "@bootstrap_js" %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
<script type="text/javascript" src="{{ asset('bundles/chamilolmscore/components/ajaxQueue/dist/jquery.ajaxQueue.js') }}"></script>
{% block javascript %}
<script type="text/javascript">
$(function() {
$('.progress-bar li:last-child em.fix-bg').width($('.progress-bar li:last-child').width() / 2);
$('.progress-bar li:first-child em.fix-bg').width($('.progress-bar li:first-child').width() / 2);
$('form').submit(function () {
$(this).find(':submit').attr('disabled', true).addClass('disabled');
});
});
function ajaxQueue(actions, url) {
var finRes = true,
aborted = false;
$.each(actions, function(i) {
var stepCon = $('#step-' + this);
stepCon.closest('tr').find('td:last').text('{{ 'wait'|trans }}');
if (i == 0) {
stepCon
.addClass('icon-wait')
.closest('tr').find('td:last').text('{{ 'progress'|trans }}');
}
$.ajaxQueue({
url: '?action=' + this,
beforeSend: function (jqXHR) {
if (!finRes) {
aborted = true;
jqXHR.abort();
}
}
}).done(function(data) {
var curRes = typeof data.result != 'undefined' && data.result,
exitCode = typeof data.exitCode != 'undefined' ? data.exitCode : 0,
finRes = finRes || curRes;
stepCon
.removeClass('icon-wait')
.addClass('icon-' + (curRes ? (exitCode == 0 ? 'yes' : 'warning') : 'no'))
.closest('tr')
.find('td:last').text(
curRes
? (exitCode == 0 ? '{{ 'passed'|trans }}' : '{{ 'skipped'|trans }}')
: '{{ 'failed'|trans }}'
).end()
.closest('tr').next()
.find('td:last').text('{{ 'progress'|trans }}').end()
.find('span').addClass('icon-wait');
if (i == actions.length - 1 && finRes) {
$('a.back').removeClass('disabled');
$('a.primary').removeClass('disabled').attr('href', url);
}
}).fail(function() {
if (aborted) {
stepCon
.removeClass('icon-wait')
.addClass('icon-warning')
.closest('tr').find('td:last').text('{{ 'skipped'|trans }}');
} else {
finRes = false;
stepCon
.removeClass('icon-wait')
.addClass('icon-no')
.closest('tr').find('td:last').text('{{ 'failed'|trans }}');
}
if (i == actions.length - 1) {
$('a.back').removeClass('disabled');
}
});
});
}
</script>
{% endblock javascript %}
</head>
<body>
<div class="container">
<div class="page-header">
<h1 class="logo">Chamilo installation</h1>
</div>
{% block progress %}{% endblock %}
{% block content %}{% endblock %}
</div>
{% block bottom %}
<footer>
<div class="container">
<p>
Chamilo
</p>
</div>
</footer>
{% endblock bottom %}
</body>
</html>

@ -0,0 +1,32 @@
{% block progress %}
{% set step = step is defined ? step|lower : 'configure' %}
<div class="progress-bar">
<ul>
<li{% if step == 'check' %} class="active"{% endif %}>
<em class="fix-bg">&nbsp;</em>
<strong class="step">1</strong>
<span>{{ 'process.step.check.header'|trans }}</span>
</li>
<li{% if step == 'configure' %} class="active"{% endif %}>
<em class="fix-bg">&nbsp;</em>
<strong class="step">2</strong>
<span>{{ 'process.step.configure.header'|trans }}</span>
</li>
<li{% if step == 'schema' %} class="active"{% endif %}>
<em class="fix-bg">&nbsp;</em>
<strong class="step">3</strong>
<span>{{ 'process.step.schema.header'|trans }}</span>
</li>
<li{% if step == 'setup' %} class="active"{% endif %}>
<em class="fix-bg">&nbsp;</em>
<strong class="step">4</strong>
<span>{{ 'process.step.setup.header'|trans }}</span>
</li>
<li{% if step == 'final' %} class="active"{% endif %}>
<em class="fix-bg">&nbsp;</em>
<strong class="step">5</strong>
<span>{{ 'process.step.final.header'|trans }}</span>
</li>
</ul>
</div>
{% endblock %}

@ -0,0 +1,84 @@
<?php
namespace ChamiloLMS\InstallerBundle;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ScriptExecutor
{
const CHAMILO_SCRIPT_ANNOTATION = 'ChamiloScript';
/**
* @var OutputInterface
*/
protected $output;
/**
* @var ContainerInterface
*/
protected $container;
/**
* @var CommandExecutor
*/
protected $commandExecutor;
/**
* @param OutputInterface $output
* @param ContainerInterface $container
* @param CommandExecutor $commandExecutor
*/
public function __construct(
OutputInterface $output,
ContainerInterface $container,
CommandExecutor $commandExecutor
) {
$this->output = $output;
$this->container = $container;
$this->commandExecutor = $commandExecutor;
}
/**
* Run script
*
* @param string $fileName
*/
public function runScript($fileName)
{
if (is_file($fileName)) {
$tokens = [];
if (preg_match(
'/@' . self::CHAMILO_SCRIPT_ANNOTATION. '(\(("([\w -]*)")?\))?/i',
file_get_contents($fileName),
$tokens
)
) {
$scriptLabel = count($tokens) === 4 && $tokens[3]
? sprintf('"%s" (%s)', $tokens[3], $fileName)
: sprintf('"%s"', $fileName);
$this->output->writeln(
sprintf('Launching %s script', $scriptLabel)
);
ob_start();
$container = $this->container;
$commandExecutor = $this->commandExecutor;
include($fileName);
$scriptOutput = ob_get_contents();
ob_clean();
$this->output->writeln($scriptOutput);
} else {
$this->output->writeln(
sprintf(
'The "%s" script must contains @%s annotation',
$fileName,
self::CHAMILO_SCRIPT_ANNOTATION
)
);
}
} else {
$this->output->writeln(sprintf('File "%s" not found', $fileName));
}
}
}

@ -0,0 +1,214 @@
<?php
namespace ChamiloLMS\InstallerBundle;
use Symfony\Component\HttpKernel\Kernel;
class ScriptManager
{
const CHAMILO_INSTALLER_SCRIPT_FILE_NAME = 'install.php';
/**
* @var Kernel
*/
protected $kernel;
/**
* @var array
* key -> script md5 key
* value -> array
* 'index' - script index (used for execute scripts in properly order)
* 'key' - script file md5 key
* 'file' - script file name
* 'label' - script label
*/
protected $scripts = null;
/**
* Constructor
*
* @param Kernel $kernel
*/
public function __construct(Kernel $kernel)
{
$this->kernel = $kernel;
}
/**
* get array with scripts keys and labels
*
* @return array
* key -> script file md5 key
* value -> script label
*/
public function getScriptLabels()
{
$this->ensureScriptsLoaded();
$result = [];
if (!empty($this->scripts)) {
foreach ($this->scripts as $script) {
$result[$script['key']] = $script['label'];
}
}
return $result;
}
/**
* Get list of scripts
*
* @return array
* key -> script md5 key
* value -> script file name
*/
public function getScriptFiles()
{
$this->ensureScriptsLoaded();
$result = [];
if (!empty($this->scripts)) {
foreach ($this->scripts as $script) {
$result[$script['key']] = $script['file'];
}
}
return $result;
}
/**
* Get script file name array by script md5 key
*
* @param string $scriptKey Script md5 key
* @return string|bool
*/
public function getScriptFileByKey($scriptKey)
{
$this->ensureScriptsLoaded();
if (!empty($this->scripts) && isset($this->scripts[$scriptKey])) {
return $this->scripts[$scriptKey]['file'];
}
return false;
}
/**
* Checks if scripts were loaded and load they if needed
*/
protected function ensureScriptsLoaded()
{
if ($this->scripts === null) {
$this->loadScripts();
}
}
/**
* Read scripts info from files
*/
protected function loadScripts()
{
$index = 0;
$scripts = [];
$this->scripts = [];
$rootDir = realpath(
$this->kernel->getRootDir() . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
);
$bundles = $this->kernel->getBundles();
foreach ($bundles as $bundle) {
$bundleDirName = $bundle->getPath();
$this->getScriptInfo($bundleDirName, $index, $scripts);
$relativePathArray = explode(DIRECTORY_SEPARATOR, str_replace($rootDir, '', $bundleDirName));
if ($relativePathArray[0] == '') {
unset ($relativePathArray[0]);
}
for ($i = count($relativePathArray); $i >= 0; $i--) {
unset($relativePathArray[$i]);
$checkPath = $rootDir . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $relativePathArray);
if ($this->getScriptInfo($checkPath, $index, $scripts)) {
break;
}
}
}
if (!empty($scripts)) {
usort($scripts, array($this, "compareScripts"));
foreach ($scripts as $script) {
$this->scripts[$script['key']] = $script;
}
}
}
/**
* Get script info from dir
*
* @param string $dirName
* @param int $index
* @param array $scripts
* @return array|bool
*/
protected function getScriptInfo($dirName, &$index, &$scripts)
{
$file = $dirName . DIRECTORY_SEPARATOR . self::CHAMILO_INSTALLER_SCRIPT_FILE_NAME;
if (is_file($file) && !isset($scripts[md5($file)])) {
$data = $this->getScriptInfoFromFile($file);
if ($data) {
$data['index'] = $index;
$index++;
$scripts[$data['file']] = $data;
return $data;
}
}
return false;
}
/**
* Compare two scripts for sorting
*
* @param array $a
* @param array $b
* @return int
*/
protected function compareScripts($a, $b)
{
$pathA = dirname($a['file']) . DIRECTORY_SEPARATOR;
$pathB = dirname($b['file']) . DIRECTORY_SEPARATOR;
if (strpos($pathA, $pathB) === 0) {
return -1;
} elseif (strpos($pathB, $pathA) === 0) {
return 1;
}
return $a['index'] < $b['index'] ? -1 : 1;
}
/**
* Get info about script file
*
* @param string $fileName
* @return array|bool
*/
protected function getScriptInfoFromFile($fileName)
{
$tokens = [];
if (preg_match(
'/@' . ScriptExecutor::CHAMILO_SCRIPT_ANNOTATION. '\("([\w -]+)"\)/i',
file_get_contents($fileName),
$tokens
)
) {
if (isset($tokens[1])) {
return [
'key' => md5($fileName),
'file' => $fileName,
'label' => str_replace('"', '', $tokens[1])
];
}
}
return false;
}
}

@ -0,0 +1,12 @@
<?php
namespace ChamiloLMS\InstallerBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
class DatabaseConnection extends Constraint
{
//@codingStandardsIgnoreStart
public $message = 'Unable to connect to database "%name%". Please check database connection parameters and user permissions.';
//@codingStandardsIgnoreEnd
}

@ -0,0 +1,30 @@
<?php
namespace ChamiloLMS\InstallerBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Doctrine\DBAL\DriverManager;
class DatabaseConnectionValidator extends ConstraintValidator
{
public function validate($value, Constraint $constraint)
{
$params = array(
'host' => $value['chamilo_installer_database_host'],
'port' => $value['chamilo_installer_database_port'],
'dbname' => $value['chamilo_installer_database_name'],
'user' => $value['chamilo_installer_database_user'],
'password' => $value['chamilo_installer_database_password'],
'driver' => 'pdo_mysql',
'charset' => 'UTF8',
);
try {
DriverManager::getConnection($params)->connect();
} catch (\PDOException $e) {
$this->context->addViolation($constraint->message, array('%name%' => $params['dbname']));
}
}
}
Loading…
Cancel
Save