当前位置: 首页>>代码示例>>PHP>>正文


PHP Resource::close方法代码示例

本文整理汇总了PHP中Pimcore\Resource::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::close方法的具体用法?PHP Resource::close怎么用?PHP Resource::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Resource的用法示例。


在下文中一共展示了Resource::close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collectGarbage

 /**
  * Forces a garbage collection.
  * @static
  * @return void
  */
 public static function collectGarbage($keepItems = array())
 {
     // close mysql-connection
     Resource::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_Resource_Mysql");
     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);
     }
     Resource::reset();
     // force PHP garbage collector
     gc_enable();
     $collectedCycles = gc_collect_cycles();
     \Logger::debug("garbage collection finished, collected cycles: " . $collectedCycles);
 }
开发者ID:pdaniel-frk,项目名称:pimcore,代码行数:32,代码来源:Pimcore.php


注:本文中的Pimcore\Resource::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。