mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit 030509a13a2fd59d1a1f08a928ad8ebb41f41fe9
parent a657d7ace9f91b3658c459f6947d1aa7d9bb0847
Author: markseu <mark2011@mayberg.se>
Date:   Tue, 29 Sep 2020 12:44:42 +0200

Updated bundle extension, better cleanup

Diffstat:
Msystem/extensions/bundle.php | 24++++++++++++++++++++----
Msystem/extensions/update-current.ini | 4++--
2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/system/extensions/bundle.php b/system/extensions/bundle.php @@ -2,7 +2,7 @@ // Bundle extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/bundle class YellowBundle { - const VERSION = "0.8.15"; + const VERSION = "0.8.16"; public $yellow; // access to API // Handle initialisation @@ -33,14 +33,30 @@ class YellowBundle { $statusCode = 0; if ($command=="clean" && $text=="all") { $path = $this->yellow->system->get("coreExtensionDirectory"); - foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/bundle-.*/", false, false) as $entry) { - if (!$this->yellow->toolbox->deleteFile($entry)) $statusCode = 500; - } + $statusCode = $this->cleanBundles($path); if ($statusCode==500) echo "ERROR cleaning bundles: Can't delete files in directory '$path'!\n"; } return $statusCode; } + // Handle update + public function onUpdate($action) { + if ($action=="update") { + $path = $this->yellow->system->get("coreExtensionDirectory"); + $statusCode = $this->cleanBundles($path); + if ($statusCode==500) $this->yellow->log("error", "Can't delete files in directory '$path'!\n"); + } + } + + // Clean bundles + public function cleanBundles($path) { + $statusCode = 200; + foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/bundle-.*/", false, false) as $entry) { + if (!$this->yellow->toolbox->deleteFile($entry)) $statusCode = 500; + } + return $statusCode; + } + // Normalise page head public function normaliseHead($text) { $dataMeta = $dataLink = $dataCss = $dataScriptDefer = $dataScriptNow = $dataOther = array(); diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini @@ -1,11 +1,11 @@ # Datenstrom Yellow update settings Extension: Bundle -Version: 0.8.15 +Version: 0.8.16 Description: Bundle website files. HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/bundle DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/bundle.zip -Published: 2020-07-29 10:13:34 +Published: 2020-09-29 11:58:48 Developer: Datenstrom Tag: feature system/extensions/bundle.php: bundle.php, create, update