-
-
Notifications
You must be signed in to change notification settings - Fork 2
fix(upgrade): skip stale patch directories and fix System module update URL #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -228,7 +228,24 @@ public function buildUpgradeQueue(): bool | |
|
|
||
| foreach ($dirs as $dir) { | ||
| if (str_contains($dir, '-to-')) { | ||
| $className = include $upgradeRoot . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . 'index.php'; | ||
| $patchFile = $upgradeRoot . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . 'index.php'; | ||
| if (!file_exists($patchFile)) { | ||
| continue; | ||
| } | ||
| try { | ||
| $className = include $patchFile; | ||
| } catch (\Throwable $e) { | ||
| // Stale directories from a previous version (e.g. | ||
| // upd_2.5.11-to-2.5.12 from the pre-rename beta cycle) can | ||
| // fail to load because they reference classes that no longer | ||
| // exist. Emit a visible warning and skip — crashing the | ||
| // entire upgrade is worse than skipping one broken patch. | ||
| trigger_error( | ||
| sprintf('Upgrade patch %s could not be loaded: %s', $dir, $e->getMessage()), | ||
| E_USER_WARNING | ||
| ); | ||
| continue; | ||
|
Comment on lines
+231
to
+247
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't silently drop broken shipped patches. Line 233 and Line 245 🤖 Prompt for AI Agents |
||
| } | ||
|
Comment on lines
+237
to
+248
|
||
| if (is_string($className) && class_exists($className)) { | ||
| $upg = $this->createPatch($className); | ||
| $results[$dir] = $upg->isApplied(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file_exists($patchFile)doesn’t guarantee this is an includable file (it may be a directory or unreadable), andincludefailures often only raise warnings (notThrowable) and returnfalse, so this can still emit warnings and/or silently skip without logging. Consider usingis_file()+is_readable()(or similar) and explicitly handling anincludereturn value offalseso broken patch entries are consistently skipped without PHP warnings.