self::SCHEMA_VERSION, 'revision' => isset( $data['revision'] ) ? (int) $data['revision'] : 0, 'extras' => array_values( array_filter( $extras, 'is_array' ) ), ); } /** * Runs on `admin_init`: persists migrations and records the installed version. */ public function maybe_run(): void { $raw = get_option( OptionExtraRepository::OPTION, null ); if ( null === $raw || false === $raw ) { add_option( OptionExtraRepository::OPTION, self::migrate_extras_data( array() ), '', false ); } elseif ( is_array( $raw ) ) { $migrated = self::migrate_extras_data( $raw ); if ( $migrated !== $raw ) { update_option( OptionExtraRepository::OPTION, $migrated, false ); } } if ( false === get_option( SettingsRepository::OPTION, false ) ) { add_option( SettingsRepository::OPTION, Schema::default_settings(), '', false ); } if ( get_option( self::VERSION_OPTION, '' ) !== EXTROVA_VERSION ) { update_option( self::VERSION_OPTION, EXTROVA_VERSION, false ); } } }