Astra_Theme_Background_Updater::update_db_version( string|null $version = null )
Update DB version to current.
Description
Parameters
- $version
-
(string|null) (Optional) New Astra theme version or null.
Default value: null
Source
File: inc/theme-update/class-astra-theme-background-updater.php
public static function update_db_version( $version = null ) {
do_action( 'astra_theme_update_before' );
// Get auto saved version number.
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$saved_version = astra_get_option( 'theme-auto-version', false );
if ( false === $saved_version ) {
$saved_version = ASTRA_THEME_VERSION;
// Update auto saved version number.
astra_update_option( 'theme-auto-version', ASTRA_THEME_VERSION );
}
// If equals then return.
if ( version_compare( $saved_version, ASTRA_THEME_VERSION, '=' ) ) {
astra_update_option( 'is_theme_queue_running', false );
return;
}
// Not have stored?
if ( empty( $saved_version ) ) {
// Get old version.
$theme_version = get_option( '_astra_auto_version', ASTRA_THEME_VERSION );
// Remove option.
delete_option( '_astra_auto_version' );
} else {
// Get latest version.
$theme_version = ASTRA_THEME_VERSION;
}
// Update auto saved version number.
astra_update_option( 'theme-auto-version', $theme_version );
astra_update_option( 'is_theme_queue_running', false );
// Update variables.
Astra_Theme_Options::refresh();
delete_transient( 'astra-addon-db-migrated' );
do_action( 'astra_theme_update_after' );
}
Expand full source code Collapse full source code View on Trac