summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-12-23 18:38:05 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-12-23 18:38:05 +0000
commitf623dce07e488bd3c2c23366f224e8015735b825 (patch)
tree478a9d2c825835dcd6bd12dbb444392b715cdcdd
parent4bf5cae547e398898d9ba987172333a3b90ad38b (diff)
downloadliberty-f623dce07e488bd3c2c23366f224e8015735b825.tar.gz
liberty-f623dce07e488bd3c2c23366f224e8015735b825.tar.bz2
liberty-f623dce07e488bd3c2c23366f224e8015735b825.zip
add option to reset all plugin settings. need this since i've had to mess with these settings a few times when they get messed up. this stuff is insane and i'm not quite sure it takes so many reloads for the plugin settings to reset themselves again
-rwxr-xr-xLibertySystem.php75
-rw-r--r--admin/plugins.php21
2 files changed, 85 insertions, 11 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 80ef49e..2e9ddea 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.50 2006/12/15 20:42:44 squareing Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.51 2006/12/23 18:38:05 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -145,8 +145,7 @@ class LibertySystem extends LibertyBase {
$current_default_format_guid = $gBitSystem->getConfig( 'default_format' );
foreach( $this->mPlugins as $guid => $plugin ) {
if( $plugin['is_active'] == 'y' ) {
- $plugin_type = $plugin['plugin_type'];
- if( $plugin_type == FORMAT_PLUGIN ) {
+ if( $plugin['plugin_type'] == FORMAT_PLUGIN ) {
$format_plugin_count++;
}
if( $current_default_format_guid == $guid ) {
@@ -167,8 +166,8 @@ class LibertySystem extends LibertyBase {
$guid = PLUGIN_GUID_TIKIWIKI;
$config_name = "{$this->mSystem}_plugin_status_" . $guid;
$config_value = 'y';
- $gBitSystem->storeConfig( $config_name, $config_value, LIBERTY_PKG_NAME );
- $gBitSystem->storeConfig( 'default_format', PLUGIN_GUID_TIKIWIKI, LIBERTY_PKG_NAME );
+ $gBitSystem->storeConfig( $config_name, $config_value, $this->mSystem );
+ $gBitSystem->storeConfig( 'default_format', PLUGIN_GUID_TIKIWIKI, $this->mSystem );
//make memory match db
$this->loadActivePlugins();
}
@@ -180,9 +179,9 @@ class LibertySystem extends LibertyBase {
$plugin_guid = preg_replace( "/^{$this->mSystem}_plugin_status_/", '', $key,1 );
if( !isset( $this->mPlugins[$plugin_guid] ) ) {
$config_name = "{$this->mSystem}_plugin_status_" . $guid;
- $gBitSystem->storeConfig( $config_name, NULL, LIBERTY_PKG_NAME );
+ $gBitSystem->storeConfig( $config_name, NULL, $this->mSystem );
$config_name = "{$this->mSystem}_plugin_file_" . $guid;
- $gBitSystem->storeConfig( $config_name, NULL, LIBERTY_PKG_NAME );
+ $gBitSystem->storeConfig( $config_name, NULL, $this->mSystem );
}
}
}
@@ -235,7 +234,13 @@ class LibertySystem extends LibertyBase {
$this->mPlugins[$pGuid] = array_merge( $this->mPlugins[$pGuid], $pPluginParams );
}
- // @parameter pPluginGuids an array of all the plugin guids that are active. Any left out are *inactive*!
+ /**
+ * setActivePlugins
+ *
+ * @param array $pPluginGuids an array of all the plugin guids that are active. Any left out are *inactive*!
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
function setActivePlugins( $pPluginGuids ) {
global $gBitSystem;
@@ -261,6 +266,13 @@ class LibertySystem extends LibertyBase {
}
}
+ /**
+ * getPluginInfo
+ *
+ * @param array $pGuid
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
function getPluginInfo( $pGuid ) {
$ret = NULL;
if( !empty( $pGuid )
@@ -271,6 +283,14 @@ class LibertySystem extends LibertyBase {
return $ret;
}
+ /**
+ * getPluginFunction
+ *
+ * @param array $pGuid
+ * @param array $pFunctionName
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
function getPluginFunction( $pGuid, $pFunctionName ) {
$ret = NULL;
if( !empty( $pGuid )
@@ -283,11 +303,42 @@ class LibertySystem extends LibertyBase {
return $ret;
}
+ /**
+ * This function will purge all plugin settings set in kernel_config. useful when the path to plugins changes
+ * or plugins don't seem to be working
+ *
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
+ function resetAllPluginSettings() {
+ global $gBitSystem;
+ //$this->mPlugins = array();
+ $confs = $gBitSystem->getConfigMatch( "/^{$this->mSystem}_plugin_/i" );
+ foreach( array_keys( $confs ) as $config ) {
+ $gBitSystem->storeConfig( $config, NULL, $this->mSystem );
+ }
+
+ if( $this->mSystem == LIBERTY_PKG_NAME ) {
+ // also remove the default format
+ $gBitSystem->storeConfig( 'default_format', NULL, $this->mSystem );
+ }
+ $this->scanAllPlugins();
+ }
+
+
+
+
+ // ****************************** Content Type Functions
+ /**
+ * getContentStatus
+ *
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
function getContentStatus() {
return( $this->mDb->getAssoc( "SELECT `content_status_id`,`content_status_name` FROM `".BIT_DB_PREFIX."liberty_content_status`" ) );
}
- // ****************************** Content Type Functions
/**
* Load all available content types into $this->mContentTypes
*
@@ -338,6 +389,9 @@ class LibertySystem extends LibertyBase {
return $ret;
}
+
+
+
// ****************************** Service Functions
/**
* Get the service details of a given package
@@ -419,6 +473,9 @@ class LibertySystem extends LibertyBase {
return $ret;
}
+
+
+
// ****************************** Miscellaneous Functions
/**
* Get the URL to the icon for the mime type passed in. This should probably check for files of multiple image types instead of just jpg
diff --git a/admin/plugins.php b/admin/plugins.php
index a9b891a..4bf52ae 100644
--- a/admin/plugins.php
+++ b/admin/plugins.php
@@ -4,6 +4,25 @@ include_once( KERNEL_PKG_PATH.'simple_form_functions_lib.php' );
$gBitSystem->verifyPermission( 'p_admin' );
+// this will clear out all plugin settings in the database. scanAllPlugins
+// below will then reload all plugins and set them to their default setup.
+if( !empty( $_REQUEST['reset_all_plugins'] ) ) {
+ //$gBitSystem->storeConfig( 'default_format', PLUGIN_GUID_TIKIWIKI, LIBERTY_PKG_NAME );
+ $gLibertySystem->resetAllPluginSettings();
+
+ // this scanAllPlugins is required. who knows why this stuff is so resilient
+ $gLibertySystem->scanAllPlugins();
+ header( "Location: ".LIBERTY_PKG_URL."admin/plugins.php?another_reload=1" );
+}
+
+// this stuff is pretty insane. calling scanAllPlugins() multiple times
+// won't do the trick. we actually need to reload the page twice!
+// (perhaps someone else can find the reason for this and come up with a
+// cleaner solution)
+if( !empty( $_REQUEST['another_reload'] ) ) {
+ header( "Location: ".LIBERTY_PKG_URL."admin/plugins.php" );
+}
+
// Since the normal startup only loads the plugins marked active
// We need to load the rest of them here so that we can display them all
$gLibertySystem->scanAllPlugins();
@@ -31,7 +50,5 @@ $gBitSmarty->assign_by_ref( 'gLibertySystem', $gLibertySystem );
ksort( $types );
$gBitSmarty->assign_by_ref( 'pluginTypes', $types );
-//vd( $gLibertySystem->mPlugins );
-
$gBitSystem->display( 'bitpackage:liberty/admin_plugins.tpl');
?>