当前位置: 首页>>代码示例>>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;未经允许,请勿转载。