本文整理汇总了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();
}
示例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);
}
示例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;
}
示例4: Folder
function __cleanUp()
{
$Cleanup = new Folder(TMP . 'tests/git');
if ($Cleanup->pwd() == TMP . 'tests/git') {
$Cleanup->delete();
}
}
示例5: tearDownFiles
/**
* Delete directory for upload test.
*
* @return void
*/
public function tearDownFiles()
{
//アップロードテストのためのディレクトリ削除
$folder = new Folder();
$folder->delete(TMP . 'tests' . DS . 'files');
unset($folder);
}
示例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);
}
示例7: tearDown
public function tearDown()
{
parent::tearDown();
// clean up test upload dir
$this->UploadFolder->delete();
unset($this->UploadFolder);
}
示例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);
}
示例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();
}
}
}
}
示例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;
}
示例11: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->Task);
$Folder = new Folder($this->path);
$Folder->delete();
}
示例12: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->Package);
$Folder = new Folder(TMP . DS . 'repos');
$Folder->delete();
parent::tearDown();
}
示例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();
}
示例14: endTest
function endTest()
{
App::import('Folder');
$folder = new Folder(FOUR_PLUGIN_LOCATION);
if (file_exists($folder->path)) {
$folder->delete();
}
}
示例15: endTest
function endTest()
{
$Cleanup = new Folder(TMP . 'tests/git');
if ($Cleanup->pwd() == TMP . 'tests/git') {
$Cleanup->delete();
}
unset($this->Source);
}