From f0c63decb07d00a1dc651bb278075bacdb073a32 Mon Sep 17 00:00:00 2001 From: dd32 Date: Thu, 27 May 2010 09:49:38 +0000 Subject: [PATCH] Fully implement the 'delete_themes' capability. See also r13547 git-svn-id: http://svn.automattic.com/wordpress/trunk@14984 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 1 + wp-admin/includes/upgrade.php | 10 +++++----- wp-admin/themes.php | 6 +++--- wp-includes/version.php | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index a129f63bb..363e3763a 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -612,6 +612,7 @@ function populate_roles_300() { $role->add_cap( 'add_users' ); $role->add_cap( 'promote_users' ); $role->add_cap( 'edit_theme_options' ); + $role->add_cap( 'delete_themes' ); } } diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 4c2c7b36e..b6a16d8bf 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -440,7 +440,7 @@ function upgrade_all() { if ( $wp_current_db_version < 11958 ) upgrade_290(); - if ( $wp_current_db_version < 14726 ) + if ( $wp_current_db_version < 14984 ) upgrade_300(); maybe_disable_automattic_widgets(); @@ -1108,11 +1108,11 @@ function upgrade_290() { function upgrade_300() { global $wp_current_db_version, $wpdb; - if ( $wp_current_db_version < 14139 ) { + if ( $wp_current_db_version < 14984 ) populate_roles_300(); - if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false ) - add_site_option( 'siteurl', '' ); - } + + if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false ) + add_site_option( 'siteurl', '' ); // 3.0-alpha nav menu postmeta changes. can be removed before release. // r13802 if ( $wp_current_db_version >= 13226 && $wp_current_db_version < 13974 ) diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 028550ec5..b2d91496b 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -20,7 +20,7 @@ if ( current_user_can('switch_themes') && isset($_GET['action']) ) { exit; } else if ( 'delete' == $_GET['action'] ) { check_admin_referer('delete-theme_' . $_GET['template']); - if ( !current_user_can('update_themes') ) + if ( !current_user_can('delete_themes') ) wp_die( __( 'Cheatin’ uh?' ) ); delete_theme($_GET['template']); wp_redirect('themes.php?deleted=true'); @@ -193,8 +193,8 @@ foreach ( $cols as $col => $theme_name ) { $actions = array(); $actions[] = '' . __('Activate') . ''; $actions[] = '' . __('Preview') . ''; - if ( current_user_can('update_themes') ) - $actions[] = '' . __('Delete') . ''; + if ( current_user_can('delete_themes') ) + $actions[] = '' . __('Delete') . ''; $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); $actions = implode ( ' | ', $actions ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 4e72301d1..838590502 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -15,7 +15,7 @@ $wp_version = '3.0-beta2-14960'; * * @global int $wp_db_version */ -$wp_db_version = 14726; +$wp_db_version = 14984; /** * Holds the TinyMCE version