-
-
Notifications
You must be signed in to change notification settings - Fork 227
[WIP] Update Manager Refactor #1259
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
Draft
jaxwilko
wants to merge
143
commits into
develop
Choose a base branch
from
wip/support-uploading-packages-update-manager-changes
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,330
−2,875
Draft
Changes from all commits
Commits
Show all changes
143 commits
Select commit
Hold shift + click to select a range
b92adbe
Added initial type hinting and better imports for update managing cla…
LukeTowers 0aaea47
Fix tests
LukeTowers 00e085f
add missing newline
LukeTowers 79e1a8e
Initial implementation of the UI to upload plugins via zip folder
LukeTowers ff85f70
Centralize updatemanager zip extracting
LukeTowers 54e2c72
Add tests & fixtures for initial plugin scanning functionality
LukeTowers 0a86efe
Initial work on supporting .zip files from plugin:install command.
LukeTowers 6bbc1c2
formatting
LukeTowers 1c0d50d
Update plugin test fixtures to avoid conflicts when installing them
LukeTowers 03270d4
Initial working install method for plugin:install command
LukeTowers bb95ba6
Hopefully fix windows tests
LukeTowers 46c1a83
WIP for retrieving the uploaded file from the plugin uploader modal
LukeTowers 9644971
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers 29195d2
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers a88d645
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers f698d3a
Init wip
jaxwilko 9546fbd
Work in progress... do not try and run it :(
jaxwilko 1663800
Add theme upload form config
LukeTowers abdb18f
Added winter/packager + ovberrides and bumped php version
jaxwilko b80e34f
Added wip
jaxwilko ac5733c
Added fix to allow install to create files
jaxwilko b22d11b
Added objects for source types
jaxwilko 6c4bbe8
WIP
jaxwilko 5d705b9
Added wip
jaxwilko db52bcd
Added fix for installing specific package
jaxwilko f250393
Added abstract stubs
jaxwilko be09f6c
Added support for updating composer plugins
jaxwilko d9830f3
Added wip
jaxwilko 2c1d4ca
Migrated core code to storm
jaxwilko 68721cf
Added wip
jaxwilko dd3fc6c
Added wip
jaxwilko 644052f
Moved commands into directories
jaxwilko 69b11d8
Refactored stuff
jaxwilko fc7e32a
Added theme extension logic
jaxwilko 1391495
Added market place support
jaxwilko a1b7c3a
Added plugin code detection from path using child process
jaxwilko 312e6bd
Added support for installing from arbitary paths
jaxwilko 56ead48
Added theme successfully installed message
jaxwilko f4b67bb
Added plugin successfully installed message and fixed no updates requ…
jaxwilko 19a09cd
Added more messages to improve ux
jaxwilko 8593b0b
Added wip
jaxwilko e6dc1ad
Hooked up old update checker ui with new update system
jaxwilko 4e1f7e8
Update composer.json
LukeTowers 43bbaf2
Moved stubs for create commands
jaxwilko fced1de
Added better reporting for module upgrades
jaxwilko f144fda
Removed stubbed function as implemented in parent class
jaxwilko bc61e32
Added default return
jaxwilko 1d268b0
Added fix to ensure upgrades succeed for uninstalled plugins
jaxwilko 62ec335
Added fix for reporting
jaxwilko bfc3cd1
Added support for preserving modules
jaxwilko 9fa2063
Removed call to setOutputNotes
jaxwilko ebd5d2d
Added fixes for tests
jaxwilko c2b62c2
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko 9395f2b
Removed packager from winter deps
jaxwilko 9a5055f
Added style fixes
jaxwilko bb953e9
Reverted php requirement change
jaxwilko 43acf5c
Added findThemesInPath method
jaxwilko 5de0809
Added method for unpacking a zip and returning all sources inside
jaxwilko e3aeefa
Fix typo
LukeTowers 729e46e
Moved logic into parent
jaxwilko 6900cae
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko d8d9850
Apply suggestions from code review
jaxwilko 4e33930
Added notice when cms.disableCoreUpdates is enabled
jaxwilko db75757
Removed misleading comment
jaxwilko c8bbe35
Added fix to refer to property instead of method
jaxwilko 8da2212
Added use of plugin manager to check for plugin code
jaxwilko f950ce3
Removed old update manager
jaxwilko 16a4841
Removed incorrect imports
jaxwilko f9773db
Removed unused class
jaxwilko 1120f01
Made plugin guessing even simplier
jaxwilko 09a7a88
Apply suggestions from code review
jaxwilko d328417
Wip
jaxwilko 9d27012
Update modules/system/controllers/updates/assets/src/components/Produ…
LukeTowers bd3ce1e
Update modules/system/controllers/updates/_install_plugins.php
LukeTowers a8540d0
Moved eslint to prevent compiled js being linted
jaxwilko 8959acd
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko d75512c
Added fix for eslint ignore
jaxwilko dbbda7c
Report missing version.yaml as no update rather than failed update
jaxwilko f062d51
Added fix for eslint
jaxwilko a1c5214
Added compiled js
jaxwilko 22aaef0
Re-added old updates.js file
jaxwilko 60a7089
Added install support for plugins
jaxwilko 3c77118
Added logic to remove composer plugin on uninstall
jaxwilko 93e0e84
Added fix to better handle caching of local data
jaxwilko b9ad3f8
Improved ui
jaxwilko 0970906
Added support for creating module asset configs
jaxwilko 00e32bd
Added vite for updates/install page
jaxwilko 81a051f
Added missing files for module configging
jaxwilko 0ae1eb2
Added ui fixes to install page
jaxwilko cfba2f3
Added theme upload string
jaxwilko a5b92ab
Manual develop merge
jaxwilko 1e74099
Merge branch 'wip/support-uploading-packages' into wip/support-upload…
LukeTowers 2d8030d
Manual merge
jaxwilko 944b67e
Added storm branch pick
jaxwilko a10577c
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers ef7888d
Added little fixes
jaxwilko 42ff54e
Manual merge develop
jaxwilko e174017
Added wip and backend ui
jaxwilko f26e7a3
Added fixes for marketplace container
jaxwilko 5b0beda
Added missing manifest
jaxwilko ff8a4d7
Manual develop merge
jaxwilko b117db2
Move pagination below filters
LukeTowers ec4e736
Added fix for pagination overflowing page
jaxwilko 9f99dcc
Added support for passing in element size in pagination
jaxwilko 7d22af2
Added fixes for updates popup
jaxwilko 53552b8
Added update indicator on product component
jaxwilko 20e08fc
Added fix for jittery popout
jaxwilko 5f62bd5
Added fixes to allow installing via the marketplace ui
jaxwilko b8ae320
Added fix for removing a plugin not rolling back the db
jaxwilko 55407b3
Added pagination to the bottom of marketplace as well as top
jaxwilko 20d402f
Added improved install ui and vue tippy for titles
jaxwilko 0d10921
Merged plugin list and plugin manage
jaxwilko 0eadc7d
Added some prettyness to the plugin manage page
jaxwilko 8923ede
Added tweaks to plugins update page
jaxwilko af086c9
Added ui tweaks
jaxwilko 9da2a04
Added support for pinning frozen plugins
jaxwilko c228b51
Added wip to update interface
jaxwilko 6730f92
Replace usage of Composer::info() with Composer::show()
LukeTowers 88d23c4
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
LukeTowers 6c54df9
Make use of Composer::getLatestSupportedVersion()
LukeTowers 9f41d86
Add todo
LukeTowers 7c586c7
Use command.beforeRun event
LukeTowers 0e86ad3
Tidy imports
LukeTowers baba774
Comment
LukeTowers 1a8a9e9
Style tweaks
LukeTowers 86d59ef
Remove unused method
LukeTowers acde89e
Tweaks
LukeTowers 85def52
Default to only running migrations from the UpdateManager->update() m…
LukeTowers 0f3be8f
Use faster composer methods from storm
LukeTowers 83b458e
Improve handling for removing plugins that don't exist
LukeTowers ada4ca2
Fix usage of composer
LukeTowers 9dcf8a9
Add comment
LukeTowers e2141de
Update composer.json
LukeTowers 04a57eb
Add support for getVersion to Theme
LukeTowers 166fa56
Code tidying
LukeTowers 80652d6
Tidy
LukeTowers 4f31b68
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers 39650a8
Lazy load core module console commands
LukeTowers a9f9664
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers b8af81d
Added fix to ensure the right app is available at the right time
jaxwilko d26dde9
Added fix to ensure tests are compatible with newer versions of vite
jaxwilko a4d137a
Added fix for npm:version command description
jaxwilko f706326
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ | |
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\Cache; | ||
| use Illuminate\Support\Facades\Lang; | ||
| use System\Classes\Extensions\Traits\HasVersionFile; | ||
| use Winter\Storm\Foundation\Extension\WinterExtension; | ||
| use System\Models\Parameter; | ||
| use Winter\Storm\Exception\ApplicationException; | ||
| use Winter\Storm\Exception\SystemException; | ||
|
|
@@ -19,7 +21,7 @@ | |
| use Winter\Storm\Support\Facades\File; | ||
| use Winter\Storm\Support\Facades\Url; | ||
| use Winter\Storm\Support\Facades\Yaml; | ||
| use Winter\Storm\Support\Str; | ||
| use Winter\Storm\Support\Traits\HasComposerPackage; | ||
|
|
||
| /** | ||
| * This class represents the CMS theme. | ||
|
|
@@ -29,8 +31,11 @@ | |
| * @package winter\wn-cms-module | ||
| * @author Alexey Bobkov, Samuel Georges | ||
| */ | ||
| class Theme extends CmsObject | ||
| class Theme extends CmsObject implements WinterExtension | ||
| { | ||
| use HasComposerPackage; | ||
| use HasVersionFile; | ||
|
|
||
| /** | ||
| * @var string Specifies the theme directory name. | ||
| */ | ||
|
|
@@ -61,6 +66,11 @@ class Theme extends CmsObject | |
| */ | ||
| protected $defaultExtension = 'yaml'; | ||
|
|
||
| /** | ||
| * @var string The version of this theme as reported by version.yaml, access with getVersion() | ||
| */ | ||
| protected $version; | ||
|
|
||
| const ACTIVE_KEY = 'cms::theme.active'; | ||
| const EDIT_KEY = 'cms::theme.edit'; | ||
|
|
||
|
|
@@ -73,6 +83,7 @@ public static function load($dirName, $file = null): self | |
| $theme = new static; | ||
| $theme->setDirName($dirName); | ||
| $theme->registerHalcyonDatasource(); | ||
|
|
||
| if (App::runningInBackend()) { | ||
| $theme->registerBackendLocalization(); | ||
| } | ||
|
|
@@ -713,4 +724,26 @@ public function __isset($key) | |
|
|
||
| return false; | ||
| } | ||
|
|
||
| public function getVersion(): string | ||
| { | ||
| if (isset($this->version)) { | ||
| return $this->version; | ||
| } | ||
|
|
||
| $versions = $this->getVersionsFromYaml( | ||
| versionFile: $this->getPath() . DIRECTORY_SEPARATOR . 'version.yaml', | ||
| includeScripts: false | ||
| ); | ||
| if (empty($versions)) { | ||
| return $this->version = '0'; | ||
| } | ||
|
|
||
| return $this->version = trim(key(array_slice($versions, -1, 1))); | ||
| } | ||
|
Comment on lines
+728
to
+743
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. getVersion() returns "0"/wrong key due to array_slice reindexing; use array_key_last instead. array_slice reindexes keys, so key(array_slice(...)) yields 0. Return the actual last version key. Apply this diff: public function getVersion(): string
{
if (isset($this->version)) {
return $this->version;
}
$versions = $this->getVersionsFromYaml(
versionFile: $this->getPath() . DIRECTORY_SEPARATOR . 'version.yaml',
includeScripts: false
);
if (empty($versions)) {
return $this->version = '0';
}
- return $this->version = trim(key(array_slice($versions, -1, 1)));
+ $last = array_key_last($versions);
+ return $this->version = is_string($last) ? trim($last) : '0';
}🤖 Prompt for AI Agents |
||
|
|
||
| public function getIdentifier(): string | ||
| { | ||
| return $this->getId(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This will need to be updated before merge.