File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Migration.php.tar
uyarreklam.com.tr/httpdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Api/Migration.php 0000644 00000003575 15154461266 0031255 0 ustar 00 var/www/vhosts <?php
namespace AIOSEO\Plugin\Common\Api;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Migration as CommonMigration;
use AIOSEO\Plugin\Common\Models;
/**
* Route class for the API.
*
* @since 4.0.6
*/
class Migration {
/**
* Resets blank title formats and retriggers the post/term meta migration.
*
* @since 4.0.6
*
* @return \WP_REST_Response The response.
*/
public static function fixBlankFormats() {
$oldOptions = ( new CommonMigration\OldOptions() )->oldOptions;
if ( ! $oldOptions ) {
return new \WP_REST_Response( [
'success' => true,
'message' => 'Could not load v3 options.'
], 400 );
}
$postTypes = aioseo()->helpers->getPublicPostTypes( true );
$taxonomies = aioseo()->helpers->getPublicTaxonomies( true );
foreach ( $oldOptions as $k => $v ) {
if ( ! preg_match( '/^aiosp_([a-zA-Z]*)_title_format$/', (string) $k, $match ) || ! empty( $v ) ) {
continue;
}
$objectName = $match[1];
if ( in_array( $objectName, $postTypes, true ) && aioseo()->dynamicOptions->searchAppearance->postTypes->has( $objectName ) ) {
aioseo()->dynamicOptions->searchAppearance->postTypes->$objectName->title = '#post_title #separator_sa #site_title';
continue;
}
if ( in_array( $objectName, $taxonomies, true ) && aioseo()->dynamicOptions->searchAppearance->taxonomies->has( $objectName ) ) {
aioseo()->dynamicOptions->searchAppearance->taxonomies->$objectName->title = '#taxonomy_title #separator_sa #site_title';
}
}
aioseo()->migration->redoMetaMigration();
Models\Notification::deleteNotificationByName( 'v3-migration-title-formats-blank' );
return new \WP_REST_Response( [
'success' => true,
'message' => 'Title formats have been reset; post/term migration has been scheduled.',
'notifications' => Models\Notification::getNotifications()
], 200 );
}
} uyarreklam.com.tr/httpdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Migration/Migration.php0000644 00000014014 15154704676 0032470 0 ustar 00 var/www/vhosts <?php
namespace AIOSEO\Plugin\Common\Migration;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// phpcs:disable WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
/**
* Handles the migration from V3 to V4.
*/
class Migration {
/**
* The old V3 options.
*
* @since 4.0.0
*
* @var array
*/
public $oldOptions = [];
/**
* Meta class instance.
*
* @since 4.2.7
*
* @var Meta
*/
public $meta = null;
/**
* Helpers class instance.
*
* @since 4.2.7
*
* @var Helpers
*/
public $helpers = null;
/**
* Class constructor.
*
* @since 4.0.0
*/
public function __construct() {
$this->meta = new Meta();
$this->helpers = new Helpers();
// NOTE: This needs to go above the is_admin check in order for it to run at all.
add_action( 'aioseo_migrate_post_meta', [ $this->meta, 'migratePostMeta' ] );
if ( ! is_admin() ) {
return;
}
if ( wp_doing_ajax() || wp_doing_cron() ) {
return;
}
add_action( 'init', [ $this, 'init' ], 2000 );
}
/**
* Initializes the class.
*
* @since 4.0.0
*
* @return void
*/
public function init() {
// Since the version numbers may vary, we only want to compare the first 3 numbers.
$lastActiveVersion = aioseo()->internalOptions->internal->lastActiveVersion;
$lastActiveVersion = $lastActiveVersion ? explode( '-', $lastActiveVersion ) : null;
if ( version_compare( $lastActiveVersion[0], '4.0.0', '<' ) ) {
aioseo()->internalOptions->internal->migratedVersion = $lastActiveVersion[0];
add_action( 'wp_loaded', [ $this, 'doMigration' ] );
}
// Run our migration again for V4 users between v4.0.0 and v4.0.4.
if (
version_compare( $lastActiveVersion[0], '4.0.0', '>=' ) &&
version_compare( $lastActiveVersion[0], '4.0.4', '<' ) &&
get_option( 'aioseop_options' )
) {
add_action( 'wp_loaded', [ $this, 'redoMetaMigration' ] );
}
// Stop migration for new v4 users where it was incorrectly triggered.
if ( version_compare( $lastActiveVersion[0], '4.0.4', '=' ) && ! get_option( 'aioseop_options' ) ) {
aioseo()->core->cache->delete( 'v3_migration_in_progress_posts' );
aioseo()->core->cache->delete( 'v3_migration_in_progress_terms' );
try {
aioseo()->actionScheduler->unschedule( 'aioseo_migrate_post_meta' );
aioseo()->actionScheduler->unschedule( 'aioseo_migrate_term_meta' );
} catch ( \Exception $e ) {
// Do nothing.
}
}
}
/**
* Starts the migration.
*
* @since 4.0.0
*
* @return void
*/
public function doMigration() {
// If our tables do not exist, create them now.
if ( ! aioseo()->core->db->tableExists( 'aioseo_posts' ) ) {
aioseo()->updates->addInitialCustomTablesForV4();
}
$this->oldOptions = ( new OldOptions() )->oldOptions;
if (
! $this->oldOptions ||
! is_array( $this->oldOptions ) ||
! count( $this->oldOptions )
) {
return;
}
update_option( 'aioseo_options_v3', $this->oldOptions );
aioseo()->core->cache->update( 'v3_migration_in_progress_posts', time(), WEEK_IN_SECONDS );
$this->migrateSettings();
$this->meta->migrateMeta();
}
/**
* Reruns the post meta migration.
*
* This is meant for users on v4.0.0, v4.0.1 or v4.0.2 where the migration might have failed.
*
* @since 4.0.3
*
* @return void
*/
public function redoMetaMigration() {
aioseo()->core->cache->update( 'v3_migration_in_progress_posts', time(), WEEK_IN_SECONDS );
$this->meta->migrateMeta();
}
/**
* Migrates the plugin settings.
*
* @since 4.0.0
*
* @param array $oldOptions The old options. We pass it in directly via the Importer/Exporter.
* @return void
*/
public function migrateSettings( $oldOptions = [] ) {
if ( empty( $this->oldOptions ) && ! empty( $oldOptions ) ) {
$this->oldOptions = ( new OldOptions( $oldOptions ) )->oldOptions;
if (
! $this->oldOptions ||
! is_array( $this->oldOptions ) ||
! count( $this->oldOptions )
) {
return;
}
}
aioseo()->core->cache->update( 'v3_migration_in_progress_settings', time() );
new GeneralSettings();
if ( ! isset( $this->oldOptions['modules']['aiosp_feature_manager_options'] ) ) {
new Sitemap();
aioseo()->core->cache->delete( 'v3_migration_in_progress_settings' );
return;
}
$this->migrateFeatureManager();
if ( isset( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_opengraph'] ) ) {
new SocialMeta();
}
if ( isset( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) ) {
new Sitemap();
}
if ( isset( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_robots'] ) ) {
new RobotsTxt();
}
if ( aioseo()->helpers->isWpmlActive() ) {
new Wpml();
}
aioseo()->core->cache->delete( 'v3_migration_in_progress_settings' );
}
/**
* Migrates the Feature Manager settings.
*
* @since 4.0.0
*
* @return void
*/
protected function migrateFeatureManager() {
if ( empty( $this->oldOptions['modules']['aiosp_feature_manager_options'] ) ) {
return;
}
if ( empty( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_opengraph'] ) ) {
aioseo()->options->social->facebook->general->enable = false;
aioseo()->options->social->twitter->general->enable = false;
}
if ( empty( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) ) {
aioseo()->options->sitemap->general->enable = false;
aioseo()->options->sitemap->rss->enable = false;
}
if ( ! empty( $this->oldOptions['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_robots'] ) ) {
aioseo()->options->tools->robots->enable = true;
}
}
/**
* Checks whether the V3 migration is running.
*
* @since 4.1.8
*
* @return bool Whether the V3 migration is running.
*/
public function isMigrationRunning() {
return aioseo()->core->cache->get( 'v3_migration_in_progress_settings' ) || aioseo()->core->cache->get( 'v3_migration_in_progress_posts' );
}
} httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Migration.php 0000644 00000003636 15155203650 0033545 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
namespace Automattic\WooCommerce\Blocks;
/**
* Takes care of the migrations.
*
* @since 2.5.0
*/
class Migration {
/**
* DB updates and callbacks that need to be run per version.
*
* Please note that these functions are invoked when WooCommerce Blocks is updated from a previous version,
* but NOT when WooCommerce Blocks is newly installed.
*
* @var array
*/
private $db_upgrades = array(
'10.3.0' => array(
'wc_blocks_update_1030_blockified_product_grid_block',
),
);
/**
* Runs all the necessary migrations.
*
* @var array
*/
public function run_migrations() {
$current_db_version = get_option( Options::WC_BLOCK_VERSION, '' );
$schema_version = get_option( 'wc_blocks_db_schema_version', '' );
// This check is necessary because the version was not being set in the database until 10.3.0.
// Checking wc_blocks_db_schema_version determines if it's a fresh install (value will be empty)
// or an update from WC Blocks older than 10.3.0 (it will have some value). In the latter scenario
// we should run the migration.
// We can remove this check in the next months.
if ( ! empty( $schema_version ) && ( empty( $current_db_version ) ) ) {
$this->wc_blocks_update_1030_blockified_product_grid_block();
}
if ( empty( $current_db_version ) ) {
// This is a fresh install, so we don't need to run any migrations.
return;
}
foreach ( $this->db_upgrades as $version => $update_callbacks ) {
if ( version_compare( $current_db_version, $version, '<' ) ) {
foreach ( $update_callbacks as $update_callback ) {
$this->{$update_callback}();
}
}
}
}
/**
* Set a flag to indicate if the blockified Product Grid Block should be rendered by default.
*/
public static function wc_blocks_update_1030_blockified_product_grid_block() {
update_option( Options::WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE, wc_bool_to_string( false ) );
}
}
httpdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Admin/Notices/Migration.php 0000644 00000003044 15155426257 0033171 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
namespace AIOSEO\Plugin\Common\Admin\Notices;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* V3 to V4 migration notice.
*
* @since 4.0.0
*/
class Migration {
/**
* Go through all the checks to see if we should show the notice.
*
* @since 4.0.0
*
* @return void
*/
public function maybeShowNotice() {
$transientPosts = aioseo()->core->cache->get( 'v3_migration_in_progress_posts' );
$transientTerms = aioseo()->core->cache->get( 'v3_migration_in_progress_terms' );
if ( ! $transientPosts && ! $transientTerms ) {
return;
}
$this->showNotice();
}
/**
* Register the notice so that it appears.
*
* @since 4.0.0
*
* @return void
*/
public function showNotice() {
// Translators: 1 - The plugin name ("AIOSEO).
$string1 = sprintf( __( '%1$s V3->V4 Migration In Progress', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME );
// Translators: 1 - The plugin name ("All in One SEO").
$string2 = sprintf( __( '%1$s is currently upgrading your database and migrating your SEO data in the background.', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_NAME );
$string3 = __( 'This notice will automatically disappear as soon as the migration has completed. Meanwhile, everything should continue to work as expected.', 'all-in-one-seo-pack' );
?>
<div class="notice notice-info aioseo-migration">
<p><strong><?php echo esc_html( $string1 ); ?></strong></p>
<p><?php echo esc_html( $string2 ); ?></p>
<p><?php echo esc_html( $string3 ); ?></p>
</div>
<style>
</style>
<?php
}
}