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


PHP Folder::delete方法代码示例

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


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

示例1: execute

 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     if (isset($this->params[self::KEY_APACHE_OWNER])) {
         $owner = Hash::get($this->params, self::KEY_APACHE_OWNER);
         $writables = array(APP . 'Config', APP . 'tmp', ROOT . DS . 'composer.json', ROOT . DS . 'bower.json');
         foreach ($writables as $file) {
             $messages = array();
             $ret = null;
             $cmd = sprintf('`which chown` %s -R %s 2>&1', $owner, $file);
             exec($cmd, $messages, $ret);
         }
     }
     if (array_key_exists(self::KEY_RELEASE, $this->params)) {
         $path = ROOT . DS . 'app' . DS . 'Plugin' . DS;
         $plugins = array_unique(array_merge(App::objects('plugins'), array_map('basename', glob($path . '*', GLOB_ONLYDIR))));
         $folder = new Folder();
         foreach ($plugins as $plugin) {
             $folder->delete($path . $plugin . DS . '.git');
         }
         $folder->delete(ROOT . DS . '.git');
         $folder->delete(ROOT . DS . '.chef');
     }
     Configure::write('NetCommons.installed', true);
     $this->InstallUtil->saveAppConf();
 }
开发者ID:s-nakajima,项目名称:install,代码行数:32,代码来源:InstallFinishTask.php

示例2: endTest

 function endTest()
 {
     $folder = new Folder(TMP);
     $folder->delete(ROOT . DS . APP_DIR . DS . 'webroot' . DS . 'files' . DS . 'test_upload');
     $folder->delete(ROOT . DS . APP_DIR . DS . 'tmp' . DS . 'tests' . DS . 'path');
     Classregistry::flush();
     unset($this->TestUpload);
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:8,代码来源:UploadTest.php

示例3: initialAppPath

 /**
  * Make sure if the $appPath exists and copy the skel to there
  * @param string $appPath
  */
 public function initialAppPath($appPath)
 {
     App::uses('Folder', 'Utility');
     $fh = new Folder();
     if (file_exists($appPath)) {
         if (false === $fh->delete($appPath)) {
             $this->errorMessage = __('Target path exists. But the program could not delete the folder automatically');
             return false;
         } else {
             $this->tasks[] = array('title' => __('Target path exists. Delete the old folders.'), 'operactions' => $fh->messages());
         }
     }
     /*
      * Copy the skelecton of the application
      */
     $fh->copy(array('to' => $appPath, 'from' => VENDORS . 'olc_baker' . DS . 'skels' . DS . 'default', 'mode' => 0777));
     $errors1 = $fh->errors();
     $fh->copy(array('to' => $appPath . DS . 'cake2' . DS . 'lib', 'from' => CAKE_CORE_INCLUDE_PATH, 'mode' => 0777));
     $errors2 = $fh->errors();
     if (!empty($errors1) || !empty($errors2)) {
         $this->errorMessage = __('The program could not copy files to the folder automatically');
         return false;
     } else {
         $this->tasks[] = array('title' => __('Copy the skelecton of application to the target path'), 'operactions' => $fh->messages());
     }
     return true;
 }
开发者ID:kiang,项目名称:olc_baker,代码行数:31,代码来源:Project.php

示例4: Folder

 function __cleanUp()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:7,代码来源:post_receive.test.php

示例5: tearDownFiles

 /**
  * Delete directory for upload test.
  *
  * @return void
  */
 public function tearDownFiles()
 {
     //アップロードテストのためのディレクトリ削除
     $folder = new Folder();
     $folder->delete(TMP . 'tests' . DS . 'files');
     unset($folder);
 }
开发者ID:Onasusweb,项目名称:Files,代码行数:12,代码来源:FilesModelTestBase.php

示例6: Folder

 /**
  * Remove a pasta .git
  */
 function _excludeGitFolder($pluginPath)
 {
     App::import('Folder');
     $gitFolder = $pluginPath . DS . '.git' . DS;
     $folder = new Folder($gitFolder, false);
     $folder->delete($gitFolder);
 }
开发者ID:rodrigorm,项目名称:plugin_manager,代码行数:10,代码来源:git.php

示例7: tearDown

 public function tearDown()
 {
     parent::tearDown();
     // clean up test upload dir
     $this->UploadFolder->delete();
     unset($this->UploadFolder);
 }
开发者ID:fm-labs,项目名称:cakephp-media,代码行数:7,代码来源:MediaUploaderTest.php

示例8: tearDown

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

示例9: main

 /**
  * The main method: where things happen
  * 
  * @access public
  */
 function main()
 {
     if (isset($this->params['quiet'])) {
         $this->quiet = true;
     }
     $tmp = new Folder(TMP);
     $folders = reset($tmp->read());
     // read only directories (array[0])
     foreach ($folders as $folder) {
         $tmp->cd(TMP);
         $tmp->cd($folder);
         $files = end($tmp->read());
         // read only files (array[1])
         if (in_array('last_interaction', $files)) {
             $file_interaction = (int) file_get_contents($tmp->pwd() . DS . 'last_interaction');
             // as each piece is 1Mb, this will give the user the chance of uploading at 13,7 kbps (1,7 kb/s)
             if (time() - $file_interaction > 600) {
                 $this->out("Removing {$folder}");
                 foreach ($files as $file) {
                     unlink($tmp->pwd() . DS . $file);
                 }
                 $tmp->delete();
             }
         }
     }
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:31,代码来源:upload_gc.php

示例10: main

 /**
  * Performs the initial git-svn clone of plugins.
  *
  * This shell grabs plugins that require their initial clone in the order
  * they were requested, and clones them from the WordPress SVN repository.
  *
  * If unspecified, a maximum of 5 plugins will be cloned with one run.
  *
  * @return int Shell return code.
  */
 function main()
 {
     $max = 5;
     if (isset($this->args[0]) && is_numeric($this->args[0]) && $this->args[0] > 0) {
         $max = (int) $this->args[0];
     }
     $plugins = $this->Plugin->findByState('cloning', array('contain' => array('PluginsState' => array('State')), 'order' => array('InnerPluginsState.modified'), 'limit' => $max));
     if (count($plugins) == 0) {
         $this->out(__('<info>No plugins need to be cloned.</info>'));
         $this->_unlock();
         return 0;
     }
     $this->out(__('Cloning %d plugins...', count($plugins)));
     $dir = new Folder(TMP . 'git', true, 0755);
     $error = implode(', ', $dir->errors());
     if (!empty($error)) {
         $this->_unlock();
         $this->error(__('Filesystem Error'), __('Failed to create git clone directory: %s', $error));
     }
     $dir = new Folder(TMP . 'logs' . DS . 'git', true, 0755);
     $error = implode(', ', $dir->errors());
     if (!empty($error)) {
         $this->_unlock();
         $this->error(__('Filesystem Error'), __('Failed to create git logs directory: %s', $error));
     }
     foreach ($plugins as $plugin) {
         $this->out(__('Cloning: "%s" (%d)', $plugin['Plugin']['slug'], $plugin['Plugin']['id']));
         $svn_url = sprintf(Configure::read('App.plugin_svn_url'), $plugin['Plugin']['slug']);
         $git_path = sprintf(Configure::read('App.plugin_repo_path'), $plugin['Plugin']['slug']);
         $log_path = TMP . 'logs' . DS . 'git' . DS . $plugin['Plugin']['slug'] . '.log';
         // Clear out any existing git-svn clone attempt that failed before.
         $git_dir = new Folder($git_path);
         $git_dir->delete();
         try {
             $this->_exec('git svn clone -qq --prefix=svn/ -s %s %s >> %s 2>&1', $svn_url, $git_path, $log_path);
         } catch (RuntimeException $e) {
             $this->out(__('<warning>Failed to clone "%s", please check the git log file.</warning>', $plugin['Plugin']['slug']));
             $this->PluginsState->touch($plugin['InnerPluginsState']['id']);
             continue;
         }
         if (!$this->_createGithubRepo($plugin['Plugin']['slug'])) {
             $this->PluginsState->touch($plugin['InnerPluginsState']['id']);
             continue;
         }
         if (!$this->PluginsState->findOrCreate($plugin['Plugin']['id'], 'cloned') || !$this->PluginsState->findOrCreate($plugin['Plugin']['id'], 'updating')) {
             $this->out(__('<warning>Failed marking plugin as cloned.</warning>'));
             // Even though this plugin cloned successfully, if we can't
             // mark it as cloned, we don't want it to slip into limbo, so
             // we'll let it attempt to do the full clone all over again.
             $this->PluginsState->touch($plugin['InnerPluginsState']['id']);
             continue;
         }
         if (!$this->PluginsState->delete($plugin['InnerPluginsState']['id'])) {
             $this->out(__('<warning>Failed removing "cloning" state on cloned plugin.</warning>'));
         }
     }
     $this->out(__('<info>Finished cloning plugins.</info>'));
     $this->_unlock();
     return 0;
 }
开发者ID:hasannawaz,项目名称:pluginmirror,代码行数:70,代码来源:CloneShell.php

示例11: tearDown

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

示例12: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Package);
     $Folder = new Folder(TMP . DS . 'repos');
     $Folder->delete();
     parent::tearDown();
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:12,代码来源:PackageTest.php

示例13: afterDelete

 public function afterDelete()
 {
     parent::afterDelete();
     $files = new Folder('files/Disography/' . $this->id);
     $files->delete();
     $cover = new Folder('files/Cover/' . $this->id);
     $cover->delete();
 }
开发者ID:thedrumz,项目名称:music,代码行数:8,代码来源:Discography.php

示例14: endTest

 function endTest()
 {
     App::import('Folder');
     $folder = new Folder(FOUR_PLUGIN_LOCATION);
     if (file_exists($folder->path)) {
         $folder->delete();
     }
 }
开发者ID:rodrigorm,项目名称:plugin_manager,代码行数:8,代码来源:installer.test.php

示例15: endTest

 function endTest()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
     unset($this->Source);
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:8,代码来源:source_controller.test.php


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