34 $reader = @new \Eloquent\Composer\Configuration\ConfigurationReader;
35 $this->configuration = $reader->read($this->plugin->getPath() .
'composer.json');
36 }
catch (\Exception $e) {
38 $this->plugin->getID(),
60 if ($this->configuration->projectName() !== $this->plugin->getID()) {
71 $license = $this->configuration->license();
72 if (!empty($license)) {
73 $license =
implode(
', ', $license);
76 return (
string) $license;
85 $cats = $this->configuration->keywords() ?: [];
88 foreach ($cats as $cat) {
97 $vendor = strtolower((
string) $this->configuration->vendorName());
111 $conflicts = $this->configuration->conflict();
115 list(,$projectname) = explode(
'/',
$name);
116 if (!empty($projectname)) {
132 if (empty($conflicts)) {
136 if (isset($conflicts[
'elgg'])) {
141 unset($conflicts[
'elgg']);
144 foreach ($conflicts as
$plugin_id => $constraints) {
152 throw new ConflictException(
"Plugin [{$plugin->getID()}] with version: {$plugin->getVersion()} conflicts with constraint {$constraints}");
165 foreach ($active_plugins as
$plugin) {
166 $conflicts = $plugin->getConflicts();
167 if (!isset($conflicts[$this->plugin->getID()])) {
171 $constraint = $conflicts[$this->plugin->getID()];
173 $msg =
'The plugin ' . $this->plugin->getDisplayName() .
' with version ' . $this->plugin->getVersion();
174 $msg .=
' conflicts with constraint '. $constraint .
' defined in ' . $plugin->getID();
190 return Semver::satisfies(
$version, $constraints);
193 elgg_log($e, \Psr\Log\LogLevel::ERROR);
206 $requirements = $this->configuration->dependencies();
207 if (!isset($requirements[
'php'])) {
211 $php_version = phpversion();
213 throw new PhpVersionException(
"The PHP version ({$php_version}) does not meet the plugin [{$this->plugin->getID()}] requirements of {$requirements['php']}");
224 $requirements = $this->configuration->dependencies();
225 foreach ($requirements as
$name => $constraint) {
226 if (!str_starts_with(
$name,
'ext-')) {
232 throw new PhpExtensionException(
"Plugin [{$this->plugin->getID()}] requires the PHP extensions {$extension}");
237 throw new PhpExtensionException(
"The PHP extension version ({$extension_version}) does not meet the plugin [{$this->plugin->getID()}] requirements of {$constraint}");
253 $cat_raw_string = strtolower(
"admin:plugins:category:{$category}");
254 if (
_elgg_services()->translator->languageKeyExists($cat_raw_string)) {
258 return ucwords(
str_replace([
'-',
'_'],
' ', $category));
elgg_get_release()
Get the current Elgg release.
elgg_get_plugins(string $status= 'active')
Returns an ordered list of plugins.
assertConflicts()
Asserts if there are conflicts.
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
if(!$user||!$user->canDelete()) $name
elgg_get_plugin_from_id(string $plugin_id)
Elgg plugins library Contains functions for managing plugins.
Indicates plugin php extension requirement issues.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
getConfiguration()
Returns the composer configuration.
getFriendlyCategory($category)
Returns a category's friendly name.
$plugin_id
Remove all user and plugin settings from the give plugin ID.
Indicates invalid php version for a plugin.
Exception thrown if a value does not match with a set of values.
elgg_is_active_plugin(string $plugin_id)
Returns if a plugin is active for a current site.
__construct(protected\ElggPlugin $plugin)
Constructor.
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
assertActivePluginConflicts()
Asserts if there are active plugins that conflict with the current plugin.
Holds plugin composer.json related functions.
getCategories()
Returns an array with categories.
assertPluginId()
Asserts if plugin id matches project name.
checkConstraints($version, $constraints)
Determine if given version satisfies given constraints.
_elgg_services()
Get the global service provider.
assertRequiredPhpExtensions()
Asserts if the required php extensions matches the actual installed extensions.
assertRequiredPhpVersion()
Asserts if the required php version matches the actual php version.
Indicates a mismatch between the plugin ID in the composer.json and the plugin directory.
Indicates a conflict with the plugin.
Indicates something wrong with the plugin composer.json.
getConflicts()
Returns an array of projectnames with their conflicting version.
getLicense()
Returns the license.