1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-30 19:24:13 +02:00

[ticket/15692] Reduce storage api calls

PHPBB3-15692
This commit is contained in:
Rubén Calvo 2018-06-15 15:58:16 +02:00
parent 1d43e15c60
commit 4fed285779

View File

@ -154,7 +154,7 @@ class storage
*/
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');
}
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
*