fixing class definition, the constructor was defined as private function

This commit is contained in:
Fernando Ontiveros
2012-07-12 20:36:41 -04:00
parent bb663544b8
commit 4f8ca480b9
3 changed files with 56 additions and 56 deletions

View File

@@ -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 "<tr><td>Number of connection structures allocated by the server </td><td>" . $status ["connection_structures"] . "</td></tr>";
echo "<tr><td>Cumulative number of retrieval requests </td><td>" . $status ["cmd_get"] . "</td></tr>";
echo "<tr><td> Cumulative number of storage requests </td><td>" . $status ["cmd_set"] . "</td></tr>";
$percCacheHit = (( real ) $status ["get_hits"] / ( real ) $status ["cmd_get"] * 100);
$percCacheHit = round ( $percCacheHit, 3 );
$percCacheMiss = 100 - $percCacheHit;
echo "<tr><td>Number of keys that have been requested and found present </td><td>" . $status ["get_hits"] . " ($percCacheHit%)</td></tr>";
echo "<tr><td>Number of items that have been requested and not found </td><td>" . $status ["get_misses"] . "($percCacheMiss%)</td></tr>";
$MBRead = ( real ) $status ["bytes_read"] / (1024 * 1024);
echo "<tr><td>Total number of bytes read by this server from network </td><td>" . $MBRead . " Mega Bytes</td></tr>";
$MBWrite = ( real ) $status ["bytes_written"] / (1024 * 1024);
echo "<tr><td>Total number of bytes sent by this server to network </td><td>" . $MBWrite . " Mega Bytes</td></tr>";

View File

@@ -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);

View File

@@ -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