示例#1
0
/**
 * Output the bbPress database version directly from the database
 *
 * @since 2.0.0 bbPress (r3468)
 *
 * @uses bbp_get_version() To get the current bbPress version
 */
function bbp_db_version_raw()
{
    echo bbp_get_db_version_raw();
}
示例#2
0
 function otw_installed_plugin($plugin_name)
 {
     $installed = false;
     switch ($plugin_name) {
         case 'bbpress':
             if (function_exists('bbp_get_db_version_raw') && bbp_get_db_version_raw()) {
                 $installed = true;
             }
             break;
         case 'wpml':
             if (function_exists('icl_get_languages')) {
                 $installed = true;
             }
             break;
         case 'buddypress':
             if (class_exists('BuddyPress')) {
                 global $bp;
                 if (strtolower(get_class($bp)) == 'buddypress') {
                     $installed = true;
                 }
             }
             break;
     }
     return $installed;
 }
/**
 * 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();
}
示例#4
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();
    // Bail if no database version exists
    if (empty($raw_db_version)) {
        return;
    }
    /** 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 < 220) {
        // No changes yet
    }
}
示例#5
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();
}
示例#6
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 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();
}