Ejemplo n.º 1
-1
 public function Unpack()
 {
     global $varChecker;
     $path = $varChecker->getValue('path');
     $zipper = new Zipper();
     if ($zipper->IsZipFile($path)) {
         $fmaker = new FileMaker();
         $filename = substr($path, strrpos($path, '/') + 1);
         $folderpath = str_replace($filename, '', $path);
         $folderpath = $folderpath . 'resources/';
         $fmaker->makeDirectory($folderpath, true);
         $files = $zipper->Decompress($path, $folderpath);
         $processedFiles = $this->saveFiles($files, $folderpath);
         $savedFiles = $processedFiles['saved'];
         $errorfiles = $processedFiles['error'];
     } else {
         //create files array with just one file
     }
     if (count($savedFiles) > 0) {
         $result = array('success' => 'resourcesuploaded', 'files' => $savedFiles, 'errorfiles' => $errorfiles, 'folder' => $folderpath, 'rawcount' => count($files));
     } else {
         $result = array('error' => 'resourcesfailed', 'files' => $savedFiles, 'errorfiles' => $errorfiles, 'folder' => $folderpath, 'rawcount' => count($files));
     }
     return $result;
 }