本文整理匯總了PHP中Pimcore\Db::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP Db::close方法的具體用法?PHP Db::close怎麽用?PHP Db::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Db
的用法示例。
在下文中一共展示了Db::close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: collectGarbage
/**
* Forces a garbage collection.
* @static
* @return void
*/
public static function collectGarbage($keepItems = array())
{
// close mysql-connection
Db::close();
$protectedItems = array("Zend_Locale", "Zend_View_Helper_Placeholder_Registry", "Zend_View_Helper_Doctype", "Zend_Translate", "Zend_Navigation", "Pimcore_API_Plugin_Broker", "pimcore_tag_block_current", "pimcore_tag_block_numeration", "Config_system", "pimcore_admin_user", "Config_website", "pimcore_editmode", "pimcore_error_document", "pimcore_site", "Pimcore_Db");
if (is_array($keepItems) && count($keepItems) > 0) {
$protectedItems = array_merge($protectedItems, $keepItems);
}
if (is_array(self::$globallyProtectedItems) && count(self::$globallyProtectedItems)) {
$protectedItems = array_merge($protectedItems, self::$globallyProtectedItems);
}
$registryBackup = array();
foreach ($protectedItems as $item) {
if (\Zend_Registry::isRegistered($item)) {
$registryBackup[$item] = \Zend_Registry::get($item);
}
}
\Zend_Registry::_unsetInstance();
foreach ($registryBackup as $key => $value) {
\Zend_Registry::set($key, $value);
}
Db::reset();
// force PHP garbage collector
gc_enable();
$collectedCycles = gc_collect_cycles();
\Logger::debug("garbage collection finished, collected cycles: " . $collectedCycles);
}