PATH:
home
/
letacommog
/
bresse-paysage
/
wp-content
/
plugins
/
wordpress-seo-premium
/
premium
/
classes
<?php /** * WPSEO Premium plugin file. * * @package WPSEO\Premium\Classes */ /** * Class WPSEO_Upgrade_Manager */ class WPSEO_Upgrade_Manager { /** * Option key to save the version of Premium */ const VERSION_OPTION_KEY = 'wpseo_premium_version'; /** * Run the upgrade routine when it's necessary. * * @param string $current_version The current WPSEO version. */ public function run_upgrade( $current_version ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX === true ) { return; } $saved_version = get_option( self::VERSION_OPTION_KEY, '3.0.7' ); if ( version_compare( $saved_version, $current_version, '<' ) ) { $this->check_update( $saved_version ); update_option( self::VERSION_OPTION_KEY, $current_version ); } } /** * Run the specific updates when it is necessary. * * @param string $version_number The version number that will be compared. */ public function check_update( $version_number ) { // Get current version. $current_version = get_site_option( WPSEO_Premium::OPTION_CURRENT_VERSION, 1 ); // Check if update is required. if ( WPSEO_Premium::PLUGIN_VERSION_CODE > $current_version ) { // Do update. $this->do_update( $current_version ); // Update version code. $this->update_current_version_code(); } if ( version_compare( $version_number, '2.3', '<' ) ) { add_action( 'wp', array( 'WPSEO_Redirect_Upgrade', 'import_redirects_2_3' ), 11 ); add_action( 'admin_head', array( 'WPSEO_Redirect_Upgrade', 'import_redirects_2_3' ), 11 ); } if ( version_compare( $version_number, '3.1', '<' ) ) { add_action( 'wp', array( 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ), 12 ); add_action( 'admin_head', array( 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ), 12 ); } if ( version_compare( $version_number, '4.7', '<' ) ) { add_action( 'wp', array( 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_7' ), 12 ); add_action( 'admin_head', array( 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_7' ), 12 ); } if ( version_compare( $version_number, '4.8', '<' ) ) { add_action( 'wp', array( 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_8' ), 12 ); add_action( 'admin_head', array( 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_8' ), 12 ); } if ( version_compare( $version_number, '9.8-RC0', '<' ) ) { add_action( 'init', array( $this, 'upgrade_9_8' ), 12 ); } if ( version_compare( $version_number, '10.3', '<' ) ) { add_action( 'init', array( $this, 'upgrade_11' ), 12 ); } } /** * Removes the orphaned content notification. * * @return void */ public function upgrade_11() { $orphaned_content_support = new WPSEO_Premium_Orphaned_Content_Support(); $notification_manager = Yoast_Notification_Center::get(); foreach ( $orphaned_content_support->get_supported_post_types() as $post_type ) { // We need to remove the dismissal first, to clean up better but also as otherwise the remove won't work. delete_metadata( 'user', false, 'wpseo-premium-orphaned-content-' . $post_type, '', true ); $notification_manager->remove_notification_by_id( 'wpseo-premium-orphaned-content-' . $post_type, true ); } // Remove the cronjob if present. wp_clear_scheduled_hook( 'wpseo-premium-orphaned-content' ); } /** * Removes the stale cornerstone content beta notification. * * @return void */ public function upgrade_9_8() { $notification_manager = Yoast_Notification_Center::get(); $notification_manager->remove_notification_by_id( 'wpseo-stale-content-notification' ); // Delete the user meta data that tracks whether the user has seen the notification. delete_metadata( 'user', false, 'wp_wpseo-stale-content-notification', '', true ); } /** * Returns whether or not we should retry the 31 upgrade * * @return bool */ public function should_retry_upgrade_31() { $retry = false; $new_redirects = get_option( WPSEO_Redirect_Option::OPTION, null ); if ( null === $new_redirects ) { $old_plain_redirects = get_option( WPSEO_Redirect_Option::OLD_OPTION_PLAIN, array() ); $old_regex_redirects = get_option( WPSEO_Redirect_Option::OLD_OPTION_REGEX, array() ); if ( ! empty( $old_plain_redirects ) || ! empty( $old_regex_redirects ) ) { $retry = true; } } return $retry; } /** * Validates if the 31 upgrade routine has correctly run and if not retries to run it * * @param bool $immediately Whether to do the upgrade immediately when this function is called. */ public function retry_upgrade_31( $immediately = false ) { /* * If we detect that the new redirect option doesn't exist but there are redirects in the old option we try the * upgrade routine again. This brings the redirects back for people if the upgrade routine failed the first * time. */ if ( $this->should_retry_upgrade_31() ) { if ( $immediately ) { WPSEO_Redirect_Upgrade::upgrade_3_1(); return; } add_action( 'wp', array( 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ), 12 ); add_action( 'admin_head', array( 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ), 12 ); } } /** * An update is required, do it * * @param string $current_version The current version number of the installation. */ private function do_update( $current_version ) { // Upgrade to version 1.2.0. if ( $current_version < 15 ) { /** * Upgrade redirects */ add_action( 'wp', array( 'WPSEO_Redirect_Upgrade', 'upgrade_1_2_0' ), 10 ); add_action( 'admin_head', array( 'WPSEO_Redirect_Upgrade', 'upgrade_1_2_0' ), 10 ); } } /** * Update the current version code */ private function update_current_version_code() { update_site_option( WPSEO_Premium::OPTION_CURRENT_VERSION, WPSEO_Premium::PLUGIN_VERSION_CODE ); } }
[+]
..
[+]
export
[-] premium-prominent-words-endpoint.php
[edit]
[-] premium-prominent-words-service.php
[edit]
[-] premium-gsc-modal.php
[edit]
[-] upgrade-manager.php
[edit]
[-] premium-import-manager.php
[edit]
[-] premium-prominent-words-unindexed-post-query.php
[edit]
[+]
views
[-] validation-warning.php
[edit]
[-] validation-result.php
[edit]
[-] premium-redirect-export-manager.php
[edit]
[-] multi-keyword.php
[edit]
[-] premium-prominent-words-recalculation-notifier.php
[edit]
[-] premium-orphaned-post-notifier.php
[edit]
[-] premium-prominent-words-recalculation.php
[edit]
[-] premium-prominent-words-link-endpoint.php
[edit]
[-] premium-post-data-service.php
[edit]
[-] premium-prominent-words-language-support.php
[edit]
[-] product-premium.php
[edit]
[-] premium-javascript-strings.php
[edit]
[-] premium-redirect-service.php
[edit]
[-] premium-redirect-endpoint.php
[edit]
[-] premium-prominent-words-link-service.php
[edit]
[-] premium-free-translations.php
[edit]
[+]
redirect
[-] premium-prominent-words-recalculation-endpoint.php
[edit]
[-] premium-register-capabilities.php
[edit]
[-] premium-orphaned-post-query.php
[edit]
[-] custom-fields-plugin.php
[edit]
[-] premium-keyword-export-manager.php
[edit]
[-] premium-prominent-words-versioning.php
[edit]
[-] premium-post-data-endpoint.php
[edit]
[-] premium-prominent-words-recalculation-service.php
[edit]
[-] premium-orphaned-post-filter.php
[edit]
[-] facebook-profile.php
[edit]
[-] premium-autoloader.php
[edit]
[-] premium-stale-cornerstone-content-notification.php
[edit]
[-] premium-beacon-setting.php
[edit]
[-] watcher.php
[edit]
[-] premium-expose-shortlinks.php
[edit]
[-] premium-link-suggestions-service.php
[edit]
[-] premium-assets.php
[edit]
[-] term-watcher.php
[edit]
[-] premium-metabox.php
[edit]
[-] metabox-link-suggestions.php
[edit]
[-] premium-gsc.php
[edit]
[-] premium-stale-cornerstone-content-filter.php
[edit]
[-] post-watcher.php
[edit]
[-] validation-error.php
[edit]
[-] premium-asset-js-l10n.php
[edit]
[-] social-previews.php
[edit]
[-] premium-prominent-words-registration.php
[edit]
[-] premium-prominent-words-support.php
[edit]
[-] premium-orphaned-content-utils.php
[edit]
[-] premium-link-suggestions-endpoint.php
[edit]
[-] premium-orphaned-content-support.php
[edit]