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


PHP Folder::delete方法代码示例

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


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

示例1: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $Folder = new Folder($this->Task->path . 'BakeTestApp');
     $Folder->delete();
     unset($this->Task);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:12,代码来源:ProjectTaskTest.php

示例2: tearDown

 /**
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $dir = new Folder(TMP . 'lock');
     $dir->delete();
     unset($this->Lock);
 }
开发者ID:uafrica,项目名称:delayed-jobs,代码行数:10,代码来源:LockTest.php

示例3: tearDown

 public function tearDown()
 {
     parent::tearDown();
     $testPluginFolder = new Folder(ROOT . DS . 'plugins' . DS . 'PluginInstallerTest');
     $testPluginFolder->delete();
     $testPluginConfigFolder = new Folder(ROOT . DS . 'config' . DS . 'Plugins' . DS . 'PluginInstallerTest');
     $testPluginConfigFolder->delete();
 }
开发者ID:mswagencia,项目名称:msw-appcore,代码行数:8,代码来源:PluginStarterTest.php

示例4: tearDown

 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Model);
     TableRegistry::clear();
     $folder = new Folder(WWW_ROOT . 'upload');
     $folder->delete(WWW_ROOT . 'upload');
 }
开发者ID:arourke,项目名称:Cake3-Upload,代码行数:13,代码来源:UploadBehaviorTest.php

示例5: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Task);
     $Folder = new Folder($this->path);
     $Folder->delete();
     Plugin::unload();
 }
开发者ID:alexunique0519,项目名称:Blog_Cakephp_association,代码行数:13,代码来源:ExtractTaskTest.php

示例6: removeAndCreateFolder

 private function removeAndCreateFolder($path)
 {
     $dir = new Folder($path);
     $dir->delete();
     $dir->create($path);
     $file = new File($path . DS . 'empty');
     $file->create();
 }
开发者ID:Jurrieb,项目名称:Eendagdeals,代码行数:8,代码来源:CacheShell.php

示例7: testExistTheme

 /**
  * Test exist theme plugin.
  *
  * @return void
  */
 public function testExistTheme()
 {
     $name = Configure::read('Theme.site');
     $path = $this->_paths[1] . $name;
     $this->_folder->create($path);
     $this->assertSame($path, Theme::exist($name));
     $this->_folder->delete($path);
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:13,代码来源:ThemeTest.php

示例8: createFileAndDeleteTmp

 private function createFileAndDeleteTmp($identifier, $filename)
 {
     $tmpFolder = new Folder($this->tmpChunkDir($identifier));
     $chunkFiles = $tmpFolder->read(true, true, true)[1];
     if ($this->createFileFromChunks($chunkFiles, $this->uploadFolder . DIRECTORY_SEPARATOR . $filename) && $this->deleteTmpFolder) {
         $tmpFolder->delete();
     }
 }
开发者ID:PhysikOnline-FFM,项目名称:riedbergtv-video-converter-script,代码行数:8,代码来源:Resumable.php

示例9: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->File->close();
     unset($this->File);
     $Folder = new Folder();
     $Folder->delete(TMP . 'tests/permissions');
 }
开发者ID:Slayug,项目名称:castor,代码行数:13,代码来源:FileTest.php

示例10: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Plugin::unload('ThemeInstallerTest');
     $testPluginFolder = new Folder(ROOT . DS . 'plugins' . DS . 'ThemeInstallerTest');
     $testPluginFolder->delete();
     $testPluginConfigFolder = new Folder(ROOT . DS . 'config' . DS . 'Plugins' . DS . 'ThemeInstallerTest');
     $testPluginConfigFolder->delete();
     $webrootThemeFolder = new Folder(WWW_ROOT . 'theme' . DS . 'ThemeInstallerTest');
     $webrootThemeFolder->delete();
 }
开发者ID:mswagencia,项目名称:msw-appcore,代码行数:11,代码来源:ThemeInstallerTest.php

示例11: testAddTestDirectoryRecursiveWithNonPhp

 /**
  * testAddTestDirectoryRecursiveWithNonPhp
  *
  * @return void
  */
 public function testAddTestDirectoryRecursiveWithNonPhp()
 {
     $this->skipIf(!is_writable(TMP), 'Cant addTestDirectoryRecursiveWithNonPhp unless the tmp folder is writable.');
     $Folder = new Folder(TMP . 'MyTestFolder', true, 0777);
     touch($Folder->path . DS . 'BackupTest.php~');
     touch($Folder->path . DS . 'SomeNotesTest.txt');
     touch($Folder->path . DS . 'NotHiddenTest.php');
     $suite = $this->getMock('Cake\\TestSuite\\TestSuite', ['addTestFile']);
     $suite->expects($this->exactly(1))->method('addTestFile');
     $suite->addTestDirectoryRecursive($Folder->pwd());
     $Folder->delete();
 }
开发者ID:Slayug,项目名称:castor,代码行数:17,代码来源:TestSuiteTest.php

示例12: deleteFolder

 /**
  * Delete folder action.
  *
  * @return \Cake\Network\Response|void
  */
 public function deleteFolder()
 {
     $path = $this->request->query('path');
     if ($this->request->is('post') && is_dir($path)) {
         $Folder = new Folder($path);
         if ($Folder->delete()) {
             $this->Flash->success(__d('file_manager', 'Folder successfully removed'));
         } else {
             $this->Flash->success(__d('file_manager', 'An error occurred while removing a folder'));
         }
     }
     return $this->redirect(['action' => 'browse']);
 }
开发者ID:Cheren,项目名称:union,代码行数:18,代码来源:ManagerController.php

示例13: afterDelete

 /**
  * afterDelete
  *
  * No need to use an adapter here, just delete the whole folder using cakes Folder class
  *
  * @param Event $event
  * @return boolean|null
  */
 public function afterDelete(Event $event)
 {
     if ($this->_checkEvent($event)) {
         $entity = $event->data['record'];
         $storageConfig = StorageManager::config($entity['adapter']);
         $path = $storageConfig['adapterOptions'][0] . $event->data['record']['path'];
         if (is_dir($path)) {
             $Folder = new Folder($path);
             $Folder->delete();
             $event->stopPropagation();
             $event->result = true;
             return true;
         }
         $event->stopPropagation();
         $event->result = false;
         return false;
     }
 }
开发者ID:tiagocapelli,项目名称:cakephp-file-storage,代码行数:26,代码来源:LocalFileStorageListener.php

示例14: handleChunk

 public function handleChunk()
 {
     $file = $this->request->file();
     $identifier = $this->_resumableParam('identifier');
     $filename = $this->_resumableParam('filename');
     $chunkNumber = $this->_resumableParam('chunkNumber');
     $chunkSize = $this->_resumableParam('chunkSize');
     $totalSize = $this->_resumableParam('totalSize');
     if (!$this->isChunkUploaded($identifier, $filename, $chunkNumber)) {
         $chunkFile = $this->tmpChunkDir($identifier) . DIRECTORY_SEPARATOR . $this->tmpChunkFilename($filename, $chunkNumber);
         $this->moveUploadedFile($file['tmp_name'], $chunkFile);
     }
     if ($this->isFileUploadComplete($filename, $identifier, $chunkSize, $totalSize)) {
         $tmpFolder = new Folder($this->tmpChunkDir($identifier));
         $chunkFiles = $tmpFolder->read(true, true, true)[1];
         $this->createFileFromChunks($chunkFiles, $this->uploadFolder . DIRECTORY_SEPARATOR . $filename);
         if ($this->deleteTmpFolder) {
             $tmpFolder->delete();
         }
     }
     return $this->response->header(200);
 }
开发者ID:xenolOnline,项目名称:resumable.php,代码行数:22,代码来源:Resumable.php

示例15: main

 /**
  * main method
  *
  * @param  string $tempDir an other directory to clear of all folders and files, if desired
  * @return void
  */
 public function main($tempDir = null)
 {
     if (empty($tempDir)) {
         $tempDir = Configure::read('Attachments.tmpUploadsPath');
     }
     if (!Folder::isAbsolute($tempDir)) {
         $this->out('The path must be absolute, "' . $tempDir . '" given.');
         exit;
     }
     $Folder = new Folder();
     if ($Folder->cd($tempDir) === false) {
         $this->out('Path "' . $tempDir . '" doesn\'t seem to exist.');
         exit;
     }
     $dir = new Folder($tempDir);
     $folders = $dir->read();
     $files = $dir->findRecursive();
     $deletedFiles = 0;
     $deletedFolders = 0;
     $this->out('Found ' . count($folders[0]) . ' folders and ' . count($files) . ' files');
     foreach ($files as $filePath) {
         $file = new File($filePath);
         // only delete if last change is longer than 24 hours ago
         if ($file->lastChange() < time() - 24 * 60 * 60 && $file->delete()) {
             $deletedFiles++;
         }
         $file->close();
     }
     foreach ($folders[0] as $folderName) {
         $folder = new Folder($dir->pwd() . $folderName);
         // only delete if folder is empty
         if ($folder->dirsize() === 0 && $folder->delete()) {
             $deletedFolders++;
         }
     }
     $this->out('Deleted ' . $deletedFolders . ' folders and ' . $deletedFiles . ' files.');
 }
开发者ID:cleptric,项目名称:cake-attachments,代码行数:43,代码来源:CleanTempShell.php


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