コード例 #1
0
ファイル: plugin-init.php プロジェクト: coollog/theboola
function pvc_lite_upgrade_plugin()
{
    if (version_compare(get_option('a3_pvc_version'), '1.2') === -1) {
        update_option('a3_pvc_version', '1.2');
        A3_PVC::upgrade_version_1_2();
    }
    if (version_compare(get_option('a3_pvc_version'), '1.3.5') === -1) {
        wp_schedule_event(strtotime(date('Y-m-d') . ' 00:00:00'), 'daily', 'pvc_empty_daily_table_daily_event_hook');
        global $wpdb;
        $sql = "ALTER TABLE " . $wpdb->prefix . "pvc_daily  CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT";
        $wpdb->query($sql);
        $sql = "ALTER TABLE " . $wpdb->prefix . "pvc_total  CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT";
        $wpdb->query($sql);
        update_option('a3_pvc_version', '1.3.5');
    }
    if (version_compare(get_option('a3_pvc_version'), '1.3.6') === -1) {
        $pvc_settings = get_option('pvc_settings');
        if (isset($pvc_settings['post_types']) && is_array($pvc_settings['post_types']) && count($pvc_settings['post_types']) > 0) {
            $post_types_new = array();
            foreach ($pvc_settings['post_types'] as $post_type) {
                $post_types_new[$post_type] = $post_type;
            }
            $pvc_settings['post_types'] = $post_types_new;
            update_option('pvc_settings', $pvc_settings);
        }
        update_option('a3_pvc_version', '1.3.6');
    }
    update_option('a3_pvc_version', '1.3.8');
}