summaryrefslogtreecommitdiff
path: root/LibertySystem.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-01-11 10:10:04 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-01-11 10:10:04 +0000
commit60e900bef46adab6af86d9ca083d203e37c0a483 (patch)
tree5171da4499582e6fd27fe0f73b4fe832963108c6 /LibertySystem.php
parent4508706467ec265e7830f83b4a134784d62c5a61 (diff)
downloadliberty-60e900bef46adab6af86d9ca083d203e37c0a483.tar.gz
liberty-60e900bef46adab6af86d9ca083d203e37c0a483.tar.bz2
liberty-60e900bef46adab6af86d9ca083d203e37c0a483.zip
split setActivePlugin into 2 funcitons that it's possible to set an individual plugin as active
Diffstat (limited to 'LibertySystem.php')
-rwxr-xr-xLibertySystem.php46
1 files changed, 29 insertions, 17 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index db49e6a..4dbd437 100755
--- a/LibertySystem.php
+++ b/LibertySystem.php
@@ -3,7 +3,7 @@
* System class for handling the liberty package
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.55 2007/01/08 07:58:43 spiderr Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.56 2007/01/11 10:10:04 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -201,7 +201,8 @@ class LibertySystem extends LibertyBase {
* @return TRUE if the plugin is active, FALSE if it's not
**/
function isPluginActive( $pPluginGuid ) {
- return( isset( $this->mPlugins[$pGuid] ) && ( $this->mPlugins[$pGuid]['is_active'] == 'y' ) );
+ vd( $this->mPlugins[$pPluginGuid] );
+ return( isset( $this->mPlugins[$pPluginGuid] ) && ( $this->mPlugins[$pPluginGuid]['is_active'] == 'y' ) );
}
/**
@@ -227,13 +228,13 @@ class LibertySystem extends LibertyBase {
function registerPlugin( $pGuid, $pPluginParams ) {
global $gBitSystem;
#save the plugin_guid <=> filename mapping
- $config_name = "{$this->mSystem}_plugin_file_" . $pGuid;
- $gBitSystem->storeConfig($config_name, $this->mPluginFileName, LIBERTY_PKG_NAME);
- $config_name = "{$this->mSystem}_plugin_status_" . $pGuid;
- $plugin_status = $gBitSystem->getConfig($config_name);
+ $config_name = "{$this->mSystem}_plugin_file_".$pGuid;
+ $gBitSystem->storeConfig( $config_name, $this->mPluginFileName, LIBERTY_PKG_NAME );
+ $config_name = "{$this->mSystem}_plugin_status_".$pGuid;
+ $plugin_status = $gBitSystem->getConfig( $config_name );
if( empty( $plugin_status ) && isset( $pPluginParams['auto_activate'] ) && $pPluginParams['auto_activate'] == TRUE ) {
$plugin_status = 'y';
- $gBitSystem->storeConfig( $config_name,$plugin_status, LIBERTY_PKG_NAME );
+ $gBitSystem->storeConfig( $config_name, $plugin_status, LIBERTY_PKG_NAME );
}
$this->mPlugins[$pGuid]['is_active'] = $plugin_status;
$this->mPlugins[$pGuid]['filename'] = $this->mPluginFileName;
@@ -253,20 +254,16 @@ class LibertySystem extends LibertyBase {
global $gBitSystem;
if( is_array( $pPluginGuids ) ) {
- #zap list of plugins from DB
- $gBitSystem->setConfigMatch("/^{$this->mSystem}_plugin_status/i", NULL, 'n', LIBERTY_PKG_NAME);
- foreach ( $this->mPlugins as $guid=>$plugin ) {
+ # zap list of plugins from DB
+ $gBitSystem->setConfigMatch( "/^{$this->mSystem}_plugin_status/i", NULL, 'n', LIBERTY_PKG_NAME );
+ foreach( array_keys( $this->mPlugins ) as $guid ) {
$this->mPlugins[$guid]['is_active'] = 'n';
}
+
#set active those specified
foreach( array_keys( $pPluginGuids ) as $guid ) {
- if ( $pPluginGuids[$guid][0] == 'y' ) {
- $config_name = "{$this->mSystem}_plugin_status_" . $guid;
- $config_value = 'y';
- $gBitSystem->storeConfig($config_name, $config_value, LIBERTY_PKG_NAME);
- if (isset($this->mPlugins[$guid])) {
- $this->mPlugins[$guid]['is_active'] = 'y';
- }
+ if( $pPluginGuids[$guid][0] == 'y' ) {
+ $this->setActivePlugin( $guid );
}
}
//load any plugins made active, but not already loaded
@@ -275,6 +272,21 @@ class LibertySystem extends LibertyBase {
}
/**
+ * set a single plugin as active and store the appropriate information in the database
+ *
+ * @param array $pPluginGuid the plugin guid we want to set active
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
+ function setActivePlugin( $pPluginGuid ) {
+ global $gBitSystem;
+ $gBitSystem->storeConfig( "{$this->mSystem}_plugin_status_".$pPluginGuid, 'y', LIBERTY_PKG_NAME );
+ if( isset( $this->mPlugins[$pPluginGuid] )) {
+ $this->mPlugins[$pPluginGuid]['is_active'] = 'y';
+ }
+ }
+
+ /**
* getPluginInfo
*
* @param array $pGuid