当前位置: 首页>>代码示例>>PHP>>正文


PHP zip_dir函数代码示例

本文整理汇总了PHP中zip_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP zip_dir函数的具体用法?PHP zip_dir怎么用?PHP zip_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zip_dir函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testzip_dir

 public function testzip_dir()
 {
     //execute the method and verify the if zipped file exist
     $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
     $file = $cache_dir . '/zipTest.zip';
     if (file_exists($file)) {
         unlink($file);
     }
     zip_dir($cache_dir . '/modules', $file);
     $this->assertFileExists($file);
     unlink($file);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:12,代码来源:phpZipUtilsTest.php

示例2: processBackupForm

function processBackupForm()
{
    global $backup_dir;
    global $backup_zip;
    global $input_disabled;
    global $run;
    global $mod_strings;
    $errors = array();
    // process "run" commands
    if (isset($_REQUEST['run']) && $_REQUEST['run'] != "") {
        $run = $_REQUEST['run'];
        $backup_dir = $_REQUEST['backup_dir'];
        $backup_zip = $_REQUEST['backup_zip'];
        if ($run == "confirm") {
            if ($backup_dir == "") {
                $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_ERROR'];
            }
            if ($backup_zip == "") {
                $errors[] = $mod_strings['LBL_BACKUP_FILENAME_ERROR'];
            }
            if (sizeof($errors) > 0) {
                return $errors;
            }
            if (!is_dir($backup_dir)) {
                if (!mkdir_recursive($backup_dir)) {
                    $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_EXISTS'];
                }
            }
            if (!is_writable($backup_dir)) {
                $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_NOT_WRITABLE'];
            }
            if (is_file("{$backup_dir}/{$backup_zip}")) {
                $errors[] = $mod_strings['LBL_BACKUP_FILE_EXISTS'];
            }
            if (is_dir("{$backup_dir}/{$backup_zip}")) {
                $errors[] = $mod_strings['LBL_BACKUP_FILE_AS_SUB'];
            }
            if (sizeof($errors) == 0) {
                $run = "confirmed";
                $input_disabled = "readonly";
            }
        } else {
            if ($run == "confirmed") {
                ini_set("memory_limit", "-1");
                ini_set("max_execution_time", "0");
                zip_dir(".", "{$backup_dir}/{$backup_zip}");
                $run = "done";
            }
        }
    }
    return $errors;
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:52,代码来源:Backups.php

示例3: display

    /**
     * @see SugarView::display()
     */
    public function display()
    {
        require_once 'include/utils/zip_utils.php';
        $form_action = "index.php?module=Administration&action=Backups";
        $backup_dir = "";
        $backup_zip = "";
        $run = "confirm";
        $input_disabled = "";
        global $mod_strings;
        $errors = array();
        // process "run" commands
        if (isset($_REQUEST['run']) && $_REQUEST['run'] != "") {
            $run = $_REQUEST['run'];
            $backup_dir = $_REQUEST['backup_dir'];
            $backup_zip = $_REQUEST['backup_zip'];
            if ($run == "confirm") {
                if ($backup_dir == "") {
                    $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_ERROR'];
                }
                if ($backup_zip == "") {
                    $errors[] = $mod_strings['LBL_BACKUP_FILENAME_ERROR'];
                }
                if (sizeof($errors) > 0) {
                    return $errors;
                }
                if (!is_dir($backup_dir)) {
                    if (!mkdir_recursive($backup_dir)) {
                        $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_EXISTS'];
                    }
                }
                if (!is_writable($backup_dir)) {
                    $errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_NOT_WRITABLE'];
                }
                if (is_file("{$backup_dir}/{$backup_zip}")) {
                    $errors[] = $mod_strings['LBL_BACKUP_FILE_EXISTS'];
                }
                if (is_dir("{$backup_dir}/{$backup_zip}")) {
                    $errors[] = $mod_strings['LBL_BACKUP_FILE_AS_SUB'];
                }
                if (sizeof($errors) == 0) {
                    $run = "confirmed";
                    $input_disabled = "readonly";
                }
            } else {
                if ($run == "confirmed") {
                    ini_set("memory_limit", "-1");
                    ini_set("max_execution_time", "0");
                    zip_dir(".", "{$backup_dir}/{$backup_zip}");
                    $run = "done";
                }
            }
        }
        if (sizeof($errors) > 0) {
            foreach ($errors as $error) {
                print "<font color=\"red\">{$error}</font><br>";
            }
        }
        if ($run == "done") {
            $size = filesize("{$backup_dir}/{$backup_zip}");
            print $mod_strings['LBL_BACKUP_FILE_STORED'] . " {$backup_dir}/{$backup_zip} ({$size} bytes).<br>\n";
            print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_BACKUP_BACK_HOME'] . "</a>\n";
        } else {
            ?>
        
            <?php 
            echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", $mod_strings['LBL_BACKUPS_TITLE']), false);
            echo $mod_strings['LBL_BACKUP_INSTRUCTIONS_1'];
            ?>
            <br>
            <?php 
            echo $mod_strings['LBL_BACKUP_INSTRUCTIONS_2'];
            ?>
<br>
            <form action="<?php 
            print $form_action;
            ?>
" method="post">
            <table>
            <tr>
                <td><?php 
            echo $mod_strings['LBL_BACKUP_DIRECTORY'];
            ?>
<br><i><?php 
            echo $mod_strings['LBL_BACKUP_DIRECTORY_WRITABLE'];
            ?>
</i></td>
                <td><input size="100" type="input" name="backup_dir" <?php 
            print $input_disabled;
            ?>
 value="<?php 
            print $backup_dir;
            ?>
"/></td>
            </tr>
            <tr>
                <td><?php 
            echo $mod_strings['LBL_BACKUP_FILENAME'];
//.........这里部分代码省略.........
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:101,代码来源:view.backups.php

示例4: finishDiag

function finishDiag()
{
    //BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
    global $cacheDir;
    global $curdatetime;
    global $sod_guid;
    global $mod_strings;
    chdir($cacheDir);
    zip_dir(".", "../diagnostic" . $curdatetime . ".zip");
    //END ZIP ALL FILES AND EXTRACT IN CACHE ROOT
    chdir(RETURN_FROM_DIAG_DIR);
    deleteDir($cacheDir);
    print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid={$sod_guid}&time={$curdatetime}&to_pdf=1\">" . $mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK'] . "</a><BR>";
    print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic" . $curdatetime . "&guid=" . $sod_guid . "\">" . $mod_strings['LBL_DIAGNOSTIC_DELETELINK'] . "</a><br>";
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:15,代码来源:DiagnosticRun.php

示例5: testExtractTwoIndividualFilesFromAnArchive

 /**
  * @depends testZipADirectory
  */
 public function testExtractTwoIndividualFilesFromAnArchive()
 {
     zip_dir($this->testdir . '/testarchive', $this->testdir . '/testarchive.zip');
     unzip_file($this->testdir . '/testarchive.zip', array('testfile2.txt', 'testfile3.txt'), $this->testdir . '/testarchiveoutput');
     $this->assertFalse(file_exists($this->testdir . '/testarchiveoutput/testfile1.txt'));
     $this->assertTrue(file_exists($this->testdir . '/testarchiveoutput/testfile2.txt'));
     $this->assertTrue(file_exists($this->testdir . '/testarchiveoutput/testfile3.txt'));
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:11,代码来源:ZipTest.php

示例6: exportProject

 function exportProject($package, $export = true, $clean = true)
 {
     $tmppath = "custom/modulebuilder/projectTMP/";
     if (file_exists($this->getPackageDir())) {
         if (mkdir_recursive($tmppath)) {
             copy_recursive($this->getPackageDir(), $tmppath . "/" . $this->name);
             $manifest = $this->getManifest(true, $export) . $this->exportProjectInstall($package, $export);
             $fp = sugar_fopen($tmppath . '/manifest.php', 'w');
             fwrite($fp, $manifest);
             fclose($fp);
             if (file_exists('modules/ModuleBuilder/MB/LICENSE.txt')) {
                 copy('modules/ModuleBuilder/MB/LICENSE.txt', $tmppath . '/LICENSE.txt');
             } else {
                 if (file_exists('LICENSE.txt')) {
                     copy('LICENSE.txt', $tmppath . '/LICENSE.txt');
                 }
             }
             $readme_contents = $this->readme;
             $readmefp = sugar_fopen($tmppath . '/README.txt', 'w');
             fwrite($readmefp, $readme_contents);
             fclose($readmefp);
         }
     }
     require_once 'include/utils/zip_utils.php';
     $date = date('Y_m_d_His');
     $zipDir = "custom/modulebuilder/packages/ExportProjectZips";
     if (!file_exists($zipDir)) {
         mkdir_recursive($zipDir);
     }
     $cwd = getcwd();
     chdir($tmppath);
     zip_dir('.', $cwd . '/' . $zipDir . '/project_' . $this->name . $date . '.zip');
     chdir($cwd);
     if ($clean && file_exists($tmppath)) {
         rmdir_recursive($tmppath);
     }
     if ($export) {
         header('Location:' . $zipDir . '/project_' . $this->name . $date . '.zip');
     }
     return $zipDir . '/project_' . $this->name . $date . '.zip';
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:41,代码来源:MBPackage.php

示例7: process


//.........这里部分代码省略.........
            $crud_single_view_file = str_replace("%%{$key}%%", $value, $crud_single_view_file);
        }
        // Checking/Creating plugin directory
        $plugin_dir = dirname(__FILE__) . '/plugins/' . $data['plugin_name_dash'] . '/';
        if (!is_dir($plugin_dir)) {
            mkdir($plugin_dir, 0777);
        }
        // Creating plugin main file
        file_put_contents($plugin_dir . $data['plugin_name_dash'] . '.php', $plugin_main_file);
        // Creating plugin uninstall file
        file_put_contents($plugin_dir . 'uninstall.php', $plugin_uninstall_file);
        // Creating plugin main file
        if (!is_dir($plugin_dir . 'includes/')) {
            mkdir($plugin_dir . 'includes/', 0777);
        }
        $crud_dir = $plugin_dir . 'includes/' . $data['crud_singular'] . '/';
        if (!is_dir($crud_dir)) {
            mkdir($crud_dir, 0777);
        }
        file_put_contents($crud_dir . 'class-' . $data['crud_singular'] . '-admin-menu.php', $crud_admin_menu_file);
        // Creating plugin main file
        file_put_contents($crud_dir . 'class-' . $data['crud_plural'] . '-list.php', $crud_wp_list_file);
        if (!is_dir($crud_dir . 'views/')) {
            mkdir($crud_dir . 'views/', 0777);
        }
        // Creating plugin main file
        file_put_contents($crud_dir . 'views/' . $data['crud_singular'] . '-list.php', $crud_list_view_file);
        // Creating plugin main file
        file_put_contents($crud_dir . 'views/' . $data['crud_singular'] . '-new.php', $crud_new_view_file);
        // Creating plugin main file
        file_put_contents($crud_dir . 'views/' . $data['crud_singular'] . '-edit.php', $crud_edit_view_file);
        // Creating plugin main file
        file_put_contents($crud_dir . 'views/' . $data['crud_singular'] . '-single.php', $crud_single_view_file);
        zip_dir($plugin_dir, $data['plugin_name_dash'] . '.zip', $download);
    } else {
        $data['crud_singular'] = strtolower($post_data['crud_singular']);
        $data['crud_singular_cap'] = ucwords($data['crud_singular']);
        $data['crud_plural'] = $data['crud_singular'] . 's';
        $data['crud_plural_cap'] = ucwords($data['crud_plural']);
        $data['plugin_name_dash'] = str_replace(' ', '-', $data['crud_singular']);
        $data['plugin_name_cap'] = ucwords($data['crud_singular']);
        $data['plugin_page'] = strtolower($data['plugin_name_dash']);
        $data['textdomain'] = $post_data['textdomain'];
        $data['prefix'] = $post_data['prefix'];
        // Deleting existing plugin or module files
        if (file_exists($data['plugin_name_dash'] . '.zip')) {
            unlink($data['plugin_name_dash'] . '.zip');
        }
        $dir = dirname(__FILE__) . '/plugins/';
        $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
        $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
        foreach ($ri as $file) {
            $file->isDir() ? rmdir($file) : unlink($file);
        }
        // Getting contents from stubs file
        $crud_admin_menu_file = file_get_contents(dirname(__FILE__) . '/stubs/class-crud-admin-menu.stub');
        $crud_wp_list_file = file_get_contents(dirname(__FILE__) . '/stubs/class-crud-list.stub');
        $crud_list_view_file = file_get_contents(dirname(__FILE__) . '/stubs/views/crud-list.stub');
        $crud_new_view_file = file_get_contents(dirname(__FILE__) . '/stubs/views/crud-new.stub');
        $crud_edit_view_file = file_get_contents(dirname(__FILE__) . '/stubs/views/crud-edit.stub');
        $crud_single_view_file = file_get_contents(dirname(__FILE__) . '/stubs/views/crud-single.stub');
        // Replacing wp_list_table file data
        $crud_wp_list_file = str_replace("%%column_default%%", $column_default, $crud_wp_list_file);
        $crud_wp_list_file = str_replace("%%columns%%", $columns, $crud_wp_list_file);
        $crud_wp_list_file = str_replace("%%sortable_columns%%", $sortable_columns, $crud_wp_list_file);
        $crud_wp_list_file = str_replace("%%form_submit_fields%%", $form_submit_fields, $crud_wp_list_file);
开发者ID:skyview059,项目名称:wp-generator,代码行数:67,代码来源:process.php

示例8: zip

 /**
 *	creates the zip of a package
 *		-in the future remove zip_utils dependency
 *
 **/
 function zip()
 {
     require_once 'include/utils/zip_utils.php';
     chdir($this->packageDir);
     if (!file_exists('../zips/')) {
         mkdir('../zips/', 0777, true);
     }
     zip_dir('.', '../zips/package' . $this->date . '.zip');
 }
开发者ID:jasondavis,项目名称:ZiPatcher,代码行数:14,代码来源:ZiPatcher.php

示例9: ini_set

        }
        if (is_file("{$backup_dir}/{$backup_zip}")) {
            $errors[] = $mod_strings['LBL_BACKUP_FILE_EXISTS'];
        }
        if (is_dir("{$backup_dir}/{$backup_zip}")) {
            $errors[] = $mod_strings['LBL_BACKUP_FILE_AS_SUB'];
        }
        if (sizeof($errors) == 0) {
            $run = "confirmed";
            $input_disabled = "readonly";
        }
    } else {
        if ($run == "confirmed") {
            ini_set("memory_limit", "-1");
            ini_set("max_execution_time", "0");
            zip_dir(".", "{$backup_dir}/{$backup_zip}");
            $run = "done";
        }
    }
}
if (sizeof($errors) > 0) {
    foreach ($errors as $error) {
        print "<font color=\"red\">{$error}</font><br>";
    }
}
if ($run == "done") {
    $size = filesize("{$backup_dir}/{$backup_zip}");
    print $mod_strings['LBL_BACKUP_FILE_STORED'] . " {$backup_dir}/{$backup_zip} ({$size} bytes).<br>\n";
    print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_BACKUP_BACK_HOME'] . "</a>\n";
} else {
    ?>
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:31,代码来源:Backups.php


注:本文中的zip_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。