本文整理汇总了PHP中FileUtils::deleteFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::deleteFolder方法的具体用法?PHP FileUtils::deleteFolder怎么用?PHP FileUtils::deleteFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::deleteFolder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportAction
public function exportAction()
{
set_time_limit(0);
$config = Config::get();
$dbname = $config->database->name;
$dbuser = $config->database->user;
$dbpass = $config->database->password;
$dbhost = $config->database->host;
$outputDir = APPLICATION_ROOT;
$sqlSubDir = '__sql';
if (!file_exists($outputDir . $sqlSubDir) && !mkdir($outputDir . $sqlSubDir)) {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
die('Could not create output directory');
}
// dump database
$dbFilename = $sqlSubDir . '/' . $dbname . '.sql';
$command = "mysqldump -h {$dbhost} -u {$dbuser} -p{$dbpass} --add-drop-table --databases {$dbname} > {$outputDir}{$dbFilename}";
system($command);
// create zip file
$zipFilename = 'export_' . date('YmdHis') . '.zip';
$zip = new ZipArchive();
if ($zip->open($zipFilename, file_exists($zipFilename) ? \ZIPARCHIVE::OVERWRITE : \ZIPARCHIVE::CREATE) !== true) {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
die('Could not create zip file');
}
$this->zip($zip, array($dbFilename => $outputDir . $dbFilename, $outputDir . 'user-data/'));
$zip->close();
// encrypt zip
$encryptedFilename = $zipFilename . '.enc';
$command = "openssl enc -aes-256-cbc -pass pass:" . $config->sync->secret . " < {$outputDir}{$zipFilename} > {$outputDir}{$encryptedFilename}";
system($command);
// send file contents
header('Content-Length: ' . filesize($outputDir . $encryptedFilename));
$this->sendFileContents($outputDir . $encryptedFilename);
// clean up
FileUtils::deleteFolder($outputDir . $sqlSubDir);
FileUtils::deleteFile($outputDir . $zipFilename);
FileUtils::deleteFile($outputDir . $encryptedFilename);
die;
}
示例2: deleteImageDir
public function deleteImageDir($row_id)
{
$image_dir = $this->getImageDir($row_id);
if ($image_dir !== false && $image_dir != '') {
$image_dir = trim($image_dir, DIRECTORY_SEPARATOR);
if (is_dir($image_dir)) {
FileUtils::deleteFolder($image_dir);
}
}
}
示例3: switchTemplate
private function switchTemplate($page_id, $new_template_id, $properties = null)
{
if ($properties === null) {
$properties = $this->pages->getProperties($page_id);
}
if ($properties !== null && $properties !== false) {
$old_template_id = $properties['template-id'];
if ($new_template_id != $old_template_id) {
// Ver�ffentlichte Seite samt Dateien l�schen
$published_folder = $this->pages->getPagePublishedFolder($page_id, $properties);
$published_data_file = $published_folder . Pages::DATA_FILE_NAME;
$published_files_folder = $published_folder . Pages::PAGE_FILES_FOLDER_NAME;
if (file_exists($published_data_file)) {
FileUtils::deleteFile($published_data_file);
}
if (file_exists($published_files_folder)) {
FileUtils::deleteFolder($published_files_folder);
}
// Bearbeitete Seite samt Dateien l�schen
$edit_folder = $this->pages->getPageeditFolder($page_id, $properties);
$edit_data_file = $edit_folder . Pages::DATA_FILE_NAME;
$edit_files_folder = $edit_folder . Pages::PAGE_FILES_FOLDER_NAME;
if (file_exists($edit_data_file)) {
FileUtils::deleteFile($edit_data_file);
}
if (file_exists($edit_files_folder)) {
FileUtils::deleteFolder($edit_files_folder);
}
// ge�nderte Eigenschaften setzen
$edit_properties = array('template-id' => $new_template_id, 'last-change-date' => time(), 'last-change-user-id' => Auth::getUserId(), 'last-change-user-name' => Auth::getScreenName(), 'status' => Pages::STATUS_NEW);
$this->pages->setProperties($page_id, $edit_properties);
return true;
}
}
return false;
}
示例4: publish
public function publish($id)
{
$properties = $this->getProperties($id);
if ($properties === false) {
return false;
}
$res = true;
if ($properties['status'] != self::STATUS_PUBLISHED) {
$published_folder = $this->getPagePublishedFolder($id, $properties);
$edit_folder = $this->getPageEditFolder($id, $properties);
if (file_exists($edit_folder)) {
if (file_exists($published_folder)) {
FileUtils::deleteFolder($published_folder);
}
FileUtils::rename($edit_folder, $published_folder);
}
$new_properties = array('status' => self::STATUS_PUBLISHED, 'last-publish-date' => time());
$res = $this->setProperties($id, $new_properties);
}
$parameters = array('pageId' => $id);
$data = null;
Plugins::call(Plugins::PUBLISH_PAGE, $parameters, $data);
return $res;
}