Skip to content

Commit

Permalink
Updated installer for testing available extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
markseuffert committed Mar 20, 2024
1 parent c9cac5e commit 11ad5cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions system/extensions/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Install extension, https://github.com/annaesvensson/yellow-install

class YellowInstall {
const VERSION = "0.8.93";
const VERSION = "0.8.94";
const PRIORITY = "1";
public $yellow; // access to API

Expand Down Expand Up @@ -177,7 +177,7 @@ public function updateExtensions($extension, $option = "") {
$statusCode = 200;
if ($this->yellow->extension->isExisting("update")) {
if ($option=="maximal") {
$statusCode = $this->downloadExtensionsLatest();
$statusCode = $this->downloadExtensionsAvailable();
$path = $this->yellow->system->get("coreExtensionDirectory");
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.bin$/", true, false) as $entry) {
if (basename($entry)=="install-language.bin") continue;
Expand Down Expand Up @@ -391,12 +391,12 @@ public function checkServerRewrite() {
return $rewrite;
}

// Download latest extension files
public function downloadExtensionsLatest() {
// Download available extension files
public function downloadExtensionsAvailable() {
$statusCode = 200;
if ($this->yellow->extension->isExisting("update")) {
$path = $this->yellow->system->get("coreExtensionDirectory");
$fileData = $this->yellow->toolbox->readFile($path.$this->yellow->system->get("updateLatestFile"));
$fileData = $this->yellow->toolbox->readFile($path.$this->yellow->system->get("updateAvailableFile"));
$settings = $this->yellow->toolbox->getTextSettings($fileData, "extension");
$extensionsNow = 0;
$extensionsEstimated = count($settings) - substr_count(strtoloweru($fileData), "tag: language");
Expand All @@ -405,7 +405,7 @@ public function downloadExtensionsLatest() {
$fileName = $path."install-".$this->yellow->lookup->normaliseName($key, true, false, true).".bin";
if (is_file($fileName)) continue;
if (preg_match("/language/i", $value->get("tag"))) continue;
echo "\rDownloading latest extensions ".$this->getProgressPercent(++$extensionsNow, $extensionsEstimated, 5, 95)."%... ";
echo "\rDownloading available extensions ".$this->getProgressPercent(++$extensionsNow, $extensionsEstimated, 5, 95)."%... ";
$url = $value->get("downloadUrl");
curl_setopt($curlHandle, CURLOPT_URL, $this->yellow->extension->get("update")->getExtensionDownloadUrl($url));
curl_setopt($curlHandle, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; YellowInstall/".YellowInstall::VERSION).")";
Expand All @@ -427,15 +427,15 @@ public function downloadExtensionsLatest() {
$this->yellow->page->error($statusCode, "Can't write file '$fileName'!");
}
if ($this->yellow->system->get("coreDebugMode")>=2 && !is_string_empty($redirectUrl)) {
echo "YellowInstall::downloadExtensionsLatest redirected to url:$redirectUrl<br/>\n";
echo "YellowInstall::downloadExtensionsAvailable redirected to url:$redirectUrl<br/>\n";
}
if ($this->yellow->system->get("coreDebugMode")>=2) {
echo "YellowInstall::downloadExtensionsLatest status:$statusCode url:$url<br/>\n";
echo "YellowInstall::downloadExtensionsAvailable status:$statusCode url:$url<br/>\n";
}
if ($statusCode!=200) break;
}
curl_close($curlHandle);
echo "\rDownloading latest extensions 100%... done\n";
echo "\rDownloading available extensions 100%... done\n";
}
return $statusCode;
}
Expand Down
4 changes: 2 additions & 2 deletions system/extensions/update-current.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ media/images/photo.jpg: photo.jpg, create, optional
media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional

Extension: Install
Version: 0.8.93
Version: 0.8.94
Description: Install a brand new website.
DownloadUrl: https://github.com/annaesvensson/yellow-install/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-install
DocumentationLanguage: en, de, sv
Published: 2023-12-04 20:53:04
Published: 2024-03-20 19:41:21
Developer: Anna Svensson
Status: unlisted
system/extensions/install.php: install.php, create
Expand Down

0 comments on commit 11ad5cb

Please sign in to comment.