diff --git a/workflow/engine/classes/class.memcached.php b/workflow/engine/classes/class.memcached.php index 4e5a92359..03ee0b605 100644 --- a/workflow/engine/classes/class.memcached.php +++ b/workflow/engine/classes/class.memcached.php @@ -26,7 +26,7 @@ /** * The ProcessMaker memcached class - * + * * @package workflow.engine.ProcessMaker */ @@ -35,16 +35,16 @@ class PMmemcached { const ONE_HOUR = 3600; const TWO_HOURS = 7200; const EIGHT_HOURS = 28800; - + var $version; var $mem; var $connected = false; var $enabled = false; var $supported = false; - + private static $instance = NULL; - - private function __construct($workspace) { + + public function __construct($workspace) { $this->enabled = MEMCACHED_ENABLED; $this->connected = false; $this->workspace = $workspace; @@ -77,14 +77,14 @@ class PMmemcached { $this->mem = new FileCache ( $cacheFolder ); } } - + if (! MEMCACHED_ENABLED) { $this->connected = false; return false; } - + } - + /** * to get singleton instance * @@ -97,15 +97,15 @@ class PMmemcached { } return self::$instance; } - + public function __clone() { throw new Exception ( "Clone is not allowed." ); } - + public function __wakeup() { throw new Exception ( "Deserializing is not allowed." ); } - + function set($key, $object, $timeout = 0) { if (! $this->connected) return false; @@ -114,43 +114,43 @@ class PMmemcached { else $this->mem->set ( $this->workspace . '_' . $key, $object ); } - + function get($key) { if (! $this->connected) return false; return $this->mem->get ( $this->workspace . '_' . $key ); } - + function add($key, $value) { if ((! $this->connected) || ($this->class == 'filecache')) return false; return $this->mem->add ( $this->workspace . '_' . $key, $value ); } - + function increment($key, $value) { if ((! $this->connected) || ($this->class == 'filecache')) return false; return $this->mem->increment ( $this->workspace . '_' . $key, $value ); } - + function delete($key) { if ((! $this->connected) || ($this->class == 'filecache')) return false; return $this->mem->delete ( $this->workspace . '_' . $key ); } - + function flush() { if ((! $this->connected) || ($this->class == 'filecache')) return false; return $this->mem->flush (); } - + function getStats() { if ((! $this->connected) || ($this->class == 'filecache')) return false; return $status = $this->mem->getStats (); } - + function printDetails() { if ((! $this->connected) || ($this->class == 'filecache')) return false; @@ -164,16 +164,16 @@ class PMmemcached { echo "Number of connection structures allocated by the server " . $status ["connection_structures"] . ""; echo "Cumulative number of retrieval requests " . $status ["cmd_get"] . ""; echo " Cumulative number of storage requests " . $status ["cmd_set"] . ""; - + $percCacheHit = (( real ) $status ["get_hits"] / ( real ) $status ["cmd_get"] * 100); $percCacheHit = round ( $percCacheHit, 3 ); $percCacheMiss = 100 - $percCacheHit; - + echo "Number of keys that have been requested and found present " . $status ["get_hits"] . " ($percCacheHit%)"; echo "Number of items that have been requested and not found " . $status ["get_misses"] . "($percCacheMiss%)"; - + $MBRead = ( real ) $status ["bytes_read"] / (1024 * 1024); - + echo "Total number of bytes read by this server from network " . $MBRead . " Mega Bytes"; $MBWrite = ( real ) $status ["bytes_written"] / (1024 * 1024); echo "Total number of bytes sent by this server to network " . $MBWrite . " Mega Bytes"; diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index df0d573ea..bdbab675f 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -102,7 +102,7 @@ class PMPluginRegistry { * param * @return void */ - private function __construct() {} + public function __construct() {} /** * This function is instancing to this class @@ -222,11 +222,11 @@ class PMPluginRegistry { function disablePlugin($sNamespace, $eventPlugin = 1) { $sw = false; - + foreach ($this->_aPluginDetails as $namespace => $detail) { if ($namespace == $sNamespace) { unset($this->_aPluginDetails[$sNamespace]); - + if ($eventPlugin == 1) { $plugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename); $this->_aPlugins[$detail->sNamespace] = $plugin; @@ -234,7 +234,7 @@ class PMPluginRegistry { $plugin->disable(); } } - + $sw = true; } } @@ -242,7 +242,7 @@ class PMPluginRegistry { if (!$sw) { throw new Exception("Unable to disable plugin '$sNamespace' (plugin not found)"); } - + foreach ( $this->_aMenus as $key=>$detail ) { if ( $detail->sNamespace == $sNamespace ) unset ( $this->_aMenus[ $key ] ); @@ -411,73 +411,73 @@ class PMPluginRegistry { if (!file_exists(PATH_PLUGINS . $pluginFile)) { throw (new Exception("File \"$pluginFile\" doesn't exist")); } - + /////// require_once (PATH_PLUGINS . $pluginFile); - + foreach ($this->_aPluginDetails as $namespace => $detail) { if ($namespace == $sNamespace) { $this->enablePlugin($detail->sNamespace); $this->disablePlugin($detail->sNamespace); - + /////// $plugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename); $this->_aPlugins[$detail->sNamespace] = $plugin; - + if (method_exists($plugin, "uninstall")) { $plugin->uninstall(); } - + /////// $this->save(); - + /////// $pluginDir = PATH_PLUGINS . $detail->sPluginFolder; - + if (isset($detail->sFilename) && !empty($detail->sFilename) && file_exists($detail->sFilename)) { unlink($detail->sFilename); } - + if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($pluginDir)) { G::rm_dir($pluginDir); } - + /////// $this->uninstallPluginWorkspaces(array($sNamespace)); - + /////// break; } } } - + function uninstallPluginWorkspaces($arrayPlugin) { G::LoadClass("system"); G::LoadClass("wsTools"); - + $workspace = System::listWorkspaces(); - + foreach ($workspace as $indexWS => $ws) { $wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP; - + if (file_exists($wsPathDataSite . "plugin.singleton")) { //G::LoadClass("plugin"); //Here we are loading all plug-ins registered //The singleton has a list of enabled plug-ins - + $pluginRegistry = &PMPluginRegistry::getSingleton(); $pluginRegistry->unSerializeInstance(file_get_contents($wsPathDataSite . "plugin.singleton")); - + /////// $attributes = $pluginRegistry->getAttributes(); - + foreach ($arrayPlugin as $index => $value) { if (isset($attributes["_aPluginDetails"][$value])) { $pluginRegistry->disablePlugin($value, 0); } } - + /////// file_put_contents($wsPathDataSite . "plugin.singleton", $pluginRegistry->serializeInstance()); } @@ -1245,7 +1245,7 @@ class PMPluginRegistry { function registerDashboard() { // Dummy function for backwards compatibility } - + function getAttributes() { return get_object_vars($this); diff --git a/workflow/engine/classes/class.serverConfiguration.php b/workflow/engine/classes/class.serverConfiguration.php index 6b9ffa267..c51f64a29 100755 --- a/workflow/engine/classes/class.serverConfiguration.php +++ b/workflow/engine/classes/class.serverConfiguration.php @@ -53,9 +53,9 @@ class serverConf { var $logins; private $lanDirection; private $lanLanguage; - - private function __construct() { + + public function __construct() { $this->filePath = PATH_DATA . 'srvConf.singleton'; } @@ -140,7 +140,7 @@ class serverConf { function getProperty($propertyName) { if (isset ( $this->_aProperties [$propertyName] )) { return $this->_aProperties [$propertyName]; - } + } else { return null; } @@ -158,7 +158,7 @@ class serverConf { if ( isset ($this->workspaces[SYS_SYS]) && !isset ($this->workspaces[SYS_SYS]['WSP_LOGINS']) ) $this->workspaces[SYS_SYS]['WSP_LOGINS'] = 1; - + $this->saveSingleton (); } @@ -175,7 +175,7 @@ class serverConf { if (isset ( $this->_aWSapces [$wsName] )) { //Enable WS unset ( $this->_aWSapces [$wsName] ); - } + } else { $this->_aWSapces [$wsName] = 'disabled'; } @@ -330,7 +330,7 @@ class serverConf { } } } - + /** * Get the value of language direction property @@ -343,9 +343,9 @@ class serverConf { } if( defined('SYS_LANG') ) { //if we already have the landirection for this language, just return from serverConf - if ( $this->lanLanguage == SYS_LANG ) + if ( $this->lanLanguage == SYS_LANG ) return $this->lanDirection; - + //if not , we need to query Database, in order to get the direction $this->lanDirection = 'L'; //default value; $this->lanLanguage = SYS_LANG; @@ -357,7 +357,7 @@ class serverConf { $this->lanDirection = strtoupper($aLang['LAN_DIRECTION']); } $this->saveSingleton(); - } + } catch(Exception $e){ $this->lanDirection = 'L'; } @@ -387,7 +387,7 @@ class serverConf { unset ( $this->_aHeartbeatConfig [$workspace][$propertyName] ); $this->saveSingleton (); } - + /** * Returns the value of a defined property. If it doesn't exist then returns null * @param string $propertyName