PHP Class Contao\Folder

Usage: $folder = new Folder('test'); if (!$folder->isEmpty()) { $folder->purge(); }
Inheritance: extends System
Mostra file Open project: contao/core-bundle Class Usage Examples

Protected Properties

Property Type Description
$arrPathinfo array Pathinfo
$objModel FilesModel Files model
$strFolder string Folder name

Public Methods

Method Description
__construct ( string $strFolder ) Check whether the folder exists
__get ( string $strKey ) : mixed Return an object property
chmod ( string $intChmod ) : boolean Set the folder permissions
clear ( ) Purge the folder
copyTo ( string $strNewName ) : boolean Copy the folder
delete ( ) Delete the folder
getModel ( ) : FilesModel Return the files model
isEmpty ( ) : boolean Return true if the folder is empty
protect ( ) Protect the folder by removing the .public file
purge ( ) Purge the folder
renameTo ( string $strNewName ) : boolean Rename the folder
shouldBeSynchronized ( ) : boolean Check if the folder should be synchronized with the database
unprotect ( ) Unprotect the folder by adding a .public file

Protected Methods

Method Description
getHash ( ) : string Return the MD5 hash of the folder
getPathinfo ( ) : array Return the path info (binary-safe)
getSize ( ) : integer Return the size of the folder

Method Details

__construct() public method

Check whether the folder exists
public __construct ( string $strFolder )
$strFolder string The folder path

__get() public method

Return an object property
public __get ( string $strKey ) : mixed
$strKey string The property name
return mixed The property value

chmod() public method

Set the folder permissions
public chmod ( string $intChmod ) : boolean
$intChmod string The CHMOD settings
return boolean True if the operation was successful

clear() public method

Purge the folder
Deprecation: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use $this->purge() instead.
public clear ( )

copyTo() public method

Copy the folder
public copyTo ( string $strNewName ) : boolean
$strNewName string The target path
return boolean True if the operation was successful

delete() public method

Delete the folder
public delete ( )

getHash() protected method

Return the MD5 hash of the folder
protected getHash ( ) : string
return string The MD5 has

getModel() public method

Return the files model
public getModel ( ) : FilesModel
return FilesModel The files model

getPathinfo() protected method

Return the path info (binary-safe)
See also: https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php#L3520
protected getPathinfo ( ) : array
return array The path info

getSize() protected method

Return the size of the folder
protected getSize ( ) : integer
return integer The folder size in bytes

isEmpty() public method

Return true if the folder is empty
public isEmpty ( ) : boolean
return boolean True if the folder is empty

protect() public method

Protect the folder by removing the .public file
public protect ( )

purge() public method

Purge the folder
public purge ( )

renameTo() public method

Rename the folder
public renameTo ( string $strNewName ) : boolean
$strNewName string The new path
return boolean True if the operation was successful

shouldBeSynchronized() public method

Check if the folder should be synchronized with the database
Deprecation: Use Dbafs::shouldBeSynchronized() instead
public shouldBeSynchronized ( ) : boolean
return boolean True if the folder needs to be synchronized with the database

unprotect() public method

Unprotect the folder by adding a .public file
public unprotect ( )

Property Details

$arrPathinfo protected_oe property

Pathinfo
protected array $arrPathinfo
return array

$objModel protected_oe property

Files model
protected FilesModel,contao $objModel
return FilesModel

$strFolder protected_oe property

Folder name
protected string $strFolder
return string