Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
eZDFSFileHandlerMySQLiBackend Class Reference
Inheritance diagram for eZDFSFileHandlerMySQLiBackend:

## Public Member Functions
| __construct ()
| _connect ()
| _disconnect ()
| _copy ( $srcFilePath, $dstFilePath, $fname=false)
| _purge ( $filePath, $onlyExpired=false, $expiry=false, $fname=false)
| _purgeByLike ( $like, $onlyExpired=false, $limit=50, $expiry=false, $fname=false)
| _delete ( $filePath, $insideOfTransaction=false, $fname=false)
| _deleteByLike ( $like, $fname=false)
| _deleteByWildcard ( $wildcard, $fname=false)
| _deleteByDirList ( $dirList, $commonPath, $commonSuffix, $fname=false)
| _exists ( $filePath, $fname=false, $ignoreExpiredFiles=true, $checkOnDFS=false)
| _fetch ( $filePath, $uniqueName=false)
| _fetchContents ( $filePath, $fname=false)
| _fetchMetadata ( $filePath, $fname=false)
| _linkCopy ( $srcPath, $dstPath, $fname=false)
| _passThrough ( $filePath, $startOffset=0, $length=false, $fname=false)
| _rename ( $srcFilePath, $dstFilePath)
| _store ( $filePath, $datatype, $scope, $fname=false)
| _storeInner ( $filePath, $datatype, $scope, $fname)
| _storeContents ( $filePath, $contents, $scope, $datatype, $mtime=false, $fname=false)
| _storeContentsInner ( $filePath, $contents, $scope, $datatype, $curTime, $fname)
| _getFileList ( $scopes=false, $excludeScopes=false, $limit=false, $path=false)
| _insert ( $table, $array, $fname)
| _report ( $query, $fname, $timeTaken, $numRows=false)
| _startCacheGeneration ( $filePath, $generatingFilePath)
| _endCacheGeneration ( $filePath, $generatingFilePath, $rename)
| _checkCacheGenerationTimeout ( $generatingFilePath, $generatingFileMtime)
| _abortCacheGeneration ( $generatingFilePath)
| expiredFilesList ( $scopes, $limit=array(0, 100), $expiry=false)
| registerListener (eZClusterEventListener $listener)
| deleteCacheFiles ( $limit)
| applyServerUri ( $filePath)

## Public Attributes
const | TIME_UNTIL_RETRY = 100
| $db = null

## Protected Member Functions
| dbTable ( $filePath)
| _deleteInner ( $filePath, $fname)
| _deleteByWildcardInner ( $wildcard, $fname)
| _deleteByDirListInner ( $dirList, $commonPath, $commonSuffix, $fname)
| __mkdir_p ( $dir)
| _die ( $msg, $sql=null)
| _insertUpdate ( $table, $array, $update, $fname, $reportError=true)
| _sqlList ( $array)
| _selectOneRow ( $query, $fname, $error=false, $debug=false)
| _selectOneAssoc ( $query, $fname, $error=false, $debug=false)
| _selectOne ( $query, $fname, $error=false, $debug=false, $fetchCall)
| _begin ( $fname=false)
| _commit ( $fname=false)
| _rollback ( $fname=false)
| _protect ()
| _handleErrorType ( $res)
| _isFailure ( $result)
| _fail ( $value, $text=false)
| _query ( $query, $fname=false, $reportError=true)
| _quote ( $value, $escapeUnderscoreWildcards=false)
| _md5 ( $value)
| _error ( $query, $fname, $error="Failed to execute SQL for function:")
| remainingCacheGenerationTime ( $row)

## Static Protected Member Functions
static | nameTrunk ( $filePath, $scope)

## Protected Attributes
| $maxCopyTries
| $numQueries = 0
| $transactionCount = 0
| $dfsbackend = null
| $eventHandler
| $metaDataTable = 'ezdfsfile'
| $metaDataTableCache = 'ezdfsfile_cache'
| $cacheDir
| $storageDir

## Static Protected Attributes
static | $dbparams = null

## Private Member Functions
| _copyInner ( $srcFilePath, $dstFilePath, $fname, $metaData)
| _deleteByLikeInner ( $like, $fname)
| mkdir_p ( $dir)

## Detailed Description

Definition at line 50 of file mysqli.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDFSFileHandlerMySQLiBackend::__construct | ( |  | ) |

Constructor

Definition at line 67 of file mysqli.php.

References ezpEvent\getInstance().

## Member Function Documentation

## ◆ __mkdir_p()

eZDFSFileHandlerMySQLiBackend::__mkdir_p | ( |  | $dir | ) |
| protected

Deprecated:
  Use eZDFSFileHandlerMySQLiBackend::mkdir_p() instead

Parameters

  $dir |

Returns
  bool

Definition at line 694 of file mysqli.php.

References $dir, and mkdir_p().

## ◆ _abortCacheGeneration()

eZDFSFileHandlerMySQLiBackend::_abortCacheGeneration | ( |  | $generatingFilePath | ) |

Aborts the cache generation process by removing the .generating file

Parameters

  string | $generatingFilePath | .generating cache file path

Returns
  void

Definition at line 1894 of file mysqli.php.

References _begin(), _commit(), _md5(), _query(), and dbTable().

## ◆ _begin()

eZDFSFileHandlerMySQLiBackend::_begin | ( |  | $fname = `false` | ) |
| protected

Starts a new transaction by executing a BEGIN call. If a transaction is already started nothing is executed.

Definition at line 1355 of file mysqli.php.

References _query().

Referenced by _abortCacheGeneration(), _endCacheGeneration(), _protect(), _purgeByLike(), and _rename().

## ◆ _checkCacheGenerationTimeout()

eZDFSFileHandlerMySQLiBackend::_checkCacheGenerationTimeout | ( |  | $generatingFilePath,
|  |  | $generatingFileMtime
| ) |  |

Checks 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

  string | $generatingFilePath |
  int | $generatingFileMtime |

Returns
  bool true if the file didn't timeout, false otherwise

Definition at line 1831 of file mysqli.php.

References $numRows, $query, $res, $row, $time, _error(), _md5(), _report(), eZDebug\accumulatorStart(), dbTable(), and eZDebugSetting\writeDebug().

## ◆ _commit()

eZDFSFileHandlerMySQLiBackend::_commit | ( |  | $fname = `false` | ) |
| protected

Stops a current transaction and commits the changes by executing a COMMIT call. If the current transaction is a sub-transaction nothing is executed.

Returns true if the commit was executed successfully, false if it failed, null if it wasn't executed.

Returns
  bool|null

Definition at line 1374 of file mysqli.php.

References _query().

Referenced by _abortCacheGeneration(), _endCacheGeneration(), _protect(), _purgeByLike(), and _rename().

## ◆ _connect()

eZDFSFileHandlerMySQLiBackend::_connect | ( |  | ) |

Connects to the database.

Returns
  void

Exceptions

  eZClusterHandlerDBNoConnectionException |
  eZClusterHandlerDBNoDatabaseException |

Definition at line 115 of file mysqli.php.

References _fail(), eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), eZDFSFileHandlerBackendFactory\build(), and eZTextCodec\internalCharset().

## ◆ _copy()

eZDFSFileHandlerMySQLiBackend::_copy | ( |  | $srcFilePath,
|  |  | $dstFilePath,
|  |  | $fname = `false`
| ) |  |

Creates a copy of a file in DB+DFS

Parameters

  string | $srcFilePath | Source file
  string | $dstFilePath | Destination file
  bool | string | $fname |

Returns
  bool

See also
  _copyInner

Definition at line 212 of file mysqli.php.

References $result, _fetchMetadata(), and _protect().

Referenced by _linkCopy().

## ◆ _copyInner()

eZDFSFileHandlerMySQLiBackend::_copyInner | ( |  | $srcFilePath,
|  |  | $dstFilePath,
|  |  | $fname,
|  |  | $metaData
| ) |  |
| private

Inner function used by _copy to perform the operation in a transaction

Parameters

  string | $srcFilePath |
  string | $dstFilePath |
  bool | $fname |
  array | $metaData | Source file's metadata

Returns
  bool

See also
  _copy

Definition at line 247 of file mysqli.php.

References _delete(), _fail(), _insertUpdate(), dbTable(), and nameTrunk().

## ◆ _delete()

eZDFSFileHandlerMySQLiBackend::_delete | ( |  | $filePath,
|  |  | $insideOfTransaction = `false`,
|  |  | $fname = `false`
| ) |  |

Deletes a file from DB

The file won't be removed from disk, _purge has to be used for this. Only single files will be deleted, to delete multiple files, _deleteByLike has to be used.

Parameters

  string | $filePath | Path of the file to delete
  bool | $insideOfTransaction | Wether or not a transaction is already started
  bool | string | $fname | Optional caller name for debugging

See also
  _deleteInner
  _deleteByLike

Returns
  bool

Definition at line 422 of file mysqli.php.

References $filePath, $res, _deleteInner(), _handleErrorType(), and _protect().

Referenced by _copyInner().

## ◆ _deleteByDirList()

eZDFSFileHandlerMySQLiBackend::_deleteByDirList | ( |  | $dirList,
|  |  | $commonPath,
|  |  | $commonSuffix,
|  |  | $fname = `false`
| ) |  |

Parameters

  array | $dirList |
  string | $commonPath |
  string | $commonSuffix |
  string | bool | $fname |

Returns
  bool|mixed

Definition at line 564 of file mysqli.php.

References _protect().

## ◆ _deleteByDirListInner()

eZDFSFileHandlerMySQLiBackend::_deleteByDirListInner | ( |  | $dirList,
|  |  | $commonPath,
|  |  | $commonSuffix,
|  |  | $fname
| ) |  |
| protected

Parameters

  array | $dirList |
  string | $commonPath |
  string | $commonSuffix |
  string | bool | $fname |

Returns
  bool

Definition at line 581 of file mysqli.php.

References $event, $res, _query(), _quote(), dbTable(), and eZDebug\writeError().

## ◆ _deleteByLike()

eZDFSFileHandlerMySQLiBackend::_deleteByLike | ( |  | $like,
|  |  | $fname = `false`
| ) |  |

Deletes multiple files using a SQL LIKE statement

Use _delete if you need to delete single files

Parameters

  string | $like | SQL LIKE condition applied to ezdfsfile.name to look for files to delete. Will use name_trunk if the LIKE string matches a filetype that supports name_trunk.
  bool | string | $fname | Optional caller name for debugging

Returns
  bool

See also
  _deleteByLikeInner
  _delete

Definition at line 478 of file mysqli.php.

References _protect().

## ◆ _deleteByLikeInner()

eZDFSFileHandlerMySQLiBackend::_deleteByLikeInner | ( |  | $like,
|  |  | $fname
| ) |  |
| private

Callback used by _deleteByLike to perform the deletion

Parameters

  string | $like |
  string | bool | $fname |

Returns
  bool|eZMySQLBackendError

Definition at line 500 of file mysqli.php.

References $res, _fail(), _query(), _quote(), and dbTable().

## ◆ _deleteByWildcard()

eZDFSFileHandlerMySQLiBackend::_deleteByWildcard | ( |  | $wildcard,
|  |  | $fname = `false`
| ) |  |

Deletes multiple DB files by wildcard

Parameters

  string | $wildcard |
  mixed | $fname |

Returns
  bool

Deprecated:
  Has severe performance issues

Definition at line 518 of file mysqli.php.

References _protect().

## ◆ _deleteByWildcardInner()

eZDFSFileHandlerMySQLiBackend::_deleteByWildcardInner | ( |  | $wildcard,
|  |  | $fname
| ) |  |
| protected

Callback used by _deleteByWildcard to perform the deletion

Parameters

  mixed | $wildcard |
  mixed | $fname |

Returns
  bool

Deprecated:
  Has severe performance issues

Definition at line 536 of file mysqli.php.

References $res, _fail(), _query(), and dbTable().

## ◆ _deleteInner()

eZDFSFileHandlerMySQLiBackend::_deleteInner | ( |  | $filePath,
|  |  | $fname
| ) |  |
| protected

Callback method used by by _delete to delete a single file

Parameters

  string | $filePath | Path of the file to delete
  string | $fname | Optional caller name for debugging

Returns
  bool

Definition at line 457 of file mysqli.php.

References $filePath, _fail(), _md5(), _query(), and dbTable().

Referenced by _delete().

## ◆ _die()

eZDFSFileHandlerMySQLiBackend::_die | ( |  | $msg,
|  |  | $sql = `null`
| ) |  |
| protected

Handles a DB error, displaying it as an eZDebug error

See also
  eZDebug::writeError

Parameters

  string | $msg | Message to display
  string | $sql | SQL query to display error for

Returns
  void

Todo:
  to be fixed: will this generate a warning?

Definition at line 1165 of file mysqli.php.

References eZDebug\writeError().

## ◆ _disconnect()

eZDFSFileHandlerMySQLiBackend::_disconnect | ( |  | ) |

Disconnects the handler from the database

Definition at line 194 of file mysqli.php.

## ◆ _endCacheGeneration()

eZDFSFileHandlerMySQLiBackend::_endCacheGeneration | ( |  | $filePath,
|  |  | $generatingFilePath,
|  |  | $rename
| ) |  |

Ends the cache generation for the current file: moves the (meta)data for the .generating file to the actual file, and removed the .generating

Parameters

  string | $filePath |
  string | $generatingFilePath |
  bool | $rename |

Returns
  bool

Definition at line 1733 of file mysqli.php.

References $filePath, $res, _begin(), _commit(), _md5(), _query(), _rollback(), _sqlList(), dbTable(), nameTrunk(), and eZDebug\writeError().

## ◆ _error()

eZDFSFileHandlerMySQLiBackend::_error | ( |  | $query,
|  |  | $fname,
|  |  | $error = `"Failed to execute SQL for function:"`
| ) |  |
| protected

Prints error message $error to debug system.

Parameters

  string | $query | The query that was attempted, will be printed if $error is `false`
  string | $fname | The function name that started the query, should contain relevant arguments in the text.
  string | $error | The error message, if this is an array the first element is the value to dump and the second the error header (for eZDebug::writeNotice). If this is `false` a generic message is shown.

Definition at line 1589 of file mysqli.php.

References $error, and eZDebug\writeError().

Referenced by _checkCacheGenerationTimeout(), _query(), and _selectOne().

## ◆ _exists()

eZDFSFileHandlerMySQLiBackend::_exists | ( |  | $filePath,
|  |  | $fname = `false`,
|  |  | $ignoreExpiredFiles = `true`,
|  |  | $checkOnDFS = `false`
| ) |  |

Checks if a file exists

Parameters

  string | $filePath |
  string | bool | $fname |
  bool | $ignoreExpiredFiles |
  bool | $checkOnDFS |

Returns
  bool

Definition at line 624 of file mysqli.php.

References $filePath, $row, _md5(), _selectOneRow(), and dbTable().

Referenced by _rename().

## ◆ _fail()

eZDFSFileHandlerMySQLiBackend::_fail | ( |  | $value,
|  |  | $text = `false`
| ) |  |
| protected

Creates an error object which can be read by some backend functions.

Parameters

  mixed | $value | The value which is sent to the debug system.
  string | bool | $text | The text/header for the value.

Returns
  eZMySQLBackendError

Definition at line 1500 of file mysqli.php.

Referenced by _connect(), _copyInner(), _deleteByLikeInner(), _deleteByWildcardInner(), _deleteInner(), _insertUpdate(), _purge(), _purgeByLike(), _rename(), _storeContentsInner(), and _storeInner().

## ◆ _fetch()

eZDFSFileHandlerMySQLiBackend::_fetch | ( |  | $filePath,
|  |  | $uniqueName = `false`
| ) |  |

Fetches the file $filePath from the database to its own name

Saving $filePath locally with its original name, or $uniqueName if given

Parameters

  string | $filePath |
  bool | string | $uniqueName | Alternative name to save the file to

Returns
  string|bool the file physical path, or false if fetch failed

Definition at line 708 of file mysqli.php.

References $filePath, _fetchMetadata(), eZFile\APPEND_DEBUG_ON_FAILURE, eZFile\CLEAN_ON_FAILURE, file_exists(), mkdir_p(), eZFile\rename(), eZDebugSetting\writeDebug(), and eZDebug\writeError().

## ◆ _fetchContents()

eZDFSFileHandlerMySQLiBackend::_fetchContents | ( |  | $filePath,
|  |  | $fname = `false`
| ) |  |

Parameters

  string | $filePath |
  string | bool | $fname |

Returns
  string|bool

Definition at line 783 of file mysqli.php.

References $contents, $filePath, _fetchMetadata(), and eZDebug\writeError().

## ◆ _fetchMetadata()

eZDFSFileHandlerMySQLiBackend::_fetchMetadata | ( |  | $filePath,
|  |  | $fname = `false`
| ) |  |

Fetches and returns metadata for $filePath

Parameters

  string | $filePath |
  bool | $fname |

Returns
  array|false file metadata, or false if the file does not exist in database.

Definition at line 814 of file mysqli.php.

References $filePath, _md5(), _selectOneAssoc(), and dbTable().

Referenced by _copy(), _fetch(), _fetchContents(), _passThrough(), and _rename().

## ◆ _getFileList()

eZDFSFileHandlerMySQLiBackend::_getFileList | ( |  | $scopes = `false`,
|  |  | $excludeScopes = `false`,
|  |  | $limit = `false`,
|  |  | $path = `false`
| ) |  |

Returns the list of cluster files, filtered by the optional params

Parameters

  array | bool | $scopes | filter by array of scopes to include in the list
  bool | $excludeScopes | if true, $scopes param acts as an exclude filter
  array | bool | $limit | limits the search to offset limit[0], limit limit[1]
  bool | string | $path | filter to include entries only including $path

Returns
  array|false the db list of entries of false if none found

Definition at line 1109 of file mysqli.php.

References $limit, $query, $row, _query(), and eZDebug\writeError().

## ◆ _handleErrorType()

eZDFSFileHandlerMySQLiBackend::_handleErrorType | ( |  | $res | ) |
| protected

Parameters

  eZMySQLBackendError | bool | $res |

Definition at line 1465 of file mysqli.php.

References $res, and eZDebug\writeError().

Referenced by _delete().

## ◆ _insert()

eZDFSFileHandlerMySQLiBackend::_insert | ( |  | $table,
|  |  | $array,
|  |  | $fname
| ) |  |

Performs an insert of the given items in $array.

Parameters

  string | $table | Name of table to execute insert on.
  array | $array | Associative array with data to insert, the keys are the field names and the values will be quoted according to type.
  string | $fname | Name of caller function (for logging purpuse)

Returns
  bool|int|string

Definition at line 1189 of file mysqli.php.

References $query, $res, _query(), and _sqlList().

## ◆ _insertUpdate()

eZDFSFileHandlerMySQLiBackend::_insertUpdate | ( |  | $table,
|  |  | $array,
|  |  | $update,
|  |  | $fname,
|  |  | $reportError = `true`
| ) |  |
| protected

Performs an insert of the given items in $array.

If entry specified already exists the $update SQL is executed to update the entry instead.

Parameters

  string | $table | Name of table to execute insert on.
  array | $array | Associative array with data to insert, the keys are the field names and the values will be quoted according to type.
  string | $update | Partial update SQL which is executed when entry exists.
  string | $fname | Name of caller function (for logging purpuse)
  bool | $reportError |

Returns
  bool|int|string

Definition at line 1218 of file mysqli.php.

References $query, $res, _fail(), _query(), and _sqlList().

Referenced by _copyInner(), _storeContentsInner(), and _storeInner().

## ◆ _isFailure()

eZDFSFileHandlerMySQLiBackend::_isFailure | ( |  | $result | ) |
| protected

Checks if $result is a failure type and returns true if so, false otherwise.

A failure is either the value false or an error object of type eZMySQLBackendError.

Definition at line 1484 of file mysqli.php.

References $result.

## ◆ _linkCopy()

eZDFSFileHandlerMySQLiBackend::_linkCopy | ( |  | $srcPath,
|  |  | $dstPath,
|  |  | $fname = `false`
| ) |  |

Parameters

  string | $srcPath |
  string | $dstPath |
  string | bool | $fname |

Returns
  bool

Definition at line 840 of file mysqli.php.

References _copy().

## ◆ _md5()

eZDFSFileHandlerMySQLiBackend::_md5 | ( |  | $value | ) |
| protected

Provides the SQL calls to convert $value to MD5 The returned value can directly be put into SQLs.

Parameters

  string | $value |

Returns
  string

Definition at line 1573 of file mysqli.php.

Referenced by _abortCacheGeneration(), _checkCacheGenerationTimeout(), _deleteInner(), _endCacheGeneration(), _exists(), _fetchMetadata(), _purge(), _rename(), and _startCacheGeneration().

## ◆ _passThrough()

eZDFSFileHandlerMySQLiBackend::_passThrough | ( |  | $filePath,
|  |  | $startOffset = `0`,
|  |  | $length = `false`,
|  |  | $fname = `false`
| ) |  |

Passes $filePath content through

Parameters

  string | $filePath |
  int | $startOffset | Byte offset to start download from
  bool | int | $length | Byte length to be sent
  string | bool | $fname |

Returns
  bool

Definition at line 859 of file mysqli.php.

References $filePath, and _fetchMetadata().

## ◆ _protect()

eZDFSFileHandlerMySQLiBackend::_protect | ( |  | ) |
| protected

Protects a custom function with SQL queries in a database transaction. If the function reports an error the transaction is ROLLBACKed.

The first argument to the _protect() is the callback and the second is the name of the function (for query reporting). The remainder of arguments are sent to the callback.

A return value of false from the callback is considered a failure, any other value is returned from _protect(). For extended error handling call _fail() and return the value.

Returns
  bool|mixed

Definition at line 1419 of file mysqli.php.

References $args, $result, _begin(), _commit(), _rollback(), and eZDebug\writeError().

Referenced by _copy(), _delete(), _deleteByDirList(), _deleteByLike(), _deleteByWildcard(), _store(), and _storeContents().

## ◆ _purge()

eZDFSFileHandlerMySQLiBackend::_purge | ( |  | $filePath,
|  |  | $onlyExpired = `false`,
|  |  | $expiry = `false`,
|  |  | $fname = `false`
| ) |  |

Purges meta-data and file-data for a file entry

Will only expire a single file. Use _purgeByLike to purge multiple files

Parameters

  string | $filePath | Path of the file to purge
  bool | $onlyExpired | Only purges expired files
  bool | int | $expiry |
  bool | $fname |

See also
  _purgeByLike

Returns
  bool|eZMySQLBackendError

Definition at line 296 of file mysqli.php.

References $filePath, _fail(), _md5(), _query(), and dbTable().

Referenced by _rename().

## ◆ _purgeByLike()

eZDFSFileHandlerMySQLiBackend::_purgeByLike | ( |  | $like,
|  |  | $onlyExpired = `false`,
|  |  | $limit = `50`,
|  |  | $expiry = `false`,
|  |  | $fname = `false`
| ) |  |

Purges meta-data and file-data for files matching a pattern using a SQL LIKE syntax.

Parameters

  string | $like | SQL LIKE string applied to ezdfsfile.name to look for files to purge
  bool | $onlyExpired | Only purge expired files (ezdfsfile.expired = 1)
  int | $limit | Maximum number of items to purge in one call
  bool | int | $expiry | Timestamp used to limit deleted files: only files older than this date will be deleted
  string | bool | $fname | Optional caller name for debugging

See also
  _purge

Returns
  bool|int false if it fails, number of affected rows otherwise

Definition at line 339 of file mysqli.php.

References $files, $i, $limit, $res, $row, _begin(), _commit(), _fail(), _query(), _quote(), _rollback(), and dbTable().

## ◆ _query()

eZDFSFileHandlerMySQLiBackend::_query | ( |  | $query,
|  |  | $fname = `false`,
|  |  | $reportError = `true`
| ) |  |
| protected

Performs mysql query and returns mysql result.

Times the sql execution, adds accumulator timings and reports SQL to debug.

Parameters

  string | $query |
  string | bool | $fname | The function name that started the query, should contain relevant arguments in the text.
  bool | $reportError |

Returns
  bool|mysqli_result

Definition at line 1518 of file mysqli.php.

References $numRows, $query, $res, $time, _error(), _report(), eZDebug\accumulatorStart(), and eZDebug\accumulatorStop().

Referenced by _abortCacheGeneration(), _begin(), _commit(), _deleteByDirListInner(), _deleteByLikeInner(), _deleteByWildcardInner(), _deleteInner(), _endCacheGeneration(), _getFileList(), _insert(), _insertUpdate(), _purge(), _purgeByLike(), _rename(), _rollback(), _startCacheGeneration(), and expiredFilesList().

## ◆ _quote()

eZDFSFileHandlerMySQLiBackend::_quote | ( |  | $value,
|  |  | $escapeUnderscoreWildcards = `false`
| ) |  |
| protected

Make sure that $value is escaped and qouted according to type and returned as a string.

Parameters

  string | $value | a SQL parameter to escape
  bool | $escapeUnderscoreWildcards | Set to true to escape underscores as well to avoid them to act as wildcards Highly recommended for LIKE statements !

Returns
  string a string that can safely be used in SQL queries

Definition at line 1547 of file mysqli.php.

Referenced by _deleteByDirListInner(), _deleteByLikeInner(), _purgeByLike(), and _sqlList().

## ◆ _rename()

eZDFSFileHandlerMySQLiBackend::_rename | ( |  | $srcFilePath,
|  |  | $dstFilePath
| ) |  |

Renames $srcFilePath to $dstFilePath

Parameters

  string | $srcFilePath |
  string | $dstFilePath |

Returns
  bool

Definition at line 884 of file mysqli.php.

References _begin(), _commit(), _exists(), _fail(), _fetchMetadata(), _md5(), _purge(), _query(), _rollback(), dbTable(), and eZDebug\writeError().

## ◆ _report()

eZDFSFileHandlerMySQLiBackend::_report | ( |  | $query,
|  |  | $fname,
|  |  | $timeTaken,
|  |  | $numRows = `false`
| ) |  |

Report SQL $query to debug system.

Parameters

  string | $query |
  string | bool | $fname | The function name that started the query, should contain relevant arguments in the text.
  int | $timeTaken | Number of seconds the query + related operations took (as float).
  int | bool | $numRows | Number of affected rows.

Returns
  void

Definition at line 1613 of file mysqli.php.

References $numQueries, $numRows, and eZDebug\writeNotice().

Referenced by _checkCacheGenerationTimeout(), _query(), and _selectOne().

## ◆ _rollback()

eZDFSFileHandlerMySQLiBackend::_rollback | ( |  | $fname = `false` | ) |
| protected

Stops a current transaction and discards all changes by executing a ROLLBACK call. If the current transaction is a sub-transaction nothing is executed.

Definition at line 1394 of file mysqli.php.

References _query().

Referenced by _endCacheGeneration(), _protect(), _purgeByLike(), and _rename().

## ◆ _selectOne()

eZDFSFileHandlerMySQLiBackend::_selectOne | ( |  | $query,
|  |  | $fname,
|  |  | $error = `false`,
|  |  | $debug = `false`,
|  |  | $fetchCall
| ) |  |
| protected

Runs a select query, applying the $fetchCall callback to one result If there are more than one row it will fail and exit, if 0 it returns false.

Parameters

  | $query |
  string | $fname | The function name that started the query, should contain relevant arguments in the text.
  bool | string | $error | Sent to _error() in case of errors
  bool | $debug | If true it will display the fetched row in addition to the SQL.
  callback | $fetchCall | The callback to fetch the row.

Exceptions

  eZDFSFileHandlerTableNotFoundException |

Returns
  bool|array

Definition at line 1300 of file mysqli.php.

References $debug, $error, $query, $res, $row, $time, _error(), _report(), eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), and eZDebug\writeError().

Referenced by _selectOneAssoc(), and _selectOneRow().

## ◆ _selectOneAssoc()

eZDFSFileHandlerMySQLiBackend::_selectOneAssoc | ( |  | $query,
|  |  | $fname,
|  |  | $error = `false`,
|  |  | $debug = `false`
| ) |  |
| protected

Runs a select query and returns one associative row from the result.

If there are more than one row it will fail and exit, if 0 it returns false.

Parameters

  string | $query |
  string | $fname | The function name that started the query, should contain relevant arguments in the text.
  bool | string | $error | Sent to _error() in case of errors
  bool | $debug | If true it will display the fetched row in addition to the SQL.

Returns
  array|false

Definition at line 1280 of file mysqli.php.

References $debug, $error, $query, and _selectOne().

Referenced by _fetchMetadata().

## ◆ _selectOneRow()

eZDFSFileHandlerMySQLiBackend::_selectOneRow | ( |  | $query,
|  |  | $fname,
|  |  | $error = `false`,
|  |  | $debug = `false`
| ) |  |
| protected

Runs a select query and returns one numeric indexed row from the result If there are more than one row it will fail and exit, if 0 it returns false.

Parameters

  string | $query |
  string | $fname | The function name that started the query, should contain relevant arguments in the text.
  bool | string | $error | Sent to _error() in case of errors
  bool | $debug | If true it will display the fetched row in addition to the SQL.

Returns
  array|false

Definition at line 1263 of file mysqli.php.

References $debug, $error, $query, and _selectOne().

Referenced by _exists(), and _startCacheGeneration().

## ◆ _sqlList()

eZDFSFileHandlerMySQLiBackend::_sqlList | ( |  | $array | ) |
| protected

Formats a list of entries as an SQL list which is separated by commas. Each entry in the list is quoted using _quote().

Parameters

  array | $array |

Returns
  array

Definition at line 1238 of file mysqli.php.

References _quote().

Referenced by _endCacheGeneration(), _insert(), _insertUpdate(), and expiredFilesList().

## ◆ _startCacheGeneration()

eZDFSFileHandlerMySQLiBackend::_startCacheGeneration | ( |  | $filePath,
|  |  | $generatingFilePath
| ) |  |

Attempts 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

  string | $filePath |
  string | $generatingFilePath |

Returns
  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

Definition at line 1644 of file mysqli.php.

References $filePath, $query, $res, $row, _md5(), _query(), _selectOneRow(), dbTable(), remainingCacheGenerationTime(), eZDebugSetting\writeDebug(), eZDebug\writeDebug(), and eZDebug\writeError().

## ◆ _store()

eZDFSFileHandlerMySQLiBackend::_store | ( |  | $filePath,
|  |  | $datatype,
|  |  | $scope,
|  |  | $fname = `false`
| ) |  |

Stores $filePath to cluster

Parameters

  string | $filePath |
  string | $datatype |
  string | $scope |
  bool | string | $fname |

Returns
  void

Definition at line 960 of file mysqli.php.

References $filePath, _protect(), and eZDebug\writeError().

## ◆ _storeContents()

eZDFSFileHandlerMySQLiBackend::_storeContents | ( |  | $filePath,
|  |  | $contents,
|  |  | $scope,
|  |  | $datatype,
|  |  | $mtime = `false`,
|  |  | $fname = `false`
| ) |  |

Stores $contents as the contents of $filePath to the cluster

Parameters

  string | $filePath |
  string | $contents |
  string | $scope |
  string | $datatype |
  bool | int | $mtime |
  bool | string | $fname |

Returns
  void

Definition at line 1036 of file mysqli.php.

References $contents, $filePath, and _protect().

## ◆ _storeContentsInner()

eZDFSFileHandlerMySQLiBackend::_storeContentsInner | ( |  | $filePath,
|  |  | $contents,
|  |  | $scope,
|  |  | $datatype,
|  |  | $curTime,
|  |  | $fname
| ) |  |

Parameters

  string | $filePath |
  string | $contents |
  string | $scope |
  string | $datatype |
  int | bool | $curTime |
  string | bool | $fname |

Returns
  bool|eZMySQLBackendError

Definition at line 1064 of file mysqli.php.

References $contents, $filePath, _fail(), _insertUpdate(), dbTable(), and nameTrunk().

## ◆ _storeInner()

eZDFSFileHandlerMySQLiBackend::_storeInner | ( |  | $filePath,
|  |  | $datatype,
|  |  | $scope,
|  |  | $fname
| ) |  |

Callback function used to perform the actual file store operation

Parameters

  string | $filePath |
  string | $datatype |
  string | $scope |
  string | $fname |

See also
  eZDFSFileHandlerMySQLiBackend::_store()

Returns
  bool

Definition at line 989 of file mysqli.php.

References $filePath, _fail(), _insertUpdate(), dbTable(), and nameTrunk().

## ◆ applyServerUri()

eZDFSFileHandlerMySQLiBackend::applyServerUri | ( |  | $filePath | ) |

Transforms $filePath so that it contains a valid href to the file, wherever it is stored.

Parameters

  string |

Returns
  string

Definition at line 2066 of file mysqli.php.

References $filePath.

## ◆ dbTable()

eZDFSFileHandlerMySQLiBackend::dbTable | ( |  | $filePath | ) |
| protected

Returns the database table name to use for the specified file.

For files detected as cache files the cache table is returned, if not the generic table is returned.

Parameters

  string | $filePath |

Returns
  string The database table name

Definition at line 95 of file mysqli.php.

References $filePath, $metaDataTable, and $metaDataTableCache.

Referenced by _abortCacheGeneration(), _checkCacheGenerationTimeout(), _copyInner(), _deleteByDirListInner(), _deleteByLikeInner(), _deleteByWildcardInner(), _deleteInner(), _endCacheGeneration(), _exists(), _fetchMetadata(), _purge(), _purgeByLike(), _rename(), _startCacheGeneration(), _storeContentsInner(), and _storeInner().

## ◆ deleteCacheFiles()

eZDFSFileHandlerMySQLiBackend::deleteCacheFiles | ( |  | $limit | ) |

Deletes a batch of cache files from the storage table.

Parameters

  int | $limit |

Returns
  int The number of moved rows

Exceptions

  RuntimeException | if a MySQL query occurs
  InvalidArgumentException | if the split table feature is disabled

Definition at line 2043 of file mysqli.php.

References $query, and eZSys\cacheDirectory().

## ◆ expiredFilesList()

eZDFSFileHandlerMySQLiBackend::expiredFilesList | ( |  | $scopes,
|  |  | $limit = `array( 0, 100 )`,
|  |  | $expiry = `false`
| ) |  |

Returns the list of expired files

Since
  4.3

Parameters

  array | $scopes | Array of scopes to consider. At least one.
  array | int | $limit | Max number of items. Set to false for unlimited.
  bool | int | $expiry | Number of seconds, only items older than this will be returned.

Exceptions

  ezcBaseValueException |

Returns
  array(filepath)

Definition at line 1975 of file mysqli.php.

References $limit, $query, $res, $row, _query(), and _sqlList().

## ◆ mkdir_p()

eZDFSFileHandlerMySQLiBackend::mkdir_p | ( |  | $dir | ) |
| private

Creates a directory and all parent directories in its path, if necessary

Parameters

  string | $dir |

Returns
  bool

Definition at line 659 of file mysqli.php.

References $dir, $i, $result, file_exists(), and eZDir\mkdir().

Referenced by __mkdir_p(), and _fetch().

## ◆ nameTrunk()

static eZDFSFileHandlerMySQLiBackend::nameTrunk | ( |  | $filePath,
|  |  | $scope
| ) |  |
| static protected

Returns the name_trunk for a file path

Parameters

  string | $filePath |
  string | $scope |

Returns
  string

Definition at line 1913 of file mysqli.php.

References $fileName, and $filePath.

Referenced by _copyInner(), _endCacheGeneration(), _storeContentsInner(), and _storeInner().

## ◆ registerListener()

eZDFSFileHandlerMySQLiBackend::registerListener | ( | eZClusterEventListener | $listener | ) |

Registers $listener as the cluster event listener.

Parameters

  eZClusterEventListener | $listener |

Returns
  void

Implements eZClusterEventNotifier.

Definition at line 2014 of file mysqli.php.

## ◆ remainingCacheGenerationTime()

eZDFSFileHandlerMySQLiBackend::remainingCacheGenerationTime | ( |  | $row | ) |
| protected

Returns the remaining time, in seconds, before the generating file times out

Parameters

  array | $row |

Returns
  int Remaining generation seconds. A negative value indicates a timeout.

Definition at line 1954 of file mysqli.php.

References $row.

Referenced by _startCacheGeneration().

## Member Data Documentation

## ◆ $cacheDir

eZDFSFileHandlerMySQLiBackend::$cacheDir
| protected

Definition at line 2127 of file mysqli.php.

## ◆ $db

eZDFSFileHandlerMySQLiBackend::$db = null

Definition at line 2075 of file mysqli.php.

## ◆ $dbparams

eZDFSFileHandlerMySQLiBackend::$dbparams = null
| static protected

Definition at line 2081 of file mysqli.php.

## ◆ $dfsbackend

eZDFSFileHandlerMySQLiBackend::$dfsbackend = null
| protected

Definition at line 2101 of file mysqli.php.

## ◆ $eventHandler

eZDFSFileHandlerMySQLiBackend::$eventHandler
| protected

Definition at line 2107 of file mysqli.php.

## ◆ $maxCopyTries

eZDFSFileHandlerMySQLiBackend::$maxCopyTries
| protected

Definition at line 62 of file mysqli.php.

## ◆ $metaDataTable

eZDFSFileHandlerMySQLiBackend::$metaDataTable = 'ezdfsfile'
| protected

Definition at line 2113 of file mysqli.php.

Referenced by dbTable().

## ◆ $metaDataTableCache

eZDFSFileHandlerMySQLiBackend::$metaDataTableCache = 'ezdfsfile_cache'
| protected

Definition at line 2120 of file mysqli.php.

Referenced by dbTable().

## ◆ $numQueries

eZDFSFileHandlerMySQLiBackend::$numQueries = 0
| protected

Definition at line 2087 of file mysqli.php.

Referenced by _report().

## ◆ $storageDir

eZDFSFileHandlerMySQLiBackend::$storageDir
| protected

Definition at line 2134 of file mysqli.php.

## ◆ $transactionCount

eZDFSFileHandlerMySQLiBackend::$transactionCount = 0
| protected

Definition at line 2095 of file mysqli.php.

## ◆ TIME_UNTIL_RETRY

const eZDFSFileHandlerMySQLiBackend::TIME_UNTIL_RETRY = 100

Wait for n microseconds until retry if copy fails, to avoid DFS overload.

Definition at line 55 of file mysqli.php.

The documentation for this class was generated from the following file:

- mysqli.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.