File_Module

+------------------------------------------------------------+ | apnscp | +------------------------------------------------------------+ | Copyright (c) Apis Networks | +------------------------------------------------------------+ | Licensed under Artistic License 2.0 | +------------------------------------------------------------+ | Author: Matt Saladna (msaladna@apisnetworks.com) | +------------------------------------------------------------+
extends Module\Skeleton\Standard
Methods Summary
public
# __construct( )
{{{ void __construct(void)

ignore


Overrides

public
# __wakeup( )
public static
# convert_relative_absolute( string $file , string $referent )
Transform relative path into an absolute path
public
# get_registered_extensions( )
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
public
# extract( string $archive , string $dest , bool $overwrite = true )
Extract files from archive
public
# is_compressed( string $mFile )
bool is_compressed (string) Checks to see if a file is a compressed archive through a bit of guestimation
public
# compression_extension( $file )
Extract compression extension from file
public
# make_path( string $path , string & $link = '' )
Returns a path outside the chroot'd environment

TODO


public static
# sanitized( mixed $file )
Verify file name is legal
protected
# _mktmpdir( $path , $prefix = '' )
public
# stat_backend( string $file , $shadow = false )
Give information about a file

see

stat()
public
# etag( string $file )
Calculate etag of a file
public
# get_acls( string $file )
Perform ACL lookup on files
public
# expose( string $file , string $mode = 'read' )
Make a protected file ephemerally accessible by apnscp

xxx


public
# make_shadow_path( $path , string & $link = '' )
Resolve path as shadow
public
# create_directory( string $dir , int $mode = 493, bool $recursive = false )
bool create_directory (string[, int[, bool]]) Creates a directory within the filesystem and will recursively create parent directories if need be
public
# unmake_path( $mPath )
string unmake_path(string $mPath) Complimentary function to make_path
public
# stat( string $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
# get_archive_contents( string $file )
List contents of a compressed file
public
# copy( string|array $source , string $dest , int $force = true, int $recursive = true, int $prune = false )
Copy files
public
# unmake_shadow_path( $path )
Strip shadow prefix from path Because this is a wrapper to unmake_path,
public
# delete( mixed $file , bool $recursive = false )
bool delete (mixed, [bool = FALSE]) Deletes a file from within the filesystem and calls {@see can_delete()}
public
# delete_backend( array $files , bool $recurse , int $depth = 1 )
bool delete_backend (mixed, [bool = FALSE])

see

delete()
public
# chown( mixed $mFile , int|string $mUser , bool $mRecursive = false )
bool chown(string, string[, bool = false])
public
# chgrp( string $mFile , string $mGroup , bool $mRecursive = false )
bool chgrp(string, string[, bool = false])
public
# chmod( string $mFile , int $mMode , bool $mRecursive = false )
bool chmod (string, int)
public
# chmod_backend( $mFile , $mMode , $mRecursive )
bool chmod_backend (string, int[, bool = false]) {@link chmod}
public
# get_mime_type( string $file )
Determines the MIME type of a file through the file shell command
public
# get_file_contents( string $mPath , bool $raw = true )
Get file contents
public
# get_file_contents_backend( string $mPath , bool $mRaw = true )

see

get_file_contents()
public
# put_file_contents( string $file , string $data , bool $overwrite = true, bool $binary = false )
Write contents to file

privilege


public
# put_file_contents_backend( $mFile , $mData , $mOverwrite , $binary )

see

put_file_contents()
public
# create_file( string $file , int $mode = 420 )
Create an empty file
public
# get_directory_contents( string $mPath , $sort = true )
array get_directory_contents (string)
public
# get_directory_contents_backend( $mPath , $sort = true, $shadow = false )
public
# fix_apache_perms_backend( string|array $paths , bool $recursive = false )
Make directories writeable by Web server
public
# report_quota( $mUIDs )
array report_quota (mixed)

privilege


public
# convert_eol( string $mFile , string $mTarget )
Convert end-of-line characters
public static
# convert_absolute_relative( string $cwd , string $path )
Transform absolute path into relative path
public
# rename( string $from , string $to , $files = array ( ) )
Rename a file
public
# move( mixed $src , string $dest , string $overwrite = false )
Move files
public
# file_exists( $file , array & $missing = NULL )
public
# exists( string|array $file , array & $missing = NULL )
Check existence of file
public
# find_quota_files( $file = '' )
public
# canonicalize_site( string $path )
Canonicalize jailed filesystem path
public
# canonicalize_abs( string $path )
Canonicalize global path
public
# endow_upload( mixed $files )
Assume ownership of uploaded files
public
# touch( string $file , int $time = NULL )
Create or alter the timestamp of a file
public
# initialize_download( array $files )
Create a pipe destination to compress
public
# set_acls( string|array $file , string|null|array $user = NULL, int|string|null $permission = NULL, array $xtra = array ( ) )
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
public
# shadow_buildup( string $path )
Build up shadow layer component wrapper {@see shadow_buildup_backend}
public
# shadow_buildup_backend( string $path , string|int $user = 'root', int $perm = 493 )
Build up shadow layer components up to the final piece
public
# reset_path( string $path , string $user = '', int $fileperm = 420, int $dirperm = 493 )
Reset ownership of files in a path

see

takeover_user()
public
# takeover_user( string|int $olduser , string|int $newuser , string $path = '/' )
Recursively convert ownership of files from one user to another
public
# _delete( )
public
# purge( )
Dump OverlayFS cache
public
Methods inherited from Module\Skeleton\Standard
__construct(), set_user_parameters(), clean_user_parameters(), set_session_id(), _invoke(), __debugInfo(), getExportedFunctions(), _reset(), get_service_names(), get_services(), get_new_services(), get_active_services(), get_config(), get_service_value(), set_config_journal(), set_config(), query(), _resetModule()
Constants Summary
public int UPLOAD_UID
# 99
public string STCACHE_ROOT
# '6666cd76f96956469e7be39d750cc7d9'
public string ACL_MODE_RECURSIVE
# 'R'
public string ACL_MODE_DEFAULT
# 'd'
public string ACL_NO_RECALC_MASK
# 'n'
public string ACL_FLAGS
# '-PRbdkxn'
public string DOWNLOAD_SKIP_LIST
# '/config/file_download_skiplist.txt'
Constants inherited from Module\Skeleton\Standard
DEPENDENCY_MAP
Properties inherited from Module\Skeleton\Standard
$exportedFunctions, $username, $password, $domain, $user_id, $group_id, $permission_level, $session_id, $site, $site_id, $pgsql, $mysql