Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cApiPathresolveCacheHelper
  • cArray
  • cArticleCollector
  • cDirHandler
  • cFileHandler
  • cHTMLInputSelectElement
  • cIterator
  • cString
  • cStringMultiByteWrapper
  • cZipArchive
  • UI_Config_Table
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class cDirHandler

Class for directory handling. Provides functions for dealing with directories.

Package: Core\Util
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Frederic Schneider
Located at classes/class.dirhandler.php
Methods summary
public static boolean
# create( string $pathname, boolean $recursive = false )

Creates a new dir.

Creates a new dir.

Parameters

$pathname
string
$pathname the name and path of the new dir
$recursive
boolean
$recursive [optional]

Returns

boolean
Returns true on success or false on failure.
public static boolean
# remove( string $dirname )

Removes a dir from the filesystem

Removes a dir from the filesystem

Parameters

$dirname
string
$dirname The path to the directory

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
if the dir with the given dirname does not exist
public static boolean
# move( string $dirname, string $destination )

Moves a dir

Moves a dir

Parameters

$dirname
string
$dirname The path and name of the directory
$destination
string
$destination the destination. Note that the dir can also be renamed in the process of moving it

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
if the dir with the given dirname does not exist
public static
# rename( string $dirname, string $new_dirname )

Renames a dir

Renames a dir

Parameters

$dirname
string
$dirname the name and path of the dir
$new_dirname
string
$new_dirname the new name of the dir

Throws

cInvalidArgumentException
public static boolean
# chmod( string $dirname, integer $mode )

Changes the dir permissions

Changes the dir permissions

Parameters

$dirname
string
$dirname the name and path of the dir
$mode
integer
$mode the new access mode : php chmod needs octal value

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
if the dir with the given dirname does not exist
public static integer
# getDefaultPermissions( )

Determines the default permissions for new directories. These can be configured using the setting "default_perms/directory" in "data/config/<ENV>/config.misc.php". If no configuration can be found 0775 is assumed.

Determines the default permissions for new directories. These can be configured using the setting "default_perms/directory" in "data/config/<ENV>/config.misc.php". If no configuration can be found 0775 is assumed.

Returns

integer
public static boolean
# setDefaultPermissions( string $dirname )

Sets the default permissions for the given directory.

Sets the default permissions for the given directory.

Parameters

$dirname
string
$dirname the name of the directory

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
public static boolean
# setDefaultDirPerms( string $dirname )

Sets the default permissions for the given directory.

Sets the default permissions for the given directory.

Deprecated

use setDefaultPermissions() instead

Parameters

$dirname
string
$dirname the name of the directory

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
public static boolean
# recursiveRmdir( string $dirname )

Deletes a directory and all of its content.

Deletes a directory and all of its content.

Parameters

$dirname
string
$dirname the name of the directory which should be deleted

Returns

boolean
Returns true on success or false on failure.

Throws

cInvalidArgumentException
if dirname is empty
public static boolean
# recursiveCopy( string $dirname, string $destination, integer $mode = null )

Copies a directory and all of its subfolders.

Copies a directory and all of its subfolders.

Parameters

$dirname
string
$dirname the name and path of the file
$destination
string
$destination the destination. Note that existing files get overwritten
$mode
integer
$mode [optional; default as configured or 0775] chmod mode

Returns

boolean
true on success

Throws

cInvalidArgumentException
if the file with the given filename does not exist
public static boolean
# isDirectoryEmpty( string $dir )

Checks if a directory is empty

Checks if a directory is empty

Parameters

$dir
string
$dir Name of the directory

Returns

boolean
true if the directory is empty
public static array|boolean
# read( string $dirname, boolean $recursive = false, boolean $dirOnly = false, boolean $fileOnly = false )

This functions reads the content from given directory. Optionally options are to read the directory recursive or to list only directories.

This functions reads the content from given directory. Optionally options are to read the directory recursive or to list only directories.

Parameters

$dirname
string
$dirname directory
$recursive
boolean
$recursive [optional] flag to read recursive
$dirOnly
boolean
$dirOnly [optional] flag to list only directories
$fileOnly
boolean
$fileOnly [optional] flag to list only files if $dirOnly is set to false

Returns

array|boolean
array containing file names as string, false on error
public static boolean
# exists( string $dirname )

Checks if a directory exists

Checks if a directory exists

Parameters

$dirname
string
$dirname the name and path of the directory

Returns

boolean
true if the directory exists
public static integer|boolean
# getDirectorySize( string $dirname, boolean $recursive = false )

Returns the size of a directory. AKA the combined filesizes of all files within it. Note that this function uses filesize(). There could be problems with files that are larger than 2GiB

Returns the size of a directory. AKA the combined filesizes of all files within it. Note that this function uses filesize(). There could be problems with files that are larger than 2GiB

Parameters

$dirname
string
$dirname The directory name
$recursive
boolean
$recursive [optional] true if all the subdirectories should be included in the calculation

Returns

integer|boolean
false in case of an error or the size

Throws

cInvalidArgumentException
public static boolean
# isCreatable( mixed $dirname )

Checks if you can create in mother directory a new folder

Checks if you can create in mother directory a new folder

Parameters

$dirname
mixed
$dirname

Returns

boolean
Constants summary
integer DEFAULT_MODE 0775
#

default permissions for new directories

default permissions for new directories

See

CON-2770
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0