Fix For PHP 5.4.x compatibility when PMPluginRegstry singleton is loaded from serialized file
This commit is contained in:
@@ -139,6 +139,24 @@ class PMPluginRegistry
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the singleton instance from a serialized stored file
|
||||
*
|
||||
* @param $file
|
||||
* @return PMPluginRegistry
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function loadSingleton($file)
|
||||
{
|
||||
self::$instance = unserialize(file_get_contents($file));
|
||||
|
||||
if (! is_object(self::$instance) || get_class(self::$instance) != "PMPluginRegistry") {
|
||||
throw new Exception("Can't load main PMPluginRegistry object.");
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generates a storable representation of a value
|
||||
* param
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
* bootstrap - ProcessMaker Bootstrap
|
||||
* this file is used initialize main variables, redirect and dispatch all requests
|
||||
*/
|
||||
|
||||
|
||||
//session_cache_limiter('none');
|
||||
//die('neyek');
|
||||
function transactionLog($transactionName){
|
||||
if (extension_loaded('newrelic')) {
|
||||
$baseName="ProcessMaker";
|
||||
@@ -609,12 +609,13 @@ Bootstrap::LoadClass( 'plugin' );
|
||||
//here we are loading all plugins registered
|
||||
//the singleton has a list of enabled plugins
|
||||
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
|
||||
if (file_exists( $sSerializedFile )) {
|
||||
$oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
|
||||
$oPluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile);
|
||||
$attributes = $oPluginRegistry->getAttributes();
|
||||
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
|
||||
} else{
|
||||
$oPluginRegistry = PMPluginRegistry::getSingleton();
|
||||
}
|
||||
|
||||
// setup propel definitions and logging
|
||||
|
||||
Reference in New Issue
Block a user