'ids', 'number' => 0, ) ) as $site_id ) { switch_to_blog( (int) $site_id ); self::store_version(); restore_current_blog(); } } else { self::store_version(); } /** * Fires after the plugin is activated. */ do_action( 'blocksieve_activate' ); } /** * Persists the current plugin version, keeping any other stored settings. * * The first activation on a site also records it as the initial version, * which later activations leave untouched. * * @return void */ private static function store_version(): void { $settings = new Settings(); $values = array( Settings::VERSION => BLOCKSIEVE_VERSION ); if ( '' === $settings->initial_version() ) { $values[ Settings::INITIAL_VERSION ] = BLOCKSIEVE_VERSION; } $settings->update( $values ); } }