mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Refactor Appbox
This commit is contained in:
16
lib/classes/cache/databox.class.php
vendored
16
lib/classes/cache/databox.class.php
vendored
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
class cache_databox
|
||||
{
|
||||
|
||||
protected static $refreshing = false;
|
||||
/**
|
||||
*
|
||||
* @param int $sbas_id
|
||||
@@ -25,11 +25,18 @@ class cache_databox
|
||||
*/
|
||||
public static function refresh($sbas_id)
|
||||
{
|
||||
if(self::$refreshing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self::$refreshing = true;
|
||||
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
|
||||
$date = new \DateTime('-3 seconds');
|
||||
|
||||
$appbox = \appbox::get_instance();
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$registry = \registry::get_instance();
|
||||
|
||||
@@ -49,8 +56,9 @@ class cache_databox
|
||||
else
|
||||
$last_update = new \DateTime('-10 years');
|
||||
|
||||
if ($date <= $last_update || !$appbox->get_cache()->ping())
|
||||
if ($date <= $last_update)
|
||||
{
|
||||
self::$refreshing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,6 +144,8 @@ class cache_databox
|
||||
$stmt->execute(array(':date' => $now));
|
||||
$stmt->closeCursor();
|
||||
|
||||
self::$refreshing = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user