Skip to content

Commit 4dfdb68

Browse files
committed
MDLSITE-8135 Ignore the public folder prefix in components.json
1 parent 2091af5 commit 4dfdb68

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cli/fix-drift.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@
5454

5555
// Load the location of standard plugin types and core subsystems.
5656
$componentsjson = (array) json_decode(implode(PHP_EOL, $git->exec('show origin/main:lib/components.json')), true);
57-
$plugintypelocations = $componentsjson['plugintypes'];
57+
$plugintypelocations = [];
58+
59+
foreach ($componentsjson['plugintypes'] as $plugtype => $pluglocation) {
60+
if (str_starts_with($pluglocation, 'public/')) {
61+
$plugintypelocations[$plugtype] = substr($pluglocation, 7);
62+
} else {
63+
$plugintypelocations[$plugtype] = $pluglocation;
64+
}
65+
}
5866

5967
foreach (preg_split('|\R|', get_config('local_amos', 'plugintypelocations'), -1, PREG_SPLIT_NO_EMPTY) as $line) {
6068
if (preg_match('|^\s*([a-z][a-z0-9]*)\s+(.+)$|', $line, $matches)) {
@@ -119,6 +127,10 @@
119127
$filepath = $plugintypelocations[$plugintype] . '/' . $pluginname . '/lang/en/' . $legacyname . '.php';
120128
}
121129

130+
if ($version->code >= 501) {
131+
$filepath = 'public/' . $filepath;
132+
}
133+
122134
// Get the most recent snapshot from the git repository.
123135
$gitcmd = ' show ' . escapeshellarg($gitbranch) . ':' . escapeshellarg($filepath) . ' 2> /dev/null';
124136
$gitout = $git->exec($gitcmd, false, $gitstatus);

0 commit comments

Comments
 (0)