コード例 #1
0
ファイル: bbp-admin.php プロジェクト: hscale/webento
        /**
         * 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 
        }
コード例 #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) {
        // No changes
    }
    /** 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 < 220) {
        // Remove the Moderator role from the database
        remove_role(bbp_get_moderator_role());
        // Remove the Participant role from the database
        remove_role(bbp_get_participant_role());
        // Remove capabilities
        bbp_remove_caps();
    }
    /** 2.3 Branch ************************************************************/
    // 2.3
    if ($raw_db_version < 230) {
        // No changes
    }
    /** All done! *************************************************************/
    // Bump the version
    bbp_version_bump();
    // Delete rewrite rules to force a flush
    bbp_delete_rewrite_rules();
}
コード例 #3
0
ファイル: bbp-core-update.php プロジェクト: hscale/webento
/**
 * Setup the bbPress updater
 *
 * @since bbPress (r3419)
 *
 * @uses bbp_version_bump()
 * @uses bbp_deactivation()
 * @uses bbp_activation()
 */
function bbp_setup_updater()
{
    // Are we running an outdated version of bbPress?
    if (bbp_is_update()) {
        // Call the automated updater
        bbp_version_updater();
        // Bump the version
        bbp_version_bump();
        // Run the deactivation function to wipe roles, caps, and rewrite rules
        bbp_deactivation();
        // Run the activation function to reset roles, caps, and rewrite rules
        bbp_activation();
    }
}
コード例 #4
0
ファイル: install.php プロジェクト: joeyblake/bbpress
// Pull in the WordPress core test suite
require_once $config_file_path;
require_once $tests_dir_path . '/includes/functions.php';
/**
 * Include bbPress via `plugins_loaded` event
 *
 * This could maybe me earlier on `muplugins_loaded` but time will tell what
 * works best for us.
 */
function _load_bbpress()
{
    echo "Loading bbPress via `/src/bbpress.php`...\n";
    require dirname(dirname(dirname(dirname(__FILE__)))) . '/src/bbpress.php';
}
tests_add_filter('plugins_loaded', '_load_bbpress');
// Override some fussy global values
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
// Fix PHP identity crisis
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
// Include WordPress
echo "Loading WordPress via `wp-settings.php`...\n";
require_once ABSPATH . '/wp-settings.php';
// Fix fussy database settings
$wpdb->query('SET storage_engine = INNODB');
$wpdb->select(DB_NAME, $wpdb->dbh);
// Install bbPress
echo "Installing bbPress...\n";
bbp_version_bump();
コード例 #5
0
ファイル: bbp-core-update.php プロジェクト: rmccue/bbPress
/**
 * 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();
}
コード例 #6
0
ファイル: update.php プロジェクト: joeyblake/bbpress
/**
 * 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 2.2.0 bbPress (r4104)
 */
function bbp_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) bbp_get_db_version_raw();
    // Only run updater if previous installation exists
    if (!empty($raw_db_version)) {
        /** 2.0 Branch ********************************************************/
        // 2.0, 2.0.1, 2.0.2, 2.0.3
        if ($raw_db_version < 200) {
            // No changes
        }
        /** 2.1 Branch ********************************************************/
        // 2.1, 2.1.1
        if ($raw_db_version < 211) {
            /**
             * Repair private and hidden forum data
             *
             * @link https://bbpress.trac.wordpress.org/ticket/1891
             */
            bbp_admin_repair_forum_visibility();
        }
        /** 2.2 Branch ********************************************************/
        // 2.2
        if ($raw_db_version < 220) {
            // Remove any old bbPress roles
            bbp_remove_roles();
            // Remove capabilities
            bbp_remove_caps();
        }
        /** 2.3 Branch ********************************************************/
        // 2.3
        if ($raw_db_version < 230) {
            // No changes
        }
    }
    /** All done! *************************************************************/
    // Bump the version
    bbp_version_bump();
    // Delete rewrite rules to force a flush
    bbp_delete_rewrite_rules();
}