/usr/share/phpmyadmin/libraries/classes/Query
Edit: /usr/share/phpmyadmin/libraries/classes/Query/Cache.php (3276B)
$_) {
if (isset($this->tableCache[$one_database])) {
// the + operator does not do the intended effect
// when the cache for one table already exists
if ($table
&& isset($this->tableCache[$one_database][$table])
) {
unset($this->tableCache[$one_database][$table]);
}
$this->tableCache[$one_database]
+= $tables[$one_database];
} else {
$this->tableCache[$one_database] = $tables[$one_database];
}
}
}
/**
* Set an item in table cache using dot notation.
*
* @param array|null $contentPath Array with the target path
* @param mixed $value Target value
*/
public function cacheTableContent(?array $contentPath, $value): void
{
$loc = &$this->tableCache;
if (! isset($contentPath)) {
$loc = $value;
return;
}
while (count($contentPath) > 1) {
$key = array_shift($contentPath);
// If the key doesn't exist at this depth, we will just create an empty
// array to hold the next value, allowing us to create the arrays to hold
// final values at the correct depth. Then we'll keep digging into the
// array.
if (! isset($loc[$key]) || ! is_array($loc[$key])) {
$loc[$key] = [];
}
$loc = &$loc[$key];
}
$loc[array_shift($contentPath)] = $value;
}
/**
* Get a cached value from table cache.
*
* @param array $contentPath Array of the name of the target value
* @param mixed $default Return value on cache miss
*
* @return mixed cached value or default
*/
public function getCachedTableContent(array $contentPath, $default = null)
{
return Util::getValueByKey($this->tableCache, $contentPath, $default);
}
public function getCache(): array
{
return $this->tableCache;
}
public function clearTableCache(): void
{
$this->tableCache = [];
}
}