41        $path = preg_replace(
"/[\/\\\]+$/", 
"", 
$path);
 
   58        if ($mode == 
"filesystem") {
 
   59            return "./" . ILIAS_WEB_DIR . 
"/" . $ilias->client_id;
 
   62                return "../" . ILIAS_WEB_DIR . 
"/" . $ilias->client_id;
 
   64                return "./" . ILIAS_WEB_DIR . 
"/" . $ilias->client_id;
 
   76        return CLIENT_DATA_DIR;
 
   98        $a_dir = trim($a_dir);
 
  101        if (substr($a_dir, -1) == 
"/") {
 
  102            $a_dir = substr($a_dir, 0, -1);
 
  106        if (!(
$path = substr($a_dir, 0, strrpos($a_dir, 
"/") - strlen($a_dir)))) {
 
  112        return @mkdir($a_dir, fileperms(
$path));
 
  130        $dirs = array($a_dir);
 
  131        $a_dir = dirname($a_dir);
 
  133        while ($last_dirname != $a_dir) {
 
  134            array_unshift($dirs, $a_dir);
 
  135            $last_dirname = $a_dir;
 
  136            $a_dir = dirname($a_dir);
 
  140        $reverse_paths = array_reverse($dirs, 
true);
 
  142        foreach ($reverse_paths as 
$key => $value) {
 
  143            if ($found_index == -1) {
 
  144                if (is_dir($value)) {
 
  151        foreach ($dirs as $dirindex => $dir) {
 
  153            if ($dirindex >= $found_index) {
 
  154                if (!file_exists($dir)) {
 
  155                    if (strcmp(substr($dir, strlen($dir)-1, 1), 
"/") == 0) {
 
  158                        $dir = substr($dir, 0, strlen($dir)-1);
 
  161                    if (!mkdir($dir, $umask)) {
 
  165                } elseif (!is_dir($dir)) {
 
  170                    $umask = fileperms($dir);
 
  186        if (!is_dir($a_dir) || is_int(strpos($a_dir, 
".."))) {
 
  190        $current_dir = opendir($a_dir);
 
  199        while ($entryname = readdir($current_dir)) {
 
  207                unlink(${a_dir} . 
"/" . ${file});
 
  211        closedir($current_dir);
 
  221        $current_dir = opendir($a_dir);
 
  225        while ($entry = readdir($current_dir)) {
 
  226            if (is_dir($a_dir . 
"/" . $entry)) {
 
  227                $dirs[$entry] = array(
"type" => 
"dir", 
"entry" => $entry);
 
  229                $size = filesize($a_dir . 
"/" . $entry);
 
  230                $files[$entry] = array(
"type" => 
"file", 
"entry" => $entry,
 
  237        return array_merge($dirs, 
$files);
 
An exception for terminatinating execution or to throw for unit testing.
util class various functions, usage as namespace
removeTrailingPathSeparators($path)
makeDirParents($a_dir)
Create a new directory and all parent directories.
makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
getWebspaceDir($mode="filesystem")
get webspace directory
delDir($a_dir)
removes a dir and all its content (subdirs and files) recursively
getDir($a_dir)
get directory
getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file