mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
fix: extensions were not loaded due to non-list storage
This commit is contained in:
parent
1c30cf12d1
commit
42baf175aa
2 changed files with 8 additions and 4 deletions
|
|
@ -458,9 +458,12 @@ function logAndDie($userText, $errText = null)
|
|||
function loadExtensions()
|
||||
{
|
||||
$a = Config::get('extensions') ?: null;
|
||||
if (!$a || !array_is_list($a)) {
|
||||
if (!$a || !is_array($a)) {
|
||||
return;
|
||||
}
|
||||
if (!array_is_list($a)) {
|
||||
$a = array_values($a);
|
||||
}
|
||||
foreach ($a as $ext) {
|
||||
if (is_string($ext)) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -92,12 +92,12 @@ else if (isset($_POST['activate']))
|
|||
logAndDie($e->getMessage());
|
||||
}
|
||||
}
|
||||
else $a = array_diff($a, [$ext]);
|
||||
else $a = array_values(array_diff($a, [$ext]));
|
||||
Config::set('extensions', $a);
|
||||
Config::save();
|
||||
}
|
||||
else if (!$activate && in_array($ext, $a)) {
|
||||
$a = array_diff($a, [$ext]);
|
||||
$a = array_values(array_diff($a, [$ext]));
|
||||
Config::set('extensions', $a);
|
||||
Config::save();
|
||||
}
|
||||
|
|
@ -196,7 +196,8 @@ function listExtensions()
|
|||
{
|
||||
$extBundles = MTTExtensionLoader::bundles();
|
||||
$activatedExts = Config::get('extensions');
|
||||
if (!is_array($activatedExts)) $activatedExts = [];
|
||||
if (!is_array($activatedExts))
|
||||
$activatedExts = [];
|
||||
$a = [];
|
||||
foreach ($extBundles as $ext => $meta) {
|
||||
$out = htmlspecialchars($meta['name']. ' v'. $meta['version']). ' ';
|
||||
|
|
|
|||
Loading…
Reference in a new issue