$options Options used by the upgrader. * * @return void */ public function handle_plugin_update( $upgrader_object, $options ) { if ( ! $this->is_plugin_update_action( $options ) ) { return; } if ( ! isset( $options['plugins'] ) || ! is_array( $options['plugins'] ) ) { return; } if ( ! in_array( ACTIRISE_BASENAME, $options['plugins'], true ) ) { return; } $this->process_actirise_plugin_update(); } /** * @param array $options * @return bool */ private function is_plugin_update_action( $options ) { return isset( $options['action'], $options['type'] ) && $options['action'] === 'update' && $options['type'] === 'plugin'; } /** * @return void */ private function process_actirise_plugin_update() { /** @var string $old_version */ $old_version = Options::get( 'version', '0.0.0' ); $new_version = ACTIRISE_VERSION; if ( ! is_string( $old_version ) || ! version_compare( $old_version, $new_version, '<' ) ) { return; } EventAnnotation::add_event( 'Plugin update to v' . $new_version, 'The plugin was updated from version ' . $old_version . ' to version ' . $new_version, 'website_update', $old_version, $new_version, false ); Options::update( 'version', $new_version ); } }