Actualización

This commit is contained in:
Xes
2025-04-10 12:53:50 +02:00
parent f7a0ba2b2f
commit 2001ceddea
39284 changed files with 991962 additions and 0 deletions

1
app/.htaccess Normal file
View File

@@ -0,0 +1 @@
Options -Indexes

230
app/AppKernel.php Normal file
View File

@@ -0,0 +1,230 @@
<?php
/* For licensing terms, see /license.txt */
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
/**
* Class AppKernel
*/
class AppKernel extends Kernel
{
protected $rootDir;
/*
Update for PHP 8 support DamienR : AppKernel implements the Serializable interface, which is deprecated.
Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
*/
public function __serialize(): array
{
return [];
}
public function __unserialize(array $data): void
{
// Implement the logic to unserialize the object
}
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
//new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
// KNP HELPER BUNDLES
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
// Data grid
//new APY\DataGridBundle\APYDataGridBundle(),
new Chamilo\FaqBundle\ChamiloFaqBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
// Sonata
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Sonata\DatagridBundle\SonataDatagridBundle(),
new Sonata\MediaBundle\SonataMediaBundle(),
new Sonata\PageBundle\SonataPageBundle(),
new Theodo\Evolution\Bundle\SessionBundle\TheodoEvolutionSessionBundle(),
new Spy\TimelineBundle\SpyTimelineBundle(),
new Sonata\TimelineBundle\SonataTimelineBundle(),
//new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
// CMF Integration
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
//new Symfony\Cmf\Bundle\SearchBundle\CmfSearchBundle(),
//new Symfony\Cmf\Bundle\BlogBundle\CmfBlogBundle(),
//new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
// Oauth
//new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
//new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
//new Liip\ThemeBundle\LiipThemeBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new FM\ElfinderBundle\FMElfinderBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
// User
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Chamilo\UserBundle\ChamiloUserBundle(),
/*
// Sylius
/*new Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
//new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),*/
// Chamilo
//new Chamilo\InstallerBundle\ChamiloInstallerBundle(),
new Chamilo\CoreBundle\ChamiloCoreBundle(),
new Chamilo\CourseBundle\ChamiloCourseBundle(),
// new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
new Chamilo\ThemeBundle\ChamiloThemeBundle(),
//new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
new Chamilo\AdminBundle\ChamiloAdminBundle(),
new Chamilo\TimelineBundle\ChamiloTimelineBundle(),
new \Chamilo\ContactBundle\ChamiloContactBundle(),
// Based in Sonata
new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),
new Chamilo\MediaBundle\ChamiloMediaBundle(),
new Chamilo\PageBundle\ChamiloPageBundle(),
/*
// Chamilo course tool
//new Chamilo\NotebookBundle\ChamiloNotebookBundle(),
// Data
//new Oneup\FlysystemBundle\OneupFlysystemBundle(), */
// Extra
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
/*
//new JMS\TranslationBundle\JMSTranslationBundle(),
//new JMS\DiExtraBundle\JMSDiExtraBundle($this),
//new JMS\AopBundle\JMSAopBundle(),
/*new Bazinga\Bundle\FakerBundle\BazingaFakerBundle(),
//new Chamilo\CmsBundle\ChamiloCmsBundle(),
*/
new Lunetics\LocaleBundle\LuneticsLocaleBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
//$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle();
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
//$bundles[] = new Sp\BowerBundle\SpBowerBundle();
}
return $bundles;
}
/**
* @param LoaderInterface $loader
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* @return string
*/
public function getRootDir()
{
if (null === $this->rootDir) {
$r = new \ReflectionObject($this);
$this->rootDir = str_replace('\\', '/', dirname($r->getFileName()));
}
return $this->rootDir;
}
/**
* Returns the real root path
* @return string
*/
public function getRealRootDir()
{
return realpath($this->getRootDir().'/../').'/';
}
/**
* Returns the data path
* @return string
*/
public function getDataDir()
{
return $this->getRealRootDir().'data/';
}
/**
* @return string
*/
public function getAppDir()
{
return $this->getRealRootDir().'app/';
}
/**
* @return string
*/
public function getConfigDir()
{
return $this->getRealRootDir().'app/config/';
}
/**
* @return string
*/
public function getConfigurationFile()
{
return $this->getRealRootDir().'app/config/configuration.php';
}
/**
* @param array $configuration
*/
public function setApi(array $configuration)
{
new ChamiloApi($configuration);
}
}

View File

@@ -0,0 +1,58 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\DoctrineExtensions\DBAL\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateTimeType;
/**
* Save datetime values in UTC in the database
*
* @package Chamilo\CoreBundle\DoctrineExtensions\DBAL\Types
*/
class UTCDateTimeType extends DateTimeType
{
static private $utc = null;
/**
* {@inheritdoc}
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
if (is_null(self::$utc)) {
self::$utc = new \DateTimeZone('UTC');
}
$value->setTimeZone(self::$utc);
return $value->format($platform->getDateTimeFormatString());
}
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
if (is_null(self::$utc)) {
self::$utc = new \DateTimeZone('UTC');
}
$val = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value, self::$utc);
if (!$val) {
throw ConversionException::conversionFailed($value, $this->getName());
}
return $val;
}
}

View File

@@ -0,0 +1,148 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
use Chamilo\CoreBundle\Entity\SettingsOptions;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\ORM\EntityManager;
/**
* Class AbstractMigrationChamilo
*
* @package Chamilo\CoreBundle\Migrations
*/
abstract class AbstractMigrationChamilo extends AbstractMigration
{
private $manager;
/**
* @param EntityManager $manager
*/
public function setEntityManager(EntityManager $manager)
{
$this->manager = $manager;
}
/**
* @return EntityManager
*/
public function getEntityManager()
{
if (empty($this->manager)) {
$dbParams = array(
'driver' => 'pdo_mysql',
'host' => $this->connection->getHost(),
'user' => $this->connection->getUsername(),
'password' => $this->connection->getPassword(),
'dbname' => $this->connection->getDatabase(),
'port' => $this->connection->getPort()
);
$database = new \Database();
$database->connect(
$dbParams,
__DIR__.'/../../',
__DIR__.'/../../'
);
$this->manager = $database->getManager();
}
return $this->manager;
}
/**
* Speeds up SettingsCurrent creation
* @param string $variable The variable itself
* @param string $subKey The subkey
* @param string $type The type of setting (text, radio, select, etc)
* @param string $category The category (Platform, User, etc)
* @param string $selectedValue The default value
* @param string $title The setting title string name
* @param string $comment The setting comment string name
* @param string $scope The scope
* @param string $subKeyText Text if there is a subKey
* @param int $accessUrl What URL it is for
* @param bool $accessUrlChangeable Whether it can be changed on each url
* @param bool $accessUrlLocked Whether the setting for the current URL is
* locked to the current value
* @param array $options Optional array in case of a radio-type field,
* to insert options
*/
public function addSettingCurrent(
$variable,
$subKey,
$type,
$category,
$selectedValue,
$title,
$comment,
$scope = '',
$subKeyText = '',
$accessUrl = 1,
$accessUrlChangeable = false,
$accessUrlLocked = true,
$options = array()
) {
$setting = new SettingsCurrent();
$setting
->setVariable($variable)
->setSubkey($subKey)
->setType($type)
->setCategory($category)
->setSelectedValue($selectedValue)
->setTitle($title)
->setComment($comment)
->setScope($scope)
->setSubkeytext($subKeyText)
->setAccessUrl($accessUrl)
->setAccessUrlChangeable($accessUrlChangeable)
->setAccessUrlLocked($accessUrlLocked);
$this->getEntityManager()->persist($setting);
if (count($options) > 0) {
foreach ($options as $option) {
if (empty($option['text'])) {
if ($option['value'] == 'true') {
$option['text'] = 'Yes';
} else {
$option['text'] = 'No';
}
}
$settingOption = new SettingsOptions();
$settingOption
->setVariable($variable)
->setValue($option['value'])
->setDisplayText($option['text']);
$this->getEntityManager()->persist($settingOption);
}
}
$this->getEntityManager()->flush();
}
/**
* @param string $variable
* @return mixed
*/
public function getConfigurationValue($variable)
{
global $_configuration;
if (isset($_configuration[$variable])) {
return $_configuration[$variable];
}
return false;
}
/**
* Remove a setting completely
* @param string $variable The setting variable name
* @return void
*/
public function removeSettingCurrent($variable)
{
//to be implemented
}
}

View File

@@ -0,0 +1,661 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use \Doctrine\DBAL\Types\Type;
/**
* Class Version110
*
* Migrate file to updated to Chamilo 1.10
*
* @package Application\Migrations\Schema\V110
*/
class Version110 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function preUp(Schema $schema)
{
$this->addSql("ALTER TABLE session_rel_course ENGINE=InnoDB");
$this->addSql("ALTER TABLE session_rel_course_rel_user ENGINE=InnoDB");
$this->addSql("ALTER TABLE session_rel_user ENGINE=InnoDB");
$this->addSql("UPDATE session SET session.id_coach = (SELECT u.user_id FROM admin a INNER JOIN user u ON (u.user_id = a.user_id AND u.active = 1) LIMIT 1) WHERE id_coach NOT IN (SELECT user_id FROM user)");
}
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Needed to update 0000-00-00 00:00:00 values
$this->addSql('SET sql_mode = ""');
// In case this one didn't work, also try this
$this->addSql('SET SESSION sql_mode = ""');
$connection = $this->connection;
$this->addSql("CREATE TABLE IF NOT EXISTS course_field_options (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, field_id INT NOT NULL, option_value TEXT, option_display_text VARCHAR(64), option_order INT, tms DATETIME)");
$this->addSql("CREATE TABLE IF NOT EXISTS session_field_options (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, field_id INT NOT NULL, option_value TEXT, option_display_text VARCHAR(64), option_order INT, tms DATETIME)");
$this->addSql("CREATE TABLE IF NOT EXISTS hook_observer( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, path varchar(255) NOT NULL, plugin_name varchar(255) NULL, PRIMARY KEY PK_hook_management_hook_observer(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS hook_event( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, description varchar(255), PRIMARY KEY PK_hook_management_hook_event(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS hook_call( id int UNSIGNED NOT NULL AUTO_INCREMENT, hook_event_id int UNSIGNED NOT NULL, hook_observer_id int UNSIGNED NOT NULL, type tinyint NOT NULL, hook_order int UNSIGNED NOT NULL, enabled tinyint NOT NULL, PRIMARY KEY PK_hook_management_hook_call(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (iid INT NOT NULL PRIMARY KEY, id INT NULL, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (iid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT NULL, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_comment (iid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, id INT NULL, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (iid int NOT NULL auto_increment PRIMARY KEY, id INT, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL)");
$this->addSql("ALTER TABLE skill_rel_user MODIFY COLUMN acquired_skill_at datetime default NULL");
$this->addSql("ALTER TABLE track_e_access MODIFY COLUMN access_date datetime DEFAULT NULL");
$this->addSql("ALTER TABLE track_e_lastaccess MODIFY COLUMN access_date datetime DEFAULT NULL");
$table = $schema->getTable('skill_rel_user');
if (!$table->hasColumn('course_id')) {
$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id");
}
if (!$table->hasColumn('session_id')) {
$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id");
}
if (!$table->hasIndex('idx_select_cs')) {
$this->addSql("ALTER TABLE skill_rel_user ADD INDEX idx_select_cs (course_id, session_id)");
}
// Delete info of session_rel_user if session does not exists;
$this->addSql("DELETE FROM session_rel_user WHERE id_session NOT IN (SELECT id FROM session)");
// Delete info of usergroup_rel_user if usergroup does not exists;
$this->addSql("DELETE FROM usergroup_rel_user WHERE usergroup_id NOT IN (SELECT id FROM usergroup)");
$session = $schema->getTable('session');
$session->getColumn('id')->setType(Type::getType(Type::INTEGER))->setUnsigned(false);
if (!$session->hasColumn('description')) {
$session->addColumn(
'description',
'text'
);
}
if (!$session->hasColumn('show_description')) {
$session->addColumn(
'show_description',
'smallint',
array('default' => 0, 'unsigned' => true)
);
}
$sessionTable = $schema->getTable('session');
if (!$sessionTable->hasColumn('duration')) {
$this->addSql("ALTER TABLE session ADD COLUMN duration int");
}
$sessionRelUser = $schema->getTable('session_rel_user');
if (!$sessionRelUser->hasColumn('duration')) {
$this->addSql("ALTER TABLE session_rel_user ADD COLUMN duration int");
}
$table = $schema->getTable('skill');
if (!$table->hasColumn('criteria')) {
$this->addSql("ALTER TABLE skill ADD COLUMN criteria text");
}
$table = $schema->getTable('gradebook_category');
if (!$table->hasColumn('generate_certificates')) {
$this->addSql("ALTER TABLE gradebook_category ADD COLUMN generate_certificates TINYINT NOT NULL DEFAULT 0");
}
$this->addSql("ALTER TABLE track_e_access ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_lastaccess ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_exercices ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_downloads ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_hotpotatoes ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_links ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_course_access ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_online ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE track_e_attempt ADD COLUMN c_id int NOT NULL");
$table = $schema->getTable('track_e_default');
if (!$table->hasColumn('session_id')) {
$this->addSql("ALTER TABLE track_e_default ADD COLUMN session_id int NOT NULL");
}
if (!$table->hasColumn('c_id')) {
$this->addSql("ALTER TABLE track_e_default ADD COLUMN c_id int NOT NULL");
}
$this->addSql("ALTER TABLE track_e_access ADD COLUMN user_ip varchar(39) NOT NULL default ''");
$this->addSql("ALTER TABLE track_e_exercices ADD COLUMN user_ip varchar(39) NOT NULL default ''");
$this->addSql("ALTER TABLE track_e_course_access ADD COLUMN user_ip varchar(39) NOT NULL default ''");
$this->addSql("ALTER TABLE track_e_online CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''");
$this->addSql("ALTER TABLE track_e_login CHANGE COLUMN login_ip user_ip varchar(39) NOT NULL DEFAULT ''");
$this->addSql('LOCK TABLE user WRITE');
$this->addSql("ALTER TABLE user MODIFY COLUMN user_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE user ADD COLUMN id INT DEFAULT NULL");
$this->addSql("UPDATE user SET id = user_id");
$this->addSql("ALTER TABLE user MODIFY COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT AFTER user_id");
$this->addSql("ALTER TABLE user MODIFY COLUMN chatcall_date datetime default NULL");
$this->addSql("ALTER TABLE user MODIFY COLUMN chatcall_text varchar(50) default NULL");
$this->addSql("ALTER TABLE user MODIFY COLUMN chatcall_user_id int unsigned default 0");
$this->addSql("ALTER TABLE user MODIFY COLUMN expiration_date datetime default NULL");
$this->addSql("ALTER TABLE user MODIFY COLUMN registration_date datetime NOT NULL");
$this->addSql('UNLOCK TABLES');
$table = $schema->getTable('course');
if (!$table->hasColumn('add_teachers_to_sessions_courses')) {
$this->addSql("ALTER TABLE course ADD COLUMN add_teachers_to_sessions_courses tinyint NOT NULL default 0");
}
$this->addSql("ALTER TABLE course DROP COLUMN target_course_code");
$this->addSql("ALTER TABLE session MODIFY COLUMN name char(100) NOT NULL DEFAULT ''");
$this->addSql("ALTER TABLE course_rel_user ADD COLUMN c_id int default NULL");
$this->addSql("ALTER TABLE course_field_values ADD COLUMN c_id int default NULL");
$this->addSql('LOCK TABLE session_rel_course_rel_user WRITE');
$this->addSql("ALTER TABLE session_rel_course_rel_user ADD COLUMN c_id int NOT NULL");
$this->addSql("ALTER TABLE session_rel_course_rel_user CHANGE id_session session_id int");
$this->addSql("ALTER TABLE session_rel_course_rel_user CHANGE id_user user_id int");
$this->addSql('UNLOCK TABLES');
$this->addSql("ALTER TABLE access_url_rel_course ADD COLUMN c_id int");
$table = $schema->getTable('session_rel_course');
if (!$table->hasColumn('position')) {
$this->addSql("ALTER TABLE session_rel_course ADD COLUMN position int NOT NULL default 0");
}
$this->addSql("ALTER TABLE session_rel_course ADD COLUMN category varchar(255) default ''");
$this->addSql("ALTER TABLE session_rel_course ADD COLUMN c_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE session_rel_course CHANGE id_session session_id int");
$this->addSql('DELETE FROM session_rel_course WHERE session_id NOT IN (SELECT id FROM session)');
$this->addSql("DELETE FROM course_rel_user WHERE course_code NOT IN (SELECT code FROM course)");
$this->addSql("UPDATE course_rel_user SET c_id = (SELECT id FROM course WHERE code = course_code)");
// Add iid
$tables = [
'c_announcement',
'c_announcement_attachment',
'c_attendance',
'c_attendance_calendar',
//'c_attendance_calendar_rel_group',
'c_attendance_result',
//'c_attendance_sheet',
'c_attendance_sheet_log',
//'c_blog',
'c_blog_attachment',
//'c_blog_comment',
//'c_blog_post',
//'c_blog_rating',
//'c_blog_rel_user',
//'c_blog_task',
//'c_blog_task_rel_user',
'c_calendar_event',
'c_calendar_event_attachment',
//'c_calendar_event_repeat',
//'c_calendar_event_repeat_not',
'c_chat_connected',
'c_course_description',
'c_course_setting',
'c_document',
//'c_dropbox_category',
//'c_dropbox_feedback',
'c_dropbox_file',
//'c_dropbox_person',
//'c_dropbox_post',
'c_forum_attachment',
//'c_forum_category',
//'c_forum_forum',
'c_forum_mailcue',
'c_forum_notification',
//'c_forum_post',
//'c_forum_thread',
'c_forum_thread_qualify',
'c_forum_thread_qualify_log',
//'c_glossary',
'c_group_category',
'c_group_info',
'c_group_rel_tutor',
'c_group_rel_user',
'c_item_property',
'c_link',
'c_link_category',
'c_lp',
'c_lp_item',
'c_lp_item_view',
'c_lp_iv_interaction',
'c_lp_iv_objective',
'c_lp_view',
//'c_notebook',
//'c_online_connected',
'c_online_link',
'c_permission_group',
'c_permission_task',
'c_permission_user',
'c_quiz',
//'c_quiz_answer',
'c_quiz_question',
'c_quiz_question_category',
'c_quiz_question_option',
//'c_quiz_question_rel_category',
//'c_quiz_rel_question',
'c_resource',
//'c_role',
'c_role_group',
'c_role_permissions',
//'c_role_user',
'c_student_publication',
'c_student_publication_assignment',
//'c_student_publication_comment',
//'c_student_publication_rel_document',
//'c_student_publication_rel_user',
//'c_survey',
//'c_survey_answer',
'c_survey_group',
//'c_survey_invitation',
//'c_survey_question',
//'c_survey_question_option',
'c_thematic',
'c_thematic_advance',
'c_thematic_plan',
'c_tool',
//'c_tool_intro',
'c_userinfo_content',
'c_userinfo_def',
'c_wiki',
//'c_wiki_conf',
'c_wiki_discuss',
'c_wiki_mailcue'
];
foreach ($tables as $table) {
if ($schema->hasTable($table)) {
$this->addSql("ALTER TABLE $table MODIFY COLUMN id INT NOT NULL");
$this->addSql("ALTER TABLE $table MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE $table DROP PRIMARY KEY");
$this->addSql("ALTER TABLE $table MODIFY COLUMN id INT NULL");
$this->addSql("ALTER TABLE $table ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
}
}
if ($schema->hasTable('c_attendance_calendar_rel_group')) {
$table = $schema->getTable('c_attendance_calendar_rel_group');
if ($table->hasColumn('iid') === false) {
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group MODIFY COLUMN id INT NOT NULL");
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group MODIFY COLUMN id INT NULL DEFAULT NULL");
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
}
}
$this->addSql("ALTER TABLE c_attendance_sheet MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_attendance_sheet DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_attendance_sheet ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog MODIFY COLUMN blog_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_blog MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog MODIFY COLUMN blog_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_comment MODIFY COLUMN comment_id int NOT NULL");
$this->addSql("ALTER TABLE c_blog_comment MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog_comment DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_comment MODIFY COLUMN comment_id int DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_comment ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_post MODIFY COLUMN post_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_blog_post MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog_post DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_post MODIFY COLUMN post_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_post ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_rating MODIFY COLUMN rating_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_blog_rating MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog_rating DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_rating MODIFY COLUMN rating_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_rating ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_rel_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_rel_user MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog_rel_user MODIFY COLUMN blog_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_rel_user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_rel_user ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_task MODIFY COLUMN task_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_blog_task MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_blog_task DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_task MODIFY COLUMN task_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_task ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_blog_task_rel_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_blog_task_rel_user MODIFY COLUMN blog_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_task_rel_user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_task_rel_user MODIFY COLUMN task_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_blog_task_rel_user ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_calendar_event_repeat DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_calendar_event_repeat MODIFY COLUMN cal_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_calendar_event_repeat MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_calendar_event_repeat ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_calendar_event_repeat_not DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_calendar_event_repeat_not MODIFY COLUMN cal_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_calendar_event_repeat_not MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_calendar_event_repeat_not ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_dropbox_category MODIFY COLUMN cat_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_category DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_dropbox_category MODIFY COLUMN cat_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_dropbox_category MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_category ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_dropbox_feedback MODIFY COLUMN feedback_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_feedback DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_dropbox_feedback MODIFY COLUMN feedback_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_dropbox_feedback MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_feedback ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_dropbox_person DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_dropbox_person MODIFY COLUMN file_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_dropbox_person MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_person ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_dropbox_post DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_dropbox_post MODIFY COLUMN file_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_dropbox_post MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_dropbox_post ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_forum_category MODIFY COLUMN cat_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_forum_category DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_forum_category MODIFY COLUMN cat_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_category MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_forum_category ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_forum_forum MODIFY COLUMN forum_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_forum_forum DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_forum_forum MODIFY COLUMN forum_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_forum MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_forum_forum ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_forum_post MODIFY COLUMN post_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_forum_post DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_forum_post MODIFY COLUMN post_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_post MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_forum_post ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_forum_thread MODIFY COLUMN thread_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_forum_thread DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_forum_thread MODIFY COLUMN forum_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_thread MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_forum_thread MODIFY COLUMN thread_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_thread ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_forum_thread ADD COLUMN thread_peer_qualify tinyint default 0");
$this->addSql("ALTER TABLE c_glossary MODIFY COLUMN glossary_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_glossary MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_glossary DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_glossary MODIFY COLUMN glossary_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_glossary ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_notebook MODIFY COLUMN notebook_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_notebook MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_notebook DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_notebook MODIFY COLUMN notebook_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_notebook ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_online_connected MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_online_connected DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_online_connected ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
// For some reason c_tool_intro.id is a varchar in 1.9.x
$this->addSql("ALTER TABLE c_tool_intro MODIFY COLUMN id VARCHAR(50) NOT NULL");
$this->addSql("ALTER TABLE c_tool_intro MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_tool_intro MODIFY COLUMN session_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_tool_intro DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_tool_intro MODIFY COLUMN session_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_tool_intro ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id INT DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id_auto int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_quiz_answer DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id_auto int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_answer ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN question_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_quiz_question_rel_category DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN question_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_question_rel_category ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE session_rel_user MODIFY COLUMN id_session int");
$this->addSql("ALTER TABLE session_rel_user MODIFY COLUMN id_user int");
$this->addSql("ALTER TABLE session_rel_user MODIFY COLUMN relation_type int unsigned DEFAULT 0");
$this->addSql("ALTER TABLE session_rel_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE session_rel_user CHANGE id_session session_id int");
$this->addSql("ALTER TABLE session_rel_user CHANGE id_user user_id int");
$this->addSql("DELETE FROM session_rel_user WHERE user_id NOT IN (SELECT id FROM user)");
$this->addSql("ALTER TABLE session_rel_user ADD COLUMN id int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_item_property CHANGE id_session session_id int");
$this->addSql("ALTER TABLE course_rel_user CHANGE tutor_id is_tutor int");
$this->addSql("ALTER TABLE c_quiz_rel_question MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_quiz_rel_question DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_quiz_rel_question MODIFY COLUMN question_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_rel_question MODIFY COLUMN exercice_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_rel_question ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_role MODIFY COLUMN role_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_role MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_role DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_role MODIFY COLUMN role_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_role ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_role_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_role_user MODIFY COLUMN role_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_role_user MODIFY COLUMN user_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_role_user MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_role_user ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_survey MODIFY COLUMN survey_id int NOT NULL");
$this->addSql("ALTER TABLE c_survey MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_survey DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_survey MODIFY COLUMN survey_id int NULL");
$this->addSql("ALTER TABLE c_survey ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_survey_answer MODIFY COLUMN answer_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_survey_answer MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_survey_answer DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_survey_answer MODIFY COLUMN answer_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_survey_answer ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_survey_invitation MODIFY COLUMN survey_invitation_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_survey_invitation MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_survey_invitation DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_survey_invitation MODIFY COLUMN survey_invitation_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_survey_invitation ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_survey_question MODIFY COLUMN question_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_survey_question MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_survey_question DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_survey_question MODIFY COLUMN question_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_survey_question ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_survey_question_option MODIFY COLUMN question_option_id int unsigned NOT NULL");
$this->addSql("ALTER TABLE c_survey_question_option MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_survey_question_option DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_survey_question_option MODIFY COLUMN question_option_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_survey_question_option ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_wiki_conf DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_wiki_conf MODIFY COLUMN page_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_wiki_conf MODIFY COLUMN c_id INT NOT NULL");
$this->addSql("ALTER TABLE c_wiki_conf ADD COLUMN iid int NOT NULL PRIMARY KEY AUTO_INCREMENT");
// Course
$this->addSql("ALTER TABLE c_survey ADD COLUMN visible_results INT UNSIGNED DEFAULT 0");
$this->addSql("ALTER TABLE c_survey_invitation ADD COLUMN group_id INT NOT NULL");
$this->addSql("ALTER TABLE c_lp_item ADD COLUMN prerequisite_min_score float");
$this->addSql("ALTER TABLE c_lp_item ADD COLUMN prerequisite_max_score float");
$table = $schema->getTable('c_group_info');
if (!$table->hasColumn('status')) {
$this->addSql("ALTER TABLE c_group_info ADD COLUMN status tinyint DEFAULT 1");
}
$table = $schema->getTable('c_student_publication');
if (!$table->hasColumn('document_id')) {
$this->addSql("ALTER TABLE c_student_publication ADD COLUMN document_id int DEFAULT 0");
}
$this->addSql("ALTER TABLE c_lp_item MODIFY COLUMN description VARCHAR(511) DEFAULT ''");
$this->addSql("ALTER TABLE course_category MODIFY COLUMN auth_course_child VARCHAR(40) DEFAULT 'TRUE' ");
$this->addSql("ALTER TABLE course_category MODIFY COLUMN auth_cat_child VARCHAR(40) DEFAULT 'TRUE'");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN hotspot_type varchar(40) default NULL");
$this->addSql("ALTER TABLE c_tool MODIFY COLUMN target varchar(20) NOT NULL default '_self' ");
$this->addSql("ALTER TABLE c_link MODIFY COLUMN on_homepage char(10) NOT NULL default '0' ");
$this->addSql("ALTER TABLE c_blog_rating MODIFY COLUMN rating_type char(40) NOT NULL default 'post' ");
$this->addSql("ALTER TABLE c_survey MODIFY COLUMN anonymous char(10) NOT NULL default '0'");
$this->addSql("ALTER TABLE c_course_setting MODIFY COLUMN value varchar(255) default ''");
$this->addSql("UPDATE course_field SET field_type = 13 WHERE field_variable = 'special_course'");
$this->addSql("UPDATE user SET registration_date = NULL WHERE registration_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE user SET expiration_date = NULL WHERE expiration_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE track_e_default SET default_date = NULL WHERE default_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE track_e_lastaccess SET access_date = NULL WHERE access_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE track_e_downloads SET down_date = NULL WHERE down_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE track_e_access SET access_date = NULL WHERE access_date = '0000-00-00 00:00:00'");
$this->addSql("UPDATE track_e_access SET c_id = (SELECT id FROM course WHERE code = access_cours_code)");
$this->addSql("UPDATE track_e_default SET c_id = (SELECT id FROM course WHERE code = default_cours_code)");
$this->addSql("UPDATE track_e_lastaccess SET c_id = (SELECT id FROM course WHERE code = access_cours_code)");
$this->addSql("UPDATE track_e_exercices SET c_id = (SELECT id FROM course WHERE code = exe_cours_id)");
$this->addSql("UPDATE track_e_downloads SET c_id = (SELECT id FROM course WHERE code = down_cours_id)");
$this->addSql("UPDATE track_e_hotpotatoes SET c_id = (SELECT id FROM course WHERE code = exe_cours_id)");
$this->addSql("UPDATE track_e_links SET c_id = (SELECT id FROM course WHERE code = links_cours_id)");
$this->addSql("UPDATE track_e_course_access SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("UPDATE track_e_online SET c_id = (SELECT id FROM course WHERE code = course)");
$this->addSql("UPDATE track_e_attempt SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("UPDATE course_field_values SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("UPDATE session_rel_course_rel_user SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql('DELETE FROM session_rel_course WHERE course_code NOT IN (SELECT code FROM course)');
$this->addSql("UPDATE session_rel_course SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("DELETE FROM access_url_rel_course WHERE course_code NOT IN (SELECT code FROM course)");
$this->addSql("UPDATE access_url_rel_course SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("ALTER TABLE settings_current DROP INDEX unique_setting");
$this->addSql("ALTER TABLE settings_options DROP INDEX unique_setting_option");
$this->addSql("DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'advanced_filemanager'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'advanced_filemanager'");
// Fixes missing options show_glossary_in_extra_tools
$sql = "SELECT * FROM settings_current WHERE variable = 'institution_address'";
$result = $connection->executeQuery($sql);
$count = $result->rowCount();
if (empty($count)) {
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('institution_address', NULL, 'textfield', 'Platform', '', 'InstitutionAddressTitle', 'InstitutionAddressComment', NULL, NULL, 1)");
}
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('prevent_session_admins_to_manage_all_users', NULL, 'radio', 'Session', 'false', 'PreventSessionAdminsToManageAllUsersTitle', 'PreventSessionAdminsToManageAllUsersComment', NULL, NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('prevent_session_admins_to_manage_all_users', 'true', 'Yes'), ('prevent_session_admins_to_manage_all_users', 'false', 'No')");
// Fixes missing options show_glossary_in_extra_tools
$sql = "SELECT * FROM settings_options WHERE variable = 'show_glossary_in_extra_tools'";
$result = $connection->executeQuery($sql);
$count = $result->rowCount();
if (empty($count)) {
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'none', 'None')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'exercise', 'Exercise')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'lp', 'Learning path')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'exercise_and_lp', 'ExerciseAndLearningPath')");
}
$sql = "SELECT * FROM settings_current WHERE variable = 'documents_default_visibility_defined_in_course'";
$result = $connection->executeQuery($sql);
$count = $result->rowCount();
if (empty($count)) {
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('documents_default_visibility_defined_in_course', NULL,'radio','Tools','false','DocumentsDefaultVisibilityDefinedInCourseTitle','DocumentsDefaultVisibilityDefinedInCourseComment',NULL, NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('documents_default_visibility_defined_in_course', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('documents_default_visibility_defined_in_course', 'false', 'No')");
}
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_mathjax', NULL, 'radio', 'Editor', 'false', 'EnableMathJaxTitle', 'EnableMathJaxComment', NULL, NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'false', 'No')");
$this->addSql("INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('Føroyskt', 'faroese', 'fo', 'faroese', 0), ('Tagalog', 'tagalog', 'tl', 'tagalog',1), ('Tibetan', 'tibetan', 'bo', 'tibetan', 0), ('isiXhosa', 'xhosa', 'xh', 'xhosa', 0)");
$this->addSql("ALTER TABLE c_student_publication MODIFY COLUMN date_of_qualification DATETIME NULL DEFAULT NULL");
$this->addSql("ALTER TABLE c_student_publication MODIFY COLUMN sent_date DATETIME NULL DEFAULT NULL");
$this->addSql("UPDATE c_student_publication SET date_of_qualification = NULL WHERE date_of_qualification = '0000-00-00 00:00:00'");
$this->addSql("UPDATE c_student_publication SET sent_date = NULL WHERE sent_date = '0000-00-00 00:00:00'");
$this->addSql("ALTER TABLE c_student_publication_assignment MODIFY COLUMN expires_on DATETIME NULL DEFAULT NULL");
$this->addSql("ALTER TABLE c_student_publication_assignment MODIFY COLUMN ends_on DATETIME NULL DEFAULT NULL");
$this->addSql("UPDATE c_student_publication_assignment SET expires_on = NULL WHERE expires_on = '0000-00-00 00:00:00'");
$this->addSql("UPDATE c_student_publication_assignment SET ends_on = NULL WHERE ends_on = '0000-00-00 00:00:00'");
$this->addSql("UPDATE settings_current SET type = 'checkbox' WHERE variable = 'registration' AND category = 'User'");
$this->addSql("UPDATE settings_current SET selected_value = 'UTF-8' WHERE variable = 'platform_charset'");
$this->addSql("ALTER TABLE course_rel_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE course_rel_user ADD COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE course_rel_user MODIFY COLUMN user_id INT NULL");
$this->addSql("ALTER TABLE user MODIFY COLUMN user_id INT NULL");
$this->addSql("ALTER TABLE access_url_rel_course DROP PRIMARY KEY");
$this->addSql("ALTER TABLE access_url_rel_course ADD COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE access_url_rel_course DROP COLUMN course_code");
$this->addSql("ALTER TABLE access_url_rel_course ADD INDEX idx_select_c (c_id)");
$this->addSql("ALTER TABLE access_url_rel_course ADD INDEX idx_select_u (access_url_id)");
$this->addSql("ALTER TABLE access_url ADD COLUMN url_type TINYINT(1) NULL");
$this->addSql("ALTER TABLE course_rel_user ADD INDEX idx_select_c (c_id)");
$this->addSql("ALTER TABLE track_e_uploads ADD COLUMN c_id INT NOT NULL");
$this->addSql("UPDATE track_e_uploads SET c_id = (SELECT id FROM course WHERE code = upload_cours_id)");
//postUp
$this->addSql("ALTER TABLE track_e_access DROP COLUMN access_cours_code");
$this->addSql("ALTER TABLE track_e_default DROP COLUMN default_cours_code");
$this->addSql("ALTER TABLE track_e_lastaccess DROP COLUMN access_cours_code");
$this->addSql("ALTER TABLE track_e_exercices DROP COLUMN exe_cours_id");
$this->addSql("ALTER TABLE track_e_downloads DROP COLUMN down_cours_id");
$this->addSql("ALTER TABLE track_e_hotpotatoes DROP COLUMN exe_cours_id");
$this->addSql("ALTER TABLE track_e_links DROP COLUMN links_cours_id");
$this->addSql("ALTER TABLE track_e_course_access DROP COLUMN course_code");
$this->addSql("ALTER TABLE track_e_online DROP COLUMN course");
$this->addSql("ALTER TABLE track_e_attempt DROP COLUMN course_code");
$this->addSql("ALTER TABLE course_rel_user DROP COLUMN group_id");
$this->addSql("ALTER TABLE course_rel_user DROP COLUMN role");
$this->addSql("DROP TABLE track_c_countries");
$this->addSql("DROP TABLE track_c_browsers");
$this->addSql("DROP TABLE track_c_os");
$this->addSql("DROP TABLE track_c_providers");
$this->addSql("DROP TABLE track_c_referers");
}
/**
* We don't allow downgrades yet
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,181 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20150423093100
*
* @package Application\Migrations\Schema\V110
*/
class Version20150423093100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Sequence changes
if (!$schema->hasTable('sequence_rule')) {
$sequenceRule = $schema->createTable('sequence_rule');
$sequenceRule->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceRule->addColumn('text', Type::TEXT);
$sequenceRule->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_condition')) {
$sequenceCondition = $schema->createTable('sequence_condition');
$sequenceCondition->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceCondition->addColumn('description', Type::TEXT);
$sequenceCondition->addColumn('mat_op', Type::INTEGER);
$sequenceCondition->addColumn('param', Type::FLOAT);
$sequenceCondition->addColumn('act_true', Type::INTEGER);
$sequenceCondition->addColumn('act_false', Type::INTEGER);
$sequenceCondition->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_rule_condition')) {
$sequenceRuleCondition = $schema->createTable('sequence_rule_condition');
$sequenceRuleCondition->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceRuleCondition->addColumn('sequence_rule_id', Type::INTEGER)->setNotnull(false);
$sequenceRuleCondition->addColumn('sequence_condition_id', Type::INTEGER)->setNotnull(false);
$sequenceRuleCondition->setPrimaryKey(['id']);
$sequenceRuleCondition->addIndex(['sequence_rule_id']);
$sequenceRuleCondition->addIndex(['sequence_condition_id']);
$sequenceRuleCondition->addForeignKeyConstraint('sequence_condition', ['sequence_condition_id'], ['id']);
$sequenceRuleCondition->addForeignKeyConstraint('sequence_rule', ['sequence_rule_id'], ['id']);
}
if (!$schema->hasTable('sequence_method')) {
$sequenceMethod = $schema->createTable('sequence_method');
$sequenceMethod->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceMethod->addColumn('description', Type::TEXT);
$sequenceMethod->addColumn('formula', Type::TEXT);
$sequenceMethod->addColumn('assign', Type::INTEGER);
$sequenceMethod->addColumn('met_type', Type::INTEGER);
$sequenceMethod->addColumn('act_false', Type::INTEGER);
$sequenceMethod->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_rule_method')) {
$sequenceRuleMethod = $schema->createTable('sequence_rule_method');
$sequenceRuleMethod->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceRuleMethod->addColumn('sequence_rule_id', Type::INTEGER)->setNotnull(false);
$sequenceRuleMethod->addColumn('sequence_method_id', Type::INTEGER)->setNotnull(false);
$sequenceRuleMethod->addColumn('method_order', Type::INTEGER);
$sequenceRuleMethod->setPrimaryKey(['id']);
$sequenceRuleMethod->addIndex(['sequence_rule_id']);
$sequenceRuleMethod->addIndex(['sequence_method_id']);
$sequenceRuleMethod->addForeignKeyConstraint('sequence_method', ['sequence_method_id'], ['id']);
$sequenceRuleMethod->addForeignKeyConstraint('sequence_rule', ['sequence_rule_id'], ['id']);
}
if (!$schema->hasTable('sequence_variable')) {
$sequenceVariable = $schema->createTable('sequence_variable');
$sequenceVariable->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceVariable->addColumn('name', Type::STRING)->setLength(255)->setNotnull(false);
$sequenceVariable->addColumn('description', Type::TEXT)->setNotnull(false);
$sequenceVariable->addColumn('default_val', Type::STRING)->setLength(255)->setNotnull(false);
$sequenceVariable->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_formula')) {
$sequenceFormula = $schema->createTable('sequence_formula');
$sequenceFormula->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceFormula->addColumn('sequence_method_id', Type::INTEGER)->setNotnull(false);
$sequenceFormula->addColumn('sequence_variable_id', Type::INTEGER)->setNotnull(false);
$sequenceFormula->setPrimaryKey(['id']);
$sequenceFormula->addIndex(['sequence_method_id']);
$sequenceFormula->addIndex(['sequence_variable_id']);
$sequenceFormula->addForeignKeyConstraint('sequence_variable', ['sequence_variable_id'], ['id']);
$sequenceFormula->addForeignKeyConstraint('sequence_method', ['sequence_method_id'], ['id']);
}
if (!$schema->hasTable('sequence_valid')) {
$sequenceValid = $schema->createTable('sequence_valid');
$sequenceValid->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceValid->addColumn('sequence_variable_id', Type::INTEGER)->setNotnull(false);
$sequenceValid->addColumn('sequence_condition_id', Type::INTEGER)->setNotnull(false);
$sequenceValid->setPrimaryKey(['id']);
$sequenceValid->addIndex(['sequence_variable_id']);
$sequenceValid->addIndex(['sequence_condition_id']);
$sequenceValid->addForeignKeyConstraint('sequence_condition', ['sequence_condition_id'], ['id']);
$sequenceValid->addForeignKeyConstraint('sequence_variable', ['sequence_variable_id'], ['id']);
}
if (!$schema->hasTable('sequence_type_entity')) {
$sequenceTypeEntity = $schema->createTable('sequence_type_entity');
$sequenceTypeEntity->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceTypeEntity->addColumn('name', Type::STRING)->setLength(255);
$sequenceTypeEntity->addColumn('description', Type::TEXT);
$sequenceTypeEntity->addColumn('ent_table', Type::STRING)->setLength(255);
$sequenceTypeEntity->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_row_entity')) {
$sequenceRowEntity = $schema->createTable('sequence_row_entity');
$sequenceRowEntity->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceRowEntity->addColumn('sequence_type_entity_id', Type::INTEGER)->setNotnull(false);
$sequenceRowEntity->addColumn('c_id', Type::INTEGER);
$sequenceRowEntity->addColumn('session_id', Type::INTEGER);
$sequenceRowEntity->addColumn('row_id', Type::INTEGER);
$sequenceRowEntity->addColumn('name', Type::STRING)->setLength(255);
$sequenceRowEntity->setPrimaryKey(['id']);
$sequenceRowEntity->addIndex(['sequence_type_entity_id']);
$sequenceRowEntity->addForeignKeyConstraint('sequence_type_entity', ['sequence_type_entity_id'], ['id']);
}
if (!$schema->hasTable('sequence')) {
$sequence = $schema->createTable('sequence');
$sequence->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequence->addColumn('name', Type::STRING)->setLength(255);
$sequence->addColumn('graph', Type::TEXT)->setNotnull(false);
$sequence->addColumn('created_at', Type::DATETIME);
$sequence->addColumn('updated_at', Type::DATETIME);
$sequence->setPrimaryKey(['id']);
}
if (!$schema->hasTable('sequence_value')) {
$sequenceValue = $schema->createTable('sequence_value');
$sequenceValue->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceValue->addColumn('sequence_row_entity_id', Type::INTEGER)->setNotnull(false);
$sequenceValue->addColumn('user_id', Type::INTEGER);
$sequenceValue->addColumn('advance', Type::FLOAT);
$sequenceValue->addColumn('complete_items', Type::INTEGER);
$sequenceValue->addColumn('total_items', Type::INTEGER);
$sequenceValue->addColumn('success', Type::BOOLEAN);
$sequenceValue->addColumn('success_date', Type::DATETIME)->setNotnull(false);
$sequenceValue->addColumn('available', Type::BOOLEAN);
$sequenceValue->addColumn('available_start_date', Type::DATETIME)->setNotnull(false);
$sequenceValue->addColumn('available_end_date', Type::DATETIME)->setNotnull(false);
$sequenceValue->setPrimaryKey(['id']);
$sequenceValue->addIndex(['sequence_row_entity_id']);
$sequenceValue->addForeignKeyConstraint('sequence_row_entity', ['sequence_row_entity_id'], ['id']);
}
if (!$schema->hasTable('sequence_resource')) {
$sequenceResource = $schema->createTable('sequence_resource');
$sequenceResource->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sequenceResource->addColumn('sequence_id', Type::INTEGER)->setNotnull(false);
$sequenceResource->addColumn('type', Type::INTEGER);
$sequenceResource->addColumn('resource_id', Type::INTEGER);
$sequenceResource->setPrimaryKey(['id']);
$sequenceResource->addIndex(['sequence_id']);
$sequenceResource->addForeignKeyConstraint('sequence', ['sequence_id'], ['id']);
}
}
/**
* We don't allow downgrades yet
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,77 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150504182600
*
* @package Application\Migrations\Schema\V110
*/
class Version20150504182600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Set parent language to Spanish for all close-by languages. Same for Italian,
// French, Portuguese and Chinese
$connection = $this->connection;
$sql = "SELECT id, english_name
FROM language
WHERE english_name IN ('spanish', 'italian', 'portuguese', 'simpl_chinese', 'french')";
$result = $connection->executeQuery($sql);
$dataList = $result->fetchAll();
$languages = array();
if (!empty($dataList)) {
foreach ($dataList as $data) {
$languages[$data['english_name']] = $data['id'];
}
}
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'quechua_cusco'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'galician'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'esperanto'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'catalan'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'asturian'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['spanish'] . " WHERE english_name = 'friulian'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['french'] . " WHERE english_name = 'occitan'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['portuguese'] . " WHERE english_name = 'brazilian'
");
$this->addSql("
UPDATE language SET parent_id = " . $languages['simpl_chinese'] . " WHERE english_name = 'trad_chinese'
");
}
/**
* We don't allow downgrades yet
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("
UPDATE language SET parent_id = 0 WHERE english_name IN ('trad_chinese', 'brazilian', 'occitan', 'friulian', 'asturian', 'catalan', 'esperanto', 'galician', 'quechua_cusco')
");
}
}

View File

@@ -0,0 +1,64 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Extra fields changes
*/
class Version20150505132304 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// Force table creation in order to do updates/insert later.
$this->connection->executeQuery('CREATE TABLE IF NOT EXISTS extra_field (id INT AUTO_INCREMENT NOT NULL, extra_field_type INT NOT NULL, field_type INT NOT NULL, variable VARCHAR(64) NOT NULL, display_text VARCHAR(255) DEFAULT NULL, default_value LONGTEXT, field_order INT DEFAULT NULL, visible TINYINT(1) DEFAULT NULL, changeable TINYINT(1) DEFAULT NULL, filter TINYINT(1) DEFAULT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id))');
$this->connection->executeQuery('CREATE TABLE IF NOT EXISTS extra_field_values (id INT AUTO_INCREMENT NOT NULL, value VARCHAR(255) DEFAULT NULL, field_id INT NOT NULL, item_id INT NOT NULL, comment LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id))');
$this->connection->executeQuery('CREATE TABLE IF NOT EXISTS extra_field_options (id INT AUTO_INCREMENT NOT NULL, field_id INT DEFAULT NULL, option_value LONGTEXT, display_text VARCHAR(64) DEFAULT NULL, option_order INT DEFAULT NULL, priority VARCHAR(255) DEFAULT NULL, priority_message VARCHAR(255) DEFAULT NULL, INDEX IDX_A572E3AE443707B0 (field_id), PRIMARY KEY(id))');
if (!$schema->hasTable('extra_field_options')) {
$this->connection->executeQuery(
'ALTER TABLE extra_field_options ADD CONSTRAINT FK_A572E3AE443707B0 FOREIGN KEY (field_id) REFERENCES extra_field (id)'
);
}
$this->addSql('CREATE TABLE IF NOT EXISTS 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))');
/*
$this->addSql('DROP TABLE course_field');
$this->addSql('DROP TABLE course_field_options');
$this->addSql('DROP TABLE course_field_values');
$this->addSql('DROP TABLE session_field');
$this->addSql('DROP TABLE session_field_options');
$this->addSql('DROP TABLE session_field_values');
$this->addSql('DROP TABLE user_field');
$this->addSql('DROP TABLE user_field_options');
$this->addSql('DROP TABLE user_field_values');
*/
}
/**
* @param Schema $schema
*/
public function postUp(Schema $schema)
{
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE extra_field_options DROP FOREIGN KEY FK_A572E3AE443707B0');
$this->addSql('DROP TABLE extra_field_option_rel_field_option');
$this->addSql('DROP TABLE extra_field_options');
$this->addSql('DROP TABLE extra_field');
$this->addSql('DROP TABLE extra_field_values');
}
}

View File

@@ -0,0 +1,77 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20150505142900
*
* @package Application\Migrations\Schema\V110
*/
class Version20150505142900 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Create table for video chat
if (!$schema->hasTable('chat_video')) {
$chatVideoTable = $schema->createTable('chat_video');
$chatVideoTable->addColumn(
'id',
Type::INTEGER,
['autoincrement' => true, 'notnull' => true]
);
$chatVideoTable->addColumn(
'from_user',
Type::INTEGER,
['notnull' => true]
);
$chatVideoTable->addColumn(
'to_user',
Type::INTEGER,
['notnull' => true]
);
$chatVideoTable->addColumn(
'room_name',
Type::STRING,
['length' => 255, 'notnull' => true]
);
$chatVideoTable->addColumn(
'datetime',
Type::DATETIME,
['notnull' => true]
);
$chatVideoTable->setPrimaryKey(['id']);
$chatVideoTable->addIndex(
['from_user'],
'idx_chat_video_from_user'
);
$chatVideoTable->addIndex(['to_user'], 'idx_chat_video_to_user');
$chatVideoTable->addIndex(
['from_user', 'to_user'],
'idx_chat_video_users'
);
$chatVideoTable->addIndex(
['room_name'],
'idx_chat_video_room_name'
);
}
}
/**
* We don't allow downgrades yet
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable('chat_video');
}
}

View File

@@ -0,0 +1,242 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150507152600
*
* @package Application\Migrations\Schema\V110
*/
class Version20150507152600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Move some settings from configuration.php to the database
// Current settings categories are:
// Platform, Course, Session, Languages, User, Tools, Editor, Security,
// Tuning, Gradebook, Timezones, Tracking, Search, stylesheets (lowercase),
// LDAP, CAS, Shibboleth, Facebook
// Setting $_configuration['hide_home_top_when_connected'] = true;
$value = $this->getConfigurationValue('hide_home_top_when_connected');
$this->addSettingCurrent(
'hide_home_top_when_connected',
'',
'radio',
'Platform',
($value ? 'true' : 'false'),
'HideHomeTopContentWhenLoggedInText',
'HideHomeTopContentWhenLoggedInComment',
null,
'',
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
);
// Hide the global announcements for non-connected users
//$_configuration['hide_global_announcements_when_not_connected'] = true;
$value = $this->getConfigurationValue('hide_global_announcements_when_not_connected');
$this->addSettingCurrent(
'hide_global_announcements_when_not_connected',
'',
'radio',
'Platform',
($value?'true':'false'),
'HideGlobalAnnouncementsWhenNotLoggedInText',
'HideGlobalAnnouncementsWhenNotLoggedInComment',
null,
'',
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
);
// Use this course as template for all new courses (define course real ID as value)
//$_configuration['course_creation_use_template'] = 14;
$value = $this->getConfigurationValue('course_creation_use_template');
$this->addSettingCurrent(
'course_creation_use_template',
'',
'textfield',
'Course',
($value?$value:''),
'CourseCreationUsesTemplateText',
'CourseCreationUsesTemplateComment',
null,
'',
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
);
// Add password strength checker
//$_configuration['allow_strength_pass_checker'] = true;
$value = $this->getConfigurationValue('allow_strength_pass_checker');
$this->addSettingCurrent(
'allow_strength_pass_checker',
'',
'radio',
'Security',
($value?'true':'false'),
'EnablePasswordStrengthCheckerText',
'EnablePasswordStrengthCheckerComment',
null,
'',
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
);
// Enable captcha
// $_configuration['allow_captcha'] = true;
$value = $this->getConfigurationValue('allow_captcha');
$this->addSettingCurrent(
'allow_captcha',
'',
'radio',
'Security',
($value?'true':'false'),
'EnableCaptchaText',
'EnableCaptchaComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Prevent account from logging in for a certain amount of time
// if captcha is wrong for the specified number of times
//$_configuration['captcha_number_mistakes_to_block_account'] = 5;
$value = $this->getConfigurationValue('captcha_number_mistakes_to_block_account');
$this->addSettingCurrent(
'captcha_number_mistakes_to_block_account',
'',
'textfield',
'Security',
($value?$value:5),
'CaptchaNumberOfMistakesBeforeBlockingAccountText',
'CaptchaNumberOfMistakesBeforeBlockingAccountComment',
null,
'',
1,
true,
false
);
// Prevent account from logging in for the specified number of minutes
//$_configuration['captcha_time_to_block'] = 5;//minutes
$value = $this->getConfigurationValue('captcha_time_to_block');
$this->addSettingCurrent(
'captcha_time_to_block',
'',
'textfield',
'Security',
($value?$value:5),
'CaptchaTimeAccountIsLockedText',
'CaptchaTimeAccountIsLockedComment',
null,
'',
1,
true,
false
);
// Allow DRH role to access all content and users from the sessions he follows
//$_configuration['drh_can_access_all_session_content'] = true;
$value = $this->getConfigurationValue('drh_can_access_all_session_content');
$this->addSettingCurrent(
'drh_can_access_all_session_content',
'',
'radio',
'Session',
($value?'true':'false'),
'DRHAccessToAllSessionContentText',
'DRHAccessToAllSessionContentComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Display group's forum in general forum tool
//$_configuration['display_groups_forum_in_general_tool'] = true;
$value = $this->getConfigurationValue('display_groups_forum_in_general_tool');
$this->addSettingCurrent(
'display_groups_forum_in_general_tool',
'',
'radio',
'Tools',
($value?'true':'false'),
'ShowGroupForaInGeneralToolText',
'ShowGroupForaInGeneralToolComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Allow course tutors in sessions to add existing students to their session
//$_configuration['allow_tutors_to_assign_students_to_session'] = 'false';
$value = $this->getConfigurationValue('allow_tutors_to_assign_students_to_session');
$this->addSettingCurrent(
'allow_tutors_to_assign_students_to_session',
'',
'radio',
'Session',
($value?'true':'false'),
'TutorsCanAssignStudentsToSessionsText',
'TutorsCanAssignStudentsToSessionsComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
}
/**
* We don't allow downgrades yet
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("
DELETE FROM settings_options WHERE variable IN ('hide_home_top_when_connected', 'hide_global_announcements_when_not_connected', 'course_creation_use_template', 'allow_strength_pass_checker', 'allow_captcha', 'captcha_number_mistakes_to_block_account', 'captcha_time_to_block', 'drh_can_access_all_session_content', 'display_groups_forum_in_general_tool', 'allow_tutors_to_assign_students_to_session')
");
$this->addSql("
DELETE FROM settings_current WHERE variable IN ('hide_home_top_when_connected', 'hide_global_announcements_when_not_connected', 'course_creation_use_template', 'allow_strength_pass_checker', 'allow_captcha', 'captcha_number_mistakes_to_block_account', 'captcha_time_to_block', 'drh_can_access_all_session_content', 'display_groups_forum_in_general_tool', 'allow_tutors_to_assign_students_to_session')
");
}
}

View File

@@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Username changes
*/
class Version20150511133949 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE user ADD salt VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE user ADD username_canonical VARCHAR(100) NOT NULL');
//$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)');
$this->addSql('ALTER TABLE user CHANGE password password VARCHAR(255) NOT NULL');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'false', 'No')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE user DROP salt');
$this->addSql('DROP INDEX UNIQ_8D93D64992FC23A8 ON user');
$this->addSql('ALTER TABLE user DROP username_canonical');
$this->addSql('ALTER TABLE user CHANGE password password VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_teachers_to_create_sessions" ');
$this->addSql('DELETE FROM settings_options WHERE variable = "allow_teachers_to_create_sessions" ');
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Username changes
*/
class Version20150519153200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE session_rel_user ADD COLUMN registered_at DATETIME NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE session_rel_user DROP COLUMN registered_at');
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Username changes
*/
class Version20150521113600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int UNSIGNED NOT NULL DEFAULT 0');
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int UNSIGNED NOT NULL DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int NULL');
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int NULL');
}
}

View File

@@ -0,0 +1,55 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Usergroup changes
*/
class Version20150522112023 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// Set 0 if there's no group category.
//$this->addSql('UPDATE c_group_info SET category_id = 0 WHERE category_id = 2');
$this->addSql('ALTER TABLE usergroup ADD group_type INT NOT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE usergroup ADD picture VARCHAR(255) DEFAULT NULL, ADD url VARCHAR(255) DEFAULT NULL, ADD visibility VARCHAR(255) NOT NULL, ADD allow_members_leave_group INT NOT NULL, CHANGE description description LONGTEXT');
if (!$schema->hasTable('usergroup_rel_usergroup')) {
$this->addSql(
'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, PRIMARY KEY(id))'
);
}
$this->addSql('ALTER TABLE usergroup_rel_user ADD relation_type INT');
if (!$schema->hasTable('access_url_rel_usergroup')) {
$this->addSql(
'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'
);
$sql = 'SELECT * FROM usergroup';
$result = $this->connection->query($sql);
$results = $result->fetchAll();
foreach ($results as $result) {
$groupId = $result['id'];
$sql = "INSERT INTO access_url_rel_usergroup (access_url_id, usergroup_id) VALUES ('1', '$groupId')";
$this->addSql($sql);
}
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DROP TABLE access_url_rel_usergroup');
}
}

View File

@@ -0,0 +1,821 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150522222222
* @package Application\Migrations\Schema\V11010
*/
class Version20150522222222 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// The first ALTER queries here requires a check because the field might already exist
$connection = $this->connection;
$fieldExists = false;
$sql = "SELECT *
FROM user
LIMIT 1";
$result = $connection->executeQuery($sql);
$dataList = $result->fetchAll();
if (!empty($dataList)) {
foreach ($dataList as $data) {
if (isset($data['last_login'])) {
$fieldExists = true;
}
}
}
if (!$fieldExists) {
$this->addSql('ALTER TABLE user ADD COLUMN last_login datetime DEFAULT NULL');
}
// calendar events comments
$fieldExists = false;
$sql = "SELECT *
FROM c_calendar_event
LIMIT 1";
$result = $connection->executeQuery($sql);
$dataList = $result->fetchAll();
if (!empty($dataList)) {
foreach ($dataList as $data) {
if (isset($data['comment'])) {
$fieldExists = true;
}
}
}
if (!$fieldExists) {
$this->addSql("ALTER TABLE c_calendar_event ADD COLUMN comment TEXT");
}
// Move some settings from configuration.php to the database
// Current settings categories are:
// Platform, Course, Session, Languages, User, Tools, Editor, Security,
// Tuning, Gradebook, Timezones, Tracking, Search, stylesheets (lowercase),
// LDAP, CAS, Shibboleth, Facebook
// Allow select the return link in the LP view
$value = $this->getConfigurationValue('allow_lp_return_link');
$this->addSettingCurrent(
'allow_lp_return_link',
'',
'radio',
'Course',
($value?$value:'true'),
'AllowLearningPathReturnLinkTitle',
'AllowLearningPathReturnLinkComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If true the export link is blocked.
$value = $this->getConfigurationValue('hide_scorm_export_link');
$this->addSettingCurrent(
'hide_scorm_export_link',
'',
'radio',
'Course',
($value?$value:'false'),
'HideScormExportLinkTitle',
'HideScormExportLinkComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If true the copy link is blocked.
//$_configuration['hide_scorm_copy_link'] = false;
$value = $this->getConfigurationValue('hide_scorm_copy_link');
$this->addSettingCurrent(
'hide_scorm_copy_link',
'',
'radio',
'Course',
($value?$value:'false'),
'HideScormCopyLinkTitle',
'HideScormCopyLinkComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If true the pdf export link is blocked.
//$_configuration['hide_scorm_pdf_link'] = false;
$value = $this->getConfigurationValue('hide_scorm_pdf_link');
$this->addSettingCurrent(
'hide_scorm_pdf_link',
'',
'radio',
'Course',
($value?$value:'false'),
'HideScormPdfLinkTitle',
'HideScormPdfLinkComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Default session days before coach access
//$_configuration['session_days_before_coach_access'] = 0;
$value = $this->getConfigurationValue('session_days_before_coach_access');
$this->addSettingCurrent(
'session_days_before_coach_access',
'',
'textfield',
'Session',
($value?$value:'0'),
'SessionDaysBeforeCoachAccessTitle',
'SessionDaysBeforeCoachAccessComment',
null,
'',
1,
true,
false
);
// Default session days after coach access
//$_configuration['session_days_after_coach_access'] = 0;
$value = $this->getConfigurationValue('session_days_after_coach_access');
$this->addSettingCurrent(
'session_days_after_coach_access',
'',
'textfield',
'Session',
($value?$value:'0'),
'SessionDaysAfterCoachAccessTitle',
'SessionDaysAfterCoachAccessComment',
null,
'',
1,
true,
false
);
// PDF Logo header in app/Resources/public/css/themes/xxx/images/pdf_logo_header.png
//$_configuration['pdf_logo_header'] = false;
$value = $this->getConfigurationValue('pdf_logo_header');
$this->addSettingCurrent(
'pdf_logo_header',
'',
'radio',
'Course',
($value?$value:'false'),
'PdfLogoHeaderTitle',
'PdfLogoHeaderComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Order inscription user list by official_code
//$_configuration['order_user_list_by_official_code'] = false;
$value = $this->getConfigurationValue('order_user_list_by_official_code');
$this->addSettingCurrent(
'order_user_list_by_official_code',
'',
'radio',
'Platform',
($value?$value:'false'),
'OrderUserListByOfficialCodeTitle',
'OrderUserListByOfficialCodeComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Default course setting "email_alert_manager_on_new_quiz"
//$_configuration['email_alert_manager_on_new_quiz'] = 1;
$value = $this->getConfigurationValue('email_alert_manager_on_new_quiz');
$this->addSettingCurrent(
'email_alert_manager_on_new_quiz',
'',
'radio',
'Course',
($value?$value:'true'),
'AlertManagerOnNewQuizTitle',
'AlertManagerOnNewQuizComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Show official code in exercise report list.
//$_configuration['show_official_code_exercise_result_list'] = false;
$value = $this->getConfigurationValue('show_official_code_exercise_result_list');
$this->addSettingCurrent(
'show_official_code_exercise_result_list',
'',
'radio',
'Tools',
($value?$value:'false'),
'ShowOfficialCodeInExerciseResultListTitle',
'ShowOfficialCodeInExerciseResultListComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Hide private courses from course catalog
//$_configuration['course_catalog_hide_private'] = false;
$value = $this->getConfigurationValue('course_catalog_hide_private');
$this->addSettingCurrent(
'course_catalog_hide_private',
'',
'radio',
'Platform',
($value?$value:'false'),
'HidePrivateCoursesFromCourseCatalogTitle',
'HidePrivateCoursesFromCourseCatalogComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Display sessions catalog
// 0 = show only courses; 1 = show only sessions; 2 = show courses and sessions
//$_configuration['catalog_show_courses_sessions'] = 0;
$value = $this->getConfigurationValue('catalog_show_courses_sessions');
$this->addSettingCurrent(
'catalog_show_courses_sessions',
'',
'radio',
'Platform',
($value?$value:'0'),
'CoursesCatalogueShowSessionsTitle',
'CoursesCatalogueShowSessionsComment',
null,
'',
1,
true,
false,
[0 => ['value' => '0', 'text' => 'CatalogueShowOnlyCourses'], 1 => ['value' => '1', 'text' => 'CatalogueShowOnlySessions'], 2 => ['value' => '2', 'text' => 'CatalogueShowCoursesAndSessions']]
);
// Auto detect language custom pages.
// $_configuration['auto_detect_language_custom_pages'] = true;
$value = $this->getConfigurationValue('auto_detect_language_custom_pages');
$this->addSettingCurrent(
'auto_detect_language_custom_pages',
'',
'radio',
'Platform',
($value?$value:'true'),
'AutoDetectLanguageCustomPagesTitle',
'AutoDetectLanguageCustomPagesComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Show reduce LP report
//$_configuration['lp_show_reduced_report'] = false;
$value = $this->getConfigurationValue('lp_show_reduced_report');
$this->addSettingCurrent(
'lp_show_reduced_report',
'',
'radio',
'Tools',
($value?$value:'false'),
'LearningPathShowReducedReportTitle',
'LearningPathShowReducedReportComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
//Allow session-to-session copy
//$_configuration['allow_session_course_copy_for_teachers'] = true;
$value = $this->getConfigurationValue('allow_session_course_copy_for_teachers');
$this->addSettingCurrent(
'allow_session_course_copy_for_teachers',
'',
'radio',
'Session',
($value?$value:'false'),
'AllowSessionCourseCopyForTeachersTitle',
'AllowSessionCourseCopyForTeachersComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Hide the logout button
//$_configuration['hide_logout_button'] = true;
$value = $this->getConfigurationValue('hide_logout_button');
$this->addSettingCurrent(
'hide_logout_button',
'',
'radio',
'Security',
($value?$value:'false'),
'HideLogoutButtonTitle',
'HideLogoutButtonComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Prevent redirecting admin to admin page
//$_configuration['redirect_admin_to_courses_list'] = true;
$value = $this->getConfigurationValue('redirect_admin_to_courses_list');
$this->addSettingCurrent(
'redirect_admin_to_courses_list',
'',
'radio',
'Platform',
($value?$value:'false'),
'RedirectAdminToCoursesListTitle',
'RedirectAdminToCoursesListComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Shows the custom course icon instead of the classic green board icon
//$_configuration['course_images_in_courses_list'] = false;
$value = $this->getConfigurationValue('course_images_in_courses_list');
$this->addSettingCurrent(
'course_images_in_courses_list',
'',
'radio',
'Course',
($value?$value:'false'),
'CourseImagesInCoursesListTitle',
'CourseImagesInCoursesListComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Which student publication will be taken when connected to the gradebook: first|last
//$_configuration['student_publication_to_take_in_gradebook'] = 'first';
$value = $this->getConfigurationValue('student_publication_to_take_in_gradebook');
$this->addSettingCurrent(
'student_publication_to_take_in_gradebook',
'',
'radio',
'Gradebook',
($value?$value:'first'),
'StudentPublicationSelectionForGradebookTitle',
'StudentPublicationSelectionForGradebookComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'first', 'text' => 'First'], 1 => ['value' => 'last', 'text' => 'Last']]
);
// Show a filter by official code
//$_configuration['certificate_filter_by_official_code'] = false;
$value = $this->getConfigurationValue('certificate_filter_by_official_code');
$this->addSettingCurrent(
'certificate_filter_by_official_code',
'',
'radio',
'Gradebook',
($value?$value:'false'),
'FilterCertificateByOfficialCodeTitle',
'FilterCertificateByOfficialCodeComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Max quantity of fkceditor allowed in the exercise result page otherwise
// Textareas are used.
//$_configuration['exercise_max_ckeditors_in_page'] = 0;
$value = $this->getConfigurationValue('exercise_max_ckeditors_in_page');
$this->addSettingCurrent(
'exercise_max_ckeditors_in_page',
'',
'textfield',
'Tools',
($value?$value:'0'),
'MaxCKeditorsOnExerciseResultsPageTitle',
'MaxCKeditorsOnExerciseResultsPageComment',
null,
'',
1,
true,
false,
array()
);
// Default upload option
//$_configuration['document_if_file_exists_option'] = 'rename'; // overwrite
$value = $this->getConfigurationValue('document_if_file_exists_option');
$this->addSettingCurrent(
'document_if_file_exists_option',
'',
'radio',
'Tools',
($value?$value:'rename'),
'DocumentDefaultOptionIfFileExistsTitle',
'DocumentDefaultOptionIfFileExistsComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'rename', 'text' => 'Rename'], 1 => ['value' => 'overwrite', 'text' => 'Overwrite']]
);
// Enable add_gradebook_certificates.php cron task
//$_configuration['add_gradebook_certificates_cron_task_enabled'] = true;
$value = $this->getConfigurationValue('add_gradebook_certificates_cron_task_enabled');
$this->addSettingCurrent(
'add_gradebook_certificates_cron_task_enabled',
'',
'radio',
'Tools',
($value?$value:'false'),
'GradebookCronTaskGenerationTitle',
'GradebookCronTaskGenerationComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Which OpenBadges backpack send the badges
//$_configuration['openbadges_backpack'] = 'https://backpack.openbadges.org/';
$value = $this->getConfigurationValue('openbadges_backpack');
$this->addSettingCurrent(
'openbadges_backpack',
'',
'textfield',
'Gradebook',
($value?$value:'https://backpack.openbadges.org/'),
'OpenBadgesBackpackUrlTitle',
'OpenBadgesBackpackUrlComment',
null,
'',
1,
true,
false,
[]
);
// Shows a warning message explaining that the site uses cookies
//$_configuration['cookie_warning'] = false;
$value = $this->getConfigurationValue('cookie_warning');
$this->addSettingCurrent(
'cookie_warning',
'',
'radio',
'Tools',
($value?$value:'false'),
'CookieWarningTitle',
'CookieWarningComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If there are any tool available and the user is not registered hide the group
//$_configuration['hide_course_group_if_no_tools_available'] = false;
$value = $this->getConfigurationValue('hide_course_group_if_no_tools_available');
$this->addSettingCurrent(
'hide_course_group_if_no_tools_available',
'',
'radio',
'Tools',
($value?$value:'false'),
'HideCourseGroupIfNoToolAvailableTitle',
'HideCourseGroupIfNoToolAvailableComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Allow student to enroll into a session without an approval needing
//$_configuration['catalog_allow_session_auto_subscription'] = false;
$value = $this->getConfigurationValue('catalog_allow_session_auto_subscription');
$this->addSettingCurrent(
'catalog_allow_session_auto_subscription',
'',
'radio',
'Session',
($value?$value:'false'),
'CatalogueAllowSessionAutoSubscriptionTitle',
'CatalogueAllowSessionAutoSubscriptionComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Decode UTF-8 from Web Services (option passed to SOAP)
//$_configuration['registration.soap.php.decode_utf8'] = false;
$value = $this->getConfigurationValue('registration.soap.php.decode_utf8');
$this->addSettingCurrent(
'registration.soap.php.decode_utf8',
'',
'radio',
'Platform',
($value?$value:'false'),
'SoapRegistrationDecodeUtf8Title',
'SoapRegistrationDecodeUtf8Comment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Show delete option in attendance
//$_configuration['allow_delete_attendance'] = false;
$value = $this->getConfigurationValue('allow_delete_attendance');
$this->addSettingCurrent(
'allow_delete_attendance',
'',
'radio',
'Tools',
($value?$value:'false'),
'AttendanceDeletionEnableTitle',
'AttendanceDeletionEnableComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Enable Gravatar profile image if no local image has been given
//$_configuration['gravatar_enabled'] = true;
$value = $this->getConfigurationValue('gravatar_enabled');
$this->addSettingCurrent(
'gravatar_enabled',
'',
'radio',
'Platform',
($value?$value:'false'),
'GravatarPicturesTitle',
'GravatarPicturesComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If Gravatar is enabled, tells which type of picture we want (default is "mm").
// Options: mm | identicon | monsterid | wavatar
//$_configuration['gravatar_type'] = 'mm';
$value = $this->getConfigurationValue('gravatar_type');
$this->addSettingCurrent(
'gravatar_type',
'',
'radio',
'Platform',
($value?$value:'mm'),
'GravatarPicturesTypeTitle',
'GravatarPicturesTypeComment',
null,
'',
1,
true,
false,
[
0 => ['value' => 'mm', 'text' => 'mystery-man'],
1 => ['value' => 'identicon', 'text' => 'identicon'],
2 => ['value' => 'monsterid', 'text' => 'monsterid'],
3 => ['value' => 'wavatar', 'text' => 'wavatar']
]
);
// Limit for the Session Admin role. The administration page show only
// User block -> Add user
// Course Sessions block -> Training session list
//$_configuration['limit_session_admin_role'] = false;
$value = $this->getConfigurationValue('limit_session_admin_role');
$this->addSettingCurrent(
'limit_session_admin_role',
'',
'radio',
'Session',
($value?'true':'false'),
'SessionAdminPermissionsLimitTitle',
'SessionAdminPermissionsLimitComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Show session description
//$_configuration['show_session_description'] = false;
$value = $this->getConfigurationValue('show_session_description');
$this->addSettingCurrent(
'show_session_description',
'',
'radio',
'Session',
($value?$value:'false'),
'ShowSessionDescriptionTitle',
'ShowSessionDescriptionComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Hide only for students the link to export certificates to PDF
//$_configuration['hide_certificate_export_link_students'] = false;
$value = $this->getConfigurationValue('hide_certificate_export_link_students');
$this->addSettingCurrent(
'hide_certificate_export_link_students',
'',
'radio',
'Gradebook',
($value?$value:'false'),
'CertificateHideExportLinkStudentTitle',
'CertificateHideExportLinkStudentComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Hide for all user roles the link to export certificates to PDF
//$_configuration['hide_certificate_export_link'] = false;
$value = $this->getConfigurationValue('hide_certificate_export_link');
$this->addSettingCurrent(
'hide_certificate_export_link',
'',
'radio',
'Gradebook',
($value?$value:'false'),
'CertificateHideExportLinkTitle',
'CertificateHideExportLinkComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Hide session course coach in dropbox sent to user list
//$_configuration['dropbox_hide_course_coach'] = false;
$value = $this->getConfigurationValue('dropbox_hide_course_coach');
$this->addSettingCurrent(
'dropbox_hide_course_coach',
'',
'radio',
'Tools',
($value ? $value : 'false'),
'DropboxHideCourseCoachTitle',
'DropboxHideCourseCoachComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
$value = $this->getConfigurationValue('dropbox_hide_general_coach');
$this->addSettingCurrent(
'dropbox_hide_general_coach',
'',
'radio',
'Tools',
($value ? $value : 'false'),
'DropboxHideGeneralCoachTitle',
'DropboxHideGeneralCoachComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If SSO is used, the redirection to the master server is forced.
//$_configuration['force_sso_redirect'] = false;
$value = $this->getConfigurationValue('force_sso_redirect');
$this->addSettingCurrent(
'sso_force_redirect',
'',
'radio',
'Security',
($value?$value:'false'),
'SSOForceRedirectTitle',
'SSOForceRedirectComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// Session course ordering in the the session view.
// false = alphabetic order (default)
// true = based in the session course list
//$_configuration['session_course_ordering'] = false;
$value = $this->getConfigurationValue('session_course_ordering');
$this->addSettingCurrent(
'session_course_ordering',
'',
'radio',
'Session',
($value?$value:'false'),
'SessionCourseOrderingTitle',
'SessionCourseOrderingComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM settings_options WHERE variable IN ('session_course_ordering', 'sso_force_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
$this->addSql("DELETE FROM settings_current WHERE variable IN ('session_course_ordering', 'sso_force_redirect', 'dropbox_hide_course_coach', 'hide_certificate_export_link', 'hide_certificate_export_link_students', 'show_session_description', 'limit_session_admin_role', 'gravatar_type', 'gravatar_enabled', 'allow_delete_attendance', 'registration.soap.php.decode_utf8', 'catalog_allow_session_auto_subscription', 'hide_course_group_if_no_tools_available', 'cookie_warning', 'openbadges_backpack', 'add_gradebook_certificates_cron_task_enabled', 'document_if_file_exists_option', 'exercise_max_ckeditors_in_page', 'certificate_filter_by_official_code', 'student_publication_to_take_in_gradebook', 'course_images_in_courses_list', 'redirect_admin_to_courses_list', 'hide_logout_button', 'allow_session_course_copy_for_teachers', 'lp_show_reduced_report', 'auto_detect_language_custom_pages', 'catalog_show_courses_sessions', 'course_catalog_hide_private', 'show_official_code_exercise_result_list', 'allow_lp_return_link', 'hide_scorm_export_link', 'hide_scorm_copy_link', 'hide_scorm_pdf_link', 'session_days_before_coach_access', 'session_days_after_coach_access', 'pdf_logo_header', 'order_user_list_by_official_code', 'email_alert_manager_on_new_quiz')");
$this->addSql('ALTER TABLE user DROP COLUMN last_login');
}
}

View File

@@ -0,0 +1,55 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150527120703
* LP autolunch -> autolaunch
* @package Application\Migrations\Schema\V11010
*/
class Version20150527101600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'gamification_mode',
'',
'radio',
'Platform',
0,
'GamificationModeTitle',
'GamificationModeComment',
null,
'',
1,
true,
false,
[
[
'value' => 1,
'text' => 'Yes'
],
[
'value' => 0,
'text' => 'No'
]
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM settings_options WHERE variable = 'gamification_mode'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'gamification_mode'");
}
}

View File

@@ -0,0 +1,33 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150527114220
* Lp category
* @package Application\Migrations\Schema\V11010
*/
class Version20150527114220 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('CREATE TABLE IF NOT EXISTS c_lp_category (iid INT AUTO_INCREMENT 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');
$this->addSql('ALTER TABLE c_lp ADD category_id INT NOT NULL DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DROP TABLE c_lp_category');
$this->addSql('ALTER TABLE c_lp DROP category_id');
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150527120703
* LP autolunch -> autolaunch
* @package Application\Migrations\Schema\V11010
*/
class Version20150527120703 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_lp CHANGE COLUMN autolunch autolaunch INT NOT NULL DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_lp CHANGE COLUMN autolaunch autolunch INT NOT NULL');
}
}

View File

@@ -0,0 +1,84 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150528103216 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE session ADD COLUMN access_start_date datetime');
$this->addSql('ALTER TABLE session ADD COLUMN access_end_date datetime');
$this->addSql('ALTER TABLE session ADD COLUMN coach_access_start_date datetime');
$this->addSql('ALTER TABLE session ADD COLUMN coach_access_end_date datetime');
$this->addSql('ALTER TABLE session ADD COLUMN display_start_date datetime');
$this->addSql('ALTER TABLE session ADD COLUMN display_end_date datetime');
$this->addSql('UPDATE session SET access_start_date = date_start');
$this->addSql("UPDATE session SET access_end_date = CONVERT(CONCAT(date_end, ' 23:59:59'), DATETIME)");
$this->addSql('UPDATE session SET coach_access_start_date = CONVERT(DATE_SUB(date_start, INTERVAL nb_days_access_before_beginning DAY), DATETIME) ');
$this->addSql('UPDATE session SET coach_access_start_date = NULL WHERE nb_days_access_before_beginning = 0');
$this->addSql('UPDATE session SET coach_access_end_date = CONVERT(DATE_ADD(date_end, INTERVAL nb_days_access_after_end DAY), DATETIME) ');
$this->addSql('UPDATE session SET coach_access_end_date = NULL WHERE nb_days_access_after_end = 0');
$this->addSql('UPDATE session SET display_start_date = access_start_date');
$this->addSql('UPDATE session SET display_end_date = access_end_date');
// Set dates to NULL
$this->addSql('UPDATE session SET access_start_date = NULL WHERE access_start_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET access_end_date = NULL WHERE access_end_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET access_start_date = NULL WHERE access_start_date = "0000-00-00 23:59:59"');
$this->addSql('UPDATE session SET access_end_date = NULL WHERE access_end_date = "0000-00-00 23:59:59"');
$this->addSql('UPDATE session SET coach_access_start_date = NULL WHERE coach_access_start_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET coach_access_end_date = NULL WHERE coach_access_end_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET coach_access_start_date = NULL WHERE coach_access_start_date = "0000-00-00 23:59:59"');
$this->addSql('UPDATE session SET coach_access_end_date = NULL WHERE coach_access_end_date = "0000-00-00 23:59:59"');
$this->addSql('UPDATE session SET display_start_date = NULL WHERE display_start_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET display_end_date = NULL WHERE display_end_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE session SET display_start_date = NULL WHERE display_start_date = "0000-00-00 23:59:59"');
$this->addSql('UPDATE session SET display_end_date = NULL WHERE display_end_date = "0000-00-00 23:59:59"');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE session CREATE date_start date NOT NULL');
$this->addSql('ALTER TABLE session CREATE date_end date NOT NULL');
$this->addSql('ALTER TABLE session CREATE nb_days_access_before_beginning TINYINT');
$this->addSql('ALTER TABLE session CREATE nb_days_access_after_end TINYINT');
$this->addSql('UPDATE session SET date_start = access_start_date');
$this->addSql('UPDATE session SET date_end = access_end_date');
$this->addSql('UPDATE session SET nb_days_access_before_beginning = DATEDIFF(access_start_date, coach_access_start_date) WHERE access_start_date != coach_access_start_date AND coach_access_start_date IS NOT NULL');
$this->addSql('UPDATE session SET nb_days_access_after_end = DATEDIFF(coach_access_end_date, coach_access_end_date) WHERE access_end_date != coach_access_end_date AND coach_access_end_date IS NOT NULL');
$this->addSql('UPDATE session SET nb_days_access_before_beginning = 0 WHERE access_start_date = coach_access_start_date OR coach_access_start_date IS NULL');
$this->addSql('UPDATE session SET nb_days_access_after_end = 0 WHERE access_end_date = coach_access_end_date OR coach_access_end_date IS NULL');
$this->addSql('ALTER TABLE session DROP access_start_date');
$this->addSql('ALTER TABLE session DROP access_end_date');
$this->addSql('ALTER TABLE session DROP coach_access_start_date');
$this->addSql('ALTER TABLE session DROP coach_access_end_date');
$this->addSql('ALTER TABLE session DROP display_start_date');
$this->addSql('ALTER TABLE session DROP display_end_date');
}
}

View File

@@ -0,0 +1,67 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type as TableColumnType;
/**
* Session date changes
*/
class Version20150529164400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
if (!$schema->hasTable('gradebook_score_log')) {
$gradebookScoreLog = $schema->createTable('gradebook_score_log');
$gradebookScoreLog->addColumn(
'id',
TableColumnType::INTEGER,
['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'category_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'user_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'score',
TableColumnType::FLOAT,
['notnull' => true, 'scale' => 0, 'precision' => 10]
);
$gradebookScoreLog->addColumn(
'registered_at',
TableColumnType::DATETIME,
['notnull' => true]
);
$gradebookScoreLog->setPrimaryKey(['id']);
$gradebookScoreLog->addIndex(
['user_id'],
'idx_gradebook_score_log_user'
);
$gradebookScoreLog->addIndex(
['user_id', 'category_id'],
'idx_gradebook_score_log_user_category'
);
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable('gradebook_score_log');
}
}

View File

@@ -0,0 +1,70 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Add branch
*/
class Version20150603142550 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function preUp(Schema $schema)
{
$this->addSql("ALTER TABLE c_calendar_event ENGINE=InnoDB");
$this->addSql("ALTER TABLE c_thematic_advance ENGINE=InnoDB");
}
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('CREATE TABLE IF NOT EXISTS room (id INT AUTO_INCREMENT NOT NULL, branch_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, description LONGTEXT, geolocation VARCHAR(255) DEFAULT NULL, ip VARCHAR(39) DEFAULT NULL, ip_mask VARCHAR(6) DEFAULT NULL, INDEX IDX_729F519BDCD6CC49 (branch_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS branch_transaction_status (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS branch_transaction (id BIGINT AUTO_INCREMENT NOT NULL, status_id INT DEFAULT NULL, branch_id INT DEFAULT NULL, transaction_id BIGINT NOT NULL, action VARCHAR(20) DEFAULT NULL, item_id VARCHAR(255) DEFAULT NULL, origin VARCHAR(255) DEFAULT NULL, dest_id VARCHAR(255) DEFAULT NULL, external_info VARCHAR(255) DEFAULT NULL, time_insert DATETIME NOT NULL, time_update DATETIME NOT NULL, failed_attempts INT NOT NULL, INDEX IDX_FEFBA12B6BF700BD (status_id), INDEX IDX_FEFBA12BDCD6CC49 (branch_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS branch_sync (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, access_url_id INT NOT NULL, unique_id VARCHAR(50) NOT NULL, branch_name VARCHAR(250) NOT NULL, description LONGTEXT, 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, UNIQUE INDEX UNIQ_F62F45EDE3C68343 (unique_id), INDEX IDX_F62F45ED727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BDCD6CC49 FOREIGN KEY (branch_id) REFERENCES branch_sync (id)');
$this->addSql('ALTER TABLE branch_transaction ADD CONSTRAINT FK_FEFBA12B6BF700BD FOREIGN KEY (status_id) REFERENCES branch_transaction_status (id)');
$this->addSql('ALTER TABLE branch_transaction ADD CONSTRAINT FK_FEFBA12BDCD6CC49 FOREIGN KEY (branch_id) REFERENCES branch_sync (id)');
$this->addSql('ALTER TABLE branch_sync ADD CONSTRAINT FK_F62F45ED727ACA70 FOREIGN KEY (parent_id) REFERENCES branch_sync (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE course ADD room_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE course ADD CONSTRAINT FK_169E6FB954177093 FOREIGN KEY (room_id) REFERENCES room (id)');
$this->addSql('CREATE INDEX IDX_169E6FB954177093 ON course (room_id)');
$this->addSql('ALTER TABLE c_calendar_event ADD room_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_calendar_event ADD CONSTRAINT FK_A062258154177093 FOREIGN KEY (room_id) REFERENCES room (id)');
$this->addSql('CREATE INDEX IDX_A062258154177093 ON c_calendar_event (room_id)');
$this->addSql('ALTER TABLE c_thematic_advance ADD room_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E9754177093 FOREIGN KEY (room_id) REFERENCES room (id)');
$this->addSql('CREATE INDEX IDX_62798E9754177093 ON c_thematic_advance (room_id)');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE course DROP FOREIGN KEY FK_169E6FB954177093');
$this->addSql('ALTER TABLE c_calendar_event DROP FOREIGN KEY FK_A062258154177093');
$this->addSql('ALTER TABLE c_thematic_advance DROP FOREIGN KEY FK_62798E9754177093');
$this->addSql('ALTER TABLE branch_transaction DROP FOREIGN KEY FK_FEFBA12B6BF700BD');
$this->addSql('ALTER TABLE room DROP FOREIGN KEY FK_729F519BDCD6CC49');
$this->addSql('ALTER TABLE branch_transaction DROP FOREIGN KEY FK_FEFBA12BDCD6CC49');
$this->addSql('ALTER TABLE branch_sync DROP FOREIGN KEY FK_F62F45ED727ACA70');
$this->addSql('DROP TABLE room');
$this->addSql('DROP TABLE branch_transaction_status');
$this->addSql('DROP TABLE branch_transaction');
$this->addSql('DROP TABLE branch_sync');
$this->addSql('DROP INDEX IDX_A062258154177093 ON c_calendar_event');
$this->addSql('ALTER TABLE c_calendar_event DROP room_id');
$this->addSql('DROP INDEX IDX_62798E9754177093 ON c_thematic_advance');
$this->addSql('ALTER TABLE c_thematic_advance DROP room_id');
$this->addSql('DROP INDEX IDX_169E6FB954177093 ON course');
$this->addSql('ALTER TABLE course DROP room_id');
}
}

View File

@@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150603151200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_forum ADD lp_id INTEGER UNSIGNED NOT NULL');
$this->addSql('ALTER TABLE c_forum_thread ADD lp_item_id INTEGER UNSIGNED NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_forum DROP lp_id');
$this->addSql('ALTER TABLE c_forum_thread DROP lp_item_id');
}
}

View File

@@ -0,0 +1,125 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Lp changes
*/
class Version20150603181728 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function preUp(Schema $schema)
{
$this->addSql("ALTER TABLE course ENGINE=InnoDB");
$this->addSql("ALTER TABLE c_group_info ENGINE=InnoDB");
$this->addSql("ALTER TABLE session ENGINE=InnoDB");
$this->addSql("ALTER TABLE user ENGINE=InnoDB");
$this->addSql("ALTER TABLE c_item_property ENGINE=InnoDB");
}
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$table = $schema->getTable('c_lp');
if (!$table->hasColumn('max_attempts')) {
$this->addSql('ALTER TABLE c_lp ADD max_attempts INT NOT NULL');
}
if (!$table->hasColumn('subscribe_users')) {
$this->addSql('ALTER TABLE c_lp ADD subscribe_users INT NOT NULL DEFAULT 0');
}
$this->addSql('ALTER TABLE c_item_property MODIFY c_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY lastedit_user_id INT NOT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY to_group_id INT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY insert_user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY start_visible DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY end_visible DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY session_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY to_user_id INT NULL');
$this->addSql("UPDATE c_item_property SET start_visible = NULL WHERE start_visible = '0000-00-00 00:00:00'");
$this->addSql("UPDATE c_item_property SET end_visible = NULL WHERE end_visible = '0000-00-00 00:00:00'");
// Remove inconsistencies about non-existing courses
$this->addSql("DELETE FROM c_item_property WHERE session_id IS NOT NULL and session_id <> 0 AND session_id NOT IN (SELECT id FROM session)");
$this->addSql("DELETE FROM c_item_property WHERE to_user_id IS NOT NULL and to_user_id <> 0 AND to_user_id NOT IN (SELECT id FROM user)");
// Sometimes the user was deleted but we need to keep the document.
// Taking first admin
$this->addSql("UPDATE c_item_property SET insert_user_id = (SELECT u.user_id FROM admin a INNER JOIN user u ON (u.user_id = a.user_id AND u.active = 1) LIMIT 1) WHERE insert_user_id IS NOT NULL AND insert_user_id <> 0 AND insert_user_id NOT IN (SELECT id FROM user)");
// Remove inconsistencies about non-existing courses
$this->addSql("DELETE FROM c_item_property WHERE c_id NOT IN (SELECT id FROM course)");
// Remove inconsistencies about non-existing users
$this->addSql("DELETE FROM course_rel_user WHERE user_id NOT IN (SELECT id FROM user)");
// Fix to_group_id
$this->addSql("UPDATE c_item_property SET to_group_id = NULL WHERE to_group_id = 0");
$this->addSql('UPDATE c_item_property SET to_user_id = NULL WHERE to_user_id = 0');
$this->addSql('UPDATE c_item_property SET insert_user_id = NULL WHERE insert_user_id = 0');
$this->addSql('UPDATE c_item_property SET session_id = NULL WHERE session_id = 0');
$table = $schema->getTable('c_group_info');
if ($table->hasIndex('idx_cginfo_id') == false) {
$this->addSql('ALTER TABLE c_group_info ADD INDEX idx_cginfo_id (id);');
}
if ($table->hasIndex('idx_cginfo_cid') == false) {
$this->addSql('ALTER TABLE c_group_info ADD INDEX idx_cginfo_cid (c_id);');
}
$table = $schema->getTable('c_item_property');
if ($table->hasIndex('idx_cip_tgid') == false) {
$this->addSql('ALTER TABLE c_item_property ADD INDEX idx_cip_tgid (to_group_id);');
}
if ($table->hasIndex('idx_cip_cid') == false) {
$this->addSql('ALTER TABLE c_item_property ADD INDEX idx_cip_cid (c_id);');
}
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18191D79BD3 FOREIGN KEY (c_id) REFERENCES course(id)');
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18129F6EE60 FOREIGN KEY (to_user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C1819C859CC3 FOREIGN KEY (insert_user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181613FECDF FOREIGN KEY (session_id) REFERENCES session (id)');
$this->addSql('CREATE INDEX IDX_1D84C18191D79BD3 ON c_item_property (c_id)');
$this->addSql('CREATE INDEX IDX_1D84C18129F6EE60 ON c_item_property (to_user_id)');
$this->addSql('CREATE INDEX IDX_1D84C1819C859CC3 ON c_item_property (insert_user_id)');
$this->addSql('CREATE INDEX IDX_1D84C181613FECDF ON c_item_property (session_id)');
// Update c_item_property.to_group_id
$this->addSql('UPDATE c_item_property cip SET cip.to_group_id = (SELECT cgi.iid FROM c_group_info cgi WHERE cgi.c_id = cip.c_id AND cgi.id = cip.to_group_id)');
$this->addSql("DELETE FROM c_item_property WHERE to_group_id IS NOT NULL AND to_group_id <> 0 AND to_group_id NOT IN (SELECT iid FROM c_group_info)");
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)');
$this->addSql('CREATE INDEX IDX_1D84C181330D47E9 ON c_item_property (to_group_id)');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_lp DROP max_attempts, DROP subscribe_users');
$this->addSql('ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C18191D79BD3');
$this->addSql('ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181330D47E9');
$this->addSql('ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C18129F6EE60');
$this->addSql('ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C1819C859CC3');
$this->addSql('ALTER TABLE c_item_property DROP FOREIGN KEY FK_1D84C181613FECDF');
$this->addSql('DROP INDEX IDX_1D84C18191D79BD3 ON c_item_property');
$this->addSql('DROP INDEX IDX_1D84C181330D47E9 ON c_item_property');
$this->addSql('DROP INDEX IDX_1D84C18129F6EE60 ON c_item_property');
$this->addSql('DROP INDEX IDX_1D84C1819C859CC3 ON c_item_property');
$this->addSql('DROP INDEX IDX_1D84C181613FECDF ON c_item_property');
$this->addSql('ALTER TABLE c_item_property CHANGE c_id c_id INT NOT NULL, CHANGE insert_user_id insert_user_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE start_visible start_visible DATETIME NOT NULL, CHANGE end_visible end_visible DATETIME NOT NULL');
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* track_e_default changes
*/
class Version20150604145047 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE track_e_default CHANGE default_event_type default_event_type VARCHAR(255) NOT NULL, CHANGE default_value_type default_value_type VARCHAR(255) NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE track_e_default CHANGE default_event_type default_event_type VARCHAR(20) NOT NULL COLLATE utf8_unicode_ci, CHANGE default_value_type default_value_type VARCHAR(20) NOT NULL COLLATE utf8_unicode_ci');
}
}

View File

@@ -0,0 +1,70 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type as TableColumnType;
/**
* Session date changes
*/
class Version20150608104600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
if (!$schema->hasTable('extra_field_rel_tag')) {
$extraFieldRelTag = $schema->createTable('extra_field_rel_tag');
$extraFieldRelTag->addColumn(
'id',
TableColumnType::INTEGER,
['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'field_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'item_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'tag_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->setPrimaryKey(['id']);
$extraFieldRelTag->addIndex(
['field_id'],
'idx_frt_field'
);
$extraFieldRelTag->addIndex(
['item_id'],
'idx_frt_item'
);
$extraFieldRelTag->addIndex(
['tag_id'],
'idx_frt_tag'
);
$extraFieldRelTag->addIndex(
['field_id', 'item_id', 'tag_id'],
'idx_frt_field_item_tag'
);
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable('extra_field_rel_tag');
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150609113500 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'tags'";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (2, 10, 'tags', 'Tags', 1, 1, NOW())");
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM extra_field
WHERE variable = 'tags' AND
extra_field_type = 2 AND
field_type = 10");
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Tool changes
*/
class Version20150610143426 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_tool ADD description LONGTEXT, ADD custom_icon VARCHAR(255) DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_tool DROP description, DROP custom_icon');
}
}

View File

@@ -0,0 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Version20150615171900 class
* Change in CCourseDescription entity
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*/
class Version20150615171900 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_course_description CHANGE description_type description_type INTEGER NOT NULL DEFAULT 1');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_course_description CHANGE description_type description_type BOOLEAN NOT NULL');
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150616093200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'video_url'";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (2, 19, 'video_url', 'VideoUrl', 1, 1, NOW())");
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM extra_field
WHERE variable = 'video_url' AND
extra_field_type = 2 AND
field_type = 19");
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150624164100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'image'";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (3, 16, 'image', 'Image', 1, 1, NOW())");
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM extra_field
WHERE variable = 'image' AND
extra_field_type = 3 AND
field_type = 16");
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150625155000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'captcha_blocked_until_date'";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (1, 1, 'captcha_blocked_until_date', 'Account locked until', 0, 0, NOW())" );
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM extra_field
WHERE variable = 'captcha_blocked_until_date' AND
extra_field_type = 1 AND
field_type = 1");
}
}

View File

@@ -0,0 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* GradebookCategory changes
*/
class Version20150706135000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$gradebookCategory = $schema->getTable('gradebook_category');
$isRequirement = $gradebookCategory->addColumn(
'is_requirement',
\Doctrine\DBAL\Types\Type::BOOLEAN
);
$isRequirement->setNotnull(true)->setDefault(false);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$gradebookCategory = $schema->getTable('gradebook_category');
$gradebookCategory->dropColumn('is_requirement');
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Agenda
*/
class Version20150709083710 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_calendar_event ADD color VARCHAR(100) DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_calendar_event DROP color');
}
}

View File

@@ -0,0 +1,35 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150713132630
*
* @package Application\Migrations\Schema\V11010
*/
class Version20150713132630 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
if ($schema->hasTable('c_student_publication')) {
$this->addSql('ALTER TABLE c_student_publication ADD url_correction VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE c_student_publication ADD title_correction VARCHAR(255) DEFAULT NULL');
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_student_publication DROP url_correction');
$this->addSql('ALTER TABLE c_student_publication DROP title_correction');
}
}

View File

@@ -0,0 +1,111 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150803163400
*
* @package Application\Migrations\Schema\V110
*/
class Version20150803163400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'cron_remind_course_expiration_activate',
null,
'radio',
'Crons',
'false',
'CronRemindCourseExpirationActivateTitle',
'CronRemindCourseExpirationActivateComment',
null,
null,
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'cron_remind_course_expiration_frequency',
null,
'textfield',
'Crons',
'2',
'CronRemindCourseExpirationFrecuenqyTitle',
'CronRemindCourseExpirationFrecuenqyComment',
null,
null,
1,
true,
false
);
$this->addSettingCurrent(
'cron_course_finished_activate',
null,
'radio',
'Crons',
'false',
'CronCourseFinishedActivateTitle',
'CronCourseFinishedActivateComment',
null,
null,
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'cron_remind_course_expiration_activate',
'cron_course_finished_activate'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'cron_remind_course_expiration_activate',
'cron_remind_course_expiration_frequency',
'cron_course_finished_activate'
]
)
);
$deleteSettings->getQuery()->execute();
}
}

View File

@@ -0,0 +1,37 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150803171220
*
* @package Application\Migrations\Schema\V110
*/
class Version20150803171220 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('UPDATE user SET username_canonical = username');
$this->addSql('ALTER TABLE user ADD confirmation_token VARCHAR(255) NULL');
$this->addSql('ALTER TABLE user ADD password_requested_at DATETIME DEFAULT NULL');
$this->addSql('RENAME TABLE track_e_exercices TO track_e_exercises');
// This drops the old table
// $schema->renameTable('track_e_exercices', 'track_e_exercises');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE user DROP confirmation_token');
$this->addSql('ALTER TABLE user DROP password_requested_at');
}
}

View File

@@ -0,0 +1,40 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150713132630
*
* @package Application\Migrations\Schema\V11010
*/
class Version20150805161000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$sessionTable = $schema->getTable('session');
$sessionTable->addColumn(
'send_subscription_notification',
\Doctrine\DBAL\Types\Type::BOOLEAN,
['default' => false]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$sessionTable = $schema->getTable('session');
$sessionTable->dropColumn('send_subscription_notification');
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Calendar color
*/
class Version20150810132615 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE personal_agenda ADD color VARCHAR(255) DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE personal_agenda DROP color');
}
}

View File

@@ -0,0 +1,75 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150812230500
*
* @package Application\Migrations\Schema\V11010
*/
class Version20150812230500 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'allow_coach_feedback_exercises',
null,
'radio',
'Session',
'false',
'AllowCoachFeedbackExercisesTitle',
'AllowCoachFeedbackExercisesComment',
null,
null,
1,
true,
false,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No']
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'allow_coach_feedback_exercises'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'allow_coach_feedback_exercises'
]
)
);
$deleteSettings->getQuery()->execute();
}
}

View File

@@ -0,0 +1,166 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Calendar color
*/
class Version20150813143000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'prevent_multiple_simultaneous_login',
null,
'radio',
'Security',
'false',
'PreventMultipleSimultaneousLoginTitle',
'PreventMultipleSimultaneousLoginComment',
null,
null,
1,
false,
true,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'gradebook_detailed_admin_view',
null,
'radio',
'Gradebook',
'false',
'ShowAdditionalColumnsInStudentResultsPageTitle',
'ShowAdditionalColumnsInStudentResultsPageComment',
null,
null,
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'course_catalog_published',
null,
'radio',
'Course',
'false',
'CourseCatalogIsPublicTitle',
'CourseCatalogIsPublicComment',
null,
null,
1,
false,
true,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'user_reset_password',
null,
'radio',
'Security',
'false',
'ResetPasswordTokenTitle',
'ResetPasswordTokenComment',
null,
null,
1,
false,
true,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'user_reset_password_token_limit',
null,
'textfield',
'Security',
'3600',
'ResetPasswordTokenLimitTitle',
'ResetPasswordTokenLimitComment',
null,
null,
1,
false,
true
);
$this->addSettingCurrent(
'my_courses_view_by_session',
null,
'radio',
'Session',
'false',
'ViewMyCoursesListBySessionTitle',
'ViewMyCoursesListBySessionComment',
null,
null,
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'prevent_multiple_simultaneous_login',
'gradebook_detailed_admin_view',
'course_catalog_published',
'user_reset_password',
'user_reset_password_token_limit',
'my_courses_view_by_session'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'prevent_multiple_simultaneous_login',
'gradebook_detailed_admin_view',
'course_catalog_published',
'user_reset_password',
'my_courses_view_by_session'
]
)
);
$deleteSettings->getQuery()->execute();
}
}

View File

@@ -0,0 +1,71 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Calendar color
*/
class Version20150813200000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'math_mimetex'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'math_mimetex'
]
)
);
$deleteSettings->getQuery()->execute();
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSettingCurrent(
'math_mimetex',
null,
'radio',
'Editor',
'false',
'MathMimetexTitle',
'MathMimetexComment',
null,
null,
1,
false,
true,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
}
}

View File

@@ -0,0 +1,45 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150819095300
*
* @package Application\Migrations\Schema\V11010
*/
class Version20150819095300 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$skillTable = $schema->getTable('skill');
$skillTable->addColumn(
'status',
\Doctrine\DBAL\Types\Type::INTEGER,
['default' => 1]
);
$skillTable->addColumn(
'updated_at',
\Doctrine\DBAL\Types\Type::DATETIME
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$skillTable = $schema->getTable('skill');
$skillTable->dropColumn('status');
$skillTable->dropColumn('updated_at');
}
}

View File

@@ -0,0 +1,178 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150821150000
*
* @package Application\Migrations\Schema\V11010
*/
class Version20150821150000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'display_mini_month_calendar'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'display_mini_month_calendar'
]
)
);
$deleteSettings->getQuery()->execute();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'display_upcoming_events'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'display_upcoming_events'
]
)
);
$deleteSettings->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'number_of_upcoming_events'
]
)
);
$deleteSettings->getQuery()->execute();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
[
'allow_reservation'
]
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
[
'allow_reservation'
]
)
);
$deleteSettings->getQuery()->execute();
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSettingCurrent(
'display_mini_month_calendar',
null,
'radio',
'Tools',
'true',
'DisplayMiniMonthCalendarTitle',
'DisplayMiniMonthCalendarComment',
null,
null,
1,
false,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'display_upcoming_events',
null,
'radio',
'Tools',
'true',
'DisplayUpcomingEventsTitle',
'DisplayUpcomingEventsComment',
null,
null,
1,
false,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
$this->addSettingCurrent(
'number_of_upcoming_events',
null,
'textfield',
'Tools',
'1',
'NumberOfUpcomingEventsTitle',
'NumberOfUpcomingEventsComment',
null,
null,
1,
false,
false
);
$this->addSettingCurrent(
'allow_reservation',
null,
'radio',
'Tools',
'false',
'AllowReservationTitle',
'AllowReservationComment',
null,
null,
1,
true,
false,
[
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No']
]
);
}
}

View File

@@ -0,0 +1,67 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Calendar color
*/
class Version20150825141100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'show_full_skill_name_on_skill_wheel',
null,
'radio',
'Platform',
'false',
'ShowFullSkillNameOnSkillWheelTitle',
'ShowFullSkillNameOnSkillWheelComment',
null,
null,
1,
false,
true,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No']
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entityManage = $this->getEntityManager();
$deleteOptions = $entityManage->createQueryBuilder();
$deleteSettings = $entityManage->createQueryBuilder();
$deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
->andWhere(
$deleteOptions->expr()->in(
'o.variable',
['show_full_skill_name_on_skill_wheel']
)
);
$deleteOptions->getQuery()->execute();
$deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
->andWhere(
$deleteSettings->expr()->in(
's.variable',
['show_full_skill_name_on_skill_wheel']
)
);
$deleteSettings->getQuery()->execute();
}
}

View File

@@ -0,0 +1,51 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Calendar color
*/
class Version20151101082200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("ALTER TABLE access_url ENGINE=InnoDB");
$this->addSql("ALTER TABLE access_url_rel_course ENGINE=InnoDB");
$this->addSql("ALTER TABLE course_rel_user ENGINE=InnoDB");
$this->addSql("ALTER TABLE session_category ENGINE=InnoDB");
$this->addSql("ALTER TABLE settings_current ENGINE=InnoDB");
$this->addSql("ALTER TABLE settings_options ENGINE=InnoDB");
$this->addSql("ALTER TABLE usergroup ENGINE=InnoDB");
$this->addSql("ALTER TABLE usergroup_rel_user ENGINE=InnoDB");
$this->addSql("ALTER TABLE session_rel_course DROP PRIMARY KEY");
$this->addSql("ALTER TABLE session_rel_course_rel_user DROP PRIMARY KEY");
$this->addSql("ALTER TABLE session MODIFY session_category_id INT NULL");
$this->addSql("UPDATE session SET session_category_id = NULL WHERE session_category_id NOT IN (SELECT id FROM session_category)");
$table = $schema->getTable('session_rel_course_rel_user');
if ($table->hasForeignKey('FK_720167E91D79BD3')) {
$this->addSql("ALTER TABLE session_rel_course_rel_user DROP FOREIGN KEY FK_720167E91D79BD3");
}
$table = $schema->getTable('session_rel_course');
if ($table->hasForeignKey('FK_12D110D391D79BD3')) {
$this->addSql("ALTER TABLE session_rel_course DROP FOREIGN KEY FK_12D110D391D79BD3");
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,320 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Calendar color
*/
class Version20151101082300 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$accessUrl = $schema->getTable('access_url');
$accessUrl->getColumn('id')->setUnsigned(false);
$this->connection->executeQuery('UPDATE access_url_rel_course SET access_url_id = NULL WHERE access_url_id NOT IN (SELECT id FROM access_url)');
$accessUrlRelCourse = $schema->getTable('access_url_rel_course');
$accessUrlRelCourse->getColumn('access_url_id')->setUnsigned(false);
$accessUrlRelCourse->addForeignKeyConstraint('access_url', ['access_url_id'], ['id']);
$accessUrlRelCourse->addForeignKeyConstraint('course', ['c_id'], ['id']);
if ($schema->hasTable('class')) {
$schema->renameTable('class', 'class_item');
}
if ($schema->hasTable('class_user')) {
$classUser = $schema->getTable('class_user');
$classUser->getColumn('class_id')->setUnsigned(false);
$classUser->getColumn('user_id')->setUnsigned(false);
}
$course = $schema->getTable('course');
$course->getColumn('course_type_id')->setUnsigned(false);
$course->addForeignKeyConstraint('room', ['room_id'], ['id']);
if ($schema->hasTable('course_rel_class')) {
$courseRelClass = $schema->getTable('course_rel_class');
$courseRelClass->getColumn('class_id')->setUnsigned(false)->setType(Type::getType(Type::INTEGER));
}
$courseRelUser = $schema->getTable('course_rel_user');
$courseRelUser->addForeignKeyConstraint('course', ['c_id'], ['id']);
$courseRelUser->addForeignKeyConstraint('user', ['user_id'], ['id']);
if ($schema->hasTable('course_type')) {
$courseType = $schema->getTable('course_type');
$courseType->getColumn('id')->setUnsigned(false);
}
$schema->getTable('c_announcement')->addIndex(['c_id']);
$schema->getTable('c_announcement_attachment')->addIndex(['c_id']);
$schema->getTable('c_attendance')->addIndex(['c_id']);
$schema->getTable('c_attendance_calendar')->addIndex(['c_id']);
$cAttendanceCalendarRelGroup = $schema->getTable('c_attendance_calendar_rel_group');
$cAttendanceCalendarRelGroup->addIndex(['c_id']);
$cAttendanceCalendarRelGroup->addIndex(['group_id']);
$schema->getTable('c_attendance_result')->addIndex(['c_id']);
$cAttendanceSheet = $schema->getTable('c_attendance_sheet');
$cAttendanceSheet->addIndex(['c_id']);
$cAttendanceSheet->addIndex(['user_id']);
$schema->getTable('c_attendance_sheet_log')->addIndex(['c_id']);
$schema->getTable('c_blog')->addIndex(['c_id']);
$schema->getTable('c_blog_attachment')->addIndex(['c_id']);
$schema->getTable('c_blog_comment')->addIndex(['c_id']);
$schema->getTable('c_blog_post')->addIndex(['c_id']);
$schema->getTable('c_blog_rating')->addIndex(['c_id']);
$cBlogRelUser = $schema->getTable('c_blog_rel_user');
$cBlogRelUser->getColumn('blog_id')->setUnsigned(false);
$cBlogRelUser->getColumn('user_id')->setUnsigned(false);
$cBlogRelUser->addIndex(['c_id']);
$schema->getTable('c_blog_task')->addIndex(['c_id']);
$cBlogTaskRelUser = $schema->getTable('c_blog_task_rel_user');
$cBlogTaskRelUser->getColumn('blog_id')->setUnsigned(false);
$cBlogTaskRelUser->getColumn('user_id')->setUnsigned(false);
$cBlogTaskRelUser->getColumn('task_id')->setUnsigned(false);
$cBlogTaskRelUser->addIndex(['c_id']);
$cBlogTaskRelUser->addIndex(['user_id']);
$cBlogTaskRelUser->addIndex(['task_id']);
$cCalendarEvent = $schema->getTable('c_calendar_event');
$cCalendarEvent->addIndex(['c_id']);
$schema->getTable('c_calendar_event_attachment')->addIndex(['c_id']);
$schema->getTable('c_calendar_event_repeat')->addIndex(['c_id']);
$schema->getTable('c_calendar_event_repeat_not')->addIndex(['c_id']);
$cChatConnected = $schema->getTable('c_chat_connected');
$cChatConnected->addIndex(['c_id']);
$cChatConnected->addIndex(['user_id']);
$schema->getTable('c_course_setting')->addIndex(['c_id']);
$schema->getTable('c_document')->addIndex(['c_id']);
$schema->getTable('c_dropbox_category')->addIndex(['c_id']);
$schema->getTable('c_dropbox_feedback')->addIndex(['c_id']);
$schema->getTable('c_dropbox_file')->addIndex(['c_id']);
$cDropboxPerson = $schema->getTable('c_dropbox_person');
$cDropboxPerson->addIndex(['c_id']);
$cDropboxPerson->addIndex(['user_id']);
$cDropboxPost = $schema->getTable('c_dropbox_post');
$cDropboxPost->addIndex(['c_id']);
$cDropboxPost->addIndex(['dest_user_id']);
$schema->getTable('c_forum_attachment')->addIndex(['c_id']);
$schema->getTable('c_forum_category')->addIndex(['c_id']);
$schema->getTable('c_forum_forum')->addIndex(['c_id']);
$cForumMailcue = $schema->getTable('c_forum_mailcue');
$cForumMailcue->addIndex(['c_id']);
$cForumMailcue->addIndex(['thread_id']);
$cForumMailcue->addIndex(['user_id']);
$cForumMailcue->addIndex(['post_id']);
$cForumNotification = $schema->getTable('c_forum_notification');
$cForumNotification->addIndex(['c_id']);
$cForumNotification->addIndex(['thread_id']);
$cForumNotification->addIndex(['post_id']);
$schema->getTable('c_forum_post')->addIndex(['c_id']);
$schema->getTable('c_forum_thread')->addIndex(['c_id']);
$schema->getTable('c_forum_thread_qualify')->addIndex(['c_id']);
$schema->getTable('c_forum_thread_qualify_log')->addIndex(['c_id']);
$schema->getTable('c_glossary')->addIndex(['c_id']);
$schema->getTable('c_group_category')->addIndex(['c_id']);
$schema->getTable('c_group_info')->addIndex(['c_id']);
$schema->getTable('c_group_rel_tutor')->addIndex(['c_id']);
$schema->getTable('c_group_rel_user')->addIndex(['c_id']);
$schema->getTable('c_link')->addIndex(['c_id']);
$schema->getTable('c_link_category')->addIndex(['c_id']);
$schema->getTable('c_lp')->addIndex(['c_id']);
$schema->getTable('c_lp_category')->addIndex(['c_id']);
$schema->getTable('c_lp_item')->addIndex(['c_id']);
$schema->getTable('c_lp_item_view')->addIndex(['c_id']);
$schema->getTable('c_lp_iv_interaction')->addIndex(['c_id']);
$schema->getTable('c_lp_iv_objective')->addIndex(['c_id']);
$schema->getTable('c_lp_view')->addIndex(['c_id']);
$schema->getTable('c_notebook')->addIndex(['c_id']);
$schema->getTable('c_online_connected')->addIndex(['c_id']);
$schema->getTable('c_online_link')->addIndex(['c_id']);
$schema->getTable('c_permission_group')->addIndex(['c_id']);
$schema->getTable('c_permission_task')->addIndex(['c_id']);
$schema->getTable('c_permission_user')->addIndex(['c_id']);
$schema->getTable('c_quiz')->addIndex(['c_id']);
$schema->getTable('c_quiz_answer')->addIndex(['c_id']);
$schema->getTable('c_quiz_question')->addIndex(['c_id']);
$schema->getTable('c_quiz_question_category')->addIndex(['c_id']);
$schema->getTable('c_quiz_question_option')->addIndex(['c_id']);
$schema->getTable('c_quiz_question_rel_category')->addIndex(['c_id']);
$cQuizRelQuestion = $schema->getTable('c_quiz_rel_question');
$cQuizRelQuestion->addIndex(['c_id']);
$cQuizRelQuestion->addIndex(['question_id']);
$cQuizRelQuestion->addIndex(['exercice_id']);
$schema->getTable('c_resource')->addIndex(['c_id']);
$schema->getTable('c_role')->addIndex(['c_id']);
$cRoleGroup = $schema->getTable('c_role_group');
$cRoleGroup->addIndex(['c_id']);
$cRoleGroup->addIndex(['group_id']);
$cRolePermissions = $schema->getTable('c_role_permissions');
$cRolePermissions->addIndex(['c_id']);
$cRolePermissions->addIndex(['role_id']);
$cRoleUser = $schema->getTable('c_role_user');
$cRoleUser->addIndex(['c_id']);
$cRoleUser->addIndex(['user_id']);
$schema->getTable('c_student_publication')->addIndex(['c_id']);
$schema->getTable('c_student_publication_assignment')->addIndex(['c_id']);
$cStudentPublicationComment = $schema->getTable('c_student_publication_comment');
$cStudentPublicationComment->addIndex(['c_id']);
$cStudentPublicationComment->addIndex(['user_id']);
$cStudentPublicationComment->addIndex(['work_id']);
$cStudentPublicationComment = $schema->getTable('c_student_publication_rel_document');
$cStudentPublicationComment->addIndex(['c_id']);
$cStudentPublicationComment->addIndex(['work_id']);
$cStudentPublicationComment->addIndex(['document_id']);
$cStudentPublicationComment = $schema->getTable('c_student_publication_rel_user');
$cStudentPublicationComment->addIndex(['c_id']);
$cStudentPublicationComment->addIndex(['work_id']);
$cStudentPublicationComment->addIndex(['user_id']);
$schema->getTable('c_survey')->addIndex(['c_id']);
$schema->getTable('c_survey_answer')->addIndex(['c_id']);
$schema->getTable('c_survey_group')->addIndex(['c_id']);
$schema->getTable('c_survey_invitation')->addIndex(['c_id']);
$schema->getTable('c_survey_question')->addIndex(['c_id']);
$schema->getTable('c_survey_question_option')->addIndex(['c_id']);
$schema->getTable('c_thematic')->addIndex(['c_id']);
$schema->getTable('c_thematic_advance')->addIndex(['c_id']);
$schema->getTable('c_thematic_plan')->addIndex(['c_id']);
$schema->getTable('c_tool')->addIndex(['c_id']);
$schema->getTable('c_tool_intro')->addIndex(['c_id']);
$schema->getTable('c_userinfo_content')->addIndex(['c_id']);
$schema->getTable('c_userinfo_def')->addIndex(['c_id']);
$schema->getTable('c_wiki')->addIndex(['c_id']);
$schema->getTable('c_wiki_conf')->addIndex(['c_id']);
$schema->getTable('c_wiki_discuss')->addIndex(['c_id']);
$cWikiMailcue = $schema->getTable('c_wiki_mailcue');
$cWikiMailcue->addIndex(['c_id']);
$cWikiMailcue->addIndex(['user_id']);
$schema->getTable('extra_field_values')->addForeignKeyConstraint('extra_field', ['field_id'], ['id']);
$session = $schema->getTable('session');
$session->getColumn('id_coach')->setUnsigned(false);
$session->addIndex(['session_category_id']);
$session->addIndex(['id_coach']);
$session->addForeignKeyConstraint('session_category', ['session_category_id'], ['id']);
$session->addForeignKeyConstraint('user', ['id_coach'], ['id']);
$this->connection->executeQuery('UPDATE session_category SET access_url_id = 1 WHERE access_url_id NOT IN (SELECT id FROM access_url)');
$sessionCategory = $schema->getTable('session_category');
$sessionCategory->addIndex(['access_url_id']);
$sessionCategory->addForeignKeyConstraint('access_url', ['access_url_id'], ['id']);
$sessionRelCourse = $schema->getTable('session_rel_course');
$sessionRelCourse->dropColumn('course_code');
$sessionRelCourse->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sessionRelCourse->getColumn('c_id')->setUnsigned(false);
$sessionRelCourse->setPrimaryKey(['id']);
$sessionRelCourse->addIndex(['c_id']);
$sessionRelCourse->addIndex(['session_id']);
$sessionRelCourse->addForeignKeyConstraint('course', ['c_id'], ['id']);
$sessionRelCourse->addForeignKeyConstraint('session', ['session_id'], ['id']);
$this->connection->executeQuery('DELETE FROM session_rel_course_rel_user WHERE c_id NOT IN (SELECT id FROM course)');
$this->connection->executeQuery('DELETE FROM session_rel_course_rel_user WHERE session_id NOT IN (SELECT id FROM session)');
$this->connection->executeQuery('DELETE FROM session_rel_course_rel_user WHERE user_id NOT IN (SELECT id FROM user)');
$sessionRelCourseRelUser = $schema->getTable('session_rel_course_rel_user');
$sessionRelCourseRelUser->dropColumn('course_code');
$sessionRelCourseRelUser->addColumn('id', Type::INTEGER)->setAutoincrement(true);
$sessionRelCourseRelUser->getColumn('c_id')->setUnsigned(false);
$sessionRelCourseRelUser->setPrimaryKey(['id']);
$sessionRelCourseRelUser->addIndex(['c_id']);
$sessionRelCourseRelUser->addIndex(['session_id']);
$sessionRelCourseRelUser->addForeignKeyConstraint('course', ['c_id'], ['id']);
$sessionRelCourseRelUser->addForeignKeyConstraint('session', ['session_id'], ['id']);
$sessionRelCourseRelUser->addForeignKeyConstraint('user', ['user_id'], ['id']);
$this->connection->executeQuery('DELETE FROM session_rel_user WHERE user_id NOT IN (SELECT id FROM user)');
$this->connection->executeQuery('DELETE FROM session_rel_user WHERE session_id NOT IN (SELECT id FROM session)');
$sessionRelUser = $schema->getTable('session_rel_user');
$sessionRelUser->addColumn('moved_to', Type::INTEGER)->setNotnull(false);
$sessionRelUser->addColumn('moved_status', Type::INTEGER)->setNotnull(false);
$sessionRelUser->addColumn('moved_at', Type::DATETIME)->setNotnull(false);
$sessionRelUser->addIndex(['session_id']);
$sessionRelUser->addIndex(['user_id']);
$sessionRelUser->addIndex(['user_id', 'moved_to']);
$sessionRelUser->addForeignKeyConstraint('user', ['user_id'], ['id']);
$sessionRelUser->addForeignKeyConstraint('session', ['session_id'], ['id']);
$settingsCurrent = $schema->getTable('settings_current');
$settingsCurrent->addUniqueIndex(['variable', 'subkey', 'access_url']);
$settingsCurrent = $schema->getTable('settings_options');
$settingsCurrent->dropIndex('id');
$settingsCurrent->addUniqueIndex(['variable', 'value']);
$schema->getTable('track_e_access')->addIndex(['c_id']);
$schema->getTable('track_e_attempt')->addIndex(['c_id']);
$schema->getTable('track_e_course_access')->addIndex(['c_id']);
$trackEDefault = $schema->getTable('track_e_default');
$trackEDefault->addIndex(['c_id']);
$trackEDefault->addIndex(['session_id']);
$schema->getTable('track_e_downloads')->addIndex(['c_id']);
$schema->getTable('track_e_exercises')->addIndex(['c_id']);
$schema->getTable('track_e_hotpotatoes')->addIndex(['c_id']);
$schema->getTable('track_e_lastaccess')->addIndex(['c_id']);
$schema->getTable('track_e_links')->addIndex(['c_id']);
$schema->getTable('track_e_online')->addIndex(['c_id']);
$schema->getTable('track_e_uploads')->addIndex(['c_id']);
$schema->getTable('user')->addUniqueIndex(['username_canonical']);
$this->connection->executeQuery('DELETE FROM usergroup_rel_user WHERE user_id NOT IN (SELECT id FROM user)');
$this->connection->executeQuery('DELETE FROM usergroup_rel_user WHERE usergroup_id NOT IN (SELECT id FROM usergroup)');
$usergroupRelUSer = $schema->getTable('usergroup_rel_user');
$usergroupRelUSer->addIndex(['user_id']);
$usergroupRelUSer->addIndex(['usergroup_id']);
$usergroupRelUSer->addForeignKeyConstraint('usergroup', ['usergroup_id'], ['id']);
$usergroupRelUSer->addForeignKeyConstraint('user', ['user_id'], ['id']);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Add new indexes
*/
class Version20151119082400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$user = $schema->getTable('user');
$user->addIndex(['user_id']);
$userRelTag = $schema->getTable('user_rel_tag');
$userRelTag->addIndex(['user_id']);
$userRelTag->addIndex(['tag_id']);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Add indexes
*/
class Version20151214164000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$extraFieldValueTable = $schema->getTable('extra_field_values');
$extraFieldValueTable->addIndex(['field_id', 'item_id']);
$extraFieldTable = $schema->getTable('extra_field');
$extraFieldTable->addIndex(['extra_field_type']);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,131 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Fix track_e_hotspot table and migrate hotspot/values
* In the wake of an issue with the hotspot code not being possible to update without moving from AS2 to AS3 (Flash), we
* have decided to rewrite the hotspot tool in JS.
* Little did we know that we would find out that the coordinates system in use by the Flash version of hotspot was in
* fact a projection into a square form of 360x360, not depending on the original size of the image, and that a square
* was defined by its center's coordinates and its width, with an initial not-null margin on the left and top borders.
* The migration below fixes those parallax issues.
*/
class Version20151214170800 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("ALTER TABLE track_e_hotspot ADD c_id INT NULL");
$this->addSql("ALTER TABLE track_e_hotspot MODIFY COLUMN hotspot_coordinate LONGTEXT NOT NULL");
$this->addSql("UPDATE track_e_hotspot SET c_id = (SELECT id FROM course WHERE code = hotspot_course_code)");
$answers = $this->connection->fetchAll("
SELECT a.iid, a.c_id, a.question_id, a.hotspot_coordinates, a.hotspot_type, q.picture, c.directory
FROM c_quiz_answer a
INNER JOIN c_quiz_question q
ON (a.question_id = q.id AND a.c_id = q.c_id)
INNER JOIN course c
ON (a.c_id = c.id AND q.c_id = c.id)
WHERE a.hotspot_type IN ('square', 'circle', 'poly', 'delineation', 'oar')
");
foreach ($answers as $answer) {
// Recover the real image size to recalculate coordinates
$imagePath = __DIR__ . "/../../../../courses/{$answer['directory']}/document/images/{$answer['picture']}";
if (!file_exists($imagePath)) {
error_log("Migration: Image does not exists: $imagePath");
$imagePath = realpath($imagePath);
error_log("Hotspot realpath: $imagePath");
error_log("api_get_path: SYS_PATH: ".api_get_path(SYS_PATH));
continue;
}
$imageSize = getimagesize($imagePath);
$widthRatio = $imageSize[0] / 360;
$heightRatio = $imageSize[1] / 360;
$oldCoords = $answer['hotspot_coordinates'];
$oldPairedString = explode('|', $oldCoords);
$newPairedString = [];
switch ($answer['hotspot_type']) {
case 'square':
$oldCenter = explode(';', $oldPairedString[0]);
$oldCenterX = intval($oldCenter[0]);
$oldCenterY = intval($oldCenter[1]);
$oldWidth = intval($oldPairedString[1]);
$oldHeight = intval($oldPairedString[2]);
$newX = floor(($oldCenterX - $oldWidth / 2) * $widthRatio) + ceil($widthRatio);
$newY = floor(($oldCenterY - $oldHeight / 2) * $heightRatio) + ceil($heightRatio);
$newWidth = ceil($oldWidth * $widthRatio) + ceil(1 * $heightRatio);
$newHeight = ceil($oldHeight * $heightRatio) + floor(1 * $heightRatio);
$newPairedString[] = implode(';', [$newX, $newY]);
$newPairedString[] = $newWidth;
$newPairedString[] = $newHeight;
break;
case 'circle':
$oldCenter = explode(';', $oldPairedString[0]);
$oldCenterX = intval($oldCenter[0]);
$oldCenterY = intval($oldCenter[1]);
$oldRadiusX = intval($oldPairedString[1]) / 2;
$oldRadiusY = intval($oldPairedString[2]) / 2;
$newCenterX = floor($oldCenterX * $widthRatio) + ceil($widthRatio);
$newCenterY = floor($oldCenterY * $heightRatio) + ceil($heightRatio);
$newRadiusX = floor($oldRadiusX * $widthRatio);
$newRadiusY = floor($oldRadiusY * $heightRatio);
$newPairedString[] = implode(';', [$newCenterX, $newCenterY]);
$newPairedString[] = $newRadiusX;
$newPairedString[] = $newRadiusY;
break;
case 'poly':
//no break;
case 'delineation':
//no break
case 'oar':
$paired = [];
foreach ($oldPairedString as $pairString) {
$pair = explode(';', $pairString);
$x = isset($pair[0]) ? intval($pair[0]) : 0;
$y = isset($pair[1]) ? intval($pair[1]) : 0;
$paired[] = [$x, $y];
}
foreach ($paired as $pair) {
$x = floor($pair[0] * $widthRatio) + ceil($widthRatio);
$y = ceil($pair[1] * $heightRatio);
$newPairedString[] = implode(';', [$x, $y]);
}
break;
}
$stmt = $this->connection->prepare("
UPDATE c_quiz_answer
SET hotspot_coordinates = :coordinates
WHERE iid = :iid AND c_id = :cid
");
$stmt->bindValue('coordinates', implode('|', $newPairedString), Type::TEXT);
$stmt->bindValue('iid', $answer['iid'], Type::INTEGER);
$stmt->bindValue('cid', $answer['c_id'], Type::INTEGER);
$stmt->execute();
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,68 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Fix c_quiz_answer's correct field for id_auto
*/
class Version20151221150100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("ALTER TABLE c_quiz_answer ENGINE=InnoDB");
$this->addSql("ALTER TABLE c_quiz_question ENGINE=InnoDB");
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_qa_question_id_temp (question_id)");
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_qa_id_temp (id)");
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_qa_correct_temp (correct)");
$this->addSql("ALTER TABLE track_e_attempt CHANGE tms tms datetime default null");
$this->addSql("UPDATE track_e_attempt SET tms = NULL WHERE tms = '0000-00-00 00:00:00'");
$this->addSql("ALTER TABLE track_e_attempt ADD INDEX idx_tea_answer_temp (answer(6))");
$this->addSql("ALTER TABLE c_quiz_question ADD INDEX idx_qq_id_temp (id)");
$this->addSql("ALTER TABLE c_quiz_question ADD INDEX idx_qq_type_temp (type)");
$this->addSql("
UPDATE track_e_attempt a
INNER JOIN c_quiz_answer qa
ON (a.question_id = qa.question_id AND a.c_id = qa.c_id)
INNER JOIN c_quiz_question q
ON (qa.question_id = q.id AND qa.c_id = q.c_id)
SET a.answer = qa.id_auto
WHERE
a.answer = qa.id AND
q.c_id = a.c_id AND
q.type IN (" . MATCHING . ", " . DRAGGABLE . ", " . MATCHING_DRAGGABLE . ")
");
$this->addSql("
UPDATE c_quiz_answer a
INNER JOIN c_quiz_answer b
ON (a.question_id = b.question_id AND b.c_id = a.c_id)
INNER JOIN c_quiz_question q
ON (b.question_id = q.id AND b.c_id = q.c_id)
SET a.correct = b.id_auto
WHERE
a.correct = b.id AND
q.c_id = a.c_id AND
q.type IN (" . MATCHING . ", " . DRAGGABLE . ", " . MATCHING_DRAGGABLE . ")
");
$this->addSql("ALTER TABLE c_quiz_answer DROP INDEX idx_qa_question_id_temp");
$this->addSql("ALTER TABLE c_quiz_answer DROP INDEX idx_qa_id_temp");
$this->addSql("ALTER TABLE c_quiz_answer DROP INDEX idx_qa_correct_temp");
$this->addSql("ALTER TABLE track_e_attempt DROP INDEX idx_tea_answer_temp");
$this->addSql("ALTER TABLE c_quiz_question DROP INDEX idx_qq_id_temp");
$this->addSql("ALTER TABLE c_quiz_question DROP INDEX idx_qq_type_temp");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Fix c_quiz_answer's correct field for id_auto
*/
class Version20160707131900 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("
ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Set null to post_parent_id when it is 0 on c_forum_post table
*/
class Version20160808110200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE c_forum_post SET post_parent_id = NULL WHERE post_parent_id = 0");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('UPDATE c_forum_post SET post_parent_id = 0 WHERE post_parent_id = NULL');
}
}

View File

@@ -0,0 +1,567 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version111
* Migrate file to updated to Chamilo 1.11
*
*/
class Version111 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
// Needed to update 0000-00-00 00:00:00 values
$this->addSql('SET sql_mode = ""');
// In case this one didn't work, also try this
$this->addSql('SET SESSION sql_mode = ""');
$this->addSql("ALTER TABLE extra_field ENGINE=InnoDB");
$this->addSql('CREATE TABLE extra_field_saved_search (id INT AUTO_INCREMENT NOT NULL, field_id INT DEFAULT NULL, user_id INT DEFAULT NULL, value LONGTEXT DEFAULT NULL COLLATE utf8_unicode_ci, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_16ABE32A443707B0 (field_id), INDEX IDX_16ABE32AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE extra_field_saved_search ADD CONSTRAINT FK_16ABE32A443707B0 FOREIGN KEY (field_id) REFERENCES extra_field (id)');
$this->addSql('ALTER TABLE extra_field_saved_search ADD CONSTRAINT FK_16ABE32AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql("ALTER TABLE extra_field_saved_search CHANGE value value LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)'");
$this->addSql('CREATE TABLE c_lp_category_user (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, INDEX IDX_61F042712469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE c_lp_category_user ADD CONSTRAINT FK_61F042712469DE2 FOREIGN KEY (category_id) REFERENCES c_lp_category (iid)');
$this->addSql('ALTER TABLE c_lp_category_user ADD user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_lp_category_user ADD CONSTRAINT FK_61F0427A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
$this->addSql('CREATE INDEX IDX_61F0427A76ED395 ON c_lp_category_user (user_id);');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_my_files','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_my_files','false','No') ");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_invisible_in_session',NULL,'radio','Session','false','ExerciseInvisibleInSessionTitle','ExerciseInvisibleInSessionComment','',NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('exercise_invisible_in_session','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('exercise_invisible_in_session','false','No') ");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('configure_exercise_visibility_in_course',NULL,'radio','Session','false','ConfigureExerciseVisibilityInCourseTitle','ConfigureExerciseVisibilityInCourseComment','',NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('configure_exercise_visibility_in_course','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('configure_exercise_visibility_in_course','false','No') ");
$this->addSql("ALTER TABLE c_forum_forum ADD moderated TINYINT(1) DEFAULT NULL");
$this->addSql("ALTER TABLE c_forum_post ADD status INT DEFAULT NULL");
$this->addSql("CREATE TABLE IF NOT EXISTS 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))");
$table = $schema->getTable('c_quiz');
if (!$table->hasColumn('question_selection_type')) {
$this->addSql("ALTER TABLE c_quiz ADD COLUMN question_selection_type INT");
}
$this->addSql("ALTER TABLE c_quiz ADD hide_question_title TINYINT(1) DEFAULT 0");
$this->addSql("CREATE TABLE faq_question_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_C2D1A2C2AC5D3 (translatable_id), UNIQUE INDEX faq_question_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;");
$this->addSql("CREATE TABLE faq_category_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_5493B0FC2C2AC5D3 (translatable_id), UNIQUE INDEX faq_category_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;");
$this->addSql("CREATE TABLE faq_category (id INT AUTO_INCREMENT NOT NULL, rank INT NOT NULL, is_active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx (is_active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;");
$this->addSql("CREATE TABLE faq_question (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, is_active TINYINT(1) NOT NULL, rank INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, only_auth_users TINYINT(1) NOT NULL, INDEX IDX_4A55B05912469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;");
$this->addSql("ALTER TABLE faq_question_translation ADD CONSTRAINT FK_C2D1A2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES faq_question (id) ON DELETE CASCADE;");
$this->addSql("ALTER TABLE faq_category_translation ADD CONSTRAINT FK_5493B0FC2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES faq_category (id) ON DELETE CASCADE;");
$this->addSql("ALTER TABLE faq_question ADD CONSTRAINT FK_4A55B05912469DE2 FOREIGN KEY (category_id) REFERENCES faq_category (id);");
$this->addSql("CREATE TABLE contact_category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;");
$table = $schema->getTable('session_rel_user');
if (!$table->hasColumn('duration')) {
$this->addSql("ALTER TABLE session_rel_user ADD duration INT DEFAULT NULL");
}
$this->addSql('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');
$stmt = $this->connection->query('SELECT id FROM course_category');
$results = $stmt->fetchAll();
foreach ($results as $result) {
$this->addSql("
INSERT INTO access_url_rel_course_category (access_url_id, course_category_id)
VALUES (1, {$result['id']})
");
}
$this->addSql('ALTER TABLE notification CHANGE content content TEXT');
$this->addSql('ALTER TABLE c_lp CHANGE publicated_on publicated_on DATETIME');
$this->addSql('ALTER TABLE c_lp CHANGE expired_on expired_on DATETIME');
$this->addSql('UPDATE c_lp SET publicated_on = NULL WHERE publicated_on = "0000-00-00 00:00:00"');
$this->addSql('UPDATE c_lp SET expired_on = NULL WHERE expired_on = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_quiz CHANGE start_time start_time DATETIME');
$this->addSql('ALTER TABLE c_quiz CHANGE end_time end_time DATETIME');
$this->addSql('UPDATE c_quiz SET start_time = NULL WHERE start_time = "0000-00-00 00:00:00"');
$this->addSql('UPDATE c_quiz SET end_time = NULL WHERE end_time = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_calendar_event CHANGE start_date start_date DATETIME');
$this->addSql('ALTER TABLE c_calendar_event CHANGE end_date end_date DATETIME');
$this->addSql('UPDATE c_calendar_event SET start_date = NULL WHERE start_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE c_calendar_event SET end_date = NULL WHERE end_date = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE personal_agenda CHANGE date date DATETIME');
$this->addSql('ALTER TABLE personal_agenda CHANGE enddate enddate DATETIME');
$this->addSql('UPDATE personal_agenda SET date = NULL WHERE date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE personal_agenda SET enddate = NULL WHERE enddate = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_forum_forum CHANGE start_time start_time DATETIME');
$this->addSql('ALTER TABLE c_forum_forum CHANGE end_time end_time DATETIME');
$this->addSql('UPDATE c_forum_forum SET start_time = NULL WHERE start_time = "0000-00-00 00:00:00"');
$this->addSql('UPDATE c_forum_forum SET end_time = NULL WHERE end_time = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE sys_calendar CHANGE start_date start_date DATETIME');
$this->addSql('ALTER TABLE sys_calendar CHANGE end_date end_date DATETIME');
$this->addSql('UPDATE sys_calendar SET start_date = NULL WHERE start_date = "0000-00-00 00:00:00"');
$this->addSql('UPDATE sys_calendar SET end_date = NULL WHERE end_date = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE message ADD votes INT DEFAULT NULL');
$this->addSql('ALTER TABLE message CHANGE update_date update_date DATETIME');
$this->addSql('UPDATE message SET update_date = NULL WHERE update_date = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_wiki_conf CHANGE startdate_assig startdate_assig DATETIME');
$this->addSql('ALTER TABLE c_wiki_conf CHANGE enddate_assig enddate_assig DATETIME');
$this->addSql('UPDATE c_wiki_conf SET startdate_assig = NULL WHERE startdate_assig = "0000-00-00 00:00:00"');
$this->addSql('UPDATE c_wiki_conf SET enddate_assig = NULL WHERE enddate_assig = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_wiki CHANGE time_edit time_edit DATETIME');
$this->addSql('UPDATE c_wiki SET time_edit = NULL WHERE time_edit = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE c_wiki CHANGE dtime dtime DATETIME');
$this->addSql('UPDATE c_wiki SET dtime = NULL WHERE dtime = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE access_url CHANGE tms tms DATETIME');
$this->addSql('UPDATE access_url SET tms = NULL WHERE tms = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE track_e_attempt CHANGE tms tms DATETIME');
$this->addSql('UPDATE track_e_attempt SET tms = NULL WHERE tms = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE track_e_default CHANGE default_date default_date DATETIME');
$this->addSql('UPDATE track_e_default SET default_date = NULL WHERE default_date = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE track_e_exercises CHANGE expired_time_control expired_time_control DATETIME');
$this->addSql('DROP TABLE group_rel_user');
$this->addSql('DROP TABLE group_rel_tag');
$this->addSql('DROP TABLE group_rel_group');
$this->addSql('DROP TABLE groups');
if ($schema->hasTable('plugin_ticket_ticket')) {
// Mean plugin was installed
$this->addSql('ALTER TABLE plugin_ticket_ticket ADD COLUMN subject varchar(255) DEFAULT NULL;');
$this->addSql('ALTER TABLE plugin_ticket_ticket ADD COLUMN message text NOT NULL;');
$this->addSql('UPDATE plugin_ticket_ticket t INNER JOIN plugin_ticket_message as m ON(t.ticket_id = m.ticket_id and message_id =1) SET t.subject = m.subject');
$this->addSql('UPDATE plugin_ticket_ticket t INNER JOIN plugin_ticket_message as m ON(t.ticket_id = m.ticket_id and message_id =1) SET t.message = m.message');
$this->addSql('DELETE FROM plugin_ticket_message WHERE message_id = 1');
$this->addSql('UPDATE plugin_ticket_project SET sys_insert_user_id = 1 WHERE sys_insert_user_id IS NULL');
$this->addSql('UPDATE plugin_ticket_project SET sys_insert_datetime = NOW() WHERE sys_insert_datetime IS NULL');
$this->addSql('ALTER TABLE plugin_ticket_ticket MODIFY ticket_id INT UNSIGNED NOT NULL;');
$this->addSql('DROP INDEX UN_ticket_code ON plugin_ticket_ticket;');
$this->addSql('DROP INDEX FK_ticket_category ON plugin_ticket_ticket;');
$this->addSql('ALTER TABLE plugin_ticket_ticket DROP PRIMARY KEY;');
$this->addSql('ALTER TABLE plugin_ticket_ticket ADD id INT, ADD code VARCHAR(255) NOT NULL');
$this->addSql('UPDATE plugin_ticket_priority SET sys_insert_datetime = NOW() WHERE sys_insert_datetime IS NULL');
$this->addSql('UPDATE plugin_ticket_priority SET sys_insert_user_id = 1 WHERE sys_insert_user_id IS NULL');
$this->addSql('ALTER TABLE plugin_ticket_priority ADD code VARCHAR(255) NOT NULL, ADD name VARCHAR(255) NOT NULL, ADD description LONGTEXT DEFAULT NULL, ADD color VARCHAR(255) NOT NULL, ADD urgency VARCHAR(255) NOT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('UPDATE plugin_ticket_priority SET code = priority_id');
$this->addSql('UPDATE plugin_ticket_priority SET name = priority');
$this->addSql('UPDATE plugin_ticket_priority SET description = priority_desc');
$this->addSql('UPDATE plugin_ticket_priority SET color = priority_color');
$this->addSql('UPDATE plugin_ticket_priority SET urgency = priority_urgency');
$this->addSql('ALTER TABLE plugin_ticket_status ADD code VARCHAR(255) NOT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL;');
$this->addSql('UPDATE plugin_ticket_status SET code = status_id ');
$this->addSql('ALTER TABLE plugin_ticket_status DROP status_id');
$this->addSql('UPDATE plugin_ticket_ticket t SET priority_id = (SELECT id FROM plugin_ticket_priority t2 WHERE t2.code = t.priority_id)');
$this->addSql('UPDATE plugin_ticket_ticket t SET status_id = (SELECT id FROM plugin_ticket_status t2 WHERE t2.code = t.status_id)');
$this->addSql('ALTER TABLE plugin_ticket_ticket CHANGE project_id project_id INT DEFAULT NULL, CHANGE priority_id priority_id INT DEFAULT NULL, CHANGE course_id course_id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL, CHANGE personal_email personal_email VARCHAR(255) NOT NULL, CHANGE assigned_last_user assigned_last_user INT DEFAULT NULL, CHANGE status_id status_id INT DEFAULT NULL, CHANGE total_messages total_messages INT NOT NULL, CHANGE keyword keyword VARCHAR(255) DEFAULT NULL, CHANGE source source VARCHAR(255) DEFAULT NULL, CHANGE start_date start_date DATETIME DEFAULT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL, CHANGE subject subject VARCHAR(255) NOT NULL, CHANGE message message LONGTEXT DEFAULT NULL;');
$this->addSql('UPDATE plugin_ticket_ticket SET code = ticket_code');
$this->addSql('UPDATE plugin_ticket_ticket SET id = ticket_id');
$this->addSql('ALTER TABLE plugin_ticket_ticket DROP ticket_id, DROP ticket_code, DROP request_user');
$this->addSql('ALTER TABLE plugin_ticket_ticket MODIFY COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT');
$table = $schema->getTable('plugin_ticket_ticket');
if ($table->hasIndex('fk_ticket_priority')) {
$this->addSql('ALTER TABLE plugin_ticket_ticket DROP INDEX fk_ticket_priority, ADD INDEX IDX_EDE2C768497B19F9(priority_id)');
}
if ($schema->hasTable('plugin_ticket_assigned_log')) {
$table = $schema->getTable('plugin_ticket_assigned_log');
if ($table->hasIndex('fk_ticket_assigned_log')) {
$this->addSql('ALTER TABLE plugin_ticket_assigned_log DROP INDEX fk_ticket_assigned_log, ADD INDEX IDX_54B65868700047D2(ticket_id);');
}
$this->addSql('RENAME TABLE plugin_ticket_assigned_log TO ticket_assigned_log');
$this->addSql('ALTER TABLE ticket_assigned_log ENGINE=InnoDB');
}
if ($schema->hasTable('plugin_ticket_category')) {
$this->addSql('RENAME TABLE plugin_ticket_category TO ticket_category');
$this->addSql('ALTER TABLE ticket_category ENGINE=InnoDB');
}
if ($schema->hasTable('plugin_ticket_message')) {
$table = $schema->getTable('plugin_ticket_message');
if ($table->hasIndex('fk_tick_message')) {
$this->addSql('ALTER TABLE plugin_ticket_message DROP INDEX fk_tick_message, ADD INDEX IDX_BA71692D700047D2(ticket_id);');
}
$this->addSql('RENAME TABLE plugin_ticket_message TO ticket_message');
$this->addSql('ALTER TABLE ticket_message ENGINE=InnoDB');
}
if ($schema->hasTable('plugin_ticket_priority')) {
$this->addSql('RENAME TABLE plugin_ticket_priority TO ticket_priority');
$this->addSql('ALTER TABLE ticket_priority ENGINE=InnoDB');
}
if ($schema->hasTable('plugin_ticket_project')) {
$this->addSql('RENAME TABLE plugin_ticket_project TO ticket_project');
$this->addSql('ALTER TABLE ticket_project ENGINE=InnoDB');
}
if ($schema->hasTable('plugin_ticket_status')) {
$this->addSql('RENAME TABLE plugin_ticket_status TO ticket_status');
$this->addSql('ALTER TABLE ticket_status ENGINE=InnoDB');
}
$this->addSql('RENAME TABLE plugin_ticket_ticket TO ticket_ticket');
$this->addSql('ALTER TABLE ticket_ticket ENGINE=InnoDB');
$this->addSql('ALTER TABLE ticket_project DROP project_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL, CHANGE email email VARCHAR(255) DEFAULT NULL, CHANGE other_area other_area INT DEFAULT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('UPDATE ticket_category SET sys_insert_user_id = 1 WHERE sys_insert_user_id IS NULL');
$this->addSql('UPDATE ticket_category SET sys_insert_datetime = NOW() WHERE sys_insert_datetime IS NULL');
$this->addSql('UPDATE ticket_category SET course_required = 0 WHERE course_required IS NULL OR course_required = ""');
$this->addSql('UPDATE ticket_category SET project_id = 1 WHERE project_id IS NULL OR project_id = ""');
$this->addSql('ALTER TABLE ticket_category DROP category_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE project_id project_id INT DEFAULT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL, CHANGE total_tickets total_tickets INT NOT NULL, CHANGE course_required course_required TINYINT(1) NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_category ADD CONSTRAINT FK_8325E540166D1F9C FOREIGN KEY (project_id) REFERENCES ticket_project (id);');
$this->addSql('CREATE INDEX IDX_8325E540166D1F9C ON ticket_category (project_id);');
if ($schema->hasTable('plugin_ticket_category_rel_user')) {
$table = $schema->getTable('plugin_ticket_category_rel_user');
$this->addSql('RENAME TABLE plugin_ticket_category_rel_user TO ticket_category_rel_user');
$this->addSql('ALTER TABLE ticket_category_rel_user ENGINE=InnoDB');
$this->addSql('ALTER TABLE ticket_category_rel_user CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE category_id category_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL;');
if ($table->hasIndex('fk_5b8a98712469de2')) {
$table->dropIndex('fk_5b8a98712469de2');
}
if ($table->hasIndex('fk_5b8a987a76ed395')) {
$table->dropIndex('fk_5b8a987a76ed395');
}
$this->addSql('CREATE INDEX IDX_5B8A98712469DE2 ON ticket_category_rel_user (category_id);');
$this->addSql('CREATE INDEX IDX_5B8A987A76ED395 ON ticket_category_rel_user (user_id);');
} else {
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_category_rel_user (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, user_id INT DEFAULT NULL, INDEX IDX_5B8A98712469DE2 (category_id), INDEX IDX_5B8A987A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE ticket_category_rel_user ADD CONSTRAINT FK_5B8A98712469DE2 FOREIGN KEY (category_id) REFERENCES ticket_category (id)');
$this->addSql('ALTER TABLE ticket_category_rel_user ADD CONSTRAINT FK_5B8A987A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
}
$this->addSql('ALTER TABLE ticket_message DROP message_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE ticket_id ticket_id INT DEFAULT NULL, CHANGE subject subject VARCHAR(255) DEFAULT NULL, CHANGE message message LONGTEXT DEFAULT NULL, CHANGE status status VARCHAR(255) NOT NULL, CHANGE ip_address ip_address VARCHAR(255) NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692D700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id);');
if ($schema->hasTable('plugin_ticket_message_attachments')) {
$table = $schema->getTable('plugin_ticket_message_attachments');
if ($table->hasIndex('ticket_message_id_fk')) {
$this->addSql('ALTER TABLE plugin_ticket_message_attachments DROP INDEX ticket_message_id_fk, ADD INDEX IDX_70BF9E26537A1329(message_id);');
}
$this->addSql('RENAME TABLE plugin_ticket_message_attachments TO ticket_message_attachments');
$this->addSql('ALTER TABLE ticket_message_attachments ENGINE=InnoDB');
$this->addSql('ALTER TABLE ticket_message_attachments DROP message_attch_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE message_id message_id INT DEFAULT NULL, CHANGE ticket_id ticket_id INT DEFAULT NULL, CHANGE filename filename LONGTEXT NOT NULL, CHANGE size size INT NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id);');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id);');
$this->addSql('CREATE INDEX IDX_70BF9E26700047D2 ON ticket_message_attachments (ticket_id);');
} else {
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_message_attachments (id INT AUTO_INCREMENT NOT NULL, ticket_id INT DEFAULT NULL, message_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, filename LONGTEXT NOT NULL, size INT NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_70BF9E26700047D2 (ticket_id), INDEX IDX_70BF9E26537A1329 (message_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id)');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id)');
}
$this->addSql('UPDATE ticket_priority SET sys_insert_user_id = 1 WHERE sys_insert_user_id IS NULL');
$this->addSql('UPDATE ticket_priority SET sys_insert_datetime = NOW() WHERE sys_insert_datetime IS NULL');
$this->addSql('ALTER TABLE ticket_priority DROP priority_id, DROP priority, DROP priority_desc, DROP priority_color, DROP priority_urgency');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768497B19F9 FOREIGN KEY (priority_id) REFERENCES ticket_priority (id);');
$this->addSql('UPDATE ticket_ticket SET project_id = 1 WHERE project_id is NULL or project_id = 0');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768166D1F9C FOREIGN KEY (project_id) REFERENCES ticket_project (id);');
$this->addSql('UPDATE ticket_ticket SET course_id = NULL WHERE course_id = 0');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768591CC992 FOREIGN KEY (course_id) REFERENCES course (id);');
$this->addSql('UPDATE ticket_ticket SET session_id = NULL WHERE session_id = 0');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768613FECDF FOREIGN KEY (session_id) REFERENCES session (id);');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C7686BF700BD FOREIGN KEY (status_id) REFERENCES ticket_status (id);');
$this->addSql('CREATE INDEX IDX_EDE2C768166D1F9C ON ticket_ticket (project_id);');
$this->addSql('CREATE INDEX IDX_EDE2C768591CC992 ON ticket_ticket (course_id);');
$this->addSql('CREATE INDEX IDX_EDE2C768613FECDF ON ticket_ticket (session_id);');
$this->addSql('CREATE INDEX IDX_EDE2C7686BF700BD ON ticket_ticket (status_id);');
$this->addSql('ALTER TABLE ticket_assigned_log CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE ticket_id ticket_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE assigned_date assigned_date DATETIME NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL;');
$this->addSql('ALTER TABLE ticket_assigned_log ADD CONSTRAINT FK_54B65868700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id);');
$this->addSql('DELETE FROM ticket_assigned_log WHERE user_id = 0 OR user_id IS NULL');
$this->addSql('ALTER TABLE ticket_assigned_log ADD CONSTRAINT FK_54B65868A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
$this->addSql('CREATE INDEX IDX_54B65868A76ED395 ON ticket_assigned_log (user_id);');
$this->addSql('ALTER TABLE ticket_ticket CHANGE category_id category_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C76812469DE2 FOREIGN KEY (category_id) REFERENCES ticket_category (id);');
$this->addSql('CREATE INDEX IDX_EDE2C76812469DE2 ON ticket_ticket (category_id);');
$this->addSql('DELETE FROM settings_current WHERE title = "Ticket"');
} else {
// Plugin was never installed. Create ticket tables
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_project (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, other_area INT DEFAULT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_status (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_category_rel_user (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, user_id INT DEFAULT NULL, INDEX IDX_5B8A98712469DE2 (category_id), INDEX IDX_5B8A987A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_message_attachments (id INT AUTO_INCREMENT NOT NULL, ticket_id INT DEFAULT NULL, message_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, filename LONGTEXT NOT NULL, size INT NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_70BF9E26700047D2 (ticket_id), INDEX IDX_70BF9E26537A1329 (message_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_priority (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, color VARCHAR(255) NOT NULL, urgency VARCHAR(255) NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_message (id INT AUTO_INCREMENT NOT NULL, ticket_id INT DEFAULT NULL, subject VARCHAR(255) DEFAULT NULL, message LONGTEXT DEFAULT NULL, status VARCHAR(255) NOT NULL, ip_address VARCHAR(255) NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_BA71692D700047D2 (ticket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_category (id INT AUTO_INCREMENT NOT NULL, project_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, total_tickets INT NOT NULL, course_required TINYINT(1) NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_8325E540166D1F9C (project_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_ticket (id INT AUTO_INCREMENT NOT NULL, project_id INT DEFAULT NULL, category_id INT DEFAULT NULL, priority_id INT DEFAULT NULL, course_id INT DEFAULT NULL, session_id INT DEFAULT NULL, status_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, message LONGTEXT DEFAULT NULL, personal_email VARCHAR(255) NOT NULL, assigned_last_user INT DEFAULT NULL, total_messages INT NOT NULL, keyword VARCHAR(255) DEFAULT NULL, source VARCHAR(255) DEFAULT NULL, start_date DATETIME DEFAULT NULL, end_date DATETIME DEFAULT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_EDE2C768166D1F9C (project_id), INDEX IDX_EDE2C76812469DE2 (category_id), INDEX IDX_EDE2C768497B19F9 (priority_id), INDEX IDX_EDE2C768591CC992 (course_id), INDEX IDX_EDE2C768613FECDF (session_id), INDEX IDX_EDE2C7686BF700BD (status_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_assigned_log (id INT AUTO_INCREMENT NOT NULL, ticket_id INT DEFAULT NULL, user_id INT DEFAULT NULL, sys_insert_user_id INT NOT NULL, assigned_date DATETIME NOT NULL, INDEX IDX_54B65868700047D2 (ticket_id), INDEX IDX_54B65868A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE ticket_category_rel_user ADD CONSTRAINT FK_5B8A98712469DE2 FOREIGN KEY (category_id) REFERENCES ticket_category (id)');
$this->addSql('ALTER TABLE ticket_category_rel_user ADD CONSTRAINT FK_5B8A987A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id)');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id)');
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692D700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id)');
$this->addSql('ALTER TABLE ticket_category ADD CONSTRAINT FK_8325E540166D1F9C FOREIGN KEY (project_id) REFERENCES ticket_project (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768166D1F9C FOREIGN KEY (project_id) REFERENCES ticket_project (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C76812469DE2 FOREIGN KEY (category_id) REFERENCES ticket_category (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768497B19F9 FOREIGN KEY (priority_id) REFERENCES ticket_priority (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768591CC992 FOREIGN KEY (course_id) REFERENCES course (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C768613FECDF FOREIGN KEY (session_id) REFERENCES session (id)');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C7686BF700BD FOREIGN KEY (status_id) REFERENCES ticket_status (id)');
$this->addSql('ALTER TABLE ticket_assigned_log ADD CONSTRAINT FK_54B65868700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id)');
$this->addSql('ALTER TABLE ticket_assigned_log ADD CONSTRAINT FK_54B65868A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
}
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_send_warning_to_all_admins', NULL, 'radio','Ticket', 'false','TicketSendWarningToAllAdminsTitle','TicketSendWarningToAllAdminsComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_warn_admin_no_user_in_category', NULL, 'radio','Ticket', 'false','TicketWarnAdminNoUserInCategoryTitle','TicketWarnAdminNoUserInCategoryComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('load_term_conditions_section', NULL, 'radio','Platform', 'login','LoadTermConditionsSectionTitle','LoadTermConditionsSectionDescription',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_terms_if_profile_completed', NULL, 'radio','Ticket', 'false','ShowTermsIfProfileCompletedTitle','ShowTermsIfProfileCompletedComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_link_ticket_notification', NULL, 'radio', 'Platform', 'false', 'ShowLinkTicketNotificationTitle', 'ShowLinkTicketNotificationComment', NULL, NULL, 0)");
// Make sure there isn't already an sso_authentication_subclass before adding an empty one
$stmt = $this->connection->query('SELECT id FROM settings_current WHERE variable = "sso_authentication_subclass" AND access_url = 1');
$results = $stmt->fetchAll();
if (empty($results)) {
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, access_url) VALUES ('sso_authentication_subclass', NULL, 'textfield', 'Security', '', 'SSOSubclassTitle', 'SSOSubclassComment', 1)");
}
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_student_add', 'true', 'Yes'), ('ticket_allow_student_add', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_category_edition', 'true', 'Yes'), ('ticket_allow_category_edition', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_send_warning_to_all_admins', 'true', 'Yes'), ('ticket_send_warning_to_all_admins', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_warn_admin_no_user_in_category', 'true', 'Yes'), ('ticket_warn_admin_no_user_in_category', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('load_term_conditions_section', 'login', 'Login'), ('load_term_conditions_section', 'course', 'Course')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_terms_if_profile_completed', 'true', 'Yes'), ('show_terms_if_profile_completed', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_link_ticket_notification', 'true', 'Yes'), ('show_link_ticket_notification', 'false', 'No')");
$table = $schema->getTable('c_quiz_question_rel_category');
if (!$table->hasIndex('idx_qqrc_qid')) {
$this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)");
}
$table = $schema->getTable('c_quiz_answer');
$hasIndex = $table->hasIndex('idx_cqa_q');
if (!$hasIndex) {
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)");
}
$this->addSql("ALTER TABLE c_student_publication ADD INDEX idx_csp_u (user_id)");
$this->addSql('ALTER TABLE legal MODIFY COLUMN language_id INT NOT NULL');
$this->addSql('ALTER TABLE legal MODIFY COLUMN legal_id INT NOT NULL');
$this->addSql('ALTER TABLE legal DROP PRIMARY KEY;');
$this->addSql('ALTER TABLE legal ADD id INT');
$this->addSql('UPDATE legal SET id = legal_id');
$this->addSql('UPDATE legal SET id = 1 WHERE id = 0');
$this->addSql('ALTER TABLE legal DROP legal_id');
$this->addSql('ALTER TABLE legal CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY;');
$this->addSql('ALTER TABLE user ADD profile_completed TINYINT(1) DEFAULT NULL;');
$this->addSql('ALTER TABLE extra_field_options CHANGE display_text display_text VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE extra_field CHANGE variable variable VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE c_course_setting MODIFY COLUMN value TEXT');
$this->addSql("ALTER TABLE session MODIFY COLUMN name VARCHAR(150) NOT NULL DEFAULT ''");
if (!$schema->hasTable('version')) {
$sql = getVersionTable();
$this->addSql($sql);
}
if ($schema->hasTable('resource')) {
$schema->dropTable('resource');
}
$this->addSql('DELETE FROM settings_current WHERE variable = "service_visio"');
$this->addSql('DELETE FROM settings_current WHERE variable = "course_create_active_tools" AND subkey = "online_conference"');
$this->addSql('DELETE FROM settings_options WHERE variable = "visio_use_rtmpt"');
$this->addSql('DELETE FROM course_module WHERE name = "conference"');
$this->addSql('ALTER TABLE c_student_publication_assignment CHANGE add_to_calendar add_to_calendar INT NOT NULL;');
// Fixes missing options show_glossary_in_extra_tools
$this->addSql("DELETE FROM settings_options WHERE variable = 'show_glossary_in_extra_tools'");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'none', 'None')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'exercise', 'Exercise')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'lp', 'LearningPaths')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'exercise_and_lp', 'ExerciseAndLearningPath')");
// Fixes from 1.10.x
// Promotion
if ($schema->hasTable('promotion')) {
$table = $schema->getTable('promotion');
$this->addSql('ALTER TABLE promotion CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT NOT NULL, CHANGE career_id career_id INT DEFAULT NULL, CHANGE status status INT');
if ($table->hasForeignKey('FK_C11D7DD1B58CDA09') == false) {
$this->addSql('ALTER TABLE promotion ADD CONSTRAINT FK_C11D7DD1B58CDA09 FOREIGN KEY (career_id) REFERENCES career (id);');
}
if ($table->hasIndex('IDX_C11D7DD1B58CDA09') == false) {
$this->addSql('CREATE INDEX IDX_C11D7DD1B58CDA09 ON promotion (career_id);');
}
}
if ($schema->hasTable('skill_profile')) {
$this->addSql('ALTER TABLE skill_profile CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT NOT NULL;');
}
// skill_rel_user_comment
if ($schema->hasTable('skill_rel_user_comment')) {
$table = $schema->getTable('skill_rel_user_comment');
$this->addSql('ALTER TABLE skill_rel_user_comment CHANGE skill_rel_user_id skill_rel_user_id INT DEFAULT NULL, CHANGE feedback_giver_id feedback_giver_id INT DEFAULT NULL, CHANGE feedback_text feedback_text LONGTEXT NOT NULL, CHANGE feedback_value feedback_value INT DEFAULT 1, CHANGE feedback_datetime feedback_datetime DATETIME NOT NULL;');
if ($table->hasForeignKey('FK_7AE9F6B6484A9317') == false) {
$this->addSql('ALTER TABLE skill_rel_user_comment ADD CONSTRAINT FK_7AE9F6B6484A9317 FOREIGN KEY (skill_rel_user_id) REFERENCES skill_rel_user (id);');
}
if ($table->hasForeignKey('FK_7AE9F6B63AF3B65B') == false) {
$this->addSql('ALTER TABLE skill_rel_user_comment ADD CONSTRAINT FK_7AE9F6B63AF3B65B FOREIGN KEY (feedback_giver_id) REFERENCES user (id);');
}
if ($table->hasIndex('IDX_7AE9F6B6484A9317') == false) {
$this->addSql('CREATE INDEX IDX_7AE9F6B6484A9317 ON skill_rel_user_comment (skill_rel_user_id);');
}
if ($table->hasIndex('IDX_7AE9F6B63AF3B65B') == false) {
$this->addSql('CREATE INDEX IDX_7AE9F6B63AF3B65B ON skill_rel_user_comment (feedback_giver_id);');
}
if ($table->hasIndex('idx_select_su_giver') == false) {
$this->addSql('CREATE INDEX idx_select_su_giver ON skill_rel_user_comment (skill_rel_user_id, feedback_giver_id);');
}
}
$this->addSql('ALTER TABLE skill_rel_gradebook CHANGE type type VARCHAR(10) NOT NULL;');
// access_url_rel_user
if ($schema->hasTable('access_url_rel_user')) {
$table = $schema->getTable('access_url_rel_user');
$this->addSql('ALTER TABLE access_url_rel_user CHANGE access_url_id access_url_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL;');
if ($table->hasForeignKey('FK_85574263A76ED395') == false) {
$this->addSql('ALTER TABLE access_url_rel_user ADD CONSTRAINT FK_85574263A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
}
if ($table->hasForeignKey('FK_8557426373444FD5') == false) {
$this->addSql('ALTER TABLE access_url_rel_user ADD CONSTRAINT FK_8557426373444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id);');
}
}
if ($schema->hasTable('sequence_rule')) {
$table = $schema->getTable('sequence_rule');
if ($table->hasColumn('text')) {
$this->addSql('ALTER TABLE sequence_rule DROP text');
}
if (!$table->hasColumn('description')) {
$this->addSql(
'ALTER TABLE sequence_rule ADD description LONGTEXT NOT NULL'
);
}
}
$this->addSql(
'CREATE TABLE IF NOT EXISTS course_rel_user_catalogue (id int NOT NULL AUTO_INCREMENT, user_id int DEFAULT NULL, c_id int DEFAULT NULL, visible int NOT NULL, PRIMARY KEY (id), KEY (user_id), KEY (c_id), CONSTRAINT FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE CASCADE, CONSTRAINT FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'
);
if ($schema->hasTable('course_rel_user_catalogue')) {
$table = $schema->getTable('course_rel_user_catalogue');
if ($table->hasForeignKey('course_rel_user_catalogue_ibfk_1')) {
$this->addSql('ALTER TABLE course_rel_user_catalogue DROP FOREIGN KEY course_rel_user_catalogue_ibfk_1;');
}
if ($table->hasForeignKey('course_rel_user_catalogue_ibfk_2')) {
$this->addSql('ALTER TABLE course_rel_user_catalogue DROP FOREIGN KEY course_rel_user_catalogue_ibfk_2;');
}
if ($table->hasForeignKey('FK_79CA412EA76ED395') == false) {
$this->addSql('ALTER TABLE course_rel_user_catalogue ADD CONSTRAINT FK_79CA412EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
}
if ($table->hasForeignKey('FK_79CA412E91D79BD3') == false) {
$this->addSql('ALTER TABLE course_rel_user_catalogue ADD CONSTRAINT FK_79CA412E91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id);');
}
}
if ($schema->hasTable('extra_field_values')) {
$table = $schema->getTable('extra_field_values');
if ($table->hasForeignKey('FK_171DF924443707B0') == false) {
$this->addSql('ALTER TABLE extra_field_values ADD CONSTRAINT FK_171DF924443707B0 FOREIGN KEY (field_id) REFERENCES extra_field (id);');
}
}
if ($schema->hasTable('extra_field_options')) {
$table = $schema->getTable('extra_field_options');
if ($table->hasForeignKey('FK_A572E3AE443707B0') == false) {
$this->addSql('ALTER TABLE extra_field_options ADD CONSTRAINT FK_A572E3AE443707B0 FOREIGN KEY (field_id) REFERENCES extra_field (id);');
}
}
if ($schema->hasTable('session_rel_course')) {
$table = $schema->getTable('session_rel_course');
if ($table->hasColumn('category')) {
$this->addSql('ALTER TABLE session_rel_course DROP category');
}
}
}
/**
* @param Schema $schema
*/
public function postUp(Schema $schema)
{
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DROP TABLE c_lp_category_user');
$this->addSql('DROP TABLE access_url_rel_course_category');
}
}

View File

@@ -0,0 +1,82 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160302133200
*/
class Version20160302133200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$allowSendPushNotification = $this->getConfigurationValue('messaging_allow_send_push_notification');
$this->addSettingCurrent(
'messaging_allow_send_push_notification',
null,
'radio',
'WebServices',
($allowSendPushNotification ? 'true' : 'false'),
'MessagingAllowSendPushNotificationTitle',
'MessagingAllowSendPushNotificationComment',
null,
'',
1,
true,
false,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No'],
]
);
$gdcProjectNumber = $this->getConfigurationValue('messaging_gdc_project_number');
$this->addSettingCurrent(
'messaging_gdc_project_number',
null,
'textfield',
'WebServices',
!empty($gdcProjectNumber) ? $gdcProjectNumber : '',
'MessagingGDCProjectNumberTitle',
'MessagingGDCProjectNumberComment',
null,
'',
1,
true,
false
);
$gdcApiKey = $this->getConfigurationValue('messaging_gdc_api_key');
$this->addSettingCurrent(
'messaging_gdc_api_key',
null,
'textfield',
'WebServices',
!empty($gdcApiKey) ? $gdcApiKey : '',
'MessagingGDCApiKeyTitle',
'MessagingGDCApiKeyComment',
null,
'',
1,
true,
false
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160304151300
*/
class Version20160304151300 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE extra_field SET visible = 0 WHERE variable IN('mail_notify_invitation', 'mail_notify_message', 'mail_notify_group_message') AND extra_field_type = 1");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160315155700
* Change type of the course_creation_use_template setting
*/
class Version20160315155700 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE settings_current SET type = 'select_course' WHERE variable = 'course_creation_use_template'");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,178 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160330103045
* @package Application\Migrations\Schema\V111
*/
class Version20160330103045 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
/*
$this->addSql(
'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'
);
$this->addSql(
'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'
);
$this->addSql(
'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'
);
$this->addSql(
'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'
);
$this->addSql(
'CREATE TABLE classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, context VARCHAR(255) 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_43629B36E25D857E (context), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'CREATE TABLE classification__context (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) 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'
);
$this->addSql(
'CREATE TABLE classification__tag (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT 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, INDEX IDX_CA57A1C7E25D857E (context), UNIQUE INDEX tag_context (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'CREATE TABLE classification__collection (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) 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, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AE25D857E (context), INDEX IDX_A406B56AEA9FDD75 (media_id), UNIQUE INDEX tag_collection (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'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'
);
$this->addSql(
'CREATE TABLE media__media (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT 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(255) 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_identifier VARCHAR(64) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_5C6DD74E12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'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'
);
$this->addSql(
'ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39EDF6BD1646 FOREIGN KEY (site_id) REFERENCES page__site (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39ED727ACA70 FOREIGN KEY (parent_id) REFERENCES page__page (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__page ADD CONSTRAINT FK_2FAE39ED158E0B66 FOREIGN KEY (target_id) REFERENCES page__page (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__snapshot ADD CONSTRAINT FK_3963EF9AF6BD1646 FOREIGN KEY (site_id) REFERENCES page__site (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__snapshot ADD CONSTRAINT FK_3963EF9AC4663E4 FOREIGN KEY (page_id) REFERENCES page__page (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__bloc ADD CONSTRAINT FK_FCDC1A97727ACA70 FOREIGN KEY (parent_id) REFERENCES page__bloc (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE page__bloc ADD CONSTRAINT FK_FCDC1A97C4663E4 FOREIGN KEY (page_id) REFERENCES page__page (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36727ACA70 FOREIGN KEY (parent_id) REFERENCES classification__category (id) ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'
);
$this->addSql(
'ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL'
);
$this->addSql(
'ALTER TABLE classification__tag ADD CONSTRAINT FK_CA57A1C7E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'
);
$this->addSql(
'ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AE25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'
);
$this->addSql(
'ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL'
);
$this->addSql(
'ALTER TABLE media__media ADD CONSTRAINT FK_5C6DD74E12469DE2 FOREIGN KEY (category_id) REFERENCES classification__category (id) ON DELETE SET NULL'
);
$this->addSql(
'ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id)'
);
$this->addSql(
'ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'
);
$this->addSql("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;");
$this->addSql("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;");
$this->addSql("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;");
$this->addSql("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;");
$this->addSql("ALTER TABLE timeline__timeline ADD CONSTRAINT FK_FFBC6AD59D32F035 FOREIGN KEY (action_id) REFERENCES timeline__action (id);");
$this->addSql("ALTER TABLE timeline__timeline ADD CONSTRAINT FK_FFBC6AD523EDC87 FOREIGN KEY (subject_id) REFERENCES timeline__component (id) ON DELETE CASCADE;");
$this->addSql("ALTER TABLE timeline__action_component ADD CONSTRAINT FK_6ACD1B169D32F035 FOREIGN KEY (action_id) REFERENCES timeline__action (id) ON DELETE CASCADE;");
$this->addSql("ALTER TABLE timeline__action_component ADD CONSTRAINT FK_6ACD1B16E2ABAFFF FOREIGN KEY (component_id) REFERENCES timeline__component (id) ON DELETE CASCADE;");
//$this->addSql("CREATE UNIQUE INDEX UNIQ_8D93D649A0D96FBF ON user (email_canonical);");
*/
$table = $schema->getTable('track_stored_values_stack');
$hasIndex = $table->hasIndex('user_sco_course_sv_stack');
if ($hasIndex) {
$this->addSql('DROP INDEX user_sco_course_sv_stack ON track_stored_values_stack');
}
$table = $schema->getTable('session_rel_user');
$hasColumn = $table->hasColumn('duration');
if (!$hasColumn) {
$this->addSql('ALTER TABLE session_rel_user ADD duration INT DEFAULT NULL');
}
$table = $schema->getTable('track_stored_values');
$hasIndex = $table->hasIndex('user_sco_course_sv');
if ($hasIndex) {
$this->addSql('DROP INDEX user_sco_course_sv ON track_stored_values');
}
$table = $schema->getTable('user');
$hasIndex = $table->hasIndex('UNIQ_8D93D649F85E0677');
if ($hasIndex) {
$this->addSql('DROP INDEX UNIQ_8D93D649F85E0677 ON user');
}
$this->addSql('ALTER TABLE user ADD email_canonical VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE user ADD credentials_expired TINYINT(1)');
$this->addSql('ALTER TABLE user ADD credentials_expire_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD locked TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE user ADD enabled TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE user ADD expired TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE user ADD expires_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE user CHANGE username username VARCHAR(100) NOT NULL');
$this->addSql('ALTER TABLE user CHANGE username_canonical username_canonical VARCHAR(100) NOT NULL');
$this->addSql('ALTER TABLE user CHANGE email email VARCHAR(100) NOT NULL');
$sql = "UPDATE user SET email_canonical = email";
$this->addSql($sql);
$sql = "ALTER TABLE user ADD roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)'";
$this->addSql($sql);
$sql = "UPDATE user SET roles = 'a:0:{}'";
$this->addSql($sql);
$sql = "UPDATE user SET enabled = '1' WHERE active = 1";
$this->addSql($sql);
$sql = "ALTER TABLE user ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL;";
$this->addSql($sql);
$sql = "UPDATE user SET username_canonical = username";
$this->addSql($sql);
$this->addSql("CREATE TABLE fos_group(id INT AUTO_INCREMENT NOT NULL, code VARCHAR(40) NOT NULL, UNIQUE INDEX UNIQ_4B019DDB77153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$this->addSql("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");
$this->addSql("ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
$this->addSql("ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447FE54D947 FOREIGN KEY (group_id) REFERENCES fos_group (id)");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,48 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160331103600
*/
class Version20160331103600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'teacher_can_select_course_template',
null,
'radio',
'Course',
'true',
'TeacherCanSelectCourseTemplateTitle',
'TeacherCanSelectCourseTemplateComment',
null,
'',
1,
true,
false,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No'],
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,131 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160405112100
* @package Application\Migrations\Schema\V111
*/
class Version20160405112100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql(
'CREATE TABLE skill_level_profile (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'CREATE TABLE skill_level (id INT AUTO_INCREMENT NOT NULL, profile_id INT NOT NULL, name VARCHAR(255) NOT NULL, position INT, short_name VARCHAR(255), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql(
'ALTER TABLE skill_rel_user ADD acquired_level INT, ADD argumentation TEXT, ADD argumentation_author_id INT, MODIFY course_id INT, MODIFY session_id INT'
);
$this->addSql(
'CREATE TABLE skill_rel_user_comment (id INT AUTO_INCREMENT NOT NULL, skill_rel_user_id INT NOT NULL, feedback_giver_id INT NOT NULL, feedback_text TEXT, feedback_value INT, feedback_datetime DATETIME, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
$this->addSql('ALTER TABLE skill ADD profile_id INT');
if ($schema->hasTable('skill')) {
$table = $schema->getTable('skill');
if ($table->hasForeignKey('FK_5E3DE477CCFA12B8') == false) {
$this->addSql('ALTER TABLE skill ADD CONSTRAINT FK_5E3DE477CCFA12B8 FOREIGN KEY (profile_id) REFERENCES skill_level_profile (id);');
}
if ($table->hasIndex('IDX_5E3DE477CCFA12B8') == false) {
$this->addSql('CREATE INDEX IDX_5E3DE477CCFA12B8 ON skill (profile_id);');
}
}
// Skill
if ($schema->hasTable('skill')) {
$this->addSql('ALTER TABLE skill CHANGE name name VARCHAR(255) NOT NULL, CHANGE short_code short_code VARCHAR(100) NOT NULL, CHANGE description description LONGTEXT NOT NULL, CHANGE icon icon VARCHAR(255) NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL;');
}
// skill_rel_user
if ($schema->hasTable('skill_rel_user')) {
$table = $schema->getTable('skill_rel_user');
$this->addSql('ALTER TABLE skill_rel_user CHANGE acquired_skill_at acquired_skill_at DATETIME NOT NULL, CHANGE argumentation argumentation LONGTEXT NOT NULL, CHANGE argumentation_author_id argumentation_author_id INT NOT NULL;');
$this->addSql('UPDATE skill_rel_user SET course_id = NULL WHERE course_id = 0');
$this->addSql('UPDATE skill_rel_user SET skill_id = NULL WHERE skill_id = 0');
$this->addSql('UPDATE skill_rel_user SET user_id = NULL WHERE user_id = 0');
$this->addSql('UPDATE skill_rel_user SET session_id = NULL WHERE session_id = 0');
$this->addSql('UPDATE skill_rel_user SET acquired_level = NULL WHERE acquired_level = 0');
if ($table->hasForeignKey('FK_79D3D95AA76ED395') == false) {
$this->addSql('ALTER TABLE skill_rel_user ADD CONSTRAINT FK_79D3D95AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
}
if ($table->hasForeignKey('FK_79D3D95A5585C142') == false) {
$this->addSql('ALTER TABLE skill_rel_user ADD CONSTRAINT FK_79D3D95A5585C142 FOREIGN KEY (skill_id) REFERENCES skill (id);');
}
if ($table->hasForeignKey('FK_79D3D95A591CC992') == false) {
$this->addSql('ALTER TABLE skill_rel_user ADD CONSTRAINT FK_79D3D95A591CC992 FOREIGN KEY (course_id) REFERENCES course (id);');
}
if ($table->hasForeignKey('FK_79D3D95A613FECDF') == false) {
$this->addSql('ALTER TABLE skill_rel_user ADD CONSTRAINT FK_79D3D95A613FECDF FOREIGN KEY (session_id) REFERENCES session (id);');
}
if ($table->hasForeignKey('FK_79D3D95AF68F11CE') == false) {
$this->addSql('ALTER TABLE skill_rel_user ADD CONSTRAINT FK_79D3D95AF68F11CE FOREIGN KEY (acquired_level) REFERENCES skill_level (id);');
}
if ($table->hasIndex('IDX_79D3D95AA76ED395') == false) {
$this->addSql('CREATE INDEX IDX_79D3D95AA76ED395 ON skill_rel_user(user_id);');
}
if ($table->hasIndex('IDX_79D3D95A5585C142') == false) {
$this->addSql('CREATE INDEX IDX_79D3D95A5585C142 ON skill_rel_user(skill_id);');
}
if ($table->hasIndex('IDX_79D3D95A591CC992') == false) {
$this->addSql('CREATE INDEX IDX_79D3D95A591CC992 ON skill_rel_user(course_id);');
}
if ($table->hasIndex('IDX_79D3D95A613FECDF') == false) {
$this->addSql('CREATE INDEX IDX_79D3D95A613FECDF ON skill_rel_user(session_id);');
}
if ($table->hasIndex('IDX_79D3D95AF68F11CE') == false) {
$this->addSql('CREATE INDEX IDX_79D3D95AF68F11CE ON skill_rel_user (acquired_level);');
}
if ($table->hasIndex('IDX_79D3D95AF68F11CE') == false) {
$this->addSql('CREATE INDEX idx_select_s_c_u ON skill_rel_user (session_id, course_id, user_id);');
}
if ($table->hasIndex('IDX_79D3D95AF68F11CE') == false) {
$this->addSql('CREATE INDEX idx_select_sk_u ON skill_rel_user(skill_id, user_id);');
}
}
// skill_level
if ($schema->hasTable('skill_level')) {
$table = $schema->getTable('skill_level');
$this->addSql('ALTER TABLE skill_level CHANGE profile_id profile_id INT DEFAULT NULL, CHANGE position position INT NOT NULL, CHANGE short_name short_name VARCHAR(255) NOT NULL;');
if ($table->hasForeignKey('FK_BFC25F2FCCFA12B8') == false) {
$this->addSql('ALTER TABLE skill_level ADD CONSTRAINT FK_BFC25F2FCCFA12B8 FOREIGN KEY (profile_id) REFERENCES skill_level_profile (id);');
}
if ($table->hasIndex('IDX_BFC25F2FCCFA12B8') == false) {
$this->addSql('CREATE INDEX IDX_BFC25F2FCCFA12B8 ON skill_level (profile_id);');
}
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql(
'ALTER TABLE skill_rel_user DROP COLUMN acquired_level, DROP COLUMN argumentation, DROP COLUMN argumentation_author_id, MODIFY course_id INT NOT NULL, MODIFY session_id INT NOT NULL'
);
$this->addSql(
'ALTER TABLE skill DROP COLUMN profile_id'
);
$this->addSql('DROP TABLE skill_level');
$this->addSql('DROP TABLE skill_level_profile');
}
}

View File

@@ -0,0 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160418093800
* Add save_correct_answers column to c_quiz table
* @package Application\Migrations\Schema\V111
*/
class Version20160418093800 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$cQuizTable = $schema->getTable('c_quiz');
$cQuizTable->addColumn('save_correct_answers', Type::BOOLEAN);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160418113000
*/
class Version20160418113000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE user ADD address VARCHAR(250) DEFAULT NULL;');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE user DROP COLUMN address');
}
}

View File

@@ -0,0 +1,70 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version_a
* Remove enable_nanogong and enable_wami_record settings and create enable_record_audio
* @package Application\Migrations\Schema\V111
*/
class Version20160421112900 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$em = $this->getEntityManager();
$enableNanogong = $em
->getRepository('ChamiloCoreBundle:SettingsCurrent')
->findOneBy(['variable' => 'enable_nanogong']);
$enableWami = $em
->getRepository('ChamiloCoreBundle:SettingsCurrent')
->findOneBy(['variable' => 'enable_wami_record']);
$enableRecordAudioValue = 'true';
if ($enableNanogong->getSelectedValue() === 'false' && $enableWami->getSelectedValue() === 'false') {
$enableRecordAudioValue = 'false';
}
$this->addSettingCurrent(
'enable_record_audio',
null,
'radio',
'Course',
$enableRecordAudioValue,
'EnableRecordAudioTitle',
'EnableRecordAudioComment',
null,
'',
1,
true,
false,
[
['value' => 'false', 'text' => 'No'],
['value' => 'true', 'text' => 'Yes']
]
);
$em->remove($enableNanogong);
$em->remove($enableWami);
$em->flush();
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,37 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160519201900
* Update the subkeytext of some settings, previously preventing translations
* @package Application\Migrations\Schema\V111
*/
class Version20160519201900 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE settings_current SET subkeytext = 'Name' WHERE variable = 'profile' AND subkey = 'name'");
$this->addSql("UPDATE settings_current SET subkeytext = 'OfficialCode' WHERE variable = 'profile' AND subkey = 'officialcode'");
$this->addSql("UPDATE settings_current SET subkeytext = 'Phone' WHERE variable = 'profile' AND subkey = 'phone'");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("UPDATE settings_current SET subkeytext = 'name' WHERE variable = 'profile' AND subkey = 'name'");
$this->addSql("UPDATE settings_current SET subkeytext = 'officialcode' WHERE variable = 'profile' AND subkey = 'officialcode'");
$this->addSql("UPDATE settings_current SET subkeytext = 'phone' WHERE variable = 'profile' AND subkey = 'phone'");
}
}

View File

@@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160603113100
* Add association mapping for Language class
* @package Application\Migrations\Schema\V111
*/
class Version20160603113100 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE language MODIFY id INT');
$this->addSql('ALTER TABLE language MODIFY parent_id INT');
$this->addSql('ALTER TABLE language ADD CONSTRAINT language_parent FOREIGN KEY (parent_id) REFERENCES language (id)');
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$languageTable = $schema->getTable('language');
$languageTable->removeForeignKey('language_parent');
$languageTable
->getColumn('parent_id')
->setType(Type::getType(Type::BOOLEAN))
->setNotnull(false);
}
}

View File

@@ -0,0 +1,92 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160610142700
* Integrate the Skype plugin and create new settings current to enable it
* @package Application\Migrations\Schema\V111
*/
class Version20160610142700 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'skype' AND extra_field_type = 1";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at)
VALUES (1, 1, 'skype', 'Skype', 1, 1, NOW())
");
}
$sql = "SELECT id FROM extra_field WHERE variable = 'skype' AND extra_field_type = 1";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at)
VALUES (1, 1, 'linkedin_url', 'LinkedInUrl', 1, 1, NOW())"
);
}
$this->addSettingCurrent(
'allow_show_skype_account',
null,
'radio',
'Platform',
'true',
'AllowShowSkypeAccountTitle',
'AllowShowSkypeAccountComment',
null,
null,
1,
true,
false,
[
['value' => 'false', 'text' => 'No'],
['value' => 'true', 'text' => 'Yes']
]
);
$this->addSettingCurrent(
'allow_show_linkedin_url',
null,
'radio',
'Platform',
'true',
'AllowShowLinkedInUrlTitle',
'AllowShowLinkedInUrlComment',
null,
null,
1,
true,
false,
[
['value' => 'false', 'text' => 'No'],
['value' => 'true', 'text' => 'Yes']
]
);
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160623143200
* Remove chatcall_date, chatcall_text, chatcall_user_id from User table
* @package Application\Migrations\Schema\V111
*/
class Version20160623143200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$schema
->getTable('user')
->dropColumn('chatcall_user_id')
->dropColumn('chatcall_date')
->dropColumn('chatcall_text');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,47 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160628220000
* Integrate the Skype plugin and create new settings current to enable it
* @package Application\Migrations\Schema\V111
*/
class Version20160628220000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this
->connection
->executeQuery("UPDATE c_lp_item SET item_type = 'dir' WHERE item_type = 'dokeos_chapter'");
$this
->connection
->executeQuery("UPDATE c_lp_item SET item_type = 'dir' WHERE item_type = 'dokeos_module'");
$this
->connection
->executeQuery("UPDATE c_lp_item SET item_type = 'dir' WHERE item_type = 'chapter'");
$this
->connection
->executeQuery("UPDATE c_lp_item SET item_type = 'dir' WHERE item_type = 'module'");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160701110000
* Add option to remove splash screen on course creation
* @package Application\Migrations\Schema\V111
*/
class Version20160701110000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_creation_splash_screen',NULL,'radio','Course','true','CourseCreationSplashScreenTitle','CourseCreationSplashScreenComment','',NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('course_creation_splash_screen','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('course_creation_splash_screen','false','No') ");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'course_creation_splash_screen'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'course_creation_splash_screen'");
}
}

View File

@@ -0,0 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160705190000
* Add accumulate scorm time to c_lp table
* @package Application\Migrations\Schema\V111
*/
class Version20160705190000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("ALTER TABLE c_lp ADD COLUMN accumulate_scorm_time INT NOT NULL DEFAULT 1");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("ALTER TABLE c_lp DROP COLUMN accumulate_scorm_time");
}
}

View File

@@ -0,0 +1,46 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160705192000
* Add accumulate scorm time to c_lp table
* @package Application\Migrations\Schema\V111
*/
class Version20160705192000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$em = $this->getEntityManager();
$result = $em
->getRepository('ChamiloCoreBundle:SettingsCurrent')
->findOneBy(['variable' => 'scorm_cumulative_session_time']);
$cumulativeScormTime = 1;
if ($result->getSelectedValue() === 'false') {
$cumulativeScormTime = 0;
}
$this->addSql("UPDATE c_lp SET accumulate_scorm_time = $cumulativeScormTime");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,41 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160706145000
* Add tag extra field for skills
* @package Application\Migrations\Schema\V111
*/
class Version20160706145000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$connection = $this->connection;
$sql = "SELECT id FROM extra_field WHERE variable = 'tags'";
$result = $connection->executeQuery($sql)->fetchAll();
if (empty($result)) {
$this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (8, 10, 'tags', 'Tags', 1, 1, NOW())");
}
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM extra_field WHERE extra_field_type = 8 AND field_type = 10 AND variable = 'tags'");
}
}

View File

@@ -0,0 +1,42 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160706182000
* Add new table to save user visibility on courses in the catalogue
* @package Application\Migrations\Schema\V111
*/
class Version20160706182000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql(
'CREATE TABLE IF NOT EXISTS course_rel_user_catalogue (id int NOT NULL AUTO_INCREMENT, user_id int DEFAULT NULL, c_id int DEFAULT NULL, visible int NOT NULL, PRIMARY KEY (id), KEY (user_id), KEY (c_id), CONSTRAINT FOREIGN KEY (c_id) REFERENCES course (id) ON DELETE CASCADE, CONSTRAINT FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'
);
}
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql(
'DROP TABLE course_rel_user_catalogue'
);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160712150000
* Add option to use SVG icons instead of their PNG version
* @package Application\Migrations\Schema\V111
*/
class Version20160712150000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('icons_mode_svg', NULL, 'radio', 'Tuning', 'false', 'IconsModeSVGTitle','IconsModeSVGComment','',NULL, 1)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg','false','No') ");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'icons_mode_svg'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'icons_mode_svg'");
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160713180000
* Add option to use SVG icons instead of their PNG version
* @package Application\Migrations\Schema\V111
*/
class Version20160713180000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'allow_browser_sniffer'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'allow_browser_sniffer'");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle','AllowBrowserSnifferComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer','false','No') ");
}
}

View File

@@ -0,0 +1,41 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160715122300
* Add association mapping between Session and CStudentPublication
* @package Application\Migrations\Schema\V111
*/
class Version20160715122300 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_student_publication CHANGE session_id session_id INT DEFAULT NULL');
$this->addSql('UPDATE c_student_publication SET session_id = NULL WHERE session_id = 0');
// Fix not existing session id
$this->addSql('DELETE FROM c_student_publication WHERE session_id <> NULL AND session_id not in (SELECT id FROM session)');
$this->addSql('ALTER TABLE c_student_publication ADD CONSTRAINT fk_session FOREIGN KEY (session_id) REFERENCES session (id)');
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$studentPublication = $schema->getTable('c_student_publication');
$studentPublication->removeForeignKey('fk_session');
$studentPublication->getColumn('session_id')->setNotnull(true);
}
}

View File

@@ -0,0 +1,35 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160727122700
* Add missing index to c_lp
* @package Application\Migrations\Schema\V111
*/
class Version20160727122700 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$schema
->getTable('c_lp')
->addIndex(['session_id'], 'session');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema
->getTable('c_lp')
->dropIndex('session');
}
}

View File

@@ -0,0 +1,50 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Entity\BranchSync;
/**
* Class Version20160727155600
* Add an initial branch_sync
* @package Application\Migrations\Schema\V111
*/
class Version20160727155600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$sql = "SELECT COUNT(id) as count FROM branch_sync";
$result = $this->connection->executeQuery($sql)->fetch();
$count = $result['count'];
if (!$count) {
$unique = sha1(uniqid());
$sql = "INSERT INTO branch_sync (branch_name, unique_id, access_url_id) VALUES ('localhost', '$unique', '1')";
$this->addSql($sql);
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$em = $this->getEntityManager();
$branchSync = $em
->getRepository('ChamiloCoreBundle:BranchSync')
->findOneBy([
'branchName' => 'localhost',
'accessUrlId' => 1
]);
$em->remove($branchSync);
$em->flush();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160808154200
* Set ponderation and destination for questions and answers
* @package Application\Migrations\Schema\V111
*/
class Version20160808154200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$question = $schema->getTable('c_quiz_question');
$question
->getColumn('ponderation')
->setDefault(0);
$answer = $schema->getTable('c_quiz_answer');
$answer
->getColumn('ponderation')
->setDefault(0);
$answer
->getColumn('destination')
->setNotnull(false)
->setDefault(null);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$answer = $schema->getTable('c_quiz_answer');
$answer
->getColumn('destination')
->setNotnull(true)
->setDefault(0);
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160808160000
* Set ponderation and destination for questions and answers
* @package Application\Migrations\Schema\V111
*/
class Version20160808160000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE c_quiz_answer SET destination = NULL WHERE TRIM(destination) = ''");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("UPDATE c_quiz_answer SET destination = '' WHERE destination IS NULL");
}
}

View File

@@ -0,0 +1,54 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160825155200
* Add option to allow download documents with the api key
* @package Application\Migrations\Schema\V111
*/
class Version20160825155200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'allow_download_documents_by_api_key',
null,
'radio',
'WebServices',
'false',
'AllowDownloadDocumentsByApiKeyTitle',
'AllowDownloadDocumentsByApiKeyComment',
null,
null,
1,
true,
true,
[
['value' => 'false', 'text' => 'No'],
['value' => 'true', 'text' => 'Yes']
]
);
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'allow_download_documents_by_api_key'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'allow_download_documents_by_api_key'");
}
}

View File

@@ -0,0 +1,242 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160907140300
* Change tables engine to InnoDB
* @package Application\Migrations\Schema\V111
*/
class Version20160907140300 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20160907140300');
$data = [
'career' => [
'created_at',
'updated_at',
],
'chat' => [
'sent',
],
'course' => [
'last_visit',
'last_edit',
'creation_date',
'expiration_date',
],
'course_request' => [
'request_date',
],
'gradebook_certificate' => [
'created_at',
],
'gradebook_evaluation' => [
'created_at',
],
'gradebook_link' => [
'created_at',
],
'gradebook_linkeval_log' => [
'created_at',
],
'gradebook_result' => [
'created_at',
],
'gradebook_result_log' => [
'created_at',
],
'message' => [
'send_date',
],
'notification' => [
'sent_at'
],
'promotion' => [
'created_at',
'updated_at',
],
'shared_survey' => [
'creation_date',
],
'sequence_value' => [
'success_date',
'available_start_date',
'available_end_date',
],
'session_rel_user' => [
'moved_at',
'registered_at',
],
'skill' => [
'updated_at',
],
'sys_announcement' => [
'date_start',
'date_end',
],
'track_e_attempt_recording' => [
'insert_date',
],
'track_e_course_access' => [
'login_course_date',
'logout_course_date',
],
'track_e_downloads' => [
'down_date',
],
'track_e_exercises' => [
'start_date',
'exe_date',
],
'track_e_hotpotatoes' => [
'exe_date',
],
'track_e_item_property' => [
'lastedit_date',
],
'track_e_links' => [
'links_date',
],
'track_e_login' => [
'logout_date',
],
'track_e_online' => [
'login_date',
],
'track_e_open' => [
'open_date',
],
'track_e_uploads' => [
'upload_date',
],
'user_api_key' => [
'created_date',
'validity_start_date',
'validity_end_date',
],
'user_rel_user' => [
'last_edit',
],
'c_attendance_calendar' => [
'date_time',
],
'c_attendance_sheet_log' => [
'calendar_date_value',
],
'c_blog' => [
'date_creation',
],
'c_blog_comment' => [
'date_creation',
],
'c_blog_post' => [
'date_creation',
],
'c_blog_task_rel_user' => [
'target_date',
],
'c_chat_connected' => [
'last_connection',
],
'c_dropbox_feedback' => [
'feedback_date',
],
'c_dropbox_file' => [
'upload_date',
'last_upload_date',
],
'c_dropbox_post' => [
'feedback_date',
],
'c_forum_post' => [
'post_date',
],
'c_forum_thread' => [
'thread_date',
'thread_close_date',
],
'c_forum_thread_qualify' => [
'qualify_time',
],
'c_forum_thread_qualify_log' => [
'qualify_time',
],
'c_lp' => [
'created_on',
'modified_on',
],
'c_notebook' => [
'creation_date',
'update_date',
],
'c_online_connected' => [
'last_connection',
],
'c_survey' => [
'creation_date',
],
'c_survey_invitation' => [
'invitation_date',
'reminder_date',
],
'c_userinfo_content' => [
'edition_time'
],
'c_wiki_discuss' => [
'dtime',
],
];
// Needed to update 0000-00-00 00:00:00 values
$this->addSql('SET sql_mode = ""');
// In case this one didn't work, also try this
$this->addSql('SET SESSION sql_mode = ""');
// The whole point of this version is to ensure that all tricky (or most)
// tricky datetime fields are null if = 0000-00-00 00:00:00, because
// this value is not tolerated in NO_ZERO_DATE mode nor to convert
// the table to InnoDB, and we want all tables to be converted to
// InnoDB (that's the point of the following migration)
// To try and avoid errors to the maximum, we first convert the fields
// to a non-DATETIME type, then change the value of zero-valued times
// to NULL, then change the field back to DATETIME
foreach ($data as $table => $fields) {
foreach ($fields as $field) {
error_log("$table . $field");
$this->addSql("ALTER TABLE $table CHANGE $field $field char(19)");
$this->addSql("UPDATE $table SET $field = NULL WHERE $field = '0000-00-00 00:00:00'");
$this->addSql("UPDATE $table SET $field = NULL WHERE $field = '0000-00-00 23:59:59'");
$this->addSql("ALTER TABLE $table CHANGE $field $field DATETIME");
}
}
// Same with DATE instead of DATETIME
$data = [
'c_announcement' => [
'end_date',
],
];
foreach ($data as $table => $fields) {
foreach ($fields as $field) {
error_log("$table . $field");
$this->addSql("ALTER TABLE $table CHANGE $field $field char(10)");
$this->addSql("UPDATE $table SET $field = NULL WHERE $field = '0000-00-00'");
$this->addSql("ALTER TABLE $table CHANGE $field $field DATE");
}
}
}
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,216 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160907150300
* Change tables engine to InnoDB
* @package Application\Migrations\Schema\V111
*/
class Version20160907150300 extends AbstractMigrationChamilo
{
private $names = [
'access_url_rel_session',
'access_url_rel_user',
'admin',
'announcement_rel_group',
'block',
'c_announcement',
'c_announcement_attachment',
'c_attendance',
'c_attendance_calendar',
'c_attendance_result',
'c_attendance_sheet',
'c_attendance_sheet_log',
'c_blog',
'c_blog_attachment',
'c_blog_comment',
'c_blog_post',
'c_blog_rating',
'c_blog_rel_user',
'c_blog_task',
'c_blog_task_rel_user',
'c_calendar_event_attachment',
'c_calendar_event_repeat',
'c_calendar_event_repeat_not',
'c_chat_connected',
'c_course_description',
'c_course_setting',
'c_document',
'c_dropbox_category',
'c_dropbox_feedback',
'c_dropbox_file',
'c_dropbox_person',
'c_dropbox_post',
'c_forum_attachment',
'c_forum_category',
'c_forum_forum',
'c_forum_mailcue',
'c_forum_notification',
'c_forum_post',
'c_forum_thread',
'c_forum_thread_qualify',
'c_forum_thread_qualify_log',
'c_glossary',
'c_group_category',
'c_group_rel_tutor',
'c_group_rel_user',
'c_link',
'c_link_category',
'c_lp',
'c_lp_item',
'c_lp_item_view',
'c_lp_iv_interaction',
'c_lp_iv_objective',
'c_lp_view',
'c_notebook',
'c_online_connected',
'c_online_link',
'c_permission_group',
'c_permission_task',
'c_permission_user',
'c_quiz',
'c_quiz_question_category',
'c_quiz_question_option',
'c_quiz_question_rel_category',
'c_quiz_rel_question',
'c_resource',
'c_role',
'c_role_group',
'c_role_permissions',
'c_role_user',
'c_student_publication',
'c_student_publication_assignment',
'c_survey',
'c_survey_answer',
'c_survey_group',
'c_survey_invitation',
'c_survey_question',
'c_survey_question_option',
'c_thematic',
'c_thematic_plan',
'c_tool',
'c_tool_intro',
'c_userinfo_content',
'c_userinfo_def',
'c_wiki',
'c_wiki_conf',
'c_wiki_discuss',
'c_wiki_mailcue',
'career',
'chat',
'class_user',
'course_category',
'course_module',
'course_rel_class',
'course_request',
'course_type',
'event_email_template',
'event_sent',
'grade_components',
'grade_model',
'gradebook_category',
'gradebook_certificate',
'gradebook_evaluation',
'gradebook_link',
'gradebook_linkeval_log',
'gradebook_result',
'gradebook_result_log',
'gradebook_score_display',
'language',
'legal',
'message',
'message_attachment',
'notification',
'openid_association',
'personal_agenda',
'personal_agenda_repeat',
'personal_agenda_repeat_not',
'promotion',
'search_engine_ref',
'shared_survey',
'shared_survey_question',
'shared_survey_question_option',
'skill',
'skill_profile',
'skill_rel_gradebook',
'skill_rel_profile',
'skill_rel_skill',
'skill_rel_user',
'specific_field',
'specific_field_values',
'sys_announcement',
'sys_calendar',
'system_template',
'tag',
'templates',
'track_course_ranking',
'track_e_access',
'track_e_attempt',
'track_e_attempt_coeff',
'track_e_attempt_recording',
'track_e_course_access',
'track_e_default',
'track_e_downloads',
'track_e_exercises',
'track_e_hotpotatoes',
'track_e_hotspot',
'track_e_item_property',
'track_e_lastaccess',
'track_e_links',
'track_e_login',
'track_e_online',
'track_e_open',
'track_e_uploads',
'track_stored_values',
'track_stored_values_stack',
'user_api_key',
'user_course_category',
'user_friend_relation_type',
'user_rel_course_vote',
'user_rel_event_type',
'user_rel_tag',
'user_rel_user',
'usergroup_rel_course',
'usergroup_rel_question',
'usergroup_rel_session'
];
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
error_log('Version20160907150300');
foreach ($this->names as $name) {
if (!$schema->hasTable($name)) {
continue;
}
$sql = "ALTER TABLE $name ENGINE=InnoDB";
$this->addSql($sql);
error_log($sql);
}
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
foreach ($this->names as $name) {
if (!$schema->hasTable($name)) {
continue;
}
$this->addSql("ALTER TABLE $name ENGINE=MyISAM");
}
}
}

View File

@@ -0,0 +1,42 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160929120000
* Change tables engine to InnoDB
* @package Application\Migrations\Schema\V111
*/
class Version20160929120000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
error_log('Version20160929120000');
$this->addSql("ALTER TABLE c_tool ADD INDEX idx_ctool_name (name(20))");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
foreach ($this->names as $name) {
if (!$schema->hasTable($name)) {
continue;
}
$this->addSql("ALTER TABLE c_tool DROP INDEX idx_ctool_name");
}
}
}

View File

@@ -0,0 +1,53 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160930144400
* Fix track_e_hotspot ussing c_quiz_answer iid
* @package Application\Migrations\Schema\V111
*/
class Version20160930144400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20160930144400');
$this->addSql('
UPDATE track_e_hotspot h
SET h.hotspot_answer_id = (
SELECT qa.iid
FROM c_quiz_answer qa
WHERE h.c_id = qa.c_id AND
h.hotspot_question_id = qa.question_id AND
h.hotspot_answer_id = qa.id
)
');
$this->addSql('ALTER TABLE extra_field ADD visible_to_others TINYINT(1) DEFAULT 0, CHANGE visible visible_to_self TINYINT(1) DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('
UPDATE track_e_hotspot h
SET h.hotspot_answer_id = (
SELECT qa.id
FROM c_quiz_answer qa
WHERE
h.c_id = qa.c_id AND
h.hotspot_question_id = qa.question_id AND
h.hotspot_answer_id = qa.iid
)
');
}
}

View File

@@ -0,0 +1,60 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20161028123400
* Add primary key as auto increment in c_student_publication_comment
* @package Application\Migrations\Schema\V111
*/
class Version20161028123400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20161028123400');
$iidColumn = $schema
->getTable('c_student_publication_comment')
->getColumn('iid');
if (!$iidColumn->getAutoincrement()) {
$iidColumn->setAutoincrement(true);
}
// Deleting users that don't exist anymore
$sql = 'DELETE FROM access_url_rel_user WHERE user_id NOT IN (SELECT user_id from user)';
$this->addSql($sql);
$table = $schema->getTable('personal_agenda');
if ($table->hasIndex('id')) {
$this->addSql('ALTER TABLE personal_agenda DROP INDEX id');
$this->addSql('ALTER TABLE personal_agenda DROP INDEX idx_personal_agenda_user');
$this->addSql('ALTER TABLE personal_agenda DROP INDEX idx_personal_agenda_parent');
$this->addSql('ALTER TABLE personal_agenda modify id INT NOT NULL');
if ($table->hasPrimaryKey()) {
$this->addSql('ALTER TABLE personal_agenda drop primary key ');
}
$this->addSql('ALTER TABLE personal_agenda CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY');
$this->addSql('CREATE INDEX idx_personal_agenda_user ON personal_agenda (user)');
$this->addSql('CREATE INDEX idx_personal_agenda_parent ON personal_agenda (parent_event_id)');
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema
->getTable('c_student_publication_comment')
->getColumn('iid')
->setAutoincrement(false);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20170522120000
* Remove track_e_attempt.course_code which is deleted between 1.9 and 1.10
* but somehow still existed in the 1.10 entity (and it is not deleted from
* 1.10 to 1.11)
* @package Application\Migrations\Schema\V111
*/
class Version20170522120000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20170522120000');
$trackEAttempt = $schema->getTable('track_e_attempt');
if ($trackEAttempt->hasColumn('course_code')) {
$this->addSql("ALTER TABLE track_e_attempt DROP COLUMN course_code");
}
}
/**
* Down does not do anything in this case because the field shouldn't
* have been there in the first place
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

View File

@@ -0,0 +1,41 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20170608164500
*
* Fix c_quiz_question changing data type of type field to integer
*
* @package Application\Migrations\Schema\V111
*/
class Version20170608164500 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20170608164500');
$schema
->getTable('c_quiz_question')
->getColumn('type')
->setType(Type::getType(Type::INTEGER));
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema
->getTable('c_quiz_question')
->getColumn('type')
->setType(Type::getType(Type::BOOLEAN));
}
}

View File

@@ -0,0 +1,58 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20171213092400
*
* Fix some missing queries for migration from 1.10 to 1.11 (GH#2214)
* These are minor changes caused by the move from static SQL to ORM entities
*
* @package Application\Migrations\Schema\V111
*/
class Version20171213092400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20171213092400');
$table = $schema->getTable('extra_field_values');
$hasIndex = $table->hasIndex('idx_efv_fiii');
if (!$hasIndex) {
$this->addSql('CREATE INDEX idx_efv_fiii ON extra_field_values (field_id, item_id)');
}
$this->addSql('ALTER TABLE language CHANGE parent_id parent_id INT DEFAULT NULL');
$table = $schema->getTable('c_quiz_answer');
$hasIndex = $table->hasIndex('idx_cqa_q');
if (!$hasIndex) {
$this->addSql('CREATE INDEX idx_cqa_q ON c_quiz_answer (question_id)');
}
$this->addSql('ALTER TABLE c_quiz CHANGE start_time start_time DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE c_quiz CHANGE end_time end_time DATETIME DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$table = $schema->getTable('c_quiz_answer');
$hasIndex = $table->hasIndex('idx_cqa_q');
if ($hasIndex) {
$this->addSql('DROP INDEX idx_cqa_q ON c_quiz_answer');
}
$table = $schema->getTable('language');
$this->addSql('ALTER TABLE language CHANGE parent_id parent_id TINYINT DEFAULT NULL');
$table = $schema->getTable('extra_field_values');
$hasIndex = $table->hasIndex('idx_efv_fiii');
if ($hasIndex) {
$this->addSql('DROP INDEX idx_efv_fiii ON extra_field_values');
}
}
}

View File

@@ -0,0 +1,87 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20171227120000
*
* Fix more missing queries for migration from 1.10 to 1.11 (GH#2214)
* These are minor changes caused by the move from static SQL to ORM entities
*
* @package Application\Migrations\Schema\V111
*/
class Version20171227120000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
error_log('Version20171227120000');
$this->addSql('ALTER TABLE access_url CHANGE description description LONGTEXT NOT NULL');
$this->addSql('ALTER TABLE career CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE chat CHANGE sent sent DATETIME NOT NULL');
$this->addSql('ALTER TABLE course_category CHANGE auth_course_child auth_course_child VARCHAR(40) DEFAULT NULL');
$this->addSql('ALTER TABLE course_request CHANGE request_date request_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE extra_field CHANGE visible_to_self visible_to_self TINYINT DEFAULT NULL, CHANGE visible_to_others visible_to_others TINYINT DEFAULT NULL');
$this->addSql('ALTER TABLE gradebook_certificate CHANGE created_at created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE gradebook_evaluation CHANGE created_at created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE gradebook_link CHANGE created_at created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE gradebook_linkeval_log CHANGE created_at created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE gradebook_result CHANGE created_at created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE gradebook_result_log CHANGE created_at created_at DATETIME NOT NULL');
// Fails because of FK on id field
//$this->addSql('ALTER TABLE language CHANGE id id INT AUTO_INCREMENT NOT NULL');
$this->addSql('ALTER TABLE message CHANGE send_date send_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE promotion CHANGE status status INT NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE session CHANGE name name VARCHAR(150) NOT NULL');
$this->addSql('ALTER TABLE session_rel_user CHANGE registered_at registered_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE shared_survey CHANGE creation_date creation_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE skill CHANGE updated_at updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE skill_rel_user_comment CHANGE skill_rel_user_id skill_rel_user_id INT DEFAULT NULL, CHANGE feedback_giver_id feedback_giver_id INT DEFAULT NULL, CHANGE feedback_text feedback_text LONGTEXT NOT NULL, CHANGE feedback_value feedback_value INT DEFAULT 1, CHANGE feedback_datetime feedback_datetime DATETIME NOT NULL');
$this->addSql('ALTER TABLE sys_announcement CHANGE date_start date_start DATETIME NOT NULL, CHANGE date_end date_end DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_attempt_recording CHANGE insert_date insert_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_course_access CHANGE login_course_date login_course_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_downloads CHANGE down_date down_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_exercises CHANGE exe_date exe_date DATETIME NOT NULL, CHANGE start_date start_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_hotpotatoes CHANGE exe_date exe_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_item_property CHANGE lastedit_date lastedit_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_links CHANGE links_date links_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_online CHANGE login_date login_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_open CHANGE open_date open_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE track_e_uploads CHANGE upload_date upload_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE user CHANGE email_canonical email_canonical VARCHAR(100) NOT NULL, CHANGE credentials_expired credentials_expired TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE c_attendance_calendar CHANGE date_time date_time DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_blog CHANGE date_creation date_creation DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_blog_comment CHANGE date_creation date_creation DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_blog_post CHANGE date_creation date_creation DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_blog_task_rel_user CHANGE target_date target_date DATE NOT NULL');
$this->addSql('ALTER TABLE c_chat_connected CHANGE last_connection last_connection DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_dropbox_feedback CHANGE feedback_date feedback_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_dropbox_file CHANGE upload_date upload_date DATETIME NOT NULL, CHANGE last_upload_date last_upload_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_dropbox_post CHANGE feedback_date feedback_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_item_property CHANGE visibility visibility INT NOT NULL');
$this->addSql('ALTER TABLE c_lp CHANGE created_on created_on DATETIME NOT NULL, CHANGE modified_on modified_on DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_notebook CHANGE creation_date creation_date DATETIME NOT NULL, CHANGE update_date update_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_online_connected CHANGE last_connection last_connection DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_quiz CHANGE hide_question_title hide_question_title TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE c_quiz_rel_category CHANGE category_id category_id INT DEFAULT NULL, CHANGE count_questions count_questions INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_survey CHANGE creation_date creation_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_survey_invitation CHANGE invitation_date invitation_date DATETIME NOT NULL, CHANGE reminder_date reminder_date DATETIME NOT NULL');
$this->addSql('ALTER TABLE c_wiki_discuss CHANGE dtime dtime DATETIME NOT NULL');
$this->addSql('ALTER TABLE skill_level CHANGE profile_id profile_id INT DEFAULT NULL, CHANGE position position INT NOT NULL, CHANGE short_name short_name VARCHAR(255) NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// No need to revert those database changes as they are minor.
// There would be no real use to that
}
}

View File

@@ -0,0 +1,27 @@
{
"name": "MathJax",
"main": "./MathJax.js",
"homepage": "http://www.mathjax.org/",
"ignore": [
"**/.*",
"node_modules",
"components"
],
"keywords": [
"math",
"js",
"LaTeX",
"MathML",
"AsciiMath"
],
"version": "2.7.8",
"_release": "2.7.8",
"_resolution": {
"type": "version",
"tag": "2.7.8",
"commit": "85e47d7801b2dea6c15878ac7b3dcf62cfd659b5"
},
"_source": "https://github.com/mathjax/MathJax.git",
"_target": "2.7.*",
"_originalSource": "MathJax"
}

View File

@@ -0,0 +1,286 @@
# Contributing to MathJax
You are interested in giving us a hand? That's awesome! We've put
together some brief guidelines that should help you get started
quickly and easily.
There are lots and lots of ways to get involved, this document covers:
* [reporting an issue](#reporting-an-issue)
* [bug reports](#bug-reports)
* [feature requests](#feature-requests)
* [change requests](#change-requests)
* [working on MathJax core](#working-on-mathjax-core)
* [key branches and tags](#key-branches--tags)
* [submitting pull requests](#submitting-pull-requests)
* [testing and quality assurance](#testing-and-quality-assurance)
* [writing documentation](#writing-documentation)
* [translation](#translation)
* [Conduct](#conduct)
## Reporting An Issue
If you're about to raise an issue because you think you've found a
problem with MathJax, or you'd like to make a request for a new
feature in the codebase, or any other reason… please read this first.
The GitHub issue tracker is the preferred channel for [bug reports](#bug-reports),
[feature requests](#feature-requests), [change requests](#change-requests) and [submitting pull
requests](#submitting-pull-requests), but please respect the following restrictions:
* Please **search for existing issues**. Help us keep duplicate issues
to a minimum by checking to see if someone has already reported your
problem or requested your idea.
* Please **do not** use the issue tracker for personal support
requests (use [the MathJax User Group](https://groups.google.com/forum/#!forum/mathjax-users)).
* Please **be civil**. Keep the discussion on topic and respect the
opinions of others. See also our [Conduct Guidelines](#conduct)
### Bug Reports
A bug is a _demonstrable problem_ that is caused by the code in the repository.
Good bug reports are extremely helpful - thank you!
Guidelines for bug reports:
1. **Use the GitHub issue search** &mdash; check if the issue has already been
reported.
2. **Check if the issue has been fixed** &mdash; look for [closed
issues in the current
milestone](https://github.com/MathJax/MathJax/issues?&page=1&state=closed)
or try to reproduce it using the latest `develop` branch. Please
note that we only pack MathJax for releases, so on the `develop`
branch you have to use `/unpacked/MathJax.js` etc. to test.
3. **Share a live sample of the problem** &mdash; without a live page
it is usually impossible to debug problems; see also the Bug Report
Template below.
4. **Isolate the problem** &mdash; a live sample is a starting point
but if you want to speed things up create a [reduced test
case](http://css-tricks.com/6263-reduced-test-cases/). Be specific
about your setup (browser, OS versions etc). Use services like
[jsbin](http://jsbin.com), [CodePen](http://codepen.io),
[JSfiddle](http://jsfiddle.com) to make collaboration on minimal
test cases easier for everyone. Use the unpacked copy of MathJax
(`[...]/unpacked/MathJax.js` etc.) for better debugging.
5. **Include a screenshot/cast as a last resort** &mdash; Is your
issue about a layout or design feature / bug but hard to reproduce
or isolate? Then please provide a screenshot or screencast. Tools
like [LICEcap](http://www.cockos.com/licecap/) or
[SauceLabs](http://www.saucelabs.com) allow you to quickly and
easily record a screencasts. Make it an animated gif, embed it
directly into your GitHub issue -- kapow!
6. Use the Bug Report template below or [click this
link](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)
to start creating a bug report with the template automatically.
A good bug report shouldn't leave others needing to chase you up for
more information. Be sure to include the details of your environment.
Here is a [real example](https://github.com/mathjax/MathJax/issues/820)
Template Example ([click to use](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)):
```
Short and descriptive example bug report title
### Issue Summary
A summary of the issue and the browser/OS environment in which it occurs. If
suitable, include the steps required to reproduce the bug.
### Steps to Reproduce
1. This is the first step
2. This is the second step
3. Further steps, etc.
Any other information you want to share that is relevant to the issue
being reported. Especially, why do you consider this to be a bug? What
do you expect to happen instead?
### Technical details:
* MathJax Version: 2.3 (latest commit: f3aaf3a2a3e964df2770dc4aaaa9c87ce5f47e2c)
* Client OS: Mac OS X 10.8.4
* Browser: Chrome 29.0.1547.57
```
### Feature Requests
Feature requests are welcome. Before you submit one be sure to have:
1. Read the
[Roadmaps](https://github.com/mathjax/MathJax/wiki/Mathjax-roadmap),
**use the GitHub search** and check the feature hasn't already been
requested.
2. Take a moment to think about whether your idea fits with the scope
and aims of the project, or if it might better fit being a [custom
extension](https://github.com/mathjax/MathJax-third-party-extensions).
3. Remember, it's up to *you* to make a strong case to convince the
project's leaders of the merits of this feature. Please provide as
much detail and context as possible, this means explaining the use
case and why it is likely to be common.
4. Clearly indicate whether this is a feature request for MathJax
core, input & output jax, or extensions.
### Change Requests
Change requests cover both architectural and functional changes to how
MathJax works. If you have an idea for a new or different dependency,
a refactor, or an improvement to a feature, etc - please be sure to:
1. **Use the GitHub search** and check someone else didn't get there first
2. Take a moment to think about the best way to make a case for, and
explain what you're thinking. Are you sure this shouldn't really be
a [bug report](#bug-reports) or a [feature
request](#feature-requests)? Is it really one idea or is it many?
What's the context? What problem are you solving? Why is what you
are suggesting better than what's already there? Does it fit with
the Roadmap?
## Working on MathJax core
You want to contribute code? Fantastic! Let's get you started.
### Key Branches & Tags
To get it out of the way:
- **[develop](https://github.com/MathJax/MathJax/tree/develop)** is
the development branch. All work on the next release happens here so
you should generally branch off `develop`. Do **NOT** use this branch
for a production site.
- **[master](https://github.com/MathJax/MathJax)** contains the latest
release of MathJax. This branch may be used in production. Do
**NOT** use this branch to work on MathJax's source.
### Submitting Pull Requests
Pull requests are awesome. If you're looking to raise a PR for
something which doesn't have an open issue, please think carefully
about [raising an issue](#reporting-an-issue) which your PR can close,
especially if you're fixing a bug. This makes it more likely that
there will be enough information available for your PR to be properly
tested and merged.
##### Need Help?
If you're not completely clear on how to submit / update / *do* Pull
Requests, please check out our [source control
policies](https://github.com/mathjax/MathJax/wiki/Source-control-policies). For
more insights, chech the excellent in depth [Git Workflow
guide](https://github.com/TryGhost/Ghost/wiki/Git-Workflow) from
Ghost, in particular
* [Ghost Workflow guide: commit messages](https://github.com/TryGhost/Ghost/wiki/Git-workflow#commit-messages)
### Testing and Quality Assurance
Never underestimate just how useful quality assurance is. If you're
looking to get involved with the code base and don't know where to
start, checking out and testing a pull request is one of the most
useful things you could do.
If you want to get involved with testing MathJax, there is a set of QA
Documentation [in our testing
framework](https://github.com/MathJax/MathJax-test).
Essentially though, [check out the latest develop
branch](#working-on-mathJax-core), take it for a spin, and if you find
anything odd, please follow the [bug report guidelines](#bug-reports)
and let us know!
#### Checking out a Pull Request
These are some [excellent
instructions](https://gist.github.com/piscisaureus/3342247) on
configuring your GitHub repository to allow you to checkout pull
requests in the same way as branches:
<https://gist.github.com/piscisaureus/3342247>.
### Writing documentation
MathJax's main documentation can be found at [docs.mathjax.org](http://docs.mathjax.org).
The source of the docs is hosted in the
[mathjax/mathjax-docs](http://github.com/mathjax/mathjax-docs) repo here on GitHub.
The documentation is generated using [Sphinx-doc](http://sphinx-doc.org/) and hosted on
[Read the docs](http://readthedocs.org).
You can clone the repo and submit pull requests following the
[pull-request](#submitting-pull-requests) guidelines.
### Translation
If you wish to add or update translations of MathJax, please do it on
[TranslateWiki.net](https://translatewiki.net/w/i.php?title=Special:Translate&group=out-mathjax-0-all)
(and while you're there you can help other open source projects,
too, because you're awesome!).
For bug reports and other questions that don't fit on
TranslateWiki.net, head over to the
[mathjax/mathjax-i18n](https://github.com/mathjax/MathJax-i18n)
repository.
## Conduct
As a NumFOCUS fiscally sponsored project, MathJax is governed by the
[NumFOCUS code of conduct](https://numfocus.org/code-of-conduct),
which we summarize as follows:
We are committed to providing a friendly, safe and welcoming environment for
all, regardless of gender, sexual orientation, disability, ethnicity, religion,
or similar personal characteristic.
Please be kind and courteous. There's no need to be mean or rude.
Respect that people have differences of opinion and that every design or
implementation choice carries a trade-off and numerous costs. There is seldom
a right answer, merely an optimal answer given a set of values and
circumstances.
Please keep unstructured critique to a minimum. If you have solid ideas you
want to experiment with, make a fork and see how it works.
We will exclude you from interaction if you insult, demean or harass
anyone. That is not welcome behaviour. We interpret the term
"harassment" as including the definition in the [Unacceptable
Behavior](https://numfocus.org/code-of-conduct#unacceptable-behavior)
section of the [NumFOCUS code of
conduct](https://numfocus.org/code-of-conduct); if you have any lack
of clarity about what might be included in that concept, please read
that definition. In particular, we don't tolerate behavior that
excludes people in socially marginalized groups.
Private harassment is also unacceptable. No matter who you are, if you
feel you have been or are being harassed or made uncomfortable by a
community member, please contact one of the channel ops or any of the
[MathJax](https://github.com/MathJax/MathJax) core team
immediately. Whether you're a regular contributor or a newcomer, we
care about making this community a safe place for you and we've got
your back.
Likewise any spamming, trolling, flaming, baiting or other attention-stealing
behaviour is not welcome.
We also recommend that you read [discourse's
rules](http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/)
for further suggestions on appropriate behavior.
## References
* We heavily borrowed from Mozilla and Ghost -- thank you!
* https://github.com/TryGhost/Ghost/blob/master/CONTRIBUTING.md
* https://github.com/mozilla/rust/wiki/Note-development-policy
* https://github.com/jden/CONTRIBUTING.md/blob/master/CONTRIBUTING.md
* http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
# MathJax <img alt="GitHub package.json version (branch)" src="https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg">
## Beautiful math in all browsers
MathJax is an open-source JavaScript display engine for LaTeX, MathML, and
AsciiMath notation that works in all modern browsers. It was designed with
the goal of consolidating the recent advances in web technologies into a
single, definitive, math-on-the-web platform supporting the major browsers
and operating systems. It requires no setup on the part of the user (no
plugins to download or software to install), so the page author can write
web documents that include mathematics and be confident that users will be
able to view it naturally and easily. Simply include MathJax and some
mathematics in a web page, and MathJax does the rest.
Some of the main features of MathJax include:
- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages
- Supported in most browsers with no plug-ins, extra fonts, or special
setup for the reader
- Easy for authors, flexible for publishers, extensible for developers
- Supports math accessibility, cut-and-paste interoperability, and other
advanced functionality
- Powerful API for integration with other web applications
See <http://www.mathjax.org/> for additional details.
## Installation and Usage
The MathJax installation and usage documentation is available in a
separate GitHub repository at <https://github.com/mathjax/mathjax-docs>.
The HTML versions can now be viewed at <http://docs.mathjax.org/>,
where it is possible for you to submit corrections and modifications
directly to the documentation on line.
## Community
The main MathJax website is <http://www.mathjax.org>, and it includes
announcements and other important information. MathJax is maintained and
distributed on GitHub at <http://github.com/mathjax/MathJax>. A user forum
for asking questions and getting assistance is hosted at Google, and the
bug tracker is hosted at GitHub:
Bug tracker: <https://github.com/mathjax/MathJax/issues>
MathJax-Users Group: <http://groups.google.com/group/mathjax-users>
Before reporting a bug, please check that it has not already been reported.
Also, please use the bug tracker for reporting bugs rather than the help forum.

View File

@@ -0,0 +1,11 @@
{
"name": "MathJax",
"main": "./MathJax.js",
"homepage": "http://www.mathjax.org/",
"ignore": [
"**/.*",
"node_modules",
"components"
],
"keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"]
}

View File

@@ -0,0 +1,14 @@
{
"name": "mathjax/mathjax",
"type": "library",
"description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.",
"keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"],
"homepage": "http://www.mathjax.org/",
"license": "Apache-2.0",
"authors": [
{
"name": "MathJax Consortium",
"homepage": "https://github.com/mathjax"
}
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More