internalOptions->internal->lastActiveVersion; // Don't run updates if the last active version is the same as the current version. if ( aioseoIndexNow()->version === $lastActiveVersion ) { return; } // Try to acquire the lock. if ( ! aioseo()->core->db->acquireLock( 'aioseo_index_now_run_updates_lock', 0 ) ) { // If we couldn't acquire the lock, exit early without doing anything. // This means another process is already running updates. return; } if ( version_compare( $lastActiveVersion, '1.0.0', '<' ) ) { // Do something here. } } /** * Updates the latest version after all migrations and updates have run. * * @since 1.0.6 * * @return void */ public function updateLatestVersion() { if ( aioseoIndexNow()->internalOptions->internal->lastActiveVersion === aioseoIndexNow()->version ) { return; } aioseoIndexNow()->internalOptions->internal->lastActiveVersion = aioseoIndexNow()->version; // Bust the DB cache so we can make sure that everything is fresh. aioseo()->core->db->bustCache(); } }