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


PHP main::remove方法代码示例

本文整理汇总了PHP中main::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP main::remove方法的具体用法?PHP main::remove怎么用?PHP main::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在main的用法示例。


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

示例1: run

 public function run()
 {
     try {
         main::log(lang::get('Start Backup process...', false));
         $this->init();
         $db_param = $this->getDBParams();
         $mysql = $this->incMysql();
         if (isset($this->params['optimize'])) {
             main::log(lang::get('Optimize Database Tables', false));
             $mysql->optimize();
         }
         $mysql->backup($this->db_file);
         if (filesize($this->db_file) == 0) {
             throw new Exception(lang::get('Error in create dump Database: Chance of a lack of rights for the backup.', fale));
         } else {
             $size_dump = round(filesize($this->db_file) / 1024 / 1024, 2);
             main::log(str_replace('%s', $size_dump, lang::get('Database Dump was successfully created( %s Mb):', false)) . str_replace(ABSPATH, '', $this->db_file));
         }
         $files = $this->createListFiles();
         $files[] = $this->db_file;
         if (($n = count($files)) > 0) {
             include main::getPluginDir() . "/libs/pclzip.lib.php";
             $archive = $this->dir_backup . '/' . $this->getArchive($this->name);
             $zip = new PclZip($archive);
             main::log(lang::get('Add files to Backup', false));
             main::log(lang::get('Create part ', false) . basename($archive));
             for ($i = 0; $i < $n; $i++) {
                 if (file_exists($archive) && filesize($archive) > $this->max_size_archive) {
                     unset($zip);
                     $archive = $this->dir_backup . '/' . $this->getNextArchive($this->name);
                     main::log(lang::get('Create part ', false) . basename($archive));
                     $zip = new PclZip($archive);
                 }
                 $zip->add($files[$i], PCLZIP_OPT_REMOVE_PATH, ABSPATH);
                 $this->saveMd5($files[$i], $archive);
             }
             // delete dump db
             main::log(lang::get('Remove dump Database with folder', false));
             main::remove($this->db_file);
             $dirs = readDirectrory($this->dir_backup, array('.zip', '.md5'));
             $size = 0;
             if (($n = count($dirs)) > 0) {
                 for ($i = 0; $i < $n; $i++) {
                     $size += filesize($dirs[$i]);
                     $dirs[$i] = basename($dirs[$i]);
                 }
             }
             $sizeMb = round($size / 1024 / 1024, 2);
             // MB
             main::log(str_replace('%s', $sizeMb, lang::get('Backup created is finish ( %s Mb)', false)));
             $this->dirs = $dirs;
             $this->size = $size;
         }
     } catch (Exception $e) {
         $this->setError($e->message);
     }
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:57,代码来源:backup.php

示例2: local

 private function local()
 {
     $this->files = readDirectrory(BACKUP_DIR . '/' . $this->params['name'], array('.zip'));
     include main::getPluginDir() . '/libs/pclzip.lib.php';
     if (($n = count($this->files)) > 0) {
         for ($i = 0; $i < $n; $i++) {
             main::log(str_replace('%s', basename($this->files[$i]), lang::get("Data decompression: %s", false)));
             $this->archive = new PclZip($this->files[$i]);
             $file_in_zip = $this->archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
         }
         if (file_exists(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql')) {
             main::log(lang::get("Run process restore Database", false));
             $mysql = $this->incMysql();
             $mysql->restore(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
             main::log(lang::get("Stopped process restore Database", false));
             main::remove(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
         }
     }
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:19,代码来源:recover.php


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