LLMS_DB_Upgrader::enqueue_updates()

Enqueue and dispatch required updates


Description Description

Adds callbacks for all required updates to the LLMS_Background_Updater and dispatches the updater in the background.

If the update group cannot be auto-updated the following admin notices will be included:

  • The "update started" notice will be immediately displayed/added.
  • The "update complete" notice will be added to the end of the queue (and then displayed when the update is complete).

Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-llms-db-ugrader.php

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
public function enqueue_updates() {
 
    $queued = false;
    foreach ( $this->get_required_updates() as $version => $info ) {
 
        $prefix = $this->get_callback_prefix( $info, $version );
        foreach ( $info['updates'] as $callback ) {
 
            $callback = $prefix . $callback;
 
            $this->updater->log( sprintf( 'Queuing %s - %s', $version, $callback ) );
            $this->updater->push_to_queue( $callback );
            $queued = true;
 
        }
    }
 
    // No updates to add, return early.
    if ( ! $queued ) {
        return;
    }
 
    // Show a start and complete notice for manual updates.
    if ( ! $this->can_auto_update() ) {
        $this->show_notice_started();
        $this->updater->push_to_queue( array( $this, 'show_notice_complete' ) );
    }
 
    $this->updater->save();
 
    add_action( 'shutdown', array( 'LLMS_Install', 'dispatch_db_updates' ) );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.6.0 Add namespace prefix to qualifying callback functions.
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.