Beispiel #1
0
 public static function init()
 {
     static $inited;
     if (!$inited) {
         self::$accessiblePath = N2Filesystem::getWebCachePath();
         self::$notAccessiblePath = N2Filesystem::getNotWebCachePath();
         $inited = true;
     }
 }
Beispiel #2
0
 public static function updateFromZip($fileRaw, $updateInfo)
 {
     N2Loader::import('libraries.zip.zip_read');
     $tmpHandle = tmpfile();
     fwrite($tmpHandle, $fileRaw);
     $metaData = stream_get_meta_data($tmpHandle);
     $tmpFilename = $metaData['uri'];
     $zip = new N2ZipRead();
     $files = $zip->read_zip($tmpFilename);
     $updateFolder = N2Filesystem::getNotWebCachePath() . '/update/';
     $zip->recursive_extract($files, $updateFolder);
     fclose($tmpHandle);
     $installer = JInstaller::getInstance();
     $installer->setOverwrite(true);
     if (!$installer->install($updateFolder)) {
         N2Filesystem::deleteFolder($updateFolder);
         return false;
     }
     N2Filesystem::deleteFolder($updateFolder);
     return true;
 }