golden hour
/home/doctorbruno/.trash/google-site-kit.1/includes/Core/Util
⬆️ Go Up
Upload
File/Folder
Size
Actions
Activation_Flag.php
3.25 KB
Del
OK
Activation_Notice.php
4.11 KB
Del
OK
Auto_Updates.php
4.29 KB
Del
OK
BC_Functions.php
6.35 KB
Del
OK
Block_Support.php
1.32 KB
Del
OK
Collection_Key_Cap_Filter.php
1.38 KB
Del
OK
Current_Screen.php
987 B
Del
OK
Date.php
2.65 KB
Del
OK
Developer_Plugin_Installer.php
5.44 KB
Del
OK
Entity.php
3.2 KB
Del
OK
Entity_Factory.php
20.63 KB
Del
OK
Exit_Handler.php
836 B
Del
OK
Feature_Flags.php
2.33 KB
Del
OK
Google_Icon.php
1.58 KB
Del
OK
Google_URL_Matcher_Trait.php
3.02 KB
Del
OK
Google_URL_Normalizer.php
1.6 KB
Del
OK
Health_Checks.php
3.99 KB
Del
OK
Input.php
2.76 KB
Del
OK
Method_Proxy_Trait.php
1.09 KB
Del
OK
Migrate_Legacy_Keys.php
1.08 KB
Del
OK
Migration_1_123_0.php
4.54 KB
Del
OK
Migration_1_129_0.php
4.01 KB
Del
OK
Migration_1_150_0.php
3.12 KB
Del
OK
Migration_1_163_0.php
3.08 KB
Del
OK
Migration_1_177_0.php
2.79 KB
Del
OK
Migration_1_3_0.php
2.97 KB
Del
OK
Migration_1_8_1.php
6.85 KB
Del
OK
Plugin_Status.php
1.36 KB
Del
OK
REST_Entity_Search_Controller.php
3.34 KB
Del
OK
Requires_Javascript_Trait.php
1.09 KB
Del
OK
Reset.php
9.73 KB
Del
OK
Reset_Persistent.php
666 B
Del
OK
Sanitize.php
1.04 KB
Del
OK
Scopes.php
2.59 KB
Del
OK
Sort.php
1.1 KB
Del
OK
Synthetic_WP_Query.php
4.08 KB
Del
OK
URL.php
5.45 KB
Del
OK
Uninstallation.php
4.3 KB
Del
OK
WP_Context_Switcher_Trait.php
2.13 KB
Del
OK
WP_Query_Factory.php
9.77 KB
Del
OK
Edit: Migration_1_150_0.php
<?php /** * Migration for Audience Settings. * * @package Google\Site_Kit\Core\Util * @copyright 2025 Google LLC * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://sitekit.withgoogle.com */ namespace Google\Site_Kit\Core\Util; use Google\Site_Kit\Context; use Google\Site_Kit\Core\Storage\Options; use Google\Site_Kit\Modules\Analytics_4\Settings as Analytics_Settings; use Google\Site_Kit\Modules\Analytics_4\Audience_Settings; /** * Class Migration_1_150_0 * * @since 1.151.0 * @access private * @ignore */ class Migration_1_150_0 { /** * Target DB version. */ const DB_VERSION = '1.150.0'; /** * DB version option name. */ const DB_VERSION_OPTION = 'googlesitekit_db_version'; /** * Context instance. * * @since 1.151.0 * @var Context */ protected $context; /** * Options instance. * * @since 1.151.0 * @var Options */ protected $options; /** * Analytics_Settings instance. * * @since 1.151.0 * @var Analytics_Settings */ protected $analytics_settings; /** * Audience_Settings instance. * * @since 1.151.0 * @var Audience_Settings */ protected $audience_settings; /** * Constructor. * * @since 1.151.0 * * @param Context $context Plugin context instance. * @param Options $options Optional. Options instance. */ public function __construct( Context $context, ?Options $options = null ) { $this->context = $context; $this->options = $options ?: new Options( $context ); $this->analytics_settings = new Analytics_Settings( $this->options ); $this->audience_settings = new Audience_Settings( $this->options ); } /** * Registers hooks. * * @since 1.151.0 */ public function register() { add_action( 'admin_init', array( $this, 'migrate' ) ); } /** * Migrates the DB. * * @since 1.151.0 */ public function migrate() { $db_version = $this->options->get( self::DB_VERSION_OPTION ); if ( ! $db_version || version_compare( $db_version, self::DB_VERSION, '<' ) ) { $this->migrate_audience_settings(); $this->options->set( self::DB_VERSION_OPTION, self::DB_VERSION ); } } /** * Migrates the Audience Settings from Analytics settings to new Audience settings. * * @since 1.151.0 */ protected function migrate_audience_settings() { if ( ! $this->analytics_settings->has() ) { return; } $analytics_settings = $this->analytics_settings->get(); if ( ! is_array( $analytics_settings ) || empty( $analytics_settings ) ) { return; } $audience_settings = (array) $this->audience_settings->get(); $keys_to_migrate = array( 'availableAudiences', 'availableAudiencesLastSyncedAt', 'audienceSegmentationSetupCompletedBy', ); $has_migration = false; foreach ( $keys_to_migrate as $key ) { if ( array_key_exists( $key, $analytics_settings ) ) { $audience_settings[ $key ] = $analytics_settings[ $key ]; unset( $analytics_settings[ $key ] ); $has_migration = true; } } if ( $has_migration ) { $this->audience_settings->set( $audience_settings ); $this->analytics_settings->set( $analytics_settings ); } } }
Save