From 4e18083722db5ebf1fa133b6898bc8726feadc96 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Thu, 17 Jul 2014 07:35:40 +0200 Subject: [PATCH] PHP 5.3 > openssl needed --- system/includes/updater.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/system/includes/updater.php b/system/includes/updater.php index fe53f9f..d4957ad 100644 --- a/system/includes/updater.php +++ b/system/includes/updater.php @@ -38,7 +38,7 @@ class Updater protected $versionFile = "cache/installedVersion.json"; protected $zipFile = "cache/tmpZipFile.zip"; - protected $infos = []; + protected $infos = array(); public function __construct() { @@ -59,10 +59,16 @@ class Updater } else { - $fileContent = @file_get_contents($path,false, stream_context_create(['http'=>['header'=>"User-Agent: Awesome-Update-My-Self\r\n"]])); - if($fileContent == false) + $fileContent = file_get_contents($path,false, stream_context_create( + array( + 'http' => array( + 'header'=>"User-Agent: Awesome-Update-My-Self\r\n" + ) + ) + )); + if($fileContent === false) { - return []; + return array(); } $json = json_decode($fileContent,true); $fileContent = json_encode($json, JSON_PRETTY_PRINT); @@ -99,10 +105,10 @@ class Updater if($this->unZip()) { unlink($this->zipFile); - file_put_contents($this->versionFile, json_encode([ + file_put_contents($this->versionFile, json_encode(array( "id" => $this->infos[0]['id'], "tag_name" => $this->infos[0]['tag_name'] - ], JSON_PRETTY_PRINT)); + ), JSON_PRETTY_PRINT)); return true; } } @@ -126,7 +132,8 @@ class Updater $cutLength = strlen($zip->getNameIndex(0)); for($i = 1; $i < $zip->numFiles; $i++) {//iterate throw the Zip $fileName = $zip->getNameIndex($i); - if($zip->statIndex($i)["crc"] == 0) + $stat = $zip->statIndex($i); + if($stat["crc"] == 0) { $dirName = substr($fileName,$cutLength); if(! file_exists($dirName))