Skip to content

Commit ca27a79

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents 59810d7 + bb56458 commit ca27a79

6 files changed

Lines changed: 51 additions & 12 deletions

File tree

.env.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}'
8282
# AZURE_STORAGE_RESOURCE_CACHE_PREFIX='optional/prefix'
8383
# AZURE_STORAGE_THEMES_CONTAINER='themes-container-name'
8484
# AZURE_STORAGE_THEMES_PREFIX='optional/prefix'
85+
# AZURE_STORAGE_PLUGINS_CONTAINER='plugins-container-name'
86+
# AZURE_STORAGE_PLUGINS_PREFIX='optional/prefix'
8587
###< azure blob storage as filesystem ###
8688

8789
###> aws s3 storage as filesystem ###
@@ -99,6 +101,8 @@ ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}'
99101
# AWS_S3_STORAGE_RESOURCE_CACHE_PREFIX='path/prefix' # Optional path prefix, you can set empty string
100102
# AWS_S3_STORAGE_THEMES_BUCKET='themes-bucket-name'
101103
# AWS_S3_STORAGE_THEMES_PREFIX='path/prefix' # Optional path prefix, you can set empty string
104+
# AWS_S3_STORAGE_PLUGINS_BUCKET='plugins-bucket-name'
105+
# AWS_S3_STORAGE_PLUGINS_PREFIX='path/prefix' # Optional path prefix, you can set empty string
102106
###< aws s3 storage as filesystem ###
103107

104108
###> google cloud storage as filesystem ###
@@ -114,6 +118,8 @@ ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}'
114118
# GOOGLE_STORAGE_RESOURCE_CACHE_PREFIX=''
115119
# GOOGLE_STORAGE_THEMES_BUCKET='themes-bucket-name'
116120
# GOOGLE_STORAGE_THEMES_PREFIX=''
121+
# GOOGLE_STORAGE_PLUGINS_BUCKET='plugins-bucket-name'
122+
# GOOGLE_STORAGE_PLUGINS_PREFIX=''
117123
###< google cloud storage as filesystem ###
118124

119125
###> SCIM (System for Cross-domain Identity Management) ###

config/packages/oneup_flysystem.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,29 @@ oneup_flysystem:
113113
bucket: '%env(GOOGLE_STORAGE_THEMES_BUCKET)%'
114114
prefix: '%env(GOOGLE_STORAGE_THEMES_PREFIX)%'
115115

116+
plugins_adapter:
117+
local:
118+
location: '%kernel.project_dir%/var/upload/plugins'
119+
120+
plugins_azure_adapter:
121+
azureblob:
122+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
123+
container: '%env(AZURE_STORAGE_PLUGINS_CONTAINER)%'
124+
prefix: '%env(AZURE_STORAGE_PLUGINS_PREFIX)%'
125+
126+
plugins_awss3_adapter:
127+
awss3v3:
128+
client: chamilo.storage.awss3_client
129+
bucket: '%env(AWS_S3_STORAGE_PLUGINS_BUCKET)%'
130+
prefix: '%env(AWS_S3_STORAGE_PLUGINS_PREFIX)%'
131+
visibilityConverter: League\Flysystem\AwsS3V3\PortableVisibilityConverter
132+
133+
plugins_google_adapter:
134+
googlecloudstorage:
135+
client: 'Google\Cloud\Storage\StorageClient'
136+
bucket: '%env(GOOGLE_STORAGE_PLUGINS_BUCKET)%'
137+
prefix: '%env(GOOGLE_STORAGE_PLUGINS_PREFIX)%'
138+
116139
filesystems:
117140
asset:
118141
adapter: asset_adapter
@@ -133,3 +156,8 @@ oneup_flysystem:
133156
themes:
134157
adapter: themes_adapter
135158
mount: themes
159+
160+
plugins:
161+
adapter: plugins_adapter
162+
mount: plugins
163+
visibility: private

public/plugin/ExerciseFocused/src/ExerciseFocusedPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ public function install(): void
6969
$objField = new ExtraField('exercise');
7070
$objField->save([
7171
'variable' => self::FIELD_SELECTED,
72-
'field_type' => ExtraField::FIELD_TYPE_CHECKBOX,
72+
'value_type' => ExtraField::FIELD_TYPE_CHECKBOX,
7373
'display_text' => $this->get_title(),
7474
'visible_to_self' => true,
7575
'changeable' => true,
76-
'filter' => false,
76+
'filter' => 0,
7777
]);
7878
}
7979

public/plugin/ExerciseMonitoring/src/ExerciseMonitoringPlugin.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
/* For licensing terms, see /license.txt */
44

5+
use Chamilo\CoreBundle\Framework\Container;
56
use Chamilo\PluginBundle\ExerciseMonitoring\Entity\Log;
67
use Doctrine\ORM\Tools\SchemaTool;
78
use Doctrine\ORM\Tools\ToolsException;
8-
use Symfony\Component\Filesystem\Filesystem;
9+
use League\Flysystem\FilesystemOperator;
910

1011
class ExerciseMonitoringPlugin extends Plugin
1112
{
@@ -70,22 +71,21 @@ public function install(): void
7071
]
7172
);
7273

73-
$pluginDirName = api_get_path(SYS_UPLOAD_PATH).'plugins/ExerciseMonitoring';
74+
/** @var FilesystemOperator $fs */
75+
$fs = Container::$container->get('oneup_flysystem.plugins_filesystem');
7476

75-
$fs = new Filesystem();
76-
$fs->mkdir(
77-
$pluginDirName,
78-
api_get_permissions_for_new_directories()
79-
);
77+
if (!$fs->directoryExists('ExerciseMonitoring')) {
78+
$fs->createDirectory('ExerciseMonitoring');
79+
}
8080

8181
$objField = new ExtraField('exercise');
8282
$objField->save([
8383
'variable' => self::FIELD_SELECTED,
84-
'field_type' => ExtraField::FIELD_TYPE_CHECKBOX,
84+
'value_type' => ExtraField::FIELD_TYPE_CHECKBOX,
8585
'display_text' => $this->get_title(),
8686
'visible_to_self' => true,
8787
'changeable' => true,
88-
'filter' => false,
88+
'filter' => 0,
8989
]);
9090
}
9191

src/CoreBundle/DependencyInjection/Compiler/PluginEntityPass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function process(ContainerBuilder $container): void
2323

2424
foreach ($entityDirs as $dir) {
2525
$pluginTitle = basename(\dirname($dir));
26+
27+
if ('src' === $pluginTitle) {
28+
$pluginTitle = basename(\dirname($dir, 2));
29+
}
30+
2631
$namespace = "Chamilo\\PluginBundle\\$pluginTitle";
2732

2833
$driverReference = new Reference('doctrine.orm.default_attribute_metadata_driver');

src/CoreBundle/Helpers/PluginEntityLoaderHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(
1717
public function getEntityDirectories(): array
1818
{
1919
$finder = new Finder();
20-
$finder->directories()->in($this->pluginDir)->name('Entity')->depth('== 1');
20+
$finder->directories()->in($this->pluginDir)->name('Entity')->depth('<= 2');
2121

2222
$directories = [];
2323
foreach ($finder as $dir) {

0 commit comments

Comments
 (0)