[wp-cvs] wordpress/wp-admin plugins.php, 1.14,
1.15 upgrade-functions.php, 1.65, 1.66
Matthew Mullenweg
saxmatt at users.sourceforge.net
Mon Aug 9 07:17:56 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5541/wp-admin
Modified Files:
plugins.php upgrade-functions.php
Log Message:
Use array storage for plugins list.
Index: plugins.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/plugins.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** plugins.php 15 Jun 2004 23:24:35 -0000 1.14
--- plugins.php 9 Aug 2004 07:17:53 -0000 1.15
***************
*** 1,5 ****
<?php
! if (isset($_GET['action'])) {
$standalone = 1;
require_once('admin-header.php');
--- 1,5 ----
<?php
! if ( isset($_GET['action']) ) {
$standalone = 1;
require_once('admin-header.php');
***************
*** 8,16 ****
if ('activate' == $_GET['action']) {
! $current = "\n" . get_settings('active_plugins') . "\n";
! $current = preg_replace("|(\n)+\s*|", "\n", $current);
! $current = trim($current) . "\n " . trim($_GET['plugin']);
! $current = trim($current);
! $current = preg_replace("|\n\s*|", "\n", $current); // I don't know where this is coming from
update_option('active_plugins', $current);
header('Location: plugins.php?activate=true');
--- 8,14 ----
if ('activate' == $_GET['action']) {
! $current = get_settings('active_plugins');
! $current[] = trim( $_GET['plugin'] );
! sort($current);
update_option('active_plugins', $current);
header('Location: plugins.php?activate=true');
***************
*** 18,25 ****
if ('deactivate' == $_GET['action']) {
! $current = "\n" . get_settings('active_plugins') . "\n";
! $current = str_replace("\n" . $_GET['plugin'], '', $current);
! $current = preg_replace("|(\n)+\s*|", "\n", $current);
! update_option('active_plugins', trim($current));
header('Location: plugins.php?deactivate=true');
}
--- 16,22 ----
if ('deactivate' == $_GET['action']) {
! $current = get_settings('active_plugins');
! array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
! update_option('active_plugins', $current);
header('Location: plugins.php?deactivate=true');
}
***************
*** 31,51 ****
if ($user_level < 9) // Must be at least level 9
! die (__("Sorry, you must be at least a level 8 user to modify plugins."));
// Clean up options
! // if any files are in the option that don't exist, axe 'em
! $check_plugins = explode("\n", (get_settings('active_plugins')));
foreach ($check_plugins as $check_plugin) {
if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
! $current = get_settings('active_plugins') . "\n";
! $current = str_replace($check_plugin . "\n", '', $current);
! $current = preg_replace("|\n+|", "\n", $current);
! update_option('active_plugins', trim($current));
}
}
-
-
-
?>
--- 28,44 ----
if ($user_level < 9) // Must be at least level 9
! die (__('Sorry, you must be at least a level 8 user to modify plugins.'));
// Clean up options
! // If any plugins don't exist, axe 'em
! $check_plugins = get_settings('active_plugins');
foreach ($check_plugins as $check_plugin) {
if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
! $current = get_settings('active_plugins');
! unset($current[$_GET['plugin']]);
! update_option('active_plugins', $current);
}
}
?>
***************
*** 61,65 ****
<div class="wrap">
<h2><?php _e('Plugin Management'); ?></h2>
! <p><?php _e('Plugins are files you usually download separately from WordPress that add functionality. To install a plugin you generally just need to put the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
<?php
// Files in wp-content/plugins directory
--- 54,58 ----
<div class="wrap">
<h2><?php _e('Plugin Management'); ?></h2>
! <p><?php _e('Plugins are files you usually download separately from WordPress that add functionality. To install a plugin you generally just need to put the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is installed, you may activate it or deactivate it here. If something goes wrong with a plugin and you can’t use WordPress, delete that plugin from the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p>
<?php
// Files in wp-content/plugins directory
***************
*** 72,78 ****
}
! if ('' != trim(get_settings('active_plugins'))) {
! $current_plugins = explode("\n", (get_settings('active_plugins')));
! }
if (!$plugins_dir || !$plugin_files) {
--- 65,70 ----
}
! if ( get_settings('active_plugins') )
! $current_plugins = get_settings('active_plugins');
if (!$plugins_dir || !$plugin_files) {
Index: upgrade-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/upgrade-functions.php,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** upgrade-functions.php 29 Jul 2004 03:34:07 -0000 1.65
--- upgrade-functions.php 9 Aug 2004 07:17:53 -0000 1.66
***************
*** 924,927 ****
--- 924,932 ----
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
}
+
+ if ( !is_array( get_settings('active_plugins') ) ) {
+ $plugins = explode("\n", get_settings('active_plugins') );
+ update_option('active_plugins', $plugins);
+ }
}
More information about the cvs
mailing list