$phk_tab
$phk_tab : array
validate(string $mnt) : string
Same as isMounted but throws an exception is the mount point is invalid.
Returns the mount point so that it can be embedded in a call string.
string | $mnt | Mount point to check |
if mount point is invalid
mount point (not modified)
proxy(string $mnt) : \PHK\Proxy
Returns the \PHK\Proxy object corresponding to a given mount point
If the corresponding \PHK\Proxy object does not exist yet, it is created.
string | $mnt | Mount point |
if mount point is invalid
proxy object
setCache(boolean|null $caching) : void
Sets the global caching toggle
Normally, the global cache toggle is always null, except in 'webinfo' mode, where it is false to inhibit any caching of webinfo information (2 reasons: useless in terms of performance, and could use the same keys as the 'non-webinfo' mode, so we would have to use another key prefix).
boolean|null | $caching | True: always cache, False: never cache, null: use per-instance logic. |
cacheEnabled(string|null $mnt, string|null $command, array|null $params, string $path) : boolean
Determines if a an URI can be cached.
For performance reasons, the input URI is splitted.
Called by the wrapper to know if it should cache the data it got from its backend.
The global cache toggle is checked first. If it is null, control is transferred to the instance logic.
string|null | $mnt | Mount point or null if global command |
string|null | $command | command if defined |
array|null | $params | Command parameters if defined |
string | $path | Path |
if mount point is invalid
whether the data should be cached or not
pathToMnt(string $path) : \PHK\the
Given a file path, tries to determine if it is currently mounted. If it is the case, the corresponding mount point is returned. If not, an exception is thrown.
Note: when dealing with sub-packages, the input path parameter can be a PHK URI.
string | $path | Path of a PHK package |
if the file is not currently mounted
corresponding mount point
topLevelPath(string $path) : \PHK\the
Given a PHK uri, returns the path of the first-level package for this path. The function recurses until it finds a physical path.
string | $path | A path typically set as 'FILE' |
physical path of the 1st-level package containing this path
mount(string $path, integer $flags) : string
Mount a PHK package and returns the new (or previous, if already loaded) PHK mount point.
Can also create empty \PHK\Build\Creator instances (when the 'CREATOR' flag is set).
string | $path | The path of an existing PHK archive, or the path of the
|
integer | $flags | Or-ed combination of PHK mount flags. |
the mount point
umount(string $mnt)
Umounts a mounted package and any mounted descendant.
We dont use __destruct because :
Accepts to remove a non registered mount point without error
string | $mnt | The mount point to umount |
uriToMnt(string $uri) : string
Returns the mount ID of a subfile's phk uri.
Allows to reference other subfiles in the same package if you don't want
or cannot use Automap (the preferred method) or a relative path.
Example : include(\PHK\Mgr::uri(\PHK\Mgr::uriToMnt(FILE),
string | $uri |
if the input URI is not a PHK URI
a mount point
checkPhpVersion() : void
Check if the current PHP version is supported.
Note that, if PHP version < 5.3, parsing fails because of namespaces and we don't even start execution. So, this test is only executed when PHP version
= 5.3
As a side effect, until we require a version > 5.3, this function never fails.
Calls exit(1) if PHP version is not supported by the PHK runtime
getStoreData(string $mnt, array $options, array $buildInfo) : void
Checks the PHK version this package requires against the current version.
Then, retrieves the 'options' and 'buildInfo' arrays.
This function is separated from mount() to mimic the behavior of the PHK extension, where this data is cached in persistent memory.
string | $mnt | the mount point |
array | $options | on return, contains the options array |
array | $buildInfo | on return, contains the buildInfo array |
computeMnt(string $path, $parentMnt, string $mnt, integer $mtime) : void
Computes the mount point corresponding to a given path.
Also returns the parent mount point (for sub-packages), and the modification time (allows to call stat() only once).
Mount point uniqueness is based on a combination of device+inode+mtime.
When dealing with sub-packages, the input path is a PHK URI.
Sub-packages inherit their parent's modification time.
string | $path | The path to be mounted |
$parentMnt | string|null returns the parent mount point. Not null only for sub-packages. |
|
string | $mnt | returns the computed mount point |
integer | $mtime | returns the modification time |
with message 'File not found' if unable to stat($path).