Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Generate temp name and store in storage folder if php native tempnam is blocked on shared hosting
givanz2710897dcefe
diff --git a/system/extensions/extensions.php b/system/extensions/extensions.phpindex 9a79d85..053385e 100755--- a/system/extensions/extensions.php+++ b/system/extensions/extensions.php@@ -135,14 +135,23 @@ abstract class Extensions {}static function download($url) {- //$temp = tmpfile();$f = false;- $temp = tempnam(sys_get_temp_dir(), 'vvveb_plugin');-+ $temp = @tempnam(sys_get_temp_dir(), 'vvveb_plugin');++ if (!$temp) {+ $temp = @tmpfile();+ }++ //if temp still fails use cache dir, some shared hosting have this issue+ if (!$temp) {+ $temp = DIR_CACHE . APP . '.extension.' . md5($url) . '.zip';+ }+if ($content = download($url)) {$f = file_put_contents($temp, $content, LOCK_EX);-- return $temp;+ if ($f) {+ return $temp;+ }}return $f;@@ -156,7 +165,7 @@ abstract class Extensions {$zip = new \ZipArchive();- if ($zip->open($extensionZipFile) === true) {+ if ($zip->open($extensionZipFile/*, \ZipArchive::OVERWRITE*/) === true) {$info = false;$folderName = $zip->getNameIndex(0);diff --git a/system/extensions/plugins.php b/system/extensions/plugins.phpindex 15fd55a..f402368 100755--- a/system/extensions/plugins.php+++ b/system/extensions/plugins.php@@ -28,7 +28,7 @@ use function Vvveb\rrmdir;use Vvveb\System\Event;class Plugins extends Extensions {- static protected $url = 'https://plugins.vvveb.com';+ static protected $url = 'https://www.vvveb.com';static protected $feedUrl = 'https://plugins.vvveb.com/feed/plugins';@@ -131,7 +131,7 @@ class Plugins extends Extensions {if (! file_exists($publicDest)) {//try symlink first- if (symlink($publicSrc, $publicDest)) {+ if (function_exists('symlink') && \symlink($publicSrc, $publicDest)) {return true;} else {return rcopy($publicSrc, $publicDest);diff --git a/system/update.php b/system/update.phpindex 4599b69..d174334 100755--- a/system/update.php+++ b/system/update.php@@ -126,14 +126,23 @@ class Update {}static function download($url) {- //$temp = tmpfile();$f = false;- $temp = tempnam(sys_get_temp_dir(), 'vvveb_update');+ $temp = @tempnam(sys_get_temp_dir(), 'vvveb_update');+ if (!$temp) {+ $temp = @tmpfile();+ }++ //if temp still fails use cache dir, some shared hosting have this issue+ if (!$temp) {+ $temp = DIR_CACHE . APP . '.update.' . md5($url) . 'zip';+ }+if ($content = download($url)) {$f = file_put_contents($temp, $content, LOCK_EX);-- return $temp;+ if ($f) {+ return $temp;+ }}return $f;@@ -190,7 +199,7 @@ class Update {}function copyConfig() {- $skip = ['plugins.php', 'mail.php', 'sites.php', 'app.php', 'admin.php', 'app-routes.php'];+ $skip = ['plugins.php', 'mail.php', 'sites.php', 'app.php', 'admin.php', 'rest.php', 'graphql.php', 'app-routes.php'];return $this->copyFolder($this->workDir . DS . 'config', DIR_ROOT . DS . 'config', $skip);}@@ -285,7 +294,7 @@ class Update {$diff = [];$tableSql = [];- $db;+//get table names from sql filesforeach ($files as $filename) {$tableName = basename($filename, '.sql');