commit df6d5b7414081b18c934b4a72b223ed096ae27f7
parent 1659f1e690efe8e64d65b2429cda605f9debccf2
Author: markseu <mark2011@mayberg.se>
Date: Tue, 9 Dec 2025 19:06:00 +0100
Updated installation files
Diffstat:
3 files changed, 11 insertions(+), 98 deletions(-)
diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini
@@ -753,14 +753,14 @@ Status: available
system/workers/turkish.php: turkish.php, create, update
Extension: Update
-Version: 0.9.7
+Version: 0.9.8
Description: Keep your extensions up to date.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-update
DocumentationLanguage: en, de, sv
-Published: 2025-11-21 18:17:47
+Published: 2025-12-09 18:50:25
Status: available
system/workers/update.php: update.php, create, update
system/workers/updatepatch.bin: updatepatch.php, create, additional
diff --git a/system/extensions/update-installed.ini b/system/extensions/update-installed.ini
@@ -128,14 +128,14 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea
system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful
Extension: Update
-Version: 0.9.7
+Version: 0.9.8
Description: Keep your extensions up to date.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-update
DocumentationLanguage: en, de, sv
-Published: 2025-11-21 18:17:47
+Published: 2025-12-09 18:50:25
Status: available
system/workers/update.php: update.php, create, update
system/workers/updatepatch.bin: updatepatch.php, create, additional
diff --git a/system/workers/update.php b/system/workers/update.php
@@ -2,7 +2,7 @@
// Update extension, https://github.com/annaesvensson/yellow-update
class YellowUpdate {
- const VERSION = "0.9.7";
+ const VERSION = "0.9.8";
const PRIORITY = "2";
public $yellow; // access to API
public $extensions; // number of extensions
@@ -17,7 +17,6 @@ class YellowUpdate {
$this->yellow->system->setDefault("updateExtensionFile", "extension.ini");
$this->yellow->system->setDefault("updateEventPending", "none");
$this->yellow->system->setDefault("updateEventDaily", "0");
- $this->yellow->system->setDefault("updateLogEntries", "20");
$this->yellow->system->setDefault("updateTrashTimeout", "7776660");
}
@@ -55,7 +54,6 @@ class YellowUpdate {
if ($statusCode==0) {
switch ($command) {
case "about": $statusCode = $this->processCommandAbout($command, $text); break;
- case "log": $statusCode = $this->processCommandLog($command, $text); break;
case "install": $statusCode = $this->processCommandInstall($command, $text); break;
case "uninstall": $statusCode = $this->processCommandUninstall($command, $text); break;
case "update": $statusCode = $this->processCommandUpdate($command, $text); break;
@@ -67,25 +65,17 @@ class YellowUpdate {
// Handle command help
public function onCommandHelp() {
- return array("about [extension]", "log [filter]", "install [extension]", "uninstall [extension]", "update [extension]");
+ return array("about [extension]", "install [extension]", "uninstall [extension]", "update [extension]");
}
// Handle page content element
public function onParseContentElement($page, $name, $text, $attributes, $type) {
$output = null;
- if ($name=="yellow" && $type=="inline") {
- if ($text=="about") {
- list($dummy, $settingsCurrent) = $this->getExtensionSettings(true);
- $output = "Datenstrom Yellow ".YellowCore::RELEASE."<br />\n";
- foreach ($settingsCurrent as $key=>$value) {
- $output .= ucfirst($key)." ".$value->get("version")."<br />\n";
- }
- }
- if ($text=="log") {
- $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreWebsiteFile");
- $output = htmlspecialchars($this->getFileData($fileName, $this->yellow->system->get("updateLogEntries")));
- $output = str_replace("\n", "<br />\n", $output);
- if (is_string_empty($output)) $output = "No entries in log file\n";
+ if ($name=="about" && $type=="inline") {
+ list($dummy, $settingsCurrent) = $this->getExtensionSettings(true);
+ $output = "Datenstrom Yellow ".YellowCore::RELEASE."<br />\n";
+ foreach ($settingsCurrent as $key=>$value) {
+ $output .= ucfirst($key)." ".$value->get("version")."<br />\n";
}
}
return $output;
@@ -113,16 +103,6 @@ class YellowUpdate {
}
return $statusCode;
}
-
- // Process command to show log file
- public function processCommandLog($command, $text) {
- $statusCode = 200;
- $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreWebsiteFile");
- $fileData = $this->getFileData($fileName, $this->yellow->system->get("updateLogEntries"), $text);
- echo $fileData;
- if (is_string_empty($fileData)) echo "Yellow $command: No entries in log file\n";
- return $statusCode;
- }
// Process command to install extensions
public function processCommandInstall($command, $text) {
@@ -941,71 +921,4 @@ class YellowUpdate {
}
return mktime(0, 0, 0) + 60*60*24 + $timeOffset;
}
-
- // Return entries in log file
- public function getFileData($fileName, $entriesMax = 0, $filter = "") {
- $fileData = "";
- $fileHandle = @fopen($fileName, "rb");
- if ($fileHandle) {
- clearstatcache(true, $fileName);
- if (flock($fileHandle, LOCK_SH)) {
- $entriesFound = 0;
- $filter = strtoloweru($filter);
- $filePos = filesize($fileName)-1;
- $fileTop = -1;
- while (($line = $this->getFileLinePrevious($fileHandle, $filePos, $fileTop, $dataBuffer))!==false) {
- if (is_string_empty($filter) || strposu(strtoloweru($line), $filter)!==false) {
- $fileData = $line.$fileData;
- ++$entriesFound;
- if ($entriesFound==$entriesMax) break;
- }
- }
- flock($fileHandle, LOCK_UN);
- }
- fclose($fileHandle);
- }
- return $fileData;
- }
-
- // Return previous text line from file, false if not found
- public function getFileLinePrevious($fileHandle, &$filePos, &$fileTop, &$dataBuffer) {
- if ($filePos>=0) {
- $line = "";
- $lineEndingSearch = false;
- $this->getFileLineBuffer($fileHandle, $filePos, $fileTop, $dataBuffer);
- $endPos = $filePos - $fileTop;
- for (;$filePos>=0; --$filePos) {
- $currentPos = $filePos - $fileTop;
- if ($dataBuffer===false) {
- $line = false;
- break;
- }
- if ($dataBuffer[$currentPos]=="\n" && $lineEndingSearch) {
- $line = substru($dataBuffer, $currentPos+1, $endPos-$currentPos).$line;
- break;
- }
- if ($currentPos==0) {
- $line = substru($dataBuffer, $currentPos, $endPos-$currentPos+1).$line;
- $this->getFileLineBuffer($fileHandle, $filePos-1, $fileTop, $dataBuffer);
- $endPos = $filePos-1 - $fileTop;
- }
- $lineEndingSearch = true;
- }
- } else {
- $line = false;
- }
- return $line;
- }
-
- // Update text line buffer
- public function getFileLineBuffer($fileHandle, $filePos, &$fileTop, &$dataBuffer) {
- if ($filePos>=0) {
- $top = intval($filePos/4096) * 4096;
- if ($fileTop!=$top) {
- $fileTop = $top;
- fseek($fileHandle, $fileTop);
- $dataBuffer = fread($fileHandle, 4096);
- }
- }
- }
}