Skip to content

Commit a10b6df

Browse files
committed
Fix getComponentInstallDirectory plugintypes retrieval issue.
fetch_plugintypes return signature was changed at MDL-79843. Fixes #338
1 parent 06df50c commit a10b6df

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
99
The format of this change log follows the advice given at [Keep a CHANGELOG](https://keepachangelog.com).
1010

1111
## [Unreleased]
12+
### Fixed
13+
- Fix getComponentInstallDirectory plugintypes retrieval issue to comply with 5.0
14+
1215
## [4.5.5] - 2024-11-06
1316
### Added
1417
- Improvements to plugin validation implementation:

src/Bridge/Moodle.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ public function getComponentInstallDirectory(string $component): string
106106
$method->setAccessible(true);
107107
$result = $method->invoke(null);
108108

109-
if (!array_key_exists($type, $result[0])) {
109+
$plugintypes = $this->getBranch() >= 500 ? $result['plugintypes'] : $result[0];
110+
111+
if (!array_key_exists($type, $plugintypes)) {
110112
throw new \InvalidArgumentException(sprintf('The component %s has an unknown plugin type of %s', $component, $type));
111113
}
112114

113-
return $result[0][$type] . '/' . $name;
115+
return $plugintypes[$type] . '/' . $name;
114116
}
115117

116118
/**

0 commit comments

Comments
 (0)