Ejemplo n.º 1
0
        /**
         * Update all bbPress forums across all sites
         *
         * @since bbPress (r3689)
         *
         * @global WPDB $wpdb
         * @uses get_blog_option()
         * @uses wp_remote_get()
         */
        public static function update_screen()
        {
            // Get action
            $action = isset($_GET['action']) ? $_GET['action'] : '';
            ?>

		<div class="wrap">
			<div id="icon-edit" class="icon32 icon32-posts-topic"><br /></div>
			<h2><?php 
            _e('Update Forum', 'bbpress');
            ?>
</h2>

		<?php 
            // Taking action
            switch ($action) {
                case 'bbpress-update':
                    // @todo more update stuff here, evaluate performance
                    // Remove roles and caps
                    bbp_remove_roles();
                    bbp_remove_caps();
                    // Make sure roles, capabilities, and options exist
                    bbp_add_roles();
                    bbp_add_caps();
                    bbp_add_options();
                    // Ensure any new permalinks are created
                    flush_rewrite_rules();
                    // Ensure proper version in the DB
                    bbp_version_bump();
                    ?>
			
				<p><?php 
                    _e('All done!', 'bbpress');
                    ?>
</p>
				<a class="button" href="index.php?page=bbpress-update"><?php 
                    _e('Go Back', 'bbpress');
                    ?>
</a>

				<?php 
                    break;
                case 'show':
                default:
                    ?>

				<p><?php 
                    _e('You can update your forum through this page. Hit the link below to update.', 'bbpress');
                    ?>
</p>
				<p><a class="button" href="index.php?page=bbpress-update&amp;action=bbpress-update"><?php 
                    _e('Update Forum', 'bbpress');
                    ?>
</a></p>

			<?php 
                    break;
            }
            ?>

		</div><?php 
        }
Ejemplo n.º 2
0
/**
 * bbPress's version updater looks at what the current database version is, and
 * runs whatever other code is needed.
 *
 * This is most-often used when the data schema changes, but should also be used
 * to correct issues with bbPress meta-data silently on software update.
 *
 * @since bbPress (r4104)
 */
function bbp_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) bbp_get_db_version_raw();
    /** 2.0 Branch ************************************************************/
    // 2.0, 2.0.1, 2.0.2, 2.0.3
    if ($raw_db_version < 200) {
        // Do nothing
    }
    /** 2.1 Branch ************************************************************/
    // 2.1, 2.1.1
    if ($raw_db_version < 211) {
        /**
         * Repair private and hidden forum data
         *
         * @link http://bbpress.trac.wordpress.org/ticket/1891
         */
        bbp_admin_repair_forum_visibility();
    }
    /** 2.2 Branch ************************************************************/
    // 2.2
    if ($raw_db_version < 214) {
        // Remove bbPress 1.1 roles (BuddyPress)
        remove_role('member');
        remove_role('inactive');
        remove_role('blocked');
        remove_role('moderator');
        remove_role('keymaster');
        // Remove bbPress 2.1 roles
        remove_role('bbp_moderator');
        remove_role('bbp_participant');
        // Refresh capabilities
        bbp_remove_caps();
        bbp_add_caps();
    }
    /** All done! *************************************************************/
    // Bump the version
    bbp_version_bump();
    // Delete rewrite rules to force a flush
    bbp_delete_rewrite_rules();
}