/** * Update the App with the given ID */ public static function app($id) { if ($id == "") { echo ser("Error", "No App Mentioned to update."); } self::log("Installing Latest Version of App {$id}"); $url = Server::download("app", $id); $zipFile = L_DIR . "/contents/update/{$id}.zip"; self::zipFile($url, $zipFile); // Un Zip the file if (class_exists("ZipArchive")) { $zip = new \ZipArchive(); if ($zip->open($zipFile) != "true") { self::log("Unable to open Downloaded App ({$id}) File : {$zipFile}"); echo ser("Error", "Unable to open Downloaded App File."); } else { /** * Extract App */ $appDir = APPS_DIR . "/{$id}"; if (!file_exists($appDir)) { mkdir($appDir); } $zip->extractTo($appDir); $zip->close(); FS::remove($zipFile); self::log("Installed App {$id}"); return true; } } else { throw new \Exception("Unable to Install App, because <a href='" . L_SERVER . "/docs/quick#section-requirements' target='_blank'>PHP Zip Extension</a> is not installed"); } }
/** * Update the App with the given ID */ public static function app($id) { if ($id == "") { ser("Error", "No App Mentioned to update."); } \Lobby::log("Installing Latest Version of App {$id}"); $url = \Lobby\Server::download("app", $id); $zipFile = L_DIR . "/contents/update/{$id}.zip"; self::zipFile($url, $zipFile); // Un Zip the file $zip = new \ZipArchive(); if ($zip->open($zipFile) != "true") { \Lobby::log("Unable to open Downloaded App ({$id}) File : {$zipFile}"); ser("Error", "Unable to open Downloaded App File."); } else { /** * Extract App */ $zip->extractTo(APPS_DIR); $zip->close(); \Lobby\FS::remove($zipFile); \Lobby::log("Installed App {$id}"); return true; } }