Ejemplo n.º 1
0
 public static function clearGroup($group)
 {
     N2Cache::init();
     if (N2Filesystem::existsFolder(self::$accessiblePath . NDS . $group)) {
         N2Filesystem::deleteFolder(self::$accessiblePath . NDS . $group);
     }
     if (N2Filesystem::existsFolder(self::$notAccessiblePath . NDS . $group)) {
         N2Filesystem::deleteFolder(self::$notAccessiblePath . NDS . $group);
     }
 }
Ejemplo n.º 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;
 }