晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/stando/www/wp-content/plugins/wordpress-seo-premium/premium/classes/ |
Upload File : |
<?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', [ 'WPSEO_Redirect_Upgrade', 'import_redirects_2_3' ], 11 );
add_action( 'admin_head', [ 'WPSEO_Redirect_Upgrade', 'import_redirects_2_3' ], 11 );
}
if ( version_compare( $version_number, '3.1', '<' ) ) {
add_action( 'wp', [ 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ], 12 );
add_action( 'admin_head', [ 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ], 12 );
}
if ( version_compare( $version_number, '4.7', '<' ) ) {
add_action( 'wp', [ 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_7' ], 12 );
add_action( 'admin_head', [ 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_7' ], 12 );
}
if ( version_compare( $version_number, '4.8', '<' ) ) {
add_action( 'wp', [ 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_8' ], 12 );
add_action( 'admin_head', [ 'WPSEO_Premium_Prominent_Words_Versioning', 'upgrade_4_8' ], 12 );
}
if ( version_compare( $version_number, '9.8-RC0', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_9_8' ], 12 );
}
if ( version_compare( $version_number, '10.3', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_11' ], 12 );
}
if ( version_compare( $version_number, '12.8', '<' ) ) {
add_action( 'init', [ 'WPSEO_Premium_Prominent_Words_Recalculation_Notifier', 'upgrade_12_8' ], 12 );
}
if ( version_compare( $version_number, '13.0-RC0', '<' ) ) {
add_action( 'init', [ 'WPSEO_Redirect_Upgrade', 'upgrade_13_0' ], 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 ( $new_redirects === null ) {
$old_plain_redirects = get_option( WPSEO_Redirect_Option::OLD_OPTION_PLAIN, [] );
$old_regex_redirects = get_option( WPSEO_Redirect_Option::OLD_OPTION_REGEX, [] );
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', [ 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ], 12 );
add_action( 'admin_head', [ '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', [ 'WPSEO_Redirect_Upgrade', 'upgrade_1_2_0' ], 10 );
add_action( 'admin_head', [ '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 );
}
}