Beispiel #1
0
/**
 * Performs various update functions and set a new verion number.
 *
 * This acts as a main() for applying database updates when the update ajax is
 * called.
 *
 * @since 0.3
 */
function largo_perform_update()
{
    if (largo_need_updates()) {
        // this must run before any other function that makes use of of_set_option()
        largo_set_new_option_defaults();
        // Run when updating from pre-0.4
        if (version_compare(of_get_option('largo_version'), '0.4') < 0) {
            largo_home_transition();
            largo_update_widgets();
            largo_transition_nav_menus();
            largo_update_prominence_term_descriptions();
            largo_force_settings_update();
            largo_enable_if_series();
            largo_enable_series_if_landing_page();
        }
        // Repeatable, should be run when updating to 0.4+
        largo_remove_topstory_prominence_term();
        // Always run
        largo_update_custom_less_variables();
        largo_check_deprecated_widgets();
        // Set version.
        of_set_option('largo_version', largo_version());
    }
    return true;
}
Beispiel #2
0
 function test_largo_update_prominence_term_descriptions()
 {
     //This test checks that largo_update_prominence_term_description_single was run with certain arguments.
     // This is the only term of the set that largo_update_prominence_term_descriptions updates that is not already created by the time the test is run.
     $term_ids = $this->factory->term->create_many(1, array('taxonomy' => 'prominence'));
     wp_update_term($term_ids[0], 'prominence', array('name' => 'Top Story', 'description' => 'If you are using the Newspaper or Carousel optional homepage layout, add this label to label to a post to make it the top story on the homepage.', 'slug' => 'top-story'));
     largo_update_prominence_term_descriptions();
     $test_post = get_term($term_ids[0], 'prominence', 'ARRAY_A');
     $this->assertEquals('If you are using a "Big story" homepage layout, add this label to a post to make it the top story on the homepage', $test_post['description']);
 }