當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PclZip::errorInfo方法代碼示例

本文整理匯總了PHP中PclZip::errorInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP PclZip::errorInfo方法的具體用法?PHP PclZip::errorInfo怎麽用?PHP PclZip::errorInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PclZip的用法示例。


在下文中一共展示了PclZip::errorInfo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rex_a22_extract_archive

function rex_a22_extract_archive($file, $destFolder = null)
{
    global $REX;
    if (!$destFolder) {
        $destFolder = '../files/' . $REX['TEMP_PREFIX'] . '/addon_framework';
    }
    $archive = new PclZip($file);
    if ($archive->extract(PCLZIP_OPT_PATH, $destFolder) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    if (($list = $archive->listContent()) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    echo '<div style="height:200px;width:770px;overflow:auto;margin-bottom:10px;text-align:center;">';
    echo '<h3>Archiv wird extrahiert...</h3>';
    echo '<table border="1" style="margin:0 auto 0 auto;">';
    echo '<tr><th>Datei</th><th>Gr&ouml;&szlig;e</th>';
    for ($i = 0; $i < count($list); $i++) {
        echo '<tr>';
        echo '<td>' . $list[$i]['filename'] . '</td><td>' . $list[$i]['size'] . ' bytes</td>';
        echo '</tr>';
    }
    echo '</table>';
    echo '</div>';
}
開發者ID:BackupTheBerlios,項目名稱:redaxo-addons,代碼行數:25,代碼來源:function_pclzip.inc.php

示例2: toSCO

 function toSCO()
 {
     $deck_id = $_GET['deck_id'];
     if (isset($_GET['format'])) {
         $format = $_GET['format'];
     } else {
         $format = 'scorm2004_3rd';
     }
     $scorm = new Scorm();
     $scorm->create($deck_id, $format);
     $deck_name = $scorm->root_deck_name;
     $archive = new PclZip($deck_name . '.zip');
     //adding sco universal metadata
     $v_list = $archive->create(ROOT . DS . 'libraries' . DS . 'backend' . DS . $format, PCLZIP_OPT_REMOVE_PATH, ROOT . DS . 'libraries' . DS . 'backend' . DS . $format, PCLZIP_OPT_ADD_TEMP_FILE_ON);
     if ($v_list == 0) {
         die("Error : " . $archive->errorInfo(true));
     }
     //adding sco from tmp
     $v_list = $archive->add(ROOT . DS . 'tmp' . DS . $deck_name, PCLZIP_OPT_REMOVE_PATH, ROOT . DS . 'tmp' . DS . $deck_name, PCLZIP_OPT_ADD_TEMP_FILE_ON);
     if ($v_list == 0) {
         die("Error : " . $archive->errorInfo(true));
     }
     $archive->force_download();
     chmod(ROOT . DS . $deck_name . '.zip', 0777);
     unlink(ROOT . DS . $deck_name . '.zip');
     $this->RemoveDir(ROOT . DS . 'tmp' . DS . $deck_name);
 }
開發者ID:TBoonX,項目名稱:SlideWiki,代碼行數:27,代碼來源:ExportController.php

示例3: rex_a52_extract_archive

function rex_a52_extract_archive($file, $msg = '', $path = '../files/tmp_')
{
    $archive = new PclZip($file);
    if ($archive->extract(PCLZIP_OPT_PATH, $path) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    if (($list = $archive->listContent()) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
}
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:10,代碼來源:function_pclzip.inc.php

示例4: unzip

 function unzip($zipfile, $destination_dir = false, $delete_old_dir = false)
 {
     //We check if the previous folder needs to be removed. If so, we do it with deltree() function that recursively deletes all files and then the empty folders from the target folder. if no destination_dir, then ignore this section.
     if ($destination_dir && $delete_old_dir) {
         if (file_exists($destination_dir)) {
             if (!is_writable($destination_dir)) {
                 $this->create_error("Error in deleting the old directory. Missing write permissions in '" . $destination_dir . "'");
             } else {
                 $this->deltree($destination_dir);
             }
         }
     }
     //if destination url, we need to check if it's there and writable, if now, we are going to make it. This script is meant to make the final directory, it will not create the necessary tree up the the folder.
     if (!$this->error() && $destination_dir) {
         if (file_exists($destination_dir)) {
             if (!is_writable($destination_dir)) {
                 $this->create_error("Missing write permissions in '" . $destination_dir . "'");
             }
         } else {
             if (!mkdir($destination_dir, 0775)) {
                 $this->create_error("Unable to create directory '" . $destination_dir . "'. Check writing permissions.");
             }
         }
     }
     //check if the archive file exists and is readable, then depending on destination_dir either just unpack it or unpack it into the destination_dir folder.
     if (!$this->error) {
         if (file_exists($zipfile)) {
             if (is_readable($zipfile)) {
                 $archive = new PclZip($zipfile);
                 if ($destination_dir) {
                     if ($archive->extract(PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_PATH, $destination_dir, PCLZIP_OPT_SET_CHMOD, 0777) == 0) {
                         $this->create_error("Error : " . $archive->errorInfo(true));
                     } else {
                         return true;
                     }
                 } else {
                     if ($archive->extract(PCLZIP_OPT_SET_CHMOD, 0777) == 0) {
                         $this->create_error("Error : " . $archive->errorInfo(true));
                     } else {
                         return true;
                     }
                 }
             } else {
                 $this->create_error("Unable to read ZIP file '" . $zipfile . "'. Check reading permissions.");
             }
         } else {
             $this->create_error("Missing ZIP file '.{$zipfile}.'");
         }
     }
     return $error;
 }
開發者ID:sauruscms,項目名稱:Saurus-CMS-Community-Edition,代碼行數:51,代碼來源:archive.class.php

示例5: rex_a52_extract_archive

function rex_a52_extract_archive($file, $msg = '', $path = null)
{
    global $REX;
    if (!$path) {
        $path = '../files/' . $REX['TEMP_PREFIX'];
    }
    $archive = new PclZip($file);
    if ($archive->extract(PCLZIP_OPT_PATH, $path) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    if (($list = $archive->listContent()) == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
}
開發者ID:BackupTheBerlios,項目名稱:redaxo,代碼行數:14,代碼來源:function_pclzip.inc.php

示例6: themedrive_unzip

function themedrive_unzip($file, $dir)
{
    if (!current_user_can('edit_files')) {
        echo 'Oops, sorry you are not authorized to do this';
        return false;
    }
    if (!class_exists('PclZip')) {
        require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
    }
    $unzipArchive = new PclZip($file);
    $list = $unzipArchive->properties();
    if (!$list['nb']) {
        return false;
    }
    //echo "Number of files in archive : ".$list['nb']."<br>";
    echo "Copying the files<br>";
    $result = $unzipArchive->extract(PCLZIP_OPT_PATH, $dir);
    if ($result == 0) {
        echo 'Could not unarchive the file: ' . $unzipArchive->errorInfo(true) . ' <br />';
        return false;
    } else {
        //print_r($result);
        foreach ($result as $item) {
            if ($item['status'] != 'ok') {
                echo $item['stored_filename'] . ' ... ' . $item['status'] . '<br>';
            }
        }
        return true;
    }
}
開發者ID:aguerojahannes,項目名稱:aguerojahannes.com,代碼行數:30,代碼來源:themedrive.php

示例7: guardarArchivo

 function guardarArchivo()
 {
     global $db, $t;
     // Copia el archivo del usuario al directorio ../files
     $tipoArchivo = $_FILES['userfile']['type'];
     //if( $tipoArchivo=="application/zip" ){
     if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
         copy($_FILES['userfile']['tmp_name'], "../facturas/facturas.zip");
         $msg[] = "<font color=green>El archivo fue cargado correctamente.</font>";
         // -------------------------------------------
         // Descomprimir los zip
         require_once '../include/pclzip.lib.php';
         $archive = new PclZip('../facturas/facturas.zip');
         //Ejecutamos la funcion extract
         //if ( $archive->extract(PCLZIP_OPT_PATH, ' ../files/facturas/',PCLZIP_OPT_REMOVE_PATH, '../files/facturas/') == 0) {
         if ($archive->extract(PCLZIP_OPT_PATH, '../facturas/', PCLZIP_OPT_REMOVE_PATH, '../facturas/') == 0) {
             die("Error : " . $archive->errorInfo(true));
         }
         // -------------------------------------------
         // Eliminar zip, ya no es necesario.
         unlink("../facturas/facturas.zip");
     } else {
         $msg[] = "<font color=red>ERROR : Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
     }
     //}
     //else{
     //    $archivo = $_FILES['userfile']['name'];
     //    $msg[]= "<font color=red>ERROR : El archivo (<i>$archivo</i>) es incorrecto, debe cargar un formato ZIP, y dentro de él todas las facturas.";
     //}
     return $msg;
 }
開發者ID:nesmaster,項目名稱:anakosta,代碼行數:31,代碼來源:facUploadFac.php

示例8: bps_Zip_CC_Master_File

function bps_Zip_CC_Master_File()
{
    // Use ZipArchive
    if (class_exists('ZipArchive')) {
        $zip = new ZipArchive();
        $filename = WP_PLUGIN_DIR . '/bulletproof-security/admin/core/cc-master.zip';
        if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
            exit("Error: Cannot Open {$filename}\n");
        }
        $zip->addFile(WP_PLUGIN_DIR . '/bulletproof-security/admin/core/cc-master.txt', "cc-master.txt");
        $zip->close();
        return true;
    } else {
        // Use PclZip
        define('PCLZIP_TEMPORARY_DIR', WP_PLUGIN_DIR . '/bulletproof-security/admin/core/');
        require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
        if (ini_get('mbstring.func_overload') && function_exists('mb_internal_encoding')) {
            $previous_encoding = mb_internal_encoding();
            mb_internal_encoding('ISO-8859-1');
        }
        $archive = new PclZip(WP_PLUGIN_DIR . '/bulletproof-security/admin/core/cc-master.zip');
        $v_list = $archive->create(WP_PLUGIN_DIR . '/bulletproof-security/admin/core/cc-master.txt', PCLZIP_OPT_REMOVE_PATH, WP_PLUGIN_DIR . '/bulletproof-security/admin/core/');
        return true;
        if ($v_list == 0) {
            die("Error : " . $archive->errorInfo(true));
            return false;
        }
    }
}
開發者ID:alpual,項目名稱:sweekswatercolors,代碼行數:29,代碼來源:core-export-import.php

示例9: create_zip

function create_zip($themeName)
{
    $exclude_files = array('.', '..', '.svn', 'thumbs.db', '!sources', 'style.less.cache', 'bootstrap.less.cache', '.gitignore', '.git');
    $all_themes_dir = str_replace('\\', '/', get_theme_root());
    $backup_dir = str_replace('\\', '/', WP_CONTENT_DIR) . '/themes_backup';
    $zip_name = $backup_dir . "/" . $themeName . '.zip';
    $backup_date = date("F d Y");
    if (is_dir($all_themes_dir . "/" . $themeName)) {
        $file_string = scan_dir($all_themes_dir . "/" . $themeName, $exclude_files);
    }
    if (function_exists('wp_get_theme')) {
        $backup_version = wp_get_theme($themeName)->Version;
    } else {
        $backup_version = get_current_theme($themeName)->Version;
    }
    if (!is_dir($backup_dir)) {
        if (mkdir($backup_dir, 0700)) {
            $htaccess_file = fopen($backup_dir . '/.htaccess', 'a');
            $htaccess_text = 'deny from all';
            fwrite($htaccess_file, $htaccess_text);
            fclose($htaccess_file);
        }
    }
    $zip = new PclZip($zip_name);
    if ($zip->create($file_string, PCLZIP_OPT_REMOVE_PATH, $all_themes_dir . "/" . $themeName) == 0) {
        die("Error : " . $zip->errorInfo(true));
    }
    update_option($themeName . "_date_backup", $backup_date, '', 'yes');
    update_option($themeName . "_version_backup", $backup_version, '', 'yes');
    echo $backup_date . "," . $backup_version;
}
開發者ID:hoangluanlee,項目名稱:dlbh,代碼行數:31,代碼來源:backup.php

示例10: decompress

 function decompress($to)
 {
     if (!file_exists($this->zip)) {
         throw new \Fuse_Exception('File :file does not exist', array(':file' => $this->zip));
     }
     $zip = new PclZip($this->zip);
     if (($list = $zip->listContent()) == 0) {
         error_log($zip->errorInfo(true));
         throw new \Fuse_Exception('Invalid zip file');
     }
     $v_list = $zip->extract($to);
     if ($v_list == 0) {
         error_log($zip->errorInfo(true));
         throw new \Fuse_Exception('Zip extraction failed');
     }
     return true;
 }
開發者ID:BillingFuse,項目名稱:BillingFuse,代碼行數:17,代碼來源:Zip.php

示例11: zip_dir

function zip_dir($zip_dir, $zip_archive)
{
    $archive = new PclZip("{$zip_archive}");
    $v_list = $archive->create("{$zip_dir}");
    if ($v_list == 0) {
        die("Error: " . $archive->errorInfo(true));
    }
}
開發者ID:BackupTheBerlios,項目名稱:livealphaprint,代碼行數:8,代碼來源:zip_utils.php

示例12: cherry_unzip_backup

function cherry_unzip_backup($file, $themes_folder)
{
    $zip = new PclZip($file);
    if ($zip->extract(PCLZIP_OPT_PATH, $themes_folder) == 0) {
        die("Error : " . $zip->errorInfo(true));
    }
    echo get_option(PARENT_NAME . "_version_backup");
}
開發者ID:robbuh,項目名稱:CherryFramework,代碼行數:8,代碼來源:restore.php

示例13: ZipExtract

 /**
  * Extract zip file 
  * @param string $path path to extract files
  * @param string $input input zip file to extract
  * @example  $com->ZipExtract('newlibs', './sample.zip');
  */
 public function ZipExtract($path, $input)
 {
     include_once 'external/pclzip.lib.php';
     $archive = new PclZip($input);
     if ($archive->extract(PCLZIP_OPT_PATH, $path) == 0) {
         die("Error : " . $archive->errorInfo(true));
     }
 }
開發者ID:A1Gard,項目名稱:ToosFrameWork,代碼行數:14,代碼來源:TCompress.php

示例14: unzip

function unzip($filename, $path)
{
    $zipfile = new PclZip($filename);
    if ($zipfile->extract(PCLZIP_OPT_PATH, $path) == 0) {
        return 'Error : ' . $zipfile->errorInfo(true);
    } else {
        return TRUE;
    }
}
開發者ID:Anuragigts,項目名稱:25_clinic,代碼行數:9,代碼來源:unzip_helper.php

示例15: backupSite

 /**
  * Функция делает бекап всех файлов скрипта
  * Для исключения файлов из архива необходимо прописать их в свойство backup::$arrExcept (по умолчанию в нем array('updates', 'updates/backups'))
  * 
  * @return bool
  */
 static function backupSite()
 {
     function except($p_event, &$p_header)
     {
         return backup::skipAddingFilesToArchive($p_event, $p_header);
     }
     $file = CONF_BACKUPS_PATH_TO_FILES . terms::currentDate() . '_site_revision_' . CONF_INFO_SCRIPT_REVISION . '.zip';
     file_exists($file) ? unlink($file) : null;
     $zip = new PclZip($file);
     return !$zip->create(CONF_ROOT_DIR, PCLZIP_OPT_REMOVE_PATH, CONF_ROOT_DIR, PCLZIP_CB_PRE_ADD, 'except') ? $zip->errorInfo(true) : true;
 }
開發者ID:innova-market,項目名稱:JobExpert,代碼行數:17,代碼來源:backup.class.php


注:本文中的PclZip::errorInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。