kernel/classes/clusterfilehandlers/ezfsfilehandler.php
File containing the eZFSFileHandler class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- kernel
- Version
- 4.6.0
\eZFSFileHandler
File containing the eZFSFileHandler class.
- Children
- \eZFS2FileHandler
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants
Properties
Methods


abortCacheGeneration(
)
:
void
Aborts the current cache generation process.
Does so by rolling back the current transaction, which should be the .generating file lock


checkCacheGenerationTimeout(
)
:
void
Checks if the .generating file was changed, which would mean that generation timed out. If not timed out, refreshes the timestamp so that storage won't be stolen


delete(
)
:
void
Deletes specified file/directory.
If a directory specified it is deleted recursively.
\public \static


deleteLocal(
)
:
void
Deletes a file that has been fetched before.
In case of fetching from filesystem does nothing.
\public


eZFSFileHandler(
$filePath
=
false
)
:
void
Constructor.
$filePath File path. If specified, file metadata is fetched in the constructor.
Name | Type | Description |
---|---|---|
$filePath |


exists(
)
:
void
Check if given file/dir exists.
NOTE: this function does not interact with filesystem. Instead, it just returns existance status determined in the constructor.
\public


fetch(
$noLocalCache
=
false
)
:
void
Fetches file from db and saves it in FS under the same name.
In case of fetching from filesystem does nothing.
Name | Type | Description |
---|---|---|
$noLocalCache |


fetchContents(
)
:
void
Returns file contents.
\public \return contents string, or false in case of an error.


fetchUnique(
)
:
string
Fetches file from db and saves it in FS under unique name.
In case of fetching from filesystem, does nothing
Type | Description |
---|---|
string | The unique file path. on FS, the file path. |


fileCopy(
$srcPath, $dstPath
)
:
void
Copy file.
\public \static
Name | Type | Description |
---|---|---|
$srcPath | ||
$dstPath |


fileDelete(
$path, $fnamePart
=
false
)
:
void
\public \static
Name | Type | Description |
---|---|---|
$path | ||
$fnamePart |


fileDeleteByDirList(
$dirList, $commonPath, $commonSuffix
)
:
void
Delete files located in a directories from dirList, with common prefix specified by commonPath, and common suffix with added wildcard at the end
\public \static \sa fileDeleteByRegex()
Name | Type | Description |
---|---|---|
$dirList | ||
$commonPath | ||
$commonSuffix |


fileDeleteByRegex(
$dir, $fileRegex
)
:
void
Delete files matching regex $fileRegex under directory $dir.
\public \static \sa fileDeleteByWildcard()
Name | Type | Description |
---|---|---|
$dir | ||
$fileRegex |


fileDeleteByWildcard(
$wildcard
)
:
void
Delete files matching given wildcard.
Note that this method is faster than fileDeleteByRegex().
\public \static \sa fileDeleteByRegex()
Name | Type | Description |
---|---|---|
$wildcard |


fileDeleteLocal(
$path
)
:
void
Deletes a file that has been fetched before.
Name | Type | Description |
---|---|---|
$path |
- See
- \fetchUnique


fileExists(
$path
)
:
void
Check if given file/dir exists.
\public \static
Name | Type | Description |
---|---|---|
$path |


fileFetch(
$filePath
)
:
void
Fetches file from db and saves it in FS under the same name.
In case of fetching from filesystem does nothing.
Name | Type | Description |
---|---|---|
$filePath |


fileFetchContents(
$filePath
)
:
string | false
Returns file contents.
Name | Type | Description |
---|---|---|
$filePath |
Type | Description |
---|---|
string | false | contents string, or false in case of an error. |


fileLinkCopy(
$srcPath, $dstPath, $symLink
)
:
void
Create symbolic or hard link to file.
\public \static
Name | Type | Description |
---|---|---|
$srcPath | ||
$dstPath | ||
$symLink |


fileMove(
$srcPath, $dstPath
)
:
void
Move file.
\public \static
Name | Type | Description |
---|---|---|
$srcPath | ||
$dstPath |


fileStore(
string $filePath, string $scope
=
false, string $delete
=
false, $datatype
=
false
)
:
void
Store file.
In case of storing to filesystem does nothing.
Name | Type | Description |
---|---|---|
$filePath | string | Path to the file being stored. |
$scope | string | Means something like "file category". May be used to clean caches of a certain type. |
$delete | string | true if the file should be deleted after storing. |
$datatype |


fileStoreContents(
$filePath, $contents, $scope
=
false, $datatype
=
false
)
:
void
Store file contents.
\public \static
Name | Type | Description |
---|---|---|
$filePath | ||
$contents | ||
$scope | ||
$datatype |


isExpired(
int $expiry, int $curtime, int $ttl
)
:
bool
Calculates if the current file data is expired or not.
Name | Type | Description |
---|---|---|
$expiry | int | Time when file is to be expired, a value of -1 will disable this check. |
$curtime | int | The current time to check against. |
$ttl | int | Number of seconds the data can live, set to null to disable TTL. |
Type | Description |
---|---|
bool |


isFileExpired(
string $fname, int $mtime, int $expiry, int $curtime, int $ttl
)
:
bool
Calculates if the file data is expired or not.
Name | Type | Description |
---|---|---|
$fname | string | Name of file, available for easy debugging. |
$mtime | int | Modification time of file, can be set to false if file does not exist. |
$expiry | int | Time when file is to be expired, a value of -1 will disable this check. |
$curtime | int | The current time to check against. |
$ttl | int | Number of seconds the data can live, set to null to disable TTL. |
Type | Description |
---|---|
bool |


passthrough(
int $offset
=
0, int $length
=
false
)
:
void
Outputs file contents to the browser Note: does not handle headers. eZFile::downloadHeaders() can be used for this
Name | Type | Description |
---|---|---|
$offset | int | Transfer start offset |
$length | int | Transfer length, in bytes |


processCache(
$retrieveCallback, $generateCallback
=
null, $ttl
=
null, $expiry
=
null, $extraData
=
null
)
:
void
Name | Type | Description |
---|---|---|
$retrieveCallback | ||
$generateCallback | ||
$ttl | ||
$expiry | ||
$extraData |


processFile(
$callback, $expiry
=
false, $extraData
=
null
)
:
void
Name | Type | Description |
---|---|---|
$callback | ||
$expiry | ||
$extraData |


purge(
$printCallback
=
false, $microsleep
=
false, $max
=
false, $expiry
=
false
)
:
void
Name | Type | Description |
---|---|---|
$printCallback | ||
$microsleep | ||
$max | ||
$expiry |


requiresBinaryPurge(
)
:
bool
eZFS does not require binary purge.
Files are stored on plain FS and removed using FS functions
Type | Description |
---|---|
bool |
- Deprecated
- Deprecated as of 4.5, use {@link eZFSFileHandler::requiresPurge()} instead.
- Since
- 4.3


requiresClusterizing(
)
:
bool
eZFS only stores data to FS and doesn't require/support clusterizing
Type | Description |
---|---|
bool | false |


requiresPurge(
)
:
bool
eZFS does not require binary purge.
Files are stored on plain FS and removed using FS functions
Type | Description |
---|---|
bool |
- Since
- 4.5.0


startCacheGeneration(
)
:
mixed
Starts cache generation for the current file.
This is done by creating a file named by the original file name, prefixed with '.generating'.
Type | Description |
---|---|
mixed | true if generation lock was granted, an integer matching the time before the current generation times out |
- Todo
- add timeout handling...


storeCache(
$fileData, $storeCache
=
true
)
:
void
Name | Type | Description |
---|---|---|
$fileData | ||
$storeCache |


storeContents(
string $contents, string $scope
=
false, string $datatype
=
false, bool $storeLocally
=
false
)
:
void
Store file contents to disk
Name | Type | Description |
---|---|---|
$contents | string | Binary file data |
$scope | string | Not used in the FS handler |
$datatype | string | Not used in the FS handler |
$storeLocally | bool | Not used in the FS handler |