Constructor function. Setup a virtual filesystem, but do nothing with it.
virtual_fs
virtual_fs
()
Append to a file.
boolean
append_file
(array $to_append, string $contents)
-
array
$to_append: The file to which to append
-
string
$contents: The contents to append
Change the current working directory. Equivalent to Unix "cd".
boolean
change_directory
(array $target_directory)
-
array
$target_directory: The target directory path
Copy a directory. Equivalent to Unix "cp".
boolean
copy_directory
(array $to_copy, array $destination)
-
array
$to_copy: The directory to copy
-
array
$destination: The destination path
Copy a file. Equivalent to Unix "cp".
boolean
copy_file
(array $to_copy, array $destination)
-
array
$to_copy: The file to copy
-
array
$destination: The destination path
Return a directory and file listing of the current working directory. Equivalent to Unix "ls".
array
listing
([?array $dir = NULL])
-
?array
$dir: An alternate directory in which to perform the action (NULL: current directory is used)
Create a directory under the current working directory. Equivalent to Unix "mkdir".
boolean
make_directory
(array $directory)
-
array
$directory: The new directory's path and name
Move a directory. Equivalent to Unix "mv".
boolean
move_directory
(array $to_move, array $destination)
-
array
$to_move: The directory to move
-
array
$destination: The destination path
Move a file. Equivalent to Unix "mv".
boolean
move_file
(array $to_move, array $destination)
-
array
$to_move: The file to move
-
array
$destination: The destination path
Return the current working directory of the virtual filesystem. Equivalent to Unix "pwd".
mixed
print_working_directory
([boolean $array_form = false])
-
boolean
$array_form: Return the pwd in array form?
Read a file and return the contents.
~string
read_file
(array $to_read)
-
array
$to_read: The file to read
Remove a directory under the current working directory. Equivalent to Unix "rmdir".
boolean
remove_directory
(array $directory)
-
array
$directory: The directory-to-remove's path and name
Remove a file. Equivalent to Unix "rm".
boolean
remove_file
(array $to_remove)
-
array
$to_remove: The file to remove
Return a listing of all the files/directories found matching the specified pattern. Equivalent to Unix "find".
array
search
(string $pattern, [boolean $regexp = false], [boolean $recursive = false], [boolean $files = true], [boolean $directories = false], [?array $dir = NULL])
-
string
$pattern: The search pattern (PRCE regexp or plain)
-
boolean
$regexp: Is the search pattern a regexp?
-
boolean
$recursive: Should the search be recursive?
-
boolean
$files: Should files be included in the results?
-
boolean
$directories: Should directories be included in the results?
-
?array
$dir: Directory (NULL: current directory is used)
Write to a file; create the file if it doesn't exist.
boolean
write_file
(array $to_write, string $contents)
-
array
$to_write: The file to write
-
string
$contents: The contents to write
Get details of the current meta directory.
~array
_discern_meta_dir
(array &$meta_dir, string &$meta_root_node, string &$meta_root_node_type, [?array $dir = NULL])
-
array
&$meta_dir: Meta directory
-
string
&$meta_root_node: Meta root node
-
string
&$meta_root_node_type: Meta root node type
-
?array
$dir: Directory (NULL: current directory is used)
Return the contents of the given directory in $this->virtual_fs (i.e. ls without the fancy bits).
~array
_get_current_dir_contents
([?array $dir = NULL], [boolean $full_paths = false])
-
?array
$dir: Directory (NULL: current directory is used)
-
boolean
$full_paths: Whether to use full paths
Return filename from a path.
string
_get_filename
(string $filename)
Is it a directory?
boolean
_is_dir
([?array $dir = NULL])
-
?array
$dir: Path to check (NULL: current dir is used)
Is it a file?
boolean
_is_file
(array $dir)
-
array
$dir: Path (with filename) to use
Merge an absolute array-form path with a non-absolute array-form path.
array
_merge_pwds
(array $pwd1, array $pwd2)
-
array
$pwd1: Absolute path
-
array
$pwd2: Non-absolute path
Convert a string-form path to an array.
array
_pwd_to_array
(string $pwd)
Convert an array-form path to a string.
string
_pwd_to_string
([?array $pwd = NULL])
-
?array
$pwd: Path (NULL: use $this->pwd)
Fetch the current directory from a cookie, or the default.
array
_start_pwd
()