kernel/classes/clusterfilehandlers/ezfsfilehandler.php

Show: inherited
Table of Contents

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

Package: kernel

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

Constant  EXPIRY_TIMESTAMP = 233366400

This should be defined in eZFS2FileHandler, but due to static members limitations in PHP < 5.3, it is declared here

Properties

Propertypublic  $filePath= ''
Details
Type
n/a
Propertypublic  $metaData= 'null'
Default valuenullDetails
Type
n/a

Methods

methodpublic_exclusiveLock(  $fname = false ) : void

Parameters
Name Type Description
$fname
methodpublic_freeExclusiveLock(  $fname = false ) : void

Parameters
Name Type Description
$fname
methodpublic_mutex( ) : void

methodpublicabortCacheGeneration( ) : void

Aborts the current cache generation process.

Does so by rolling back the current transaction, which should be the .generating file lock

methodpubliccheckCacheGenerationTimeout( ) : 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

methodpublicdelete( ) : void

Deletes specified file/directory.

If a directory specified it is deleted recursively.

\public \static

methodpublicdeleteLocal( ) : void

Deletes a file that has been fetched before.

In case of fetching from filesystem does nothing.

\public

methodpubliceZFSFileHandler(  $filePath = false ) : void

Constructor.

$filePath File path. If specified, file metadata is fetched in the constructor.

Parameters
Name Type Description
$filePath
methodpublicendCacheGeneration( ) : void

Ends the cache generation started by startCacheGeneration().

methodpublicexists( ) : 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

methodpublicfetch(  $noLocalCache = false ) : void

Fetches file from db and saves it in FS under the same name.

In case of fetching from filesystem does nothing.

Parameters
Name Type Description
$noLocalCache
methodpublicfetchContents( ) : void

Returns file contents.

\public \return contents string, or false in case of an error.

methodpublicfetchUnique( ) : string

Fetches file from db and saves it in FS under unique name.

In case of fetching from filesystem, does nothing

Returns
Type Description
string The unique file path. on FS, the file path.
methodpublicfileCopy(  $srcPath,  $dstPath ) : void

Copy file.

\public \static

Parameters
Name Type Description
$srcPath
$dstPath
methodpublicfileDelete(  $path,  $fnamePart = false ) : void

\public \static

Parameters
Name Type Description
$path
$fnamePart
methodpublicfileDeleteByDirList(  $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()

Parameters
Name Type Description
$dirList
$commonPath
$commonSuffix
methodpublicfileDeleteByRegex(  $dir,  $fileRegex ) : void

Delete files matching regex $fileRegex under directory $dir.

\public \static \sa fileDeleteByWildcard()

Parameters
Name Type Description
$dir
$fileRegex
methodpublicfileDeleteByWildcard(  $wildcard ) : void

Delete files matching given wildcard.

Note that this method is faster than fileDeleteByRegex().

\public \static \sa fileDeleteByRegex()

Parameters
Name Type Description
$wildcard
methodpublicfileDeleteLocal(  $path ) : void

Deletes a file that has been fetched before.

Parameters
Name Type Description
$path
Details
See
\fetchUnique  
methodpublicfileExists(  $path ) : void

Check if given file/dir exists.

\public \static

Parameters
Name Type Description
$path
methodpublicfileFetch(  $filePath ) : void

Fetches file from db and saves it in FS under the same name.

In case of fetching from filesystem does nothing.

Parameters
Name Type Description
$filePath
methodpublicfileFetchContents(  $filePath ) : string | false

Returns file contents.

Parameters
Name Type Description
$filePath
Returns
Type Description
string | false contents string, or false in case of an error.
methodpublicfileLinkCopy(  $srcPath,  $dstPath,  $symLink ) : void

Create symbolic or hard link to file.

\public \static

Parameters
Name Type Description
$srcPath
$dstPath
$symLink
methodpublicfileMove(  $srcPath,  $dstPath ) : void

Move file.

\public \static

Parameters
Name Type Description
$srcPath
$dstPath
methodpublicfileStore( string $filePath, string $scope = false, string $delete = false,  $datatype = false ) : void

Store file.

In case of storing to filesystem does nothing.

Parameters
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
methodpublicfileStoreContents(  $filePath,  $contents,  $scope = false,  $datatype = false ) : void

Store file contents.

\public \static

Parameters
Name Type Description
$filePath
$contents
$scope
$datatype
methodpublicisExpired( int $expiry, int $curtime, int $ttl ) : bool

Calculates if the current file data is expired or not.

Parameters
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.

Returns
Type Description
bool
methodpublicisFileExpired( string $fname, int $mtime, int $expiry, int $curtime, int $ttl ) : bool
static

Calculates if the file data is expired or not.

Parameters
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.

Returns
Type Description
bool
methodpublicloadMetaData(  $force = false ) : void

Parameters
Name Type Description
$force
methodpublicmove(  $dstPath ) : void

Move file.

\public

Parameters
Name Type Description
$dstPath
methodpublicmtime( ) : void

Returns file modification time.

\public

methodpublicname( ) : void

Returns file name.

\public

methodpublicpassthrough( 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

Parameters
Name Type Description
$offset int

Transfer start offset

$length int

Transfer length, in bytes

methodpublicprocessCache(  $retrieveCallback,  $generateCallback = null,  $ttl = null,  $expiry = null,  $extraData = null ) : void

Parameters
Name Type Description
$retrieveCallback
$generateCallback
$ttl
$expiry
$extraData
methodpublicprocessFile(  $callback,  $expiry = false,  $extraData = null ) : void

Parameters
Name Type Description
$callback
$expiry
$extraData
methodpublicpurge(  $printCallback = false,  $microsleep = false,  $max = false,  $expiry = false ) : void

Parameters
Name Type Description
$printCallback
$microsleep
$max
$expiry
methodpublicrequiresBinaryPurge( ) : bool

eZFS does not require binary purge.

Files are stored on plain FS and removed using FS functions

Returns
Type Description
bool
Details
Deprecated
Deprecated as of 4.5, use {@link eZFSFileHandler::requiresPurge()} instead.  
Since
4.3  
methodpublicrequiresClusterizing( ) : bool

eZFS only stores data to FS and doesn't require/support clusterizing

Returns
Type Description
bool false
methodpublicrequiresPurge( ) : bool

eZFS does not require binary purge.

Files are stored on plain FS and removed using FS functions

Returns
Type Description
bool
Details
Since
4.5.0  
methodpublicsize( ) : void

Returns file size.

\public

methodpublicstartCacheGeneration( ) : mixed

Starts cache generation for the current file.

This is done by creating a file named by the original file name, prefixed with '.generating'.

Returns
Type Description
mixed true if generation lock was granted, an integer matching the time before the current generation times out
Details
Todo
add timeout handling...  
methodpublicstat( ) : void

Returns file metadata.

\public

methodpublicstoreCache(  $fileData,  $storeCache = true ) : void

Parameters
Name Type Description
$fileData
$storeCache
methodpublicstoreContents( string $contents, string $scope = false, string $datatype = false, bool $storeLocally = false ) : void

Store file contents to disk

Parameters
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

Documentation was generated by DocBlox 0.18.1.