diff --git a/poller_intropage.php b/poller_intropage.php index 9eb8fcd..3552726 100644 --- a/poller_intropage.php +++ b/poller_intropage.php @@ -132,14 +132,25 @@ * @return void */ function intropage_correct_load_order(): void { + $previous_id = null; + while (true) { - $intro_order = db_fetch_cell('SELECT id FROM plugin_config WHERE directory="intropage"'); + $id = db_fetch_cell('SELECT id FROM plugin_config WHERE directory = "intropage"'); - if ($intro_order > 1) { - api_plugin_moveup('intropage'); - } else { - break; + // Plugin no longer exists, or the query failed. + if (!is_numeric($id)) { + return; } + + $id = (int) $id; + + // Stop if the previous move made no progress. + if ($previous_id !== null && $id >= $previous_id) { + return; + } + + $previous_id = $id; + api_plugin_moveup('intropage'); } }