kernel/classes/clusterfilehandlers/dbbackends/mysqli.php
File containing the eZDBFileHandlerMysqlBackend 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
Constants


TABLE_METADATA
= 'ezdbfile'


TABLE_DATA
= 'ezdbfile_data'
\eZDBFileHandlerMysqliBackend
Package:
Properties
Methods



_abortCacheGeneration(
string $generatingFilePath
)
:
voidAborts the cache generation process by removing the .generating file
Parameters
| Name |
Type |
Description |
| $generatingFilePath |
string |
.generating cache file path |



_checkCacheGenerationTimeout(
string $generatingFilePath, int $generatingFileMtime
)
:
boolChecks if generation has timed out by looking for the .generating file
and comparing its timestamp to the one assigned when the file was created
Parameters
| Name |
Type |
Description |
| $generatingFilePath |
string |
|
| $generatingFileMtime |
int |
|
Returns
| Type |
Description |
| bool |
true if the file didn't timeout, false otherwise |



_endCacheGeneration(
string $filePath, $generatingFilePath, $rename
)
:
boolEnds the cache generation for the current file: moves the (meta)data for
the .generating file to the actual file, and removed the .generating
Parameters
| Name |
Type |
Description |
| $filePath |
string |
|
| $generatingFilePath |
|
|
| $rename |
|
|
Returns



_fetch(
string $filePath, string $uniqueName
=
false
)
:
\theFetches the file $filePath from the database, saving it locally with its
original name, or $uniqueName if given
Parameters
| Name |
Type |
Description |
| $filePath |
string |
|
| $uniqueName |
string |
|
Returns
| Type |
Description |
| \the |
file physical path, or false if fetch failed |



_fetchMetadata(
$filePath, $fname
=
false
)
:
void\return file metadata, or false if the file does not exist in database.
Parameters
| Name |
Type |
Description |
| $filePath |
|
|
| $fname |
|
|



_passThrough(
string $filePath, int $startOffset
=
0, false | int $length
=
false, false | string $fname
=
false
)
:
voidSends a binary file's content to the client
Parameters
| Name |
Type |
Description |
| $filePath |
string |
File path |
| $startOffset |
int |
Starting offset |
| $length |
false | int |
Length to transmit, false means everything |
| $fname |
false | string |
The function name that started the query |



_report(
$query, string $fname, int $timeTaken, int $numRows
=
false
)
:
voidReport SQL $query to debug system.
Parameters
| Name |
Type |
Description |
| $query |
|
|
| $fname |
string |
The function name that started the query, should contain relevant arguments in the text. |
| $timeTaken |
int |
Number of seconds the query + related operations took (as float).
|
| $numRows |
int |
Number of affected rows. |



_selectOne(
$query, string $fname, mixed $error
=
false, bool $debug
=
false, string $fetchCall
)
:
voidCommon select method for doing a SELECT query which is passed in $query and fetching one row from the result.
If there are more than one row it will fail and exit, if 0 it returns false.
Parameters
| Name |
Type |
Description |
| $query |
|
|
| $fname |
string |
The function name that started the query, should contain relevant arguments in the text. |
| $error |
mixed |
Sent to _error() in case of errors
|
| $debug |
bool |
If true it will display the fetched row in addition to the SQL. |
| $fetchCall |
string |
The callback to fetch the row. |



_selectOneRow(
$query, string $fname, mixed $error
=
false, bool $debug
=
false
)
:
array | falseCommon select method for doing a SELECT query which is passed in $query and fetching one row from the result.
If there are more than one row it will fail and exit, if 0 it returns false.
Parameters
| Name |
Type |
Description |
| $query |
|
|
| $fname |
string |
The function name that started the query, should contain relevant arguments in the text. |
| $error |
mixed |
Sent to _error() in case of errors
|
| $debug |
bool |
If true it will display the fetched row in addition to the SQL. |
Returns
| Type |
Description |
| array | false |
A numerical array, or false if 0 or more than 1 rows |



_startCacheGeneration(
string $filePath, $generatingFilePath
)
:
arrayAttempts to begin cache generation by creating a new file named as the
given filepath, suffixed with .generating. If the file already exists,
insertion is not performed and false is returned (means that the file
is already being generated)
Parameters
| Name |
Type |
Description |
| $filePath |
string |
|
| $generatingFilePath |
|
|
Returns
| Type |
Description |
| array |
array with 2 indexes: 'result', containing either ok or ko, and another index that depends on the result: - if result == 'ok', the 'mtime' index contains the generating file's mtime - if result == 'ko', the 'remaining' index contains the remaining generation time (time until timeout) in seconds |



_verifyExclusiveLock(
string $filePath, int $expiry, int $curtime, int $ttl, string $fname
=
false
)
:
boolUses a secondary database connection to check outside the transaction scope
if a file has been generated during the current process execution
Parameters
| Name |
Type |
Description |
| $filePath |
string |
|
| $expiry |
int |
|
| $curtime |
int |
|
| $ttl |
int |
|
| $fname |
string |
|
Returns
| Type |
Description |
| bool |
false if the file exists and is not expired, true otherwise |



expiredFilesList(
array $scopes, int $limit
=
array( 0, 100 ), int $expiry
=
false
)
:
\array(filepath)Returns the list of expired files
Parameters
| Name |
Type |
Description |
| $scopes |
array |
Array of scopes to consider. At least one. |
| $limit |
int |
Max number of items. Set to false for unlimited. |
| $expiry |
int |
Number of seconds, only items older than this will be returned. |
Returns
| Type |
Description |
| \array(filepath) |
|
Details
- Since
- 4.3



nameTrunk(
string $filePath, string $scope
)
:
string
staticReturns the name_trunk for a file path
Parameters
| Name |
Type |
Description |
| $filePath |
string |
|
| $scope |
string |
|
Returns



remainingCacheGenerationTime(
$row
)
:
intReturns the remaining time, in seconds, before the generating file times
out
Parameters
| Name |
Type |
Description |
| $row |
|
|
Returns
| Type |
Description |
| int |
Remaining generation seconds. A negative value indicates a timeout. |