Skip to content

Commit 43603d6

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents af837b2 + 7e5caa9 commit 43603d6

File tree

3 files changed

+62
-23
lines changed

3 files changed

+62
-23
lines changed

src/CoreBundle/Migrations/AbstractMigrationChamilo.php

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -439,19 +439,60 @@ protected function getUpdateRootPath(): string
439439
return $this->container->getParameter('kernel.project_dir');
440440
}
441441

442-
protected function getPluginDirectoryList(): array
442+
protected static function pluginNameReplacements(): array
443443
{
444-
$pluginDir = $this->container->getParameter('kernel.project_dir').'/public/plugin';
445-
446-
$finder = new Finder();
447-
$finder->directories()->in($pluginDir)->depth('== 0');
448-
449-
$directories = [];
450-
451-
foreach ($finder as $entry) {
452-
$directories[] = $entry->getFilename();
453-
}
454-
455-
return $directories;
444+
return [
445+
'bbb' => 'Bbb',
446+
'before_login' => 'BeforeLogin',
447+
'buycourses' => 'BuyCourses',
448+
'card_game' => 'CardGame',
449+
'check_extra_field_author_company' => 'CheckExtraFieldAuthorCompany',
450+
'cleandeletedfiles' => 'CleanDeletedFiles',
451+
'courseblock' => 'CourseBlock',
452+
'coursehomenotify' => 'CourseHomeNotify',
453+
'courselegal' => 'CourseLegal',
454+
'customcertificate' => 'CustomCertificate',
455+
'customfooter' => 'CustomFooter',
456+
'dashboard' => 'Dashboard',
457+
'dictionary' => 'Dictionary',
458+
'embedregistry' => 'EmbedRegistry',
459+
'exercise_signature' => 'ExerciseSignature',
460+
'ext_auth_chamilo_logout_button_behaviour' => 'ExtAuthChamiloLogoutButtonBehaviour',
461+
'externalnotificationconnect' => 'ExternalNotificationConnect',
462+
'extramenufromwebservice' => 'ExtraMenuFromWebservice',
463+
'google_maps' => 'GoogleMaps',
464+
'grading_electronic' => 'GradingElectronic',
465+
'h5pimport' => 'H5pImport',
466+
'hello_world' => 'HelloWorld',
467+
'ims_lti' => 'ImsLti',
468+
'justification' => 'Justification',
469+
'learning_calendar' => 'LearningCalendar',
470+
'lti_provider' => 'LtiProvider',
471+
'maintenancemode' => 'MaintenanceMode',
472+
'migrationmoodle' => 'MigrationMoodle',
473+
'nosearchindex' => 'NoSearchIndex',
474+
'notebookteacher' => 'NotebookTeacher',
475+
'onlyoffice' => 'Onlyoffice',
476+
'pausetraining' => 'PauseTraining',
477+
'pens' => 'Pens',
478+
'positioning' => 'Positioning',
479+
'questionoptionsevaluation' => 'QuestionOptionsEvaluation',
480+
'redirection' => 'Redirection',
481+
'resubscription' => 'Resubscription',
482+
'rss' => 'Rss',
483+
'search_course' => 'SearchCourse',
484+
'show_regions' => 'ShowRegions',
485+
'show_user_info' => 'ShowUserInfo',
486+
'static' => 'Static',
487+
'studentfollowup' => 'StudentFollowUp',
488+
'surveyexportcsv' => 'SurveyExportCsv',
489+
'surveyexporttxt' => 'SurveyExportTxt',
490+
'test2pdf' => 'Test2Pdf',
491+
'toplinks' => 'TopLinks',
492+
'tour' => 'Tour',
493+
'userremoteservice' => 'UserRemoteService',
494+
'xapi' => 'XApi',
495+
'zoom' => 'Zoom',
496+
];
456497
}
457498
}

src/CoreBundle/Migrations/Schema/V200/Version20250306101000.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@ public function getDescription(): string
2222

2323
public function up(Schema $schema): void
2424
{
25-
$directories = $this->getPluginDirectoryList();
25+
$replacements = self::pluginNameReplacements();
2626

2727
foreach ($this->getPluginTitles() as $pluginTitle) {
2828
if (\is_array($pluginTitle) && isset($pluginTitle['title'])) {
2929
$pluginTitle = (string) $pluginTitle['title'];
3030
}
3131

32-
$pluginTitle = str_replace(' ', '', ucwords(str_replace('_', ' ', $pluginTitle)));
33-
34-
if (!\in_array($pluginTitle, $directories)) {
32+
if (!array_key_exists($pluginTitle, $replacements)) {
3533
continue;
3634
}
3735

38-
$pluginId = $this->insertPlugin($pluginTitle);
36+
$pluginId = $this->insertPlugin($replacements[$pluginTitle]);
3937

4038
$settingsByUrl = $this->getPluginSettingsByUrl($pluginTitle);
4139

src/CoreBundle/Migrations/Schema/V200/Version20251009111300.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ public function getDescription(): string
2323
*/
2424
public function up(Schema $schema): void
2525
{
26-
$directories = $this->getPluginDirectoryList();
26+
$replacements = self::pluginNameReplacements();
2727
$idListToDelete = [];
2828

2929
$pluginRows = $this->connection->executeQuery("SELECT id, title, source FROM plugin")->fetchAllAssociative();
3030

3131
foreach ($pluginRows as $pluginRow) {
32-
$title = str_replace(' ', '', ucwords(str_replace('_', ' ', $pluginRow['title'])));
32+
$title = $pluginRow['title'];
3333

34-
if (!\in_array($title, $directories)) {
34+
if (!array_key_exists($title, $replacements)) {
3535
$idListToDelete[] = $pluginRow['id'];
3636

3737
continue;
3838
}
3939

40-
$source = \in_array($title, AppPlugin::getOfficialPlugins())
40+
$source = \in_array($replacements[$title], AppPlugin::getOfficialPlugins())
4141
? Plugin::SOURCE_OFFICIAL
4242
: Plugin::SOURCE_THIRD_PARTY;
4343

4444
$this->connection->update(
4545
'plugin',
4646
[
47-
'title' => $title,
47+
'title' => $replacements[$title],
4848
'source' => $source,
4949
],
5050
['id' => $pluginRow['id']]

0 commit comments

Comments
 (0)