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


PHP Filesystem::removeFolder方法代码示例

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


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

示例1: generatePDF

 function generatePDF()
 {
     // tempfolder
     $tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (is_dir($tmpFolder)) {
         Filesystem::removeFolder($tmpFolder);
     }
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     //Get site
     Requirements::clear();
     $link = Director::absoluteURL($this->pdfLink() . "/?view=1");
     $response = Director::test($link);
     $content = $response->getBody();
     $content = utf8_decode($content);
     $contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
     if (!file_exists($contentfile)) {
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $content);
             fclose($fh);
         }
     }
     return $contentfile;
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:28,代码来源:ShopInvoice.php

示例2: tearDown

 public function tearDown()
 {
     AssetStoreTest_SpyStore::reset();
     SS_Filesystem::removeFolder($this->getBasePath());
     parent::tearDown();
     Config::unnest();
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:7,代码来源:FileMigrationHelperTest.php

示例3: rebuildCache

 /**
  * Rebuilds the static cache for the pages passed through via $urls
  * @param array $urls The URLs of pages to re-fetch and cache.
  */
 function rebuildCache($urls, $removeAll = true)
 {
     if (!is_array($urls)) {
         return;
     }
     // $urls must be an array
     if (!Director::is_cli()) {
         echo "<pre>\n";
     }
     echo "Rebuilding cache.\nNOTE: Please ensure that this page ends with 'Done!' - if not, then something may have gone wrong.\n\n";
     $page = singleton('Page');
     foreach ($urls as $i => $url) {
         $url = Director::makeRelative($url);
         if (substr($url, -1) == '/') {
             $url = substr($url, 0, -1);
         }
         $urls[$i] = $url;
     }
     $urls = array_unique($urls);
     if ($removeAll && file_exists("../cache")) {
         echo "Removing old cache... \n";
         flush();
         Filesystem::removeFolder("../cache", true);
         echo "done.\n\n";
     }
     echo "Republishing " . sizeof($urls) . " urls...\n\n";
     $page->publishPages($urls);
     echo "\n\n== Done! ==";
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:33,代码来源:RebuildStaticCacheTask.php

示例4: complete

 /**
  * Completes the job by zipping up the generated export and creating an
  * export record for it.
  */
 protected function complete()
 {
     $siteTitle = SiteConfig::current_site_config()->Title;
     $filename = preg_replace('/[^a-zA-Z0-9-.+]/', '-', sprintf('%s-%s.zip', $siteTitle, date('c')));
     $dir = Folder::findOrMake(SiteExportExtension::EXPORTS_DIR);
     $dirname = ASSETS_PATH . '/' . SiteExportExtension::EXPORTS_DIR;
     $pathname = "{$dirname}/{$filename}";
     SiteExportUtils::zip_directory($this->tempDir, "{$dirname}/{$filename}");
     Filesystem::removeFolder($this->tempDir);
     $file = new File();
     $file->ParentID = $dir->ID;
     $file->Title = $siteTitle . ' ' . date('c');
     $file->Filename = $dir->Filename . $filename;
     $file->write();
     $export = new SiteExport();
     $export->ParentClass = $this->rootClass;
     $export->ParentID = $this->rootId;
     $export->Theme = $this->theme;
     $export->BaseUrlType = ucfirst($this->baseUrlType);
     $export->BaseUrl = $this->baseUrl;
     $export->ArchiveID = $file->ID;
     $export->write();
     if ($this->email) {
         $email = new Email();
         $email->setTo($this->email);
         $email->setTemplate('SiteExportCompleteEmail');
         $email->setSubject(sprintf('Site Export For "%s" Complete', $siteTitle));
         $email->populateTemplate(array('SiteTitle' => $siteTitle, 'Link' => $file->getAbsoluteURL()));
         $email->send();
     }
 }
开发者ID:rodneyway,项目名称:silverstripe-siteexporter,代码行数:35,代码来源:SiteExportJob.php

示例5: tearDown

 public function tearDown()
 {
     SecurityToken::enable();
     $this->folder->deleteDatabaseOnly();
     Filesystem::removeFolder($this->folder->getFullPath());
     parent::tearDown();
 }
开发者ID:camfindlay,项目名称:silverstripe-versionedfiles,代码行数:7,代码来源:VersionedFileTest.php

示例6: tearDown

 public function tearDown()
 {
     if ($this->origBackend) {
         Image::set_backend($this->origBackend);
     }
     // Remove the test files that we've created
     $fileIDs = $this->allFixtureIDs('Image');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('Image', $fileID);
         if ($file && file_exists(BASE_PATH . "/{$file->Filename}")) {
             unlink(BASE_PATH . "/{$file->Filename}");
         }
     }
     // Remove the test folders that we've created
     $folderIDs = $this->allFixtureIDs('Folder');
     foreach ($folderIDs as $folderID) {
         $folder = DataObject::get_by_id('Folder', $folderID);
         if ($folder && file_exists(BASE_PATH . "/{$folder->Filename}")) {
             Filesystem::removeFolder(BASE_PATH . "/{$folder->Filename}");
         }
         if ($folder && file_exists(BASE_PATH . "/" . $folder->Filename . "_resampled")) {
             Filesystem::removeFolder(BASE_PATH . "/" . $folder->Filename . "_resampled");
         }
     }
     parent::tearDown();
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:26,代码来源:ImageTest.php

示例7: tearDown

 public function tearDown()
 {
     parent::tearDown();
     ErrorPage::config()->static_filepath = $this->orig['ErrorPage_staticfilepath'];
     Filesystem::removeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     Filesystem::removeFolder($this->tmpAssetsPath);
     Config::inst()->update('Director', 'environment_type', $this->origEnvType);
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:8,代码来源:ErrorPageTest.php

示例8: tearDown

 function tearDown()
 {
     parent::tearDown();
     ErrorPage::set_static_filepath($this->orig['ErrorPage_staticfilepath']);
     Director::set_environment_type($this->orig['Director_environmenttype']);
     Filesystem::removeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     Filesystem::removeFolder($this->tmpAssetsPath);
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:8,代码来源:ErrorPageTest.php

示例9: tearDown

 function tearDown()
 {
     unlink($this->img1->getFullPath());
     unlink($this->img2->getFullPath());
     // Remove the assets/ folder if it was created during {@link self::setUp()}
     if ($this->createdAssetsFolder) {
         Filesystem::removeFolder(ASSETS_PATH);
     }
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:9,代码来源:ProductImageTest.php

示例10: tearDown

 function tearDown()
 {
     parent::tearDown();
     Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
     FilesystemPublisher::$domain_based_caching = $this->orig['domain_based_caching'];
     if (file_exists(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder')) {
         Filesystem::removeFolder(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder');
     }
 }
开发者ID:nzjoel,项目名称:silverstripe-cms,代码行数:9,代码来源:FilesystemPublisherTest.php

示例11: tearDown

 public function tearDown()
 {
     parent::tearDown();
     SiteTree::remove_extension("FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
     Config::inst()->update('FilesystemPublisher', 'domain_based_caching', $this->orig['domain_based_caching']);
     if (file_exists(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder')) {
         Filesystem::removeFolder(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder');
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-staticpublisher,代码行数:9,代码来源:FilesystemPublisherTest.php

示例12: tearDown

 public function tearDown()
 {
     Injector::unnest();
     SS_Datetime::clear_mock_now();
     if ($this->envPath) {
         Filesystem::removeFolder($this->envPath);
         $this->envPath = null;
     }
     parent::tearDown();
 }
开发者ID:ss23,项目名称:deploynaut,代码行数:10,代码来源:DeploynautTest.php

示例13: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Config::inst()->unnest();
     SiteTree::remove_extension("FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
     if (file_exists(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder')) {
         Filesystem::removeFolder(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder');
     }
     // Purge DB from StaticPagesQueue items.
     self::empty_temp_db();
 }
开发者ID:spark-green,项目名称:silverstripe-staticpublishqueue,代码行数:11,代码来源:FilesystemPublisherTest.php

示例14: tearDown

 public function tearDown()
 {
     if ($this->rootDir) {
         Filesystem::removeFolder($this->rootDir);
         $this->rootDir = null;
     }
     if ($this->originalServer) {
         $_SERVER = $this->originalServer;
         $this->originalServer = null;
     }
     parent::tearDown();
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:12,代码来源:AssetAdapterTest.php

示例15: export

 function export()
 {
     if ($_REQUEST['baseurl']) {
         $base = $_REQUEST['baseurl'];
         if (substr($base, -1) != '/') {
             $base .= '/';
         }
         Director::setBaseURL($base);
     }
     $folder = '/tmp/static-export/' . project();
     if (!project()) {
         $folder .= 'site';
     }
     if (!file_exists($folder)) {
         mkdir($folder, Filesystem::$folder_create_mask, true);
     }
     $f1 = Director::baseFolder() . '/assets';
     $f2 = Director::baseFolder() . '/' . project();
     `cd {$folder}; ln -s {$f1}; ln -s {$f2}`;
     $baseFolder = basename($folder);
     if ($folder && file_exists($folder)) {
         $pages = DataObject::get("SiteTree");
         foreach ($pages as $page) {
             $subfolder = "{$folder}/{$page->URLSegment}";
             $contentfile = "{$folder}/{$page->URLSegment}/index.html";
             // Make the folder
             if (!file_exists($subfolder)) {
                 mkdir($subfolder, Filesystem::$folder_create_mask);
             }
             // Run the page
             Requirements::clear();
             $controllerClass = "{$page->class}_Controller";
             if (class_exists($controllerClass)) {
                 $controller = new $controllerClass($page);
                 $pageContent = $controller->run(array());
                 // Write to file
                 if ($fh = fopen($contentfile, 'w')) {
                     fwrite($fh, $pageContent->getBody());
                     fclose($fh);
                 }
             }
         }
         copy("{$folder}/home/index.html", "{$folder}/index.html");
         `cd /tmp/static-export; tar -czhf {$baseFolder}.tar.gz {$baseFolder}`;
         $content = file_get_contents("/tmp/static-export/{$baseFolder}.tar.gz");
         Filesystem::removeFolder('/tmp/static-export');
         HTTP::sendFileToBrowser($content, "{$baseFolder}.tar.gz");
         return null;
     } else {
         echo _t('StaticExporter.ONETHATEXISTS', "Please specify a folder that exists");
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:52,代码来源:StaticExporter.php


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