FacturaScripts

FileManager
in package

Class to manage the actions with folders and files.

Tags
author

Carlos García Gómez [email protected]

author

Cristo M. Estévez Hernández [email protected]

author

Francesc Pineda Segarra [email protected]

author

Raul Jimenez [email protected]

Table of Contents

DEFAULT_FOLDER_PERMS  = 0755
Default permissions to create new folders
EXCLUDE_FOLDERS  = ['.', '..', '.DS_Store', '.well-known']
Folders to exclude in scanFolder.
createFolder()  : bool
Create the folder.
delTree()  : bool
Recursive delete directory.
extractFromMarkers()  : array<string|int, mixed>
Extracts strings from between the BEGIN and END markers in the .htaccess file.
insertWithMarkers()  : bool
Inserts an array of strings into a file (.htaccess ), placing it between BEGIN and END markers.
notWritableFolders()  : array<string|int, mixed>
Returns an array with all not writable folders.
recurseCopy()  : bool
Copy all files and folders from $src to $dst
scanFolder()  : array<string|int, mixed>
Returns an array with files and folders inside given $folder

Constants

DEFAULT_FOLDER_PERMS

Default permissions to create new folders

public mixed DEFAULT_FOLDER_PERMS = 0755

EXCLUDE_FOLDERS

Folders to exclude in scanFolder.

public mixed EXCLUDE_FOLDERS = ['.', '..', '.DS_Store', '.well-known']

Methods

createFolder()

Create the folder.

public static createFolder(string $folder[, bool $recursive = false ][, int $mode = self::DEFAULT_FOLDER_PERMS ]) : bool
Parameters
$folder : string

Path to folder to create

$recursive : bool = false

If needs to be created recursively

$mode : int = self::DEFAULT_FOLDER_PERMS

Perms mode in octal format

Return values
bool

delTree()

Recursive delete directory.

public static delTree(string $folder) : bool
Parameters
$folder : string
Return values
bool

extractFromMarkers()

Extracts strings from between the BEGIN and END markers in the .htaccess file.

public static extractFromMarkers(string $fileName, string $marker) : array<string|int, mixed>
Parameters
$fileName : string
$marker : string
Tags
source
Return values
array<string|int, mixed>

An array of strings from a file (.htaccess ) from between BEGIN and END markers.

insertWithMarkers()

Inserts an array of strings into a file (.htaccess ), placing it between BEGIN and END markers.

public static insertWithMarkers(array<string|int, mixed> $insertion, string $fileName, string $marker) : bool

Replaces existing marked info. Retains surrounding data. Creates file if none exists.

Parameters
$insertion : array<string|int, mixed>

The new content to insert.

$fileName : string

Filename to alter.

$marker : string

The marker to alter.

Tags
source
Return values
bool

True on write success, false on failure.

notWritableFolders()

Returns an array with all not writable folders.

public static notWritableFolders() : array<string|int, mixed>
Return values
array<string|int, mixed>

recurseCopy()

Copy all files and folders from $src to $dst

public static recurseCopy(string $src, string $dst) : bool
Parameters
$src : string
$dst : string
Return values
bool

scanFolder()

Returns an array with files and folders inside given $folder

public static scanFolder(string $folder[, bool $recursive = false ][, array<string|int, mixed> $exclude = self::EXCLUDE_FOLDERS ]) : array<string|int, mixed>
Parameters
$folder : string
$recursive : bool = false
$exclude : array<string|int, mixed> = self::EXCLUDE_FOLDERS
Return values
array<string|int, mixed>

Search results