mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-23 10:28:55 +00:00
[ticket/15692] Reduce storage api calls
PHPBB3-15692
This commit is contained in:
parent
1d43e15c60
commit
4fed285779
1 changed files with 18 additions and 1 deletions
|
@ -154,7 +154,7 @@ class storage
|
||||||
*/
|
*/
|
||||||
public function exists($path)
|
public function exists($path)
|
||||||
{
|
{
|
||||||
return $this->get_adapter()->exists($path);
|
return $this->is_tracked($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,6 +376,23 @@ class storage
|
||||||
$this->cache->destroy('_storage_' . $this->get_name() . '_numfiles');
|
$this->cache->destroy('_storage_' . $this->get_name() . '_numfiles');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function is_tracked($path)
|
||||||
|
{
|
||||||
|
$sql_ary = array(
|
||||||
|
'file_path' => $path,
|
||||||
|
'storage' => $this->get_name(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get file, if exist update filesize, if not add new record
|
||||||
|
$sql = 'SELECT file_id FROM ' . $this->storage_table . '
|
||||||
|
WHERE ' . $this->db->sql_build_array('SELECT', $sql_ary);
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$row = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
return ($row) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename tracked file
|
* Rename tracked file
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue