本文整理汇总了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);
}
}
示例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');
}
}
}