Ejemplo n.º 1
0
function gp_upgrade_db()
{
    global $gpdb;
    $alterations = BP_SQL_Schema_Parser::delta($gpdb, gp_schema_get());
    $errors = $alterations['errors'];
    if ($errors) {
        return $errors;
    }
    gp_upgrade_data(gp_get_option_from_db('gp_db_version'));
    gp_update_db_version();
}
Ejemplo n.º 2
0
/**
 * Returns the requested bbPress option from the meta table or the $bb object
 *
 * @param string The option to be echoed
 * @return mixed The value of the option
 */
function gp_get_option($option)
{
    global $bb;
    switch ($option) {
        case 'language':
            $r = str_replace('_', '-', get_locale());
            break;
        case 'text_direction':
            global $gp_locale;
            $r = $gp_locale->text_direction;
            break;
        case 'version':
            return '1.0-alpha-1000';
            // Don't filter
        // Don't filter
        case 'gp_db_version':
            return '940';
            // Don't filter
        // Don't filter
        case 'html_type':
            $r = 'text/html';
            break;
        case 'charset':
            $r = 'UTF-8';
            break;
        case 'gp_table_prefix':
        case 'table_prefix':
            global $gpdb;
            return $gpdb->prefix;
            // Don't filter;
        // Don't filter;
        case 'url':
            $option = 'uri';
        default:
            $r = gp_get_option_from_db($option);
            break;
    }
    return apply_filters('gp_get_option_' . $option, $r, $option);
}
Ejemplo n.º 3
0
<?php

/**
 * Landing point for GlotPress installation
 */
define('GP_INSTALLING', true);
require_once 'gp-load.php';
require_once BACKPRESS_PATH . 'class.bp-sql-schema-parser.php';
require_once GP_PATH . GP_INC . 'install-upgrade.php';
require_once GP_PATH . GP_INC . 'schema.php';
$show_htaccess_instructions = false;
$action = 'upgrade';
if (gp_get_option('gp_db_version') <= gp_get_option_from_db('gp_db_version') && !isset($_GET['force'])) {
    $success_message = __('You already have the latest version, no need to upgrade!');
} else {
    if (gp_is_installed()) {
        $success_message = __('GlotPress was successully upgraded!');
        $errors = gp_upgrade();
        $show_htaccess_instructions = !gp_set_htaccess() && empty($errors);
    } else {
        if (defined('CUSTOM_USER_TABLE')) {
            $errors = gp_install();
            $success_message = __('GlotPress was successully installed!');
            if (!$errors) {
                gp_create_initial_contents();
            }
            $show_htaccess_instructions = !gp_set_htaccess() && empty($errors);
            $action = 'installed';
        } else {
            if (isset($_POST['user_name'], $_POST['user_name'], $_POST['admin_password'], $_POST['admin_password2'], $_POST['admin_email'])) {
                $user_name = trim(stripslashes_deep($_POST['user_name']));