commit fea41b25c7441b53a56d206b549c7b6b2c71cd1c
parent 74c748d48aadbfd246780f1fe429ac6ae501447a
Author: markseu <mark2011@mayberg.se>
Date: Tue, 24 Jul 2018 22:46:16 +0200
Better software update
Diffstat:
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/system/plugins/update.php b/system/plugins/update.php
@@ -5,7 +5,7 @@
class YellowUpdate
{
- const VERSION = "0.7.14";
+ const VERSION = "0.7.15";
var $yellow; //access to API
var $updates; //number of updates
@@ -63,16 +63,6 @@ class YellowUpdate
$_GET["clean-url"] = "theme-has-been-updated";
}
}
- if($update) //TODO: remove later, converts old script
- {
- $fileName = "yellow.php";
- if(is_file($fileName))
- {
- $fileData = $this->yellow->toolbox->readFile($fileName);
- $fileDataNew = preg_replace("#yellow->plugins->load\(\)#", "yellow->load()", $fileData);
- if($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileName, $fileDataNew);
- }
- }
if($update) //TODO: remove later, converts old error page
{
$fileName = $this->yellow->config->get("configDir")."page-error-500.txt";
@@ -267,7 +257,7 @@ class YellowUpdate
$fileExtension = $this->yellow->config->get("downloadExtension");
foreach($data as $key=>$value)
{
- $fileName = strtoloweru("$path$key.zip");
+ $fileName = $path.$this->yellow->lookup->normaliseName($key, true, false, true).".zip";
list($version, $url) = explode(',', $value);
list($statusCode, $fileData) = $this->getSoftwareFile($url);
if(empty($fileData) || !$this->yellow->toolbox->createFile($fileName.$fileExtension, $fileData))
@@ -281,7 +271,7 @@ class YellowUpdate
{
foreach($data as $key=>$value)
{
- $fileName = strtoloweru("$path$key.zip");
+ $fileName = $path.$this->yellow->lookup->normaliseName($key, true, false, true).".zip";
if(!$this->yellow->toolbox->renameFile($fileName.$fileExtension, $fileName))
{
$statusCode = 500;
@@ -802,10 +792,6 @@ class YellowUpdate
{
$urlRequest = "https://raw.githubusercontent.com/".$matches[1]."/".$matches[2];
}
- if(preg_match("#^https://github.com/(.+)/archive/master.zip$#", $url, $matches))
- {
- $urlRequest = "https://codeload.github.com/".$matches[1]."/zip/master";
- }
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $urlRequest);
curl_setopt($curlHandle, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; DatenstromYellow/".YellowCore::VERSION."; SoftwareUpdater)");