Beispiel #1
0
/**
 * Activation
 */
function wcs3_activate()
{
    $version = get_option('wcs3_version');
    if ($version == FALSE) {
        // This is a new installation. Let's create the necessary
        // db table.
        wcs3_create_db_tables();
        // Update version option
        add_option('wcs3_version', WCS3_VERSION);
    }
}
/**
 * Handle import update
 */
function wcs3_import_update_callback()
{
    wcs3_verify_nonce();
    wcs3_delete_everything();
    update_option('wcs3_version', WCS3_VERSION);
    /* do stuff once right after activation */
    // Create db tables
    wcs3_create_db_tables();
    // Run default settings hook.
    do_action('wcs3_default_settings');
    // Update old versions
    // New installation, let's try and get data from wcs2
    $wcs2_static_data = wcs3_get_static_wcs2_data();
    $new_ids = wcs3_create_new_wcs3_static_data($wcs2_static_data);
    $wcs2_schedule = wcs3_get_wcs2_schedule_data($new_ids);
    $response = __('Weekly Class Schedule 2.x data imported successfully.', 'wcs3');
    $result = 'updated';
    wcs3_json_response(array('response' => $response, 'result' => $result));
    die;
}