mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge pull request #863 from romainneutron/purge
[3.9] Reduce memory usage
This commit is contained in:
@@ -49,7 +49,7 @@ class ACLProvider
|
|||||||
/**
|
/**
|
||||||
* Purges ACL cache
|
* Purges ACL cache
|
||||||
*/
|
*/
|
||||||
public function purge()
|
public static function purge()
|
||||||
{
|
{
|
||||||
self::$cache = [];
|
self::$cache = [];
|
||||||
}
|
}
|
||||||
|
@@ -47,12 +47,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
protected $_prefs = [];
|
protected $_prefs = [];
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected static $_users = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
@@ -1352,4 +1346,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$_instance = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,12 +27,6 @@ class appbox extends base
|
|||||||
*/
|
*/
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var appbox
|
|
||||||
*/
|
|
||||||
protected static $_instance;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* constant defining the app type
|
* constant defining the app type
|
||||||
|
@@ -465,4 +465,9 @@ class caption_Field_Value implements cache_cacheableInterface
|
|||||||
|
|
||||||
unset(self::$localCache[$this->get_cache_key($option)]);
|
unset(self::$localCache[$this->get_cache_key($option)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$localCache = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -448,4 +448,9 @@ class caption_field implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
unset(self::$localCache[$this->get_cache_key($option)]);
|
unset(self::$localCache[$this->get_cache_key($option)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$localCache = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -730,4 +730,9 @@ class collection implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
return $this->databox->delete_data_from_cache($this->get_cache_key($option));
|
return $this->databox->delete_data_from_cache($this->get_cache_key($option));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$_collections = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ class connection
|
|||||||
*/
|
*/
|
||||||
public static function printLog(Application $app)
|
public static function printLog(Application $app)
|
||||||
{
|
{
|
||||||
if (!$app['debug']) {
|
if ($app->getEnvironment() !== Application::ENV_DEV) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1464,4 +1464,9 @@ class databox extends base
|
|||||||
}
|
}
|
||||||
parent::delete_data_from_cache($option);
|
parent::delete_data_from_cache($option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$_xpath_thesaurus = self::$_dom_thesaurus = self::$_thesaurus = self::$_sxml_thesaurus = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1071,4 +1071,9 @@ class databox_field implements cache_cacheableInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$_instance = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -587,4 +587,9 @@ class databox_status
|
|||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$_status = self::$_statuses = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -236,4 +236,9 @@ class patch_320alpha4b implements patchInterface
|
|||||||
|
|
||||||
return $feed;
|
return $feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$feeds = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,4 +35,9 @@ class thesaurus_xpath extends DOMXPath
|
|||||||
|
|
||||||
return(self::$r[$context_path]);
|
return(self::$r[$context_path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function purge()
|
||||||
|
{
|
||||||
|
self::$r = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -220,6 +220,7 @@ abstract class PhraseanetTestCase extends WebTestCase
|
|||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass()
|
||||||
{
|
{
|
||||||
self::$testCaseBooted = false;
|
self::$testCaseBooted = false;
|
||||||
|
gc_collect_cycles();
|
||||||
parent::tearDownAfterClass();
|
parent::tearDownAfterClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,6 +299,16 @@ abstract class PhraseanetTestCase extends WebTestCase
|
|||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
|
\Alchemy\Phrasea\Authentication\ACLProvider::purge();
|
||||||
|
\collection::purge();
|
||||||
|
\databox::purge();
|
||||||
|
\caption_field::purge();
|
||||||
|
\caption_Field_Value::purge();
|
||||||
|
\databox_field::purge();
|
||||||
|
\databox_status::purge();
|
||||||
|
\thesaurus_xpath::purge();
|
||||||
|
\User_Adapter::purge();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kris Wallsmith pro-tip
|
* Kris Wallsmith pro-tip
|
||||||
* @see http://kriswallsmith.net/post/18029585104/faster-phpunit
|
* @see http://kriswallsmith.net/post/18029585104/faster-phpunit
|
||||||
|
Reference in New Issue
Block a user