Methods

__construct()

__construct() 

upload()

upload(Resource  $fp, string  $dst, string  $name, string  $tmpname,   $hashes = array()) : array|false

Save uploaded file.

On success return array with new file stat and with removed file hash (if existed file was replaced)

Copied from parent and slightly modified to support attachment versioning

Parameters

Resource $fp

file pointer

string $dst

destination folder hash

string $name

file name

string $tmpname

file tmp name - required to detect mime type

$hashes

Returns

array|false

_dirname()

_dirname(string  $path) : string

Return parent directory path

Parameters

string $path

file path

Returns

string

_basename()

_basename(string  $path) : string

Return file name

Parameters

string $path

file path

Returns

string

_joinPath()

_joinPath(string  $dir, string  $name) : string

Join dir name and file name and return full path.

Some drivers (db) use int as path - so we give to concat path to driver itself

Parameters

string $dir

dir path

string $name

file name

Returns

string

_normpath()

_normpath(string  $path) : string

Return normalized path

Parameters

string $path

file path

Returns

string

_relpath()

_relpath(string  $path) : string

Return file path related to root dir

Parameters

string $path

file path

Returns

string

_abspath()

_abspath(string  $path) : string

Convert path related to root dir into real path

Parameters

string $path

rel file path

Returns

string

_path()

_path(string  $path) : string

Return fake path started from root dir.

Required to show path on client side.

Parameters

string $path

file path

Returns

string

_inpath()

_inpath(string  $path, string  $parent) : boolean

Return true if $path is children of $parent

Parameters

string $path

path to check

string $parent

parent path

Returns

boolean

_stat()

_stat(string  $path) : array|false

Return stat for given path.

Stat contains following fields:

  • (int) size file size in b. required
  • (int) ts file modification time in unix time. required
  • (string) mime mimetype. required for folders, others - optionally
  • (bool) read read permissions. required
  • (bool) write write permissions. required
  • (bool) locked is object locked. optionally
  • (bool) hidden is object hidden. optionally
  • (string) alias for symlinks - link target path relative to root path. optionally
  • (string) target for symlinks - link target path. optionally

If file does not exists - returns empty array or false.

Parameters

string $path

file path

Returns

array|false

_subdirs()

_subdirs(string  $path) : boolean

Return true if path is dir and has at least one childs directory

Parameters

string $path

dir path

Returns

boolean

_dimensions()

_dimensions(string  $path, string  $mime) : string

Return object width and height Ususaly used for images, but can be realize for video etc.

..

Parameters

string $path

file path

string $mime

file mime type

Returns

string

_scandir()

_scandir(string  $path) : array

Return files list in directory

Parameters

string $path

dir path

Returns

array

_fopen()

_fopen(string  $path, string  $mode = "rb") : resource|false

Open file and return file pointer

Parameters

string $path

file path

string $mode

open mode

Returns

resource|false

_fclose()

_fclose(resource  $fp, string  $path = '') : boolean

Close opened file

Parameters

resource $fp

file pointer

string $path

file path

Returns

boolean

_mkdir()

_mkdir(string  $path, string  $name) : string|boolean

Create dir and return created dir path or false on failed

Parameters

string $path

parent dir path

string $name

new directory name

Returns

string|boolean

_mkfile()

_mkfile(string  $path, string  $name) : string|boolean

Create file and return its path or false on failed

Parameters

string $path

parent dir path

string $name

new file name

Returns

string|boolean

_symlink()

_symlink(string  $source, string  $targetDir, string  $name) : boolean

Create symlink

Parameters

string $source

file to link to

string $targetDir

folder to create link in

string $name

symlink name

Returns

boolean

_copy()

_copy(string  $source, string  $targetDir, string  $name) : boolean

Copy file into another file (only inside one volume)

Parameters

string $source

source file path

string $targetDir

target dir path

string $name

file name

Returns

boolean

_move()

_move(string  $source, string  $targetDir, string  $name) : string|boolean

Move file into another parent dir.

Return new file path or false.

Parameters

string $source

source file path

string $targetDir

target dir path

string $name

file name

Returns

string|boolean

_unlink()

_unlink(string  $path) : boolean

Remove file

Parameters

string $path

file path

Returns

boolean

_rmdir()

_rmdir(string  $path) : boolean

Remove dir

Parameters

string $path

dir path

Returns

boolean

_save()

_save(resource  $fp, string  $dir, string  $name, array  $stat) : boolean|string

Create new file and write into it from file pointer.

Return new file path or false on error.

Parameters

resource $fp

file pointer

string $dir

target dir path

string $name

file name

array $stat

file stat (required by some virtual fs)

Returns

boolean|string

_getContents()

_getContents(string  $path) : string|false

Get file contents

Parameters

string $path

file path

Returns

string|false

_filePutContents()

_filePutContents(string  $path, string  $content) : boolean

Write a string to a file

Parameters

string $path

file path

string $content

new file content

Returns

boolean

_extract()

_extract(string  $path, array  $arc) : boolean

Extract files from archive

Parameters

string $path

file path

array $arc

archiver options

Returns

boolean

_archive()

_archive(string  $dir, array  $files, string  $name, array  $arc) : string|boolean

Create archive and return its path

Parameters

string $dir

target dir

array $files

files names list

string $name

archive name

array $arc

archiver options

Returns

string|boolean

_checkArchivers()

_checkArchivers() : void

Detect available archivers

_chmod()

_chmod(string  $path, string  $mode) : boolean

Change file mode (chmod)

Parameters

string $path

file path

string $mode

octal string such as '0755'

Returns

boolean

get_by_path()

get_by_path(  $path) 

Parameters

$path

create_document()

create_document(  $parentguid,   $title) 

Parameters

$parentguid
$title

create_attachment()

create_attachment(\org_openpsa_documents_document_dba  $doc,   $name,   $mimetype,   $fp) 

Parameters

\org_openpsa_documents_document_dba $doc
$name
$mimetype
$fp