/** * 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; }
function test_largo_check_deprecated_widgets() { // Backup sidebar widgets $widgets_backup = get_option('sidebars_widgets'); // Create the deprecated widgets update_option('sidebars_widgets', array('article-bottom' => array(0 => 'largo-footer-featured-2', 1 => 'largo-sidebar-featured-2'))); largo_check_deprecated_widgets(); // Test that the requisite deprecated widgets actions have been added to the admin_notices hook $return = has_action('admin_notices', 'largo_deprecated_footer_widget'); $this->assertTrue(isset($return)); unset($return); $return = has_action('admin_notices', 'largo_deprecated_sidebar_widget'); $this->assertTrue(isset($return)); unset($return); // Cleanup of_reset_options(); delete_option('sidebars_widgets'); update_option('sidebars_widgets', $widgets_backup); }