コード例 #1
0
ファイル: Rar.php プロジェクト: Nnadozieomeonu/lacecart
 /**
  * Return a listing of the contents of an archived file
  *
  * @param  boolean $full
  * @return array
  */
 public function listFiles($full = false)
 {
     $list = [];
     $entries = $this->archive->getEntries();
     if (!empty($entries)) {
         foreach ($entries as $entry) {
             if (!$full) {
                 $list[] = $entry->getName();
             } else {
                 $list[] = ['name' => $entry->getName(), 'unpacked_size' => $entry->getUnpackedSize(), 'packed_size' => $entry->getPackedSize(), 'host_os' => $entry->getHostOs(), 'file_time' => $entry->getFileTime(), 'crc' => $entry->getCrc(), 'attr' => $entry->getAttr(), 'version' => $entry->getVersion(), 'method' => $entry->getMethod()];
             }
         }
     }
     return $list;
 }
コード例 #2
0
ファイル: zipper.class.php プロジェクト: ruffen/Pixcel-CMS
 private function Unrar($filepath, $location)
 {
     $rar = new RarArchive();
     $res = $rar->open($filepath);
     if ($res === TRUE) {
         $entries = $rar->getEntries();
         foreach ($entries as $entry) {
             $entry->extract($location);
         }
         $rar->close();
         return true;
     }
     throw new Exception('rarfailed');
 }