HEX
Server: Apache/2.4.66 (Debian)
System: Linux 6dfabc3b2241 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: (1000)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-migrate-db/class/Common/Upgrades/Routines/Routine_2_6_2.php
<?php
namespace DeliciousBrains\WPMDB\Common\Upgrades\Routines;

/**
 * Class Routine2_6_2
 *
 * @since 2.6.2
 */
class Routine_2_6_2 implements RoutineInterface
{
    public function apply(&$profile)
    {
        if (property_exists($profile, 'current_migration')) {
            $has_revision = in_array('revision', $profile->current_migration->post_types_selected);

            if ($has_revision && in_array('exclude_post_revisions', $profile->current_migration->advanced_options_selected)) {
                $profile->current_migration->advanced_options_selected = array_diff($profile->current_migration->advanced_options_selected, ['exclude_post_revisions']);
            }
            //check exclude revisions if revision is not in the selected list
            if (!$has_revision && 'selected' === $profile->current_migration->post_types_option && !in_array('exclude_post_revisions', $profile->current_migration->advanced_options_selected)) {
                $profile->current_migration->advanced_options_selected[] = 'exclude_post_revisions';
            }
            //remove revision from selected post type list
            if ($has_revision && in_array('revision', $profile->current_migration->post_types_selected)) {
                $profile->current_migration->post_types_selected = array_values(array_filter($profile->current_migration->post_types_selected, function($value) { return $value !== 'revision'; }));
            }
        }
    }

    public function get_target_schema_version()
    {
        return "3.8.0";
    }
}