示例#1
0
/**
 * Checks the version number and runs install or update functions if needed.
 *
 * @since 2.0
 */
function wprss_version_check()
{
    // Get the old database version.
    $old_db_version = get_option('wprss_db_version');
    // Get the plugin settings.
    $settings = get_option('wprss_settings');
    // Get the plugin options
    $options = get_option('wprss_options');
    // For fresh installs
    // If there is no old database version and no settings, run the install.
    if (empty($old_db_version) && false === $settings && false === $options) {
        wprss_install();
    } elseif (empty($old_db_version) && false === $settings && !empty($options)) {
        wp_clear_scheduled_hook('wprss_generate_hook');
        wprss_install();
        wprss_migrate();
        wprss_fetch_insert_all_feed_items();
    } elseif (empty($old_db_version) && !empty($settings) && !empty($options)) {
        wp_clear_scheduled_hook('wprss_generate_hook');
        wprss_update();
        wprss_migrate();
        wprss_fetch_insert_all_feed_items();
    } elseif (intval($old_db_version) < intval(WPRSS_DB_VERSION) && FALSE != get_option('wprss_settings')) {
        wprss_upgrade_30();
        wprss_update();
        wprss_fetch_insert_all_feed_items();
    } elseif (intval($old_db_version) < intval(WPRSS_DB_VERSION)) {
        wprss_update();
        wprss_fetch_insert_all_feed_items();
        // NO FOLLOW CHANGE FIX
        $options = get_option('wprss_settings_general');
        if ($options['follow_dd'] === __("No Follow", 'wprss')) {
            $options['follow_dd'] = 'no_follow';
        } elseif ($options['follow_dd'] === __("Follow", 'wprss')) {
            $options['follow_dd'] = 'follow';
        }
    }
}
function wprss_schedule_reimport_all($deleted_ids)
{
    if (!get_transient(WPRSS_TRANSIENT_NAME_IS_REIMPORTING)) {
        return;
    }
    wprss_log('Re-import scheduled...', __FUNCTION__, WPRSS_LOG_LEVEL_SYSTEM);
    delete_transient(WPRSS_TRANSIENT_NAME_IS_REIMPORTING);
    wprss_fetch_insert_all_feed_items(TRUE);
}
示例#3
0
/**
 * Runs the above function with parameter FALSE
 * 
 * @since 3.9
 */
function wprss_fetch_insert_all_feed_items_from_cron()
{
    wprss_fetch_insert_all_feed_items(FALSE);
}
示例#4
0
/**
 * Deletes all imported feeds and re-imports everything
 *
 * @since 3.0
 */
function wprss_feed_reset()
{
    wp_schedule_single_event(time(), 'wprss_delete_all_feed_items_hook');
    wprss_fetch_insert_all_feed_items(TRUE);
}