Merge remote-tracking branch 'origin/master'

pull/5641/head
Angel Fernando Quiroz Campos 1 year ago
commit 95625a93a8
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 1
      assets/vue/store/messageRelUserStore.js
  2. 12
      assets/vue/views/message/MessageList.vue
  3. 2
      public/documentation/index.html
  4. 0
      public/documentation/installation_guide.html
  5. 2
      src/CoreBundle/Controller/Admin/IndexBlocksController.php
  6. 18
      src/CoreBundle/Migrations/AbstractMigrationChamilo.php
  7. 106
      src/CoreBundle/Migrations/Schema/V200/PriorityMigrationHelper.php
  8. 23
      src/CoreBundle/Migrations/Schema/V200/Version20.php
  9. 23
      src/CoreBundle/Migrations/Schema/V200/Version20170523100000.php
  10. 2
      src/CoreBundle/Migrations/Schema/V200/Version20230720143000.php
  11. 42
      src/CoreBundle/Migrations/Schema/V200/Version20240704120400.php

@ -18,6 +18,7 @@ export const useMessageRelUserStore = defineStore("messageRelUser", {
"receivers.receiver": securityStore.user["@id"],
itemsPerPage: 1,
msgType: MESSAGE_TYPE_INBOX,
status: 0,
}
const response = await messageService.countUnreadMessages(params)

@ -80,7 +80,7 @@
:rows="initialRowsPerPage"
:rows-per-page-options="[10, 20, 50]"
:total-records="totalItems"
:value="filteredItems"
:value="items"
current-page-report-template="{first} to {last} of {totalRecords}"
data-key="@id"
lazy
@ -90,8 +90,8 @@
sort-field="sendDate"
:sort-order="-1"
striped-rows
@page="onPage($event)"
@sort="sortingChanged($event)"
@page="onPage"
@sort="sortingChanged"
>
<template #header>
<form
@ -330,10 +330,6 @@ const rowClass = (data) => {
let fetchPayload = {}
const filteredItems = computed(() => {
return items.value.filter((item) => item.status !== MESSAGE_STATUS_DELETED)
})
function loadMessages(reset = true) {
if (reset) {
store.dispatch("message/resetList")
@ -341,6 +337,7 @@ function loadMessages(reset = true) {
}
fetchPayload.msgType = MESSAGE_TYPE_INBOX
fetchPayload.status = 0
if (selectedTag.value) {
fetchPayload["receivers.tags.tag"] = selectedTag.value.tag
@ -464,6 +461,7 @@ async function deleteMessage(message) {
}
}
notification.showSuccessNotification(t("Message deleted"))
await messageRelUserStore.findUnreadCount()
loadMessages()
} catch (e) {
notification.showErrorNotification(t("Error deleting message"))

@ -33,7 +33,7 @@
<h1>Chamilo 2.x - Documentation</h1>
<ul>
<li>
<a href="installation.html">Installation guide (EN)</a>
<a href="installation_guide.html">Installation guide (EN)</a>
</li>
<li>
<a href="https://docs.chamilo.org/">Manuals for teachers, admins and developers (several languages available through menu)</a>

@ -675,7 +675,7 @@ class IndexBlocksController extends BaseController
];
$items[] = [
'class' => 'item-installation-guide',
'url' => $this->generateUrl('legacy_main', ['name' => '../documentation/installation.html']),
'url' => $this->generateUrl('legacy_main', ['name' => '../documentation/installation_guide.html']),
'label' => $this->translator->trans('Installation guide'),
];
$items[] = [

@ -22,8 +22,10 @@ use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use DateTime;
use DateTimeZone;
use Doctrine\DBAL\Connection;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -35,6 +37,22 @@ abstract class AbstractMigrationChamilo extends AbstractMigration
protected ?EntityManagerInterface $entityManager = null;
protected ?ContainerInterface $container = null;
private LoggerInterface $logger;
/**
* Constructor
*/
public function __construct(Connection $connection, LoggerInterface $logger)
{
parent::__construct($connection, $logger);
$this->logger = $logger;
}
protected function getLogger(): LoggerInterface
{
return $this->logger;
}
public function setEntityManager(EntityManagerInterface $entityManager): void
{
$this->entityManager = $entityManager;

@ -0,0 +1,106 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Connection;
use Psr\Log\LoggerInterface;
/**
* Priority migrations are database changes that *need* to happen before anything else
* because the related Entities in the code used for the migration already use
* the new structure (entities cannot be changed on the fly).
* An instance of this class is called at the beginning of any migration process.
*/
class PriorityMigrationHelper
{
private Connection $connection;
private LoggerInterface $logger;
/**
* Constructor
*/
public function __construct(Connection $connection, LoggerInterface $logger)
{
$this->connection = $connection;
$this->logger = $logger;
}
public function executeUp(Schema $schema): void
{
$this->logger->info('Executing PriorityMigrationHelper up method.');
$this->renameSettingsTableUp();
$this->addDurationFields($schema);
}
public function executeDown(Schema $schema): void
{
$this->logger->info('Executing PriorityMigrationHelper down method.');
$this->renameSettingsTableDown();
$this->removeDurationFields($schema);
}
private function addDurationFields(Schema $schema): void
{
$tables = [
'course',
'c_survey',
'c_quiz',
'c_quiz_question',
'c_lp',
'c_lp_item',
'c_student_publication',
'c_attendance_calendar'
];
foreach ($tables as $tableName) {
$table = $schema->getTable($tableName);
if (!$table->hasColumn('duration')) {
$this->connection->executeQuery("ALTER TABLE $tableName ADD duration INT DEFAULT NULL");
}
}
}
private function removeDurationFields(Schema $schema): void
{
$tables = [
'course',
'c_survey',
'c_quiz',
'c_quiz_question',
'c_lp',
'c_lp_item',
'c_student_publication',
'c_attendance_calendar'
];
foreach ($tables as $tableName) {
$table = $schema->getTable($tableName);
if ($table->hasColumn('duration')) {
$this->connection->executeQuery("ALTER TABLE $tableName DROP COLUMN duration");
}
}
}
private function renameSettingsTableUp(): void
{
$schemaManager = $this->connection->createSchemaManager();
if ($schemaManager->tablesExist(['settings_current']) && !$schemaManager->tablesExist(['settings'])) {
$this->connection->executeQuery('RENAME TABLE settings_current TO settings');
}
}
private function renameSettingsTableDown(): void
{
$schemaManager = $this->connection->createSchemaManager();
if ($schemaManager->tablesExist(['settings']) && !$schemaManager->tablesExist(['settings_current'])) {
$this->connection->executeQuery('RENAME TABLE settings TO settings_current');
}
}
}

@ -9,12 +9,22 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\DataFixtures\LanguageFixtures;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Connection;
use Psr\Log\LoggerInterface;
/**
* Migrate file to updated to Chamilo 2.0.
*/
class Version20 extends AbstractMigrationChamilo
{
private PriorityMigrationHelper $priorityMigrationHelper;
public function __construct(Connection $connection, LoggerInterface $logger)
{
parent::__construct($connection, $logger);
$this->priorityMigrationHelper = new PriorityMigrationHelper($connection, $logger);
}
public function getDescription(): string
{
return 'Basic changes';
@ -22,6 +32,8 @@ class Version20 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$this->priorityMigrationHelper->executeUp($schema);
$this->addSql('set sql_mode=""');
// Optimize bulk operations - see https://dev.mysql.com/doc/refman/5.6/en//optimizing-innodb-bulk-data-loading.html
// $this->addSql('set autocommit=0');
@ -131,8 +143,8 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('UPDATE ticket_message SET subject = "Ticket #"+ id WHERE subject IS NULL');
$this->addSql('ALTER TABLE ticket_message CHANGE subject subject VARCHAR(255) NOT NULL');
$this->addSql('UPDATE settings_current SET variable = "No name" WHERE variable IS NULL');
$this->addSql('ALTER TABLE settings_current CHANGE variable variable VARCHAR(190) NOT NULL;');
$this->addSql('UPDATE settings SET variable = "No name" WHERE variable IS NULL');
$this->addSql('ALTER TABLE settings CHANGE variable variable VARCHAR(190) NOT NULL;');
// Global tool.
if (false === $schema->hasTable('tool')) {
@ -203,7 +215,7 @@ class Version20 extends AbstractMigrationChamilo
");
$this->addSql("
UPDATE settings_current
UPDATE settings
SET selected_value = COALESCE((
SELECT isocode
FROM language
@ -579,5 +591,8 @@ class Version20 extends AbstractMigrationChamilo
}
}
public function down(Schema $schema): void {}
public function down(Schema $schema): void
{
$this->priorityMigrationHelper->executeDown($schema);
}
}

@ -1,23 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
class Version20170523100000 extends AbstractMigrationChamilo
{
public function up(Schema $schema): void
{
$this->addSql('RENAME TABLE settings_current TO settings');
}
public function down(Schema $schema): void
{
$this->addSql('RENAME TABLE settings TO settings_current');
}
}

@ -34,7 +34,7 @@ final class Version20230720143000 extends AbstractMigrationChamilo
$path = "users/{$id}/";
$variable = 'split_users_upload_directory';
// Query the 'selected_value' from the 'settings_current' table where the 'variable' is 'split_users_upload_directory'
// Query the 'selected_value' from the 'settings' table where the 'variable' is 'split_users_upload_directory'
$query = $this->entityManager->createQuery('SELECT s.selectedValue FROM Chamilo\CoreBundle\Entity\SettingsCurrent s WHERE s.variable = :variable')
->setParameter('variable', $variable)
;

@ -1,42 +0,0 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
final class Version20240704120400 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Add duration field to multiple tables';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE course ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_survey ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_quiz ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_quiz_question ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_lp ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_lp_item ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_student_publication ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_attendance_calendar ADD duration INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE course DROP duration');
$this->addSql('ALTER TABLE c_survey DROP duration');
$this->addSql('ALTER TABLE c_quiz DROP duration');
$this->addSql('ALTER TABLE c_quiz_question DROP duration');
$this->addSql('ALTER TABLE c_lp DROP duration');
$this->addSql('ALTER TABLE c_lp_item DROP duration');
$this->addSql('ALTER TABLE c_student_publication DROP duration');
$this->addSql('ALTER TABLE c_attendance_calendar DROP duration');
}
}
Loading…
Cancel
Save