get_installed_version(); if ( $stored === $current ) { return; } $previous = '' === $stored ? ( $this->has_earlier_footprint() ? self::UNKNOWN_PREVIOUS : '' ) : $stored; update_option( self::PREVIOUS_OPTION, $previous, true ); update_option( self::VERSION_OPTION, $current, true ); /** * Fires once, on the first admin request after the installed version * changed. * * @since 2.0.0 * * @param string $current The version now installed. * @param string $previous The version it replaced, '' or UNKNOWN_PREVIOUS. */ do_action( 'aiblackout_version_changed', $current, $previous ); } /** * Returns the recorded installed version. * * @return string Version string, or '' when nothing has been recorded. */ public function get_installed_version(): string { return (string) get_option( self::VERSION_OPTION, '' ); } /** * Returns the version the last upgrade replaced. * * @return string Version string, '' on a first install, or UNKNOWN_PREVIOUS. */ public function get_previous_version(): string { return (string) get_option( self::PREVIOUS_OPTION, '' ); } /** * Whether this install has ever run an earlier version of the plugin. * * @return bool True when an earlier version left something behind. */ private function has_earlier_footprint(): bool { return false !== get_option( History::OPTION, false ) || false !== get_option( Settings::OPTION, false ); } }