Methods |
public
|
__construct()
{{{ void __construct(void)
{{{ void __construct(void)
|
#
|
public
|
__wakeup()
|
#
|
public
|
convert_relative_absolute(string $file, string $referent): string
Transform relative path into an absolute path
Transform relative path into an absolute path
Parameters
$file |
absolute location of a path
|
$referent |
relative path
|
|
#
|
public
|
get_registered_extensions(): array
array get_registered_extensions ()
Keys from the return value correspond to the extension type,
values are the classes…
array get_registered_extensions ()
Keys from the return value correspond to the extension type,
values are the classes all implementing the common interface
Compression_Interface
Returns
list of known compression extensions and their corresponding
interfaces.
|
#
|
public
|
extract(string $archive, string $dest, bool $overwrite = true): bool
Extract files from archive
Extract files from archive
Parameters
$archive |
archive file
|
$dest |
destination directory
|
$overwrite |
overwrite destination files if source exists
|
|
#
|
public
|
is_compressed(string $mFile): bool
bool is_compressed (string)
Checks to see if a file is a compressed archive through a
bit of guestimation
bool is_compressed (string)
Checks to see if a file is a compressed archive through a
bit of guestimation
|
#
|
public
|
compression_extension($file): string
Extract compression extension from file
Extract compression extension from file
|
#
|
public
|
make_path(string $path, string &$link = ''): string|false
Returns a path outside the chroot'd environment
Returns a path outside the chroot'd environment
Parameters
$link |
translated symbolic link path
|
|
#
|
public
|
stat_backend(string $file, bool $shadow = true): array
Give information about a file
Give information about a file
|
#
|
public
|
make_shadow_path($path, string &$link = ''): string
Resolve path as shadow
|
#
|
public
|
get_acls(string $file): array
Perform ACL lookup on files
Perform ACL lookup on files
Parameters
|
#
|
public
|
create_directory(string $dir, integer $mode = 0755, bool $recursive = false): bool
bool create_directory (string[, int[, bool]])
Creates a directory within the filesystem and will recursively
create…
bool create_directory (string[, int[, bool]])
Creates a directory within the filesystem and will recursively
create parent directories if need be
Parameters
$dir |
directory name to create
|
$mode |
mode to create the file
|
$recursive |
recursively create directory
|
|
#
|
public
|
temp(string $base, string $prefix = 'apiscp-temp'): string|null
Create a temporary file
Create a temporary file
Requires manual removal of file.
|
#
|
public
|
unmake_path(string $path): string
string unmake_path(string $mPath)
Complimentary function to make_path
string unmake_path(string $mPath)
Complimentary function to make_path
Returns
|
#
|
public
|
stat(string $file): array
Gives information about a file
Gives information about a file
Peforms a stat() request on named file
array(22) {
["owner"]=> string(5) "debug"
["group"]=> string(5) "group"
["uid"]=> int(664)
["gid"]=> int(664)
["size"]=> int(4096)
["file_type"]=> string(3) "dir"
["referent"]=> NULL
["portable"]=> bool(true)
["link"]=> int(0)
["nlinks"]=> int(4)
["permissions"]=> int(16889)
["site_quota"]=> bool(true)
["user_quota"]=> bool(true)
["ctime"]=> int(1242769316)
["mtime"]=> int(1242769316)
["atime"]=> int(1230433552)
["inode"]=> int(2454742)
["can_write"]=> bool(true)
["can_read"]=> bool(true)
["can_execute"]=> bool(true)
["can_chown"]=> bool(true)
["can_chgrp"]=> bool(true)
}
owner: resolved name of the uid
group: resolved name of the gid
uid: numeric user id
gid: numeric group id
size: file size in bytes
file_type: file type, values [dir, file, link]
link: file is symbolic link, 2 if directory, 1 if file
nlinks: number of hardlinks to the file
permissions: file permissions encoded as integer
site_quota: whether the file counts towards the site's quota
user_quota: whether the file counts towards the user's quota
ctime: creation time
mtime: modification time
atime: last access time
inode: filesystem inode
can_write: file has write bit set
can_read: file has read bit set
can_execute: file has execute bit set
can_chown: user privileged to chown()
can_chgrp: user privileged to chgrp()
|
#
|
public
|
etag(string $file): null|string
Calculate etag of a file
|
#
|
public
|
expose(string $file, string $mode = 'read'): string|bool
Make a protected file ephemerally accessible by apnscp
Make a protected file ephemerally accessible by apnscp
Parameters
Returns
|
#
|
public
|
get_archive_contents(string $file): array
List contents of a compressed file
List contents of a compressed file
Parameters
|
#
|
public
|
copy(
string|array $source,
string $dest,
int $force = true,
int $recursive = true,
int $prune = false,
int $depth = 0,
): bool
Copy files
Parameters
$source |
array of source files or directories to copy
|
$dest |
destination directory or file
|
$force |
overwrite destination with source if exists
|
$recursive |
recursively copy directory contents
|
$prune |
remove target before copying
|
|
#
|
public
|
unmake_shadow_path($path): string
Strip shadow prefix from path
Strip shadow prefix from path
Because this is a wrapper to unmake_path,
|
#
|
public
|
delete(mixed $file, bool $recursive = false): bool|FileError
bool delete (mixed, [bool = FALSE])
Deletes a file from within the filesystem and calls {@see can_delete()}
bool delete (mixed, [bool = FALSE])
Deletes a file from within the filesystem and calls {@see can_delete()}
Parameters
$file |
accepts file or array of files to delete
|
$recursive |
recusrively delete files
|
|
#
|
public
|
delete_backend(array $files, bool $recurse, int $depth = 1): bool
bool delete_backend (mixed, [bool = FALSE])
bool delete_backend (mixed, [bool = FALSE])
Parameters
$files |
files to remove
|
$recurse |
recurse into directories
|
$depth |
current depth
|
|
#
|
public
|
chown(mixed $mFile, int|string $mUser, bool $mRecursive = false): bool
bool chown(string, string[, bool = false])
bool chown(string, string[, bool = false])
Parameters
$mFile |
array of filenames or single filename
|
$mUser |
target uid or username
|
$mRecursive |
recursively chown
|
|
#
|
public
|
purge(bool $full = true): bool
Dump OverlayFS cache
|
#
|
public
|
chgrp(string $mFile, string $mGroup, bool $mRecursive = false): bool
bool chgrp(string, string[, bool = false])
bool chgrp(string, string[, bool = false])
Parameters
$mFile |
filename
|
$mGroup |
target gid, effectively just the admin's uid
|
$mRecursive |
recursively chown
|
|
#
|
public
|
chmod(string $mFile, int $mMode, bool $mRecursive = false): bool
bool chmod (string, int)
Parameters
$mFile |
file name
|
$mMode |
mode in octal for the file
|
|
#
|
public
|
chmod_backend(string|array $mFile, $mMode, bool $mRecursive): bool
bool chmod_backend (string, int[, bool = false])
{@link chmod}
bool chmod_backend (string, int[, bool = false])
{@link chmod}
|
#
|
public
|
get_mime_type(string $file): string|null
Determines the MIME type of a file through the file shell command
Determines the MIME type of a file through the file shell command
Returns
|
#
|
public
|
get_file_contents(string $mPath, bool $raw = true): string
Get file contents
Parameters
$mPath |
path to the filename
|
$raw |
base64 encode data
|
|
#
|
public
|
get_file_contents_backend(string $mPath, bool $mRaw = true): string
|
#
|
public
|
put_file_contents($file, string $data, bool $overwrite = true, bool $binary = false): bool
Write contents to file
Parameters
$data |
file data
|
$overwrite |
if the file exists, overwrite
|
$binary |
data is to be treated as binary data. Data must be base64 encoded
|
|
#
|
public
|
put_file_contents_backend($mFile, $mData, $mOverwrite, $binary)
|
#
|
public
|
create_file(string $file, int $mode = 0644): bool|Exception
Create an empty file
Parameters
$file |
file name to create
|
$mode |
mode for the file
|
|
#
|
public
|
get_directory_contents(string $mPath, $sort = true): array
array get_directory_contents (string)
array get_directory_contents (string)
Parameters
$mPath |
the path to the directory
|
|
#
|
public
|
get_directory_contents_backend($mPath, $sort = true, $shadow = false)
|
#
|
public
|
fix_apache_perms_backend(string|array $paths, bool $recursive = false): bool
Make directories writeable by Web server for use with DAV
Make directories writeable by Web server for use with DAV
Parameters
$paths |
paths
|
$recursive |
recursively change ownerhsip
|
|
#
|
public
|
audit(string $path, array $requirements = [], bool $union = true): array|bool
Locate files under a given path matching requirements
Locate files under a given path matching requirements
Requirements:
- user: username
- perm: permissions
- mtime/ctime: modification/creation time.
n > 0, more than n days ago, n < 0, less than n days ago
- name/regex: filename glob/regex match
Parameters
$requirements |
optional requirements
|
$union |
all must match
|
Returns
|
#
|
public
|
report_quota($mUIDs): array
array report_quota (mixed)
array report_quota (mixed)
Returns
associative array of quotas for given users supplied by the
parameter $mUIDs. The array is structured as follows:
-uid: user id of the user N.B.: the username is not used; instead
call {@link Site_Module::get_users} to retrieve the numeric values
- quota:
- soft:
- hard
- files:
- file_soft:
- file_hard
|
#
|
public
|
convert_eol(string $mFile, string $mTarget): bool
Convert end-of-line characters
Convert end-of-line characters
Parameters
$mFile |
filename
|
$mTarget |
target platform
|
|
#
|
public
|
rename($from, $to, $files = []): bool
Rename a file
|
#
|
public
|
move(mixed $src, string $dest, string $overwrite = false): bool
Move files
Parameters
$src |
source file(s) or directories
|
$dest |
destination directory
|
$overwrite |
overwrite destination if exists
|
|
#
|
public
|
symlink(string $mSrc, string $mDest): bool
Create a symbolic link
Parameters
$mSrc |
source file
|
$mDest |
destination link
|
|
#
|
public
|
convert_absolute_relative(string $cwd, string $path): string
Transform absolute path into relative path
Transform absolute path into relative path
Parameters
$cwd |
current working directory
|
$path |
target symlink
|
|
#
|
public
|
chown_symlink(string $mFile, string $mUser): bool
Change ownership of symbolic link
Change ownership of symbolic link
Parameters
$mFile |
symbolic link
|
$mUser |
target username
|
|
#
|
public
|
file_exists($file, array &$missing = null)
|
#
|
public
|
exists(string|array $file, array &$missing = null): bool|array
Check existence of file
|
#
|
public
|
canonicalize_site(string $path): string
Canonicalize jailed filesystem path
Canonicalize jailed filesystem path
|
#
|
public
|
canonicalize_abs(string $path): string
Canonicalize global path
|
#
|
public
|
endow_upload(mixed $files): bool
Assume ownership of uploaded files
Assume ownership of uploaded files
|
#
|
public
|
touch(string $file, int $time = null): bool
Create or alter the timestamp of a file
Create or alter the timestamp of a file
Parameters
$file |
filename
|
$time |
optional unix timestamp
|
|
#
|
public
|
initialize_download(array $files): string
Create a pipe destination to compress
Create a pipe destination to compress
Returns
|
#
|
public
|
set_acls(string|array $file, string|null|array $user = null, int|string|null $permission = null, array $xtra = []): bool
Set file access control lists
Set file access control lists
- user if omitted removes all ACL entries
- permissions may be of the form:
octal (0, 1, 2, 4 and any combo thereof)
or
drwx, d sets default
setting permission null will remove all permissions
- "0" permission will disallow all access for named user
Parameters
$xtra |
map of default: bool, recursive: bool (not manageable by subuser)
|
|
#
|
public
|
shadow_buildup(string $path): bool
Build up shadow layer component wrapper
{@see shadow_buildup_backend}
Build up shadow layer component wrapper
{@see shadow_buildup_backend}
Parameters
$path |
file or directory to verify
|
|
#
|
public
|
shadow_buildup_backend(string $path, string|int $user = 'root', int $perm = 0755): bool
Build up shadow layer components up to the final piece
Build up shadow layer components up to the final piece
Parameters
$path |
file or directory to verify
|
$user |
user to set on buildup (default: current user on non CLI)
|
$perm |
permission in octal form
|
|
#
|
public
|
reset_path(string $path, null|string $user = '', string|int $fileperm = 644, int $dirperm = 755): bool
Reset ownership of files in a path
Reset ownership of files in a path
Parameters
$user |
set to null to bypass user reset, blank string current user
|
$fileperm |
file permission to reset
|
$dirperm |
directory permission to reset
|
|
#
|
public
|
takeover_user(string|int $olduser, string|int $newuser, string $path = '/'): bool|array
Recursively convert ownership of files from one user to another
Recursively convert ownership of files from one user to another
Parameters
$olduser |
owner to convert
|
$newuser |
new owner
|
$path |
base path
|
|
#
|
public
|
scan(string $path): string|null
Scan a given path for malicious files
Scan a given path for malicious files
Returns
scan results or null on error
|
#
|
public
|
_delete()
|
#
|