本文整理汇总了PHP中jFile::removeDir方法的典型用法代码示例。如果您正苦于以下问题:PHP jFile::removeDir方法的具体用法?PHP jFile::removeDir怎么用?PHP jFile::removeDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jFile
的用法示例。
在下文中一共展示了jFile::removeDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
try {
$tempPath = jApp::tempBasePath();
if ($tempPath == DIRECTORY_SEPARATOR || $tempPath == '' || $tempPath == '/') {
echo "Error: bad path in jApp::tempBasePath(), it is equals to '" . $tempPath . "' !!\n";
echo " Jelix cannot clear the content of the temp directory.\n";
echo " Correct the path in your application.init.php or create the corresponding directory\n";
exit(1);
}
if (!jFile::removeDir($tempPath, false, array('.svn', '.dummy'))) {
echo "Some temp files were not removed\n";
} else {
if ($this->verbose()) {
echo "All temp files have been removed\n";
}
}
} catch (Exception $e) {
if ($this->config->helpLang == 'fr') {
echo "Un ou plusieurs répertoires n'ont pas pu être supprimés.\n" . "Message d'erreur : " . $e->getMessage() . "\n";
} else {
echo "One or more directories couldn't be deleted.\n" . "Error: " . $e->getMessage() . "\n";
}
}
}
示例2: clear
function clear()
{
$confirm = $this->param('confirm');
if ($confirm == 'Y') {
jFile::removeDir(jApp::tempPath(), false);
jMessage::add(jLocale::get('jelixcache~jelixcache.cache.clear.done'));
} else {
jMessage::add(jLocale::get('jelixcache~jelixcache.cache.clear.canceled'));
}
$rep = $this->getResponse('redirect');
$rep->action = 'jelixcache~default:index';
return $rep;
}
示例3: useit
/**
* Let use one of the available theme
*/
function useit()
{
$theme = (string) $this->param('theme');
$mainConfig = new jIniFileModifier(jApp::configPath() . 'defaultconfig.ini.php');
$mainConfig->setValue('theme', strtolower($theme));
$mainConfig->setValue('datepicker', strtolower($theme), 'forms');
$mainConfig->save();
jFile::removeDir(jApp::tempPath(), false);
jMessage::add(jLocale::get('theme.selected'), 'information');
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
示例4: clearTemp
public static function clearTemp()
{
if (!defined('JELIX_APP_TEMP_PATH')) {
echo "Error: JELIX_APP_TEMP_PATH is not defined\n";
exit(1);
}
if (JELIX_APP_TEMP_PATH == DIRECTORY_SEPARATOR || JELIX_APP_TEMP_PATH == '' || JELIX_APP_TEMP_PATH == '/') {
echo "Error: bad path in JELIX_APP_TEMP_PATH, it is equals to '" . JELIX_APP_TEMP_PATH . "' !!\n";
echo " Jelix cannot clear the content of the temp directory.\n";
echo " Correct the path in JELIX_APP_TEMP_PATH or create the directory you\n";
echo " indicated into JELIX_APP_TEMP_PATH.\n";
exit(1);
}
jFile::removeDir(JELIX_APP_TEMP_PATH, false);
}
示例5: run
public function run()
{
try {
jFile::removeDir(JELIX_APP_TEMP_PATH, false);
jFile::removeDir(JELIX_APP_REAL_TEMP_PATH, false);
if (defined('JELIX_APP_TEMP_CLI_PATH')) {
jFile::removeDir(JELIX_APP_TEMP_CLI_PATH, false);
}
} catch (Exception $e) {
if (MESSAGE_LANG == 'fr') {
echo "Un ou plusieurs répertoires n'ont pas pu être supprimés.\n" . "Message d'erreur : " . $e->getMessage() . "\n";
} else {
echo "One or more directories couldn't be deleted.\n" . "Error: " . $e->getMessage() . "\n";
}
}
}
示例6: run
public function run()
{
try {
if (!defined('JELIX_APP_TEMP_PATH')) {
echo "Error: JELIX_APP_TEMP_PATH is not defined\n";
exit(1);
}
if (JELIX_APP_TEMP_PATH == DIRECTORY_SEPARATOR || JELIX_APP_TEMP_PATH == '' || JELIX_APP_TEMP_PATH == '/') {
echo "Error: bad path in JELIX_APP_TEMP_PATH, it is equals to '" . JELIX_APP_TEMP_PATH . "' !!\n";
echo " Jelix cannot clear the content of the temp directory.\n";
echo " Correct the path in JELIX_APP_TEMP_PATH or create the directory you\n";
echo " indicated into JELIX_APP_TEMP_PATH.\n";
exit(1);
}
jFile::removeDir(JELIX_APP_TEMP_PATH, false);
if (!defined('JELIX_APP_REAL_TEMP_PATH')) {
echo "Error: JELIX_APP_REAL_TEMP_PATH is not defined\n";
exit(1);
}
if (JELIX_APP_REAL_TEMP_PATH == DIRECTORY_SEPARATOR || JELIX_APP_REAL_TEMP_PATH == '' || JELIX_APP_REAL_TEMP_PATH == '/') {
echo "Error: bad path in JELIX_APP_REAL_TEMP_PATH, it is equals to '" . JELIX_APP_REAL_TEMP_PATH . "' !!\n";
echo " Jelix cannot clear the content of the temp directory.\n";
echo " Correct the path in JELIX_APP_REAL_TEMP_PATH or create the directory you\n";
echo " indicated into JELIX_APP_REAL_TEMP_PATH.\n";
exit(1);
}
jFile::removeDir(JELIX_APP_REAL_TEMP_PATH, false);
if (defined('JELIX_APP_TEMP_CLI_PATH')) {
if (JELIX_APP_TEMP_CLI_PATH == DIRECTORY_SEPARATOR || JELIX_APP_TEMP_CLI_PATH == '' || JELIX_APP_TEMP_CLI_PATH == '/') {
echo "Error: bad path in JELIX_APP_TEMP_CLI_PATH, it is equals to '" . JELIX_APP_TEMP_CLI_PATH . "' !!\n";
echo " Jelix cannot clear the content of the temp directory.\n";
echo " Correct the path in JELIX_APP_TEMP_CLI_PATH or create the directory you\n";
echo " indicated into JELIX_APP_TEMP_CLI_PATH.\n";
exit(1);
}
jFile::removeDir(JELIX_APP_TEMP_CLI_PATH, false);
}
} catch (Exception $e) {
if (MESSAGE_LANG == 'fr') {
echo "Un ou plusieurs répertoires n'ont pas pu être supprimés.\n" . "Message d'erreur : " . $e->getMessage() . "\n";
} else {
echo "One or more directories couldn't be deleted.\n" . "Error: " . $e->getMessage() . "\n";
}
}
}
示例7: clearTemp
public static function clearTemp($path = '')
{
if ($path == '') {
$path = jApp::tempBasePath();
if ($path == '') {
throw new Exception("default temp base path is not defined", 1);
}
}
if ($path == DIRECTORY_SEPARATOR || $path == '' || $path == '/') {
throw new Exception('given temp path is invalid', 2);
}
if (!file_exists($path)) {
throw new Exception('given temp path does not exists', 3);
}
if (!is_writeable($path)) {
throw new Exception('given temp path does not exists', 4);
}
jFile::removeDir($path, false);
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$tempPath = \Jelix\Core\App::tempBasePath();
if ($tempPath == DIRECTORY_SEPARATOR || $tempPath == '' || $tempPath == '/') {
$output->writeln("<error>Error: bad path in jApp::tempBasePath(), it is equals to '" . $tempPath . "' !!</error>");
$output->writeln(" Jelix cannot clear the content of the temp directory.");
$output->writeln(" Correct the path in your application.init.php or create the corresponding directory");
return 1;
}
if (!\jFile::removeDir($tempPath, false, array('.svn', '.git', '.dummy'))) {
$output->writeln("Some temp files were not removed");
} else {
if ($output->isVerbose()) {
$output->writeln("All temp files have been removed");
}
}
} catch (\Exception $e) {
$output->writeln("One or more directories couldn't be deleted.");
$output->writeln("<error>Error: " . $e->getMessage() . "</error>");
return 2;
}
}
示例9: checkTempPath
static function checkTempPath()
{
$tempBasePath = \Jelix\Core\App::tempBasePath();
// we always clean the temp directory. But first, let's check the temp path (see ticket #840)...
if ($tempBasePath == DIRECTORY_SEPARATOR || $tempBasePath == '' || $tempBasePath == '/') {
throw new Exception("Error: bad path in \\Jelix\\Core\\App::tempBasePath(), it is equals to '" . $tempBasePath . "' !!\n" . " Jelix cannot clear the content of the temp directory.\n" . " Correct the path for the temp directory or create the directory you\n" . " indicated with \\Jelix\\Core\\App in your application.init.php.\n");
}
jFile::removeDir(\Jelix\Core\App::tempPath(), false, array('.svn', '.dummy'));
}
示例10: clearCache
/**
* Clears the cache directory
*/
public function clearCache()
{
jFile::removeDir($this->cachePath, false);
}
示例11: exit
if (file_exists(JELIXS_APPTPL_PATH) && file_exists(JELIXS_APPTPL_PATH . 'application.init.php')) {
if (!file_exists(JELIXS_APPTPL_PATH . 'jelix-scripts.init.php')) {
echo "Error: jelix-scripts.init.php doesn't exist in your application\n";
echo " You must create this file which should be similar to application.init.php\n";
echo " but with a different temp directory.\n";
echo " it should also declare a constant JELIX_APP_REAL_TEMP_PATH which should contain\n";
echo " the path to the temp directory indicated in application.init.php.\n";
exit(1);
}
include JELIXS_APPTPL_PATH . 'jelix-scripts.init.php';
if (!class_exists('jCoordinator', false)) {
// for old application.init.php which doesn't include init.php
include JELIXS_INIT_PATH;
}
// we always clean the temp directory.
jFile::removeDir(JELIX_APP_TEMP_PATH, false);
} else {
if ($commandName != 'createapp' && $commandName != 'help') {
echo "Error: the given application doesn't exist (" . JELIXS_APPTPL_PATH . " )\n";
exit(1);
}
include JELIXS_INIT_PATH;
define('JELIX_APP_PATH', JELIXS_APPTPL_PATH);
define('JELIX_APP_REAL_TEMP_PATH', JELIXS_APPTPL_TEMP_PATH);
define('JELIX_APP_CLI_TEMP_PATH', substr(JELIXS_APPTPL_TEMP_PATH, 0, -1) . '-cli/');
define('JELIX_APP_TEMP_PATH', substr(JELIXS_APPTPL_TEMP_PATH, 0, -1) . '-jelix-scripts/');
define('JELIX_APP_VAR_PATH', JELIXS_APPTPL_VAR_PATH);
define('JELIX_APP_LOG_PATH', JELIXS_APPTPL_LOG_PATH);
define('JELIX_APP_CONFIG_PATH', JELIXS_APPTPL_CONFIG_PATH);
define('JELIX_APP_WWW_PATH', JELIXS_APPTPL_WWW_PATH);
define('JELIX_APP_CMD_PATH', JELIXS_APPTPL_CMD_PATH);
示例12: clearLayerCache
public static function clearLayerCache($repository, $project, $layer)
{
// Storage type
$ser = lizmap::getServices();
$cacheStorageType = $ser->cacheStorageType;
// Cache root directory
if ($cacheStorageType != 'redis') {
$cacheRootDirectory = $ser->cacheRootDirectory;
if (!is_writable($cacheRootDirectory) or !is_dir($cacheRootDirectory)) {
$cacheRootDirectory = sys_get_temp_dir();
}
// Directory where cached files are stored for the project
$cacheProjectDir = $cacheRootDirectory . '/' . $repository . '/' . $project . '/';
$results = array();
if (file_exists($cacheProjectDir)) {
// Open the directory and walk through the filenames
$handle = opendir($cacheProjectDir);
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
// Get directories and files corresponding to the layer
if (preg_match('#(^|_)' . $layer . '($|_)#', $entry)) {
$results[] = $cacheProjectDir . $entry;
}
}
}
closedir($handle);
foreach ($results as $rem) {
if (is_dir($rem)) {
jFile::removeDir($rem);
} else {
unlink($rem);
}
}
}
} else {
// FIXME: removing by layer is not supported for the moment. For the moment, we flush all layers of the project.
$cacheName = 'lizmapCache_' . $repository . '_' . $project;
self::declareRedisProfile($ser, $cacheName, $repository, $project);
jCache::flush($cacheName);
}
jEvent::notify('lizmapProxyClearLayerCache', array('repository' => $repository, 'project' => $project, 'layer' => $layer));
}
示例13: removeLayerCache
/**
* Empty a map service cache
* @param string $repository Repository for which to remove all tile cache
* @return Redirection to the index
*/
function removeLayerCache()
{
$repository = $this->param('repository');
$project = $this->param('project');
$layer = $this->param('layer');
// Get config utility
$lrep = lizmap::getRepository($repository);
$ser = lizmap::getServices();
$lproj = lizmap::getProject($repository . '~' . $project);
$project = $lproj->getKey();
// Remove the cache for the layer
$cacheRootDirectory = $ser->cacheRootDirectory;
$cacheProjectDir = $cacheRootDirectory . '/' . $lrep->getKey() . '/' . $project . '/';
$handle = opendir($cacheProjectDir);
$results = array();
// Open the directory and walk through the filenames
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
// Get directories and files corresponding to the layer
if (preg_match('#^' . $layer . '_#', $entry) or $entry == $layer) {
$results[] = $cacheProjectDir . $entry;
}
}
}
closedir($handle);
// Remove layer files and folder cache
if ($lrep && $lproj) {
foreach ($results as $rem) {
if (is_dir($rem)) {
jFile::removeDir($rem);
} else {
unlink($rem);
}
}
}
jMessage::add(jLocale::get("admin~admin.cache.layer.removed", array($layer)));
// Redirect to the index
$rep = $this->getResponse("redirect");
$rep->action = "admin~config:index";
return $rep;
}
示例14: clearAll
/**
* clear all zone cache or all cache of a specific zone
* @param string $name zone selector
* @since 1.0b1
*/
public static function clearAll($name = '')
{
$dir = jApp::tempPath('zonecache/');
if (!file_exists($dir)) {
return;
}
if ($name != '') {
$sel = new jSelectorZone($name);
$dir .= $sel->module . '/' . strtolower($sel->resource) . 'zone/';
}
jFile::removeDir($dir, false);
}
示例15: clearTemp
public static function clearTemp()
{
jFile::removeDir(JELIX_APP_TEMP_PATH, false);
}