diff --git a/CHANGELOG.md b/CHANGELOG.md index ef47e3a..77fc817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -0.1 - 2022.12.04 +0.1.1 - 2022.12.03 - Required Dotclear 2.19 - First release \ No newline at end of file diff --git a/_define.php b/_define.php index 29172dc..67d3c7f 100644 --- a/_define.php +++ b/_define.php @@ -18,7 +18,7 @@ $this->registerModule( 'Check store version', 'Check plugins and themes available version before update', 'Jean-Christian Denis and Contributors', - '0.1', + '0.1.1', [ 'requires' => [['core', '2.19']], 'permissions' => null, diff --git a/dcstore.xml b/dcstore.xml index 018caf4..c436293 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -2,10 +2,10 @@ Check store version - 0.1 + 0.1.1 Jean-Christian Denis and Contributors Check plugins and themes available version before update - https://github.com/JcDenis/checkStoreVersion/releases/download/v0.1/plugin-checkStoreVersion.zip + https://github.com/JcDenis/checkStoreVersion/releases/download/v0.1.1/plugin-checkStoreVersion.zip 2.19 https://plugins.dotaddict.org/dc2/details/checkStoreVersion https://github.com/JcDenis/checkStoreVersion diff --git a/inc/class.csv.store.php b/inc/class.csv.store.php index b468415..320dd78 100644 --- a/inc/class.csv.store.php +++ b/inc/class.csv.store.php @@ -24,11 +24,15 @@ class csvStore extends dcStore } try { - $parser = DC_STORE_NOT_UPDATE ? false : csvStoreReader::quickParse($this->xml_url, null, true); + $parser = DC_STORE_NOT_UPDATE ? false : csvStoreReader::quickParse($this->xml_url, DC_TPL_CACHE, $force); } catch (Exception $e) { return false; } + $raw_datas = !$parser ? [] : $parser->getModules(); + + uasort($raw_datas, fn ($a, $b) => strtolower($a['id']) <=> strtolower($b['id'])); + $updates = []; $current = array_merge($this->modules->getModules(), $this->modules->getDisabledModules()); foreach ($current as $p_id => $p_infos) { @@ -36,11 +40,21 @@ class csvStore extends dcStore if (!is_array($p_infos)) { continue; } + # main repository + if (isset($raw_datas[$p_id])) { + if (dcUtils::versionsCompare($raw_datas[$p_id]['version'], $p_infos['version'], '>=')) { + $updates[$p_id] = $raw_datas[$p_id]; + $updates[$p_id]['root'] = $p_infos['root']; + $updates[$p_id]['root_writable'] = $p_infos['root_writable']; + $updates[$p_id]['current_version'] = $p_infos['version']; + } + unset($raw_datas[$p_id]); + } # per module third-party repository if (!empty($p_infos['repository']) && DC_ALLOW_REPOSITORIES) { try { $dcs_url = substr($p_infos['repository'], -12, 12) == '/dcstore.xml' ? $p_infos['repository'] : http::concatURL($p_infos['repository'], 'dcstore.xml'); - $dcs_parser = csvStoreReader::quickParse($dcs_url, null, true); + $dcs_parser = csvStoreReader::quickParse($dcs_url, DC_TPL_CACHE, $force); if ($dcs_parser !== false) { $dcs_raw_datas = $dcs_parser->getModules(); if (isset($dcs_raw_datas[$p_id]) && dcUtils::versionsCompare($dcs_raw_datas[$p_id]['version'], $p_infos['version'], '>=')) {