Пример #1
0
<?php

/**
 * @package Restrict User Access
 * @copyright Joachim Jensen <*****@*****.**>
 * @license GPLv3
 */
if (is_admin()) {
    $db_updater = new WP_DB_Updater("rua_plugin_version", RUA_App::PLUGIN_VERSION);
    $db_updater->register_version_update("0.4", "rua_db_userlevel_date");
    /**
     * Store userlevel dates with level_id
     * instead of level umeta_id
     *
     * @since  0.4
     * @return boolean
     */
    function rua_db_userlevel_date()
    {
        global $wpdb;
        //Get levels by umeta id and level id
        $levels_by_metaid = $wpdb->get_results("SELECT umeta_id,meta_value FROM {$wpdb->usermeta} WHERE meta_key = '_ca_level'", OBJECT_K);
        $levels_by_id = array();
        foreach ($levels_by_metaid as $meta_id => $level) {
            $levels_by_id[$level->meta_value] = $meta_id;
        }
        $level_dates = $wpdb->get_results("SELECT user_id,meta_key,meta_value FROM {$wpdb->usermeta} WHERE meta_key LIKE '_ca_level_%'");
        foreach ($level_dates as $level_date) {
            $level_date_level_id = str_replace("_ca_level_", "", $level_date->meta_key);
            //Check if date exists by level umeta id (old store)
            //If so, move it to new
Пример #2
0
<?php

/**
 * @package Content Aware Sidebars
 * @author Joachim Jensen <*****@*****.**>
 */
if (!defined('CAS_App::PLUGIN_VERSION')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}
$cas_db_updater = new WP_DB_Updater("cas_db_version", CAS_App::PLUGIN_VERSION);
$cas_db_updater->register_version_update("0.8", "cas_update_to_08");
$cas_db_updater->register_version_update("1.1", "cas_update_to_11");
$cas_db_updater->register_version_update("2.0", "cas_update_to_20");
$cas_db_updater->register_version_update("3.0", "cas_update_to_30");
$cas_db_updater->register_version_update("3.1", "cas_update_to_31");
/**
 * Version 3.0 -> 3.1
 * Remove flag about plugin tour for all users
 *
 * @since  3.1
 * @return boolean
 */
function cas_update_to_31()
{
    global $wpdb;
    $wpdb->query("\r\n\t\tDELETE FROM {$wpdb->usermeta}\r\n\t\tWHERE meta_key = '{$wpdb->prefix}_ca_cas_tour'\r\n\t");
    return true;
}
/**