Skip to content

Commit

Permalink
magento#25669: health_check.php fails if any database cache engine co…
Browse files Browse the repository at this point in the history
…nfigured

- fixed PHPDocs according to requirements static tests for CE
  • Loading branch information
Andrii Beziazychnyi authored and Andrii Beziazychnyi committed Nov 25, 2019
1 parent 5c121e2 commit 3905038
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions lib/internal/Magento/Framework/Cache/Backend/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Database extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extend
* Constructor
*
* @param array $options associative array of options
* @throws \Zend_Cache_Exception
*/
public function __construct($options = [])
{
Expand All @@ -82,6 +83,7 @@ public function __construct($options = [])
* Get DB adapter
*
* @return \Magento\Framework\DB\Adapter\AdapterInterface
* @throws \Zend_Cache_Exception
*/
protected function _getConnection()
{
Expand All @@ -106,6 +108,7 @@ protected function _getConnection()
* Get table name where data is stored
*
* @return string
* @throws \Zend_Cache_Exception
*/
protected function _getDataTable()
{
Expand All @@ -122,6 +125,7 @@ protected function _getDataTable()
* Get table name where tags are stored
*
* @return string
* @throws \Zend_Cache_Exception
*/
protected function _getTagsTable()
{
Expand All @@ -139,9 +143,10 @@ protected function _getTagsTable()
*
* Note : return value is always "string" (unserialization is done by the core not by the backend)
*
* @param string $id Cache id
* @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
* @param string $id Cache id
* @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
* @return string|false cached datas
* @throws \Zend_Cache_Exception
*/
public function load($id, $doNotTestCacheValidity = false)
{
Expand All @@ -166,8 +171,9 @@ public function load($id, $doNotTestCacheValidity = false)
/**
* Test if a cache is available or not (for the given id)
*
* @param string $id cache id
* @param string $id cache id
* @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
* @throws \Zend_Cache_Exception
*/
public function test($id)
{
Expand Down Expand Up @@ -196,11 +202,13 @@ public function test($id)
* Note : $data is always "string" (serialization is done by the
* core not by the backend)
*
* @param string $data Datas to cache
* @param string $id Cache id
* @param string[] $tags Array of strings, the cache record will be tagged by each string entry
* @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
* @param string $data Datas to cache
* @param string $id Cache id
* @param string[] $tags Array of strings, the cache record will be tagged by each string entry
* @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
* @return bool true if no problem
* @throws \Zend_Db_Statement_Exception
* @throws \Zend_Cache_Exception
*/
public function save($data, $id, $tags = [], $specificLifetime = false)
{
Expand Down Expand Up @@ -239,8 +247,9 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
/**
* Remove a cache record
*
* @param string $id Cache id
* @param string $id Cache id
* @return int|boolean Number of affected rows or false on failure
* @throws \Zend_Cache_Exception
*/
public function remove($id)
{
Expand All @@ -266,9 +275,10 @@ public function remove($id)
* \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
* ($tags can be an array of strings or a single string)
*
* @param string $mode Clean mode
* @param string[] $tags Array of tags
* @param string $mode Clean mode
* @param string[] $tags Array of tags
* @return boolean true if no problem
* @throws \Zend_Cache_Exception
*/
public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
{
Expand Down Expand Up @@ -301,6 +311,7 @@ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
* Return an array of stored cache ids
*
* @return string[] array of stored cache ids (string)
* @throws \Zend_Cache_Exception
*/
public function getIds()
{
Expand All @@ -316,6 +327,7 @@ public function getIds()
* Return an array of stored tags
*
* @return string[] array of stored tags (string)
* @throws \Zend_Cache_Exception
*/
public function getTags()
{
Expand All @@ -330,6 +342,7 @@ public function getTags()
*
* @param string[] $tags array of tags
* @return string[] array of matching cache ids (string)
* @throws \Zend_Cache_Exception
*/
public function getIdsMatchingTags($tags = [])
{
Expand All @@ -356,6 +369,7 @@ public function getIdsMatchingTags($tags = [])
*
* @param string[] $tags array of tags
* @return string[] array of not matching cache ids (string)
* @throws \Zend_Cache_Exception
*/
public function getIdsNotMatchingTags($tags = [])
{
Expand All @@ -369,6 +383,7 @@ public function getIdsNotMatchingTags($tags = [])
*
* @param string[] $tags array of tags
* @return string[] array of any matching cache ids (string)
* @throws \Zend_Cache_Exception
*/
public function getIdsMatchingAnyTags($tags = [])
{
Expand Down Expand Up @@ -404,6 +419,7 @@ public function getFillingPercentage()
*
* @param string $id cache id
* @return array|false array of metadatas (false if the cache id is not found)
* @throws \Zend_Cache_Exception
*/
public function getMetadatas($id)
{
Expand All @@ -425,6 +441,7 @@ public function getMetadatas($id)
* @param string $id cache id
* @param int $extraLifetime
* @return boolean true if ok
* @throws \Zend_Cache_Exception
*/
public function touch($id, $extraLifetime)
{
Expand Down Expand Up @@ -471,6 +488,7 @@ public function getCapabilities()
* @param string $id
* @param string[] $tags
* @return bool
* @throws \Zend_Cache_Exception
*/
protected function _saveTags($id, $tags)
{
Expand Down Expand Up @@ -509,6 +527,8 @@ protected function _saveTags($id, $tags)
* @param string $mode
* @param string[] $tags
* @return bool
* @throws \Zend_Cache_Exception
* @throws \Zend_Db_Statement_Exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _cleanByTags($mode, $tags)
Expand Down Expand Up @@ -558,6 +578,7 @@ protected function _cleanByTags($mode, $tags)
*
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
* @return bool
* @throws \Zend_Cache_Exception
*/
private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connection)
{
Expand All @@ -575,6 +596,7 @@ private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connec
*
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
* @return bool
* @throws \Zend_Cache_Exception
*/
private function cleanOld(\Magento\Framework\DB\Adapter\AdapterInterface $connection)
{
Expand Down

0 comments on commit 3905038

Please sign in to comment.