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


PHP FileUtils::deleteFolder方法代码示例

本文整理汇总了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;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:40,代码来源:Sync.php

示例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);
         }
     }
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:10,代码来源:DataTable.php

示例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;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:36,代码来源:Pagetree.php

示例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;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:24,代码来源:Pages.php


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