Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Static Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
eZDir Class Reference

The class eZDir does. More...

## Static Public Member Functions
static | createMultiLevelPath ( $key, $maxDepth=-1)
static | getPathFromFilename ( $filename)
static | filenamePath ( $filename, $maxCharLen=2)
static | mkdir ( $dir, $perm=false, $recursive=false)
static | cleanupEmptyDirectories ( $dir)
static | dirpath ( $filepath)
static | directoryPermission ()
static | separator ( $type)
static | convertSeparators ( $path, $toType=self::SEPARATOR_UNIX)
static | cleanPath ( $path, $toType=self::SEPARATOR_UNIX)
static | path ( $names, $includeEndSeparator=false, $type=self::SEPARATOR_UNIX)
static | recursiveDelete ( $dir, $rootCheck=true)
static | recursiveList ( $dir, $path, &$fileList)
static | recursiveFind ( $dir, $suffix)
static | unlinkWildcard ( $dir, $pattern)
static | recursiveFindRelative ( $baseDir, $subDir, $suffix)
static | findSubdirs ( $dir, $includeHidden=false, $excludeItems=false)
static | findSubitems ( $dir, $types=false, $fullPath=false, $includeHidden=false, $excludeItems=false)
static | copy ( $sourceDirectory, &$destinationDirectory, $asChild=true, $recursive=true, $includeHidden=false, $excludeItems=false)
static | temporaryFileRegexp ( $standalone=true)
static | isWriteable ( $dirname)

## Public Attributes
const | SEPARATOR_LOCAL = 1
const | SEPARATOR_UNIX = 2
const | SEPARATOR_DOS = 3

## Static Private Member Functions
static | doMkdir ( $dir, $perm, $recursive=false)

## Detailed Description

The class eZDir does.

Definition at line 16 of file ezdir.php.

## Member Function Documentation

## ◆ cleanPath()

static eZDir::cleanPath | ( |  | $path,
|  |  | $toType = `self::SEPARATOR_UNIX`
| ) |  |
| static

Removes all unneeded directory separators and resolves any "."s and ".."s found in $path.

For instance: "var/../lib/ezdb" becomes "lib/ezdb", while "../site/var" will not be changed.

Note
  Will also convert separators

See also
  convertSeparators.

Definition at line 202 of file ezdir.php.

References convertSeparators(), and separator().

Referenced by cleanupEmptyDirectories(), dirpath(), mkdir(), eZExtension\nameFromPath(), and path().

## ◆ cleanupEmptyDirectories()

static eZDir::cleanupEmptyDirectories | ( |  | $dir | ) |
| static

Goes trough the directory path $dir and removes empty directories.

Note
  This is just the opposite of mkdir() with $parents set to `true`.

Definition at line 95 of file ezdir.php.

References cleanPath(), and doMkdir().

Referenced by eZClusterFileHandler\cleanupEmptyDirectories(), eZImageAliasHandler\removeAliasFile(), and eZImageAliasHandler\updateAliasPath().

## ◆ convertSeparators()

static eZDir::convertSeparators | ( |  | $path,
|  |  | $toType = `self::SEPARATOR_UNIX`
| ) |  |
| static

Converts any directory separators found in $path, in both unix and dos style, into the separator type specified by $toType and returns it.

Definition at line 188 of file ezdir.php.

References separator().

Referenced by cleanPath().

## ◆ copy()

static eZDir::copy | ( |  | $sourceDirectory,
|  | & | $destinationDirectory,
|  |  | $asChild = `true`,
|  |  | $recursive = `true`,
|  |  | $includeHidden = `false`,
|  |  | $excludeItems = `false`
| ) |  |
| static

Copies a directory (and optionally all it's subitems) to another directory.

Parameters

  $sourceDirectory | The source directory which should be copied, this location must exist.
  $destinationDirectory | The location for the copied directory structure, this location must exist. This parameter will be modified if $asChild is `true`.
  $asChild | If `true` then it will use last part of the $sourceDirectory as a sub-folder to $destinationDirectory. e.g. copying /etc/httpd to /var/ will create /var/httpd and place all folders/files under it.
  $recursive | If `true` then it will copy folders/files recursively from folders found in $sourceDirectory.
  $includeHidden | If `true` it will include files or folders beginning with a dot (.).
  $excludeItems | A regular expression used to exclude files or folders in the subtree, use `false` for no exclusion.

Note
  The parameter $recursive is currently unused, it will always copy recursively.

Definition at line 577 of file ezdir.php.

References eZFileHandler\copy(), directoryPermission(), findSubitems(), mkdir(), and eZDebug\writeError().

Referenced by eZInstallScriptPackageHandler\add(), eZExtensionPackageHandler\addExtension(), eZPackage\appendFile(), eZSiteInstaller\createSiteAccess(), eZPackage\exportToArchive(), and eZExtensionPackageHandler\install().

## ◆ createMultiLevelPath()

static eZDir::createMultiLevelPath | ( |  | $key,
|  |  | $maxDepth = `-1`
| ) |  |
| static

Returns
  a multi-level path from a specific key. For example:
  echo createMultiLevelPath( "42abce", 3 );
  eZDir\createMultiLevelPath
  static createMultiLevelPath( $key, $maxDepth=-1)
  Definition: ezdir.php:34
  returns "/4/2/abce"

Parameters: $key: the key to be used as path $maxDepth: the maximum number of path elements to be created (-1 is unlimited)

Definition at line 34 of file ezdir.php.

References separator().

## ◆ directoryPermission()

static eZDir::directoryPermission | ( |  | ) |
| static

Returns
  the default permissions to use for directories.

Note
  The permission is converted from octal text to decimal value.

Definition at line 142 of file ezdir.php.

Referenced by copy(), and mkdir().

## ◆ dirpath()

static eZDir::dirpath | ( |  | $filepath | ) |
| static

Returns
  the dirpath portion of the filepath $filepath.
  $dirpath = eZDir::dirpath( "path/to/some/file.txt" );
  print( $dirpath ); // prints out path/to/some
  eZDir\dirpath
  static dirpath( $filepath)
  Definition: ezdir.php:129

Definition at line 129 of file ezdir.php.

References cleanPath().

Referenced by eZPackage\appendSimpleFile(), eZClusterFileHandler\cleanupEmptyDirectories(), eZContentObjectPackageHandler\createDOMNodeFromFile(), eZContentObjectPackageHandler\installTemplates(), and eZPDF\modify().

## ◆ doMkdir()

static eZDir::doMkdir | ( |  | $dir,
|  |  | $perm,
|  |  | $recursive = `false`
| ) |  |
| static private

Creates the directory $dir with permission $perm.

Definition at line 152 of file ezdir.php.

References mkdir().

Referenced by cleanupEmptyDirectories().

## ◆ filenamePath()

static eZDir::filenamePath | ( |  | $filename,
|  |  | $maxCharLen = `2`
| ) |  |
| static

Definition at line 55 of file ezdir.php.

Referenced by eZContentCache\cachePathInfo(), eZContentCache\cleanup(), and eZNodeviewfunctions\generateViewCacheFile().

## ◆ findSubdirs()

static eZDir::findSubdirs | ( |  | $dir,
|  |  | $includeHidden = `false`,
|  |  | $excludeItems = `false`
| ) |  |
| static

Returns all subdirectories in a folder

Definition at line 519 of file ezdir.php.

References findSubitems().

Referenced by eZTSTranslator\fetchList().

## ◆ findSubitems()

static eZDir::findSubitems | ( |  | $dir,
|  |  | $types = `false`,
|  |  | $fullPath = `false`,
|  |  | $includeHidden = `false`,
|  |  | $excludeItems = `false`
| ) |  |
| static

Returns all subdirectories in a folder

Definition at line 528 of file ezdir.php.

Referenced by copy(), eZTSTranslator\fetchList(), findSubdirs(), and eZPackage\packageRepositories().

## ◆ getPathFromFilename()

static eZDir::getPathFromFilename | ( |  | $filename | ) |
| static

Definition at line 41 of file ezdir.php.

Referenced by eZTemplateImageOperator\hasImage(), eZTemplateImageOperator\loadImage(), eZTemplateImageOperator\setLoadImage(), and eZTemplateImageOperator\storeImage().

## ◆ isWriteable()

static eZDir::isWriteable | ( |  | $dirname | ) |
| static

Check if a given directory is writeable

Returns
  TRUE/FALSE

Definition at line 645 of file ezdir.php.

References eZSys\fileSeparator(), and eZSys\osType().

## ◆ mkdir()

static eZDir::mkdir | ( |  | $dir,
|  |  | $perm = `false`,
|  |  | $recursive = `false`
| ) |  |
| static

Creates the directory $dir with permissions $perm. If $recursive is true it will create any missing parent directories, just like 'mkdir -p'.

Definition at line 73 of file ezdir.php.

References cleanPath(), and directoryPermission().

Referenced by eZMutex\__construct(), eZInstallScriptPackageHandler\add(), eZExtensionPackageHandler\addExtension(), eZPackage\appendFile(), eZPackage\appendInstall(), eZPackage\appendSimpleFile(), eZCharTransform\cacheFilePath(), eZImageManager\convert(), copy(), eZFile\create(), eZContentObjectPackageHandler\createDOMNodeFromFile(), eZDBPackageHandler\createInstallNode(), eZContentObjectPackageHandler\createObjectListNode(), eZSiteInstaller\createSiteAccess(), eZURLWildcard\createWildcardsIndex(), doMkdir(), eZUser\getCacheDir(), eZPackage\import(), eZImageAliasHandler\initializeFromFile(), eZBinaryFileType\insertRegularFile(), eZMediaType\insertRegularFile(), eZExtensionPackageHandler\install(), eZFilePackageHandler\install(), eZContentObjectPackageHandler\installTemplates(), eZPDF\modify(), eZFile\rename(), eZSubtreeCache\renameDir(), eZImageInterface\store(), eZContentCache\store(), eZHTTPFile\store(), eZPackage\storeCache(), eZTranslationCache\storeCache(), eZStaticCache\storeCachedFile(), eZPackage\storePackageFile(), eZBinaryFileType\unserializeContentObjectAttribute(), eZMediaType\unserializeContentObjectAttribute(), eZImageAliasHandler\updateAliasPath(), eZLog\write(), eZDebug\writeFile(), and eZLog\writeStorageLog().

## ◆ path()

static eZDir::path | ( |  | $names,
|  |  | $includeEndSeparator = `false`,
|  |  | $type = `self::SEPARATOR_UNIX`
| ) |  |
| static

Creates a path out of all the dir and file items in the array $names with correct separators in between them. It will also remove unneeded separators. $type is used to determine the separator type, see eZDir::separator. If $includeEndSeparator is true then it will make sure that the path ends with a separator if false it make sure there are no end separator.

Definition at line 237 of file ezdir.php.

References cleanPath(), and separator().

Referenced by eZMutex\__construct(), eZTranslationCache\cacheDirectory(), eZTemplateTreeCache\cacheDirectory(), eZSys\cacheDirectory(), eZContentCache\cachePathInfo(), eZContentCache\cleanup(), eZTemplateCompiler\compilationDirectory(), eZSQLite3DB\connect(), eZTemplateCompiler\executeCompilation(), eZPackage\fileStorePath(), eZTemplateCompiler\generatePHPCodeChildren(), eZNodeviewfunctions\generateViewCacheFile(), eZCollaborationItemHandler\handlerRepositories(), eZTemplateImageOperator\hasImage(), eZPackage\import(), eZDBInterface\insertFile(), eZCollaborationItemHandler\instantiate(), eZTemplateImageOperator\loadImage(), eZTSTranslator\loadTranslationFile(), eZDebug\printReport(), eZImageInterface\processImage(), eZStaticCache\removeURL(), eZPackage\repositoryPath(), eZTranslationCache\rootCacheDirectory(), eZTemplateImageOperator\setLoadImage(), eZSys\storageDirectory(), eZImageInterface\store(), eZTemplateImageOperator\storeImage(), eZPackageType\storeObjectAttribute(), eZPackage\temporaryExportPath(), eZPackage\temporaryImportPath(), and eZSys\varDirectory().

## ◆ recursiveDelete()

static eZDir::recursiveDelete | ( |  | $dir,
|  |  | $rootCheck = `true`
| ) |  |
| static

Removes a directory and all it's contents, recursively.

Parameters

  string | $dir | Directory to remove
  bool | $rootCheck | Check whether $dir is supposed to be contained in eZ Publish root directory

Returns
  bool True if the operation succeeded, false otherwise

Definition at line 264 of file ezdir.php.

References eZSys\rootDir(), and eZDebug\writeError().

Referenced by eZCache\clearGlobalINICache(), eZCache\clearItem(), eZCache\clearTemplateCompileCache(), eZCache\clearTemplateOverrideCache(), eZFSFileHandler\delete(), eZFSFileHandler\fileDelete(), eZExtensionPackageHandler\install(), eZPackage\remove(), eZPackage\removeFiles(), and eZExtensionPackageHandler\uninstall().

## ◆ recursiveFind()

static eZDir::recursiveFind | ( |  | $dir,
|  |  | $suffix
| ) |  |
| static

Recurses through the directory and returns the files that matches the given suffix

Note
  This function will not traverse . (hidden) folders

Definition at line 361 of file ezdir.php.

Referenced by eZFilePackageHandler\handleParameters().

## ◆ recursiveFindRelative()

static eZDir::recursiveFindRelative | ( |  | $baseDir,
|  |  | $subDir,
|  |  | $suffix
| ) |  |
| static

Recurses through the directory and returns the files that matches the given suffix. This function will store the relative path from the given base only. Note: this function will not traverse . (hidden) folders

Definition at line 471 of file ezdir.php.

## ◆ recursiveList()

static eZDir::recursiveList | ( |  | $dir,
|  |  | $path,
|  | & | $fileList
| ) |  |
| static

Creates a list of all files and dirs in the directory.

Definition at line 332 of file ezdir.php.

Referenced by eZExtensionPackageHandler\addExtension(), and eZPackage\exportToArchive().

## ◆ separator()

static eZDir::separator | ( |  | $type | ) |
| static

Returns
  the separator used between directories and files according to $type.

Type can be one of the following:

- self::SEPARATOR_LOCAL - Returns whatever is applicable for the current machine.
- self::SEPARATOR_UNIX - Returns a /
- self::SEPARATOR_DOS - Returns a \

Definition at line 169 of file ezdir.php.

References eZSys\fileSeparator(), SEPARATOR_DOS, SEPARATOR_LOCAL, and SEPARATOR_UNIX.

Referenced by cleanPath(), convertSeparators(), createMultiLevelPath(), and path().

## ◆ temporaryFileRegexp()

static eZDir::temporaryFileRegexp | ( |  | $standalone = `true` | ) |
| static

Returns
  a regexp which will match certain temporary files.

Definition at line 628 of file ezdir.php.

Referenced by eZPackage\appendFile().

## ◆ unlinkWildcard()

static eZDir::unlinkWildcard | ( |  | $dir,
|  |  | $pattern
| ) |  |
| static

Unlink files match the given pattern in the given directory.

Definition at line 395 of file ezdir.php.

Referenced by eZPackageType\storeObjectAttribute().

## Member Data Documentation

## ◆ SEPARATOR_DOS

const eZDir::SEPARATOR_DOS = 3

Definition at line 20 of file ezdir.php.

Referenced by separator().

## ◆ SEPARATOR_LOCAL

const eZDir::SEPARATOR_LOCAL = 1

Definition at line 18 of file ezdir.php.

Referenced by separator().

## ◆ SEPARATOR_UNIX

const eZDir::SEPARATOR_UNIX = 2

Definition at line 19 of file ezdir.php.

Referenced by separator().

The documentation for this class was generated from the following file:

- ezdir.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.