本文整理汇总了PHP中Ak::directory_delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::directory_delete方法的具体用法?PHP Ak::directory_delete怎么用?PHP Ak::directory_delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::directory_delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_should_update_plugin
function test_should_update_plugin()
{
Ak::directory_delete(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib');
$this->assertFalse(file_exists(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib'.DS.'ActsAsVersioned.php'));
$this->PluginManager->updatePlugin('acts_as_versioned');
$this->assertTrue(file_exists(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib'.DS.'ActsAsVersioned.php'));
}
示例2: clearAll
public function clearAll()
{
if (AK_LOG_EVENTS) {
$Logger =& Ak::getLogger();
$Logger->message('Clearing all database settings from cache');
}
Ak::directory_delete(AkDbSchemaCache::getCacheDir());
}
示例3: Test_directory_delete
function Test_directory_delete()
{
$this->assertFalse(!Ak::directory_delete('ak_test_folder'));
$this->assertFalse(Ak::directory_delete('../../'));
$this->assertFalse(Ak::directory_delete('..\\..\\'));
$this->assertFalse(Ak::directory_delete(' '));
$this->assertFalse(Ak::directory_delete('/'));
$this->assertFalse(Ak::directory_delete('./'));
}
示例4: directory_delete
function directory_delete($dir_name, $options = array())
{
$default_options = array('ftp' => defined('AK_DELETE_FILES_USING_FTP') && AK_DELETE_FILES_USING_FTP, 'base_path' => AK_BASE_DIR);
$options = array_merge($default_options, $options);
$sucess = true;
$dir_name = Ak::_getRestrictedPath($dir_name, $options);
if (empty($dir_name)) {
return false;
}
if ($options['ftp']) {
require_once AK_LIB_DIR . DS . 'AkFtp.php';
return AkFtp::delete($dir_name);
} else {
$items = glob($options['base_path'] . DS . $dir_name . "/*");
$hidden_items = glob($options['base_path'] . DS . $dir_name . "/.*");
$fs_items = $items || $hidden_items ? array_merge((array) $items, (array) $hidden_items) : false;
if ($fs_items) {
$items_to_delete = array('directories' => array(), 'files' => array());
foreach ($fs_items as $fs_item) {
if ($fs_item[strlen($fs_item) - 1] != '.') {
$items_to_delete[is_dir($fs_item) ? 'directories' : 'files'][] = $fs_item;
}
}
foreach ($items_to_delete['files'] as $file) {
Ak::file_delete($file, $options);
}
foreach ($items_to_delete['directories'] as $directory) {
$sucess = $sucess ? Ak::directory_delete($directory, $options) : $sucess;
}
}
return $sucess ? @rmdir($options['base_path'] . DS . $dir_name) : $sucess;
}
}
示例5: directory_delete
function directory_delete($dir_name, $options = array())
{
$default_options = array('ftp' => defined('AK_DELETE_FILES_USING_FTP') && AK_DELETE_FILES_USING_FTP, 'base_path' => AK_BASE_DIR);
$options = array_merge($default_options, $options);
$sucess = true;
$dir_name = str_replace('..', '', rtrim($dir_name, '\\/. '));
if ($dir_name == '') {
return false;
}
$dir_name = trim(str_replace($options['base_path'], '', $dir_name), DS);
if ($options['ftp']) {
require_once AK_LIB_DIR . DS . 'AkFtp.php';
$dir_name = trim(str_replace(array(DS, '//'), array('/', '/'), $dir_name), '/');
return AkFtp::delete($dir_name);
} else {
if ($fs_items = glob($options['base_path'] . DS . $dir_name . "/*")) {
$items_to_delete = array('directories' => array(), 'files' => array());
foreach ($fs_items as $fs_item) {
$items_to_delete[is_dir($fs_item) ? 'directories' : 'files'][] = $fs_item;
}
foreach ($items_to_delete['files'] as $file) {
Ak::file_delete($file, $options);
}
foreach ($items_to_delete['directories'] as $directory) {
$sucess = $sucess ? Ak::directory_delete($directory, $options) : $sucess;
}
return $sucess;
}
return rmdir($options['base_path'] . DS . $dir_name);
}
}
示例6: test_remove_plugin
function test_remove_plugin()
{
Ak::directory_delete(AK_PLUGINS_DIR . DS . 'acts_as_versioned');
}
示例7: test_should_delete_nested_directories_when_include_hidden_files
public function test_should_delete_nested_directories_when_include_hidden_files()
{
$tmp_dir = AK_TMP_DIR . DS . Ak::randomString();
$hidden_tmp_dir = $tmp_dir . DS . '.hidden';
Ak::make_dir($tmp_dir, array('base_path' => AK_TMP_DIR));
Ak::make_dir($tmp_dir . DS . '.hidden', array('base_path' => AK_TMP_DIR));
$this->assertTrue(is_dir($hidden_tmp_dir), 'Could not create test directory ' . $hidden_tmp_dir);
$this->assertTrue(Ak::directory_delete($tmp_dir, array('base_path' => AK_TMP_DIR)));
clearstatcache();
$this->assertFalse(is_dir($tmp_dir));
}
示例8: uninstallPlugin
/**
* Uninstalls an existing plugin
*
* Plugins can have an Akelos installer at located at "plugin_name/installer/plugin_name_installer.php"
* If the installer is available, it will run the "PluginNameInstaller::uninstall()" method, which will trigger
* all the down_* methods for the installer.
*
* @param string $plugin_name Plugin name
* @return void
* @access public
*/
function uninstallPlugin($plugin_name)
{
$plugin_name = Ak::sanitize_include($plugin_name, 'high');
$this->_runInstaller($plugin_name, 'uninstall');
Ak::directory_delete(AK_PLUGINS_DIR.DS.$plugin_name);
if($this->_shouldUseSvnExternals()){
$this->_uninstallExternals($plugin_name);
}
}
示例9: test_should_delete_nested_directories_when_include_hidden_files
function test_should_delete_nested_directories_when_include_hidden_files()
{
$dir_name = AK_TMP_DIR . Ak::randomString();
Ak::make_dir($dir_name);
Ak::make_dir($dir_name . DS . '.hidden');
$this->assertTrue(is_dir($dir_name), 'Could not create test directory ' . $dir_name);
$this->assertTrue(Ak::directory_delete($dir_name));
clearstatcache();
$this->assertFalse(is_dir($dir_name));
}