Skip to content
Draft
Show file tree
Hide file tree
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 Jul 30, 2024
0aaea47
Fix tests
LukeTowers Jul 30, 2024
00e085f
add missing newline
LukeTowers Jul 30, 2024
79e1a8e
Initial implementation of the UI to upload plugins via zip folder
LukeTowers Jul 30, 2024
ff85f70
Centralize updatemanager zip extracting
LukeTowers Jul 30, 2024
54e2c72
Add tests & fixtures for initial plugin scanning functionality
LukeTowers Jul 30, 2024
0a86efe
Initial work on supporting .zip files from plugin:install command.
LukeTowers Jul 30, 2024
6bbc1c2
formatting
LukeTowers Jul 30, 2024
1c0d50d
Update plugin test fixtures to avoid conflicts when installing them
LukeTowers Jul 31, 2024
03270d4
Initial working install method for plugin:install command
LukeTowers Jul 31, 2024
bb95ba6
Hopefully fix windows tests
LukeTowers Jul 31, 2024
46c1a83
WIP for retrieving the uploaded file from the plugin uploader modal
LukeTowers Aug 4, 2024
9644971
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers Nov 6, 2024
29195d2
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers Nov 6, 2024
a88d645
Merge branch 'develop' into wip/support-uploading-packages
LukeTowers Nov 27, 2024
f698d3a
Init wip
jaxwilko Nov 29, 2024
9546fbd
Work in progress... do not try and run it :(
jaxwilko Dec 3, 2024
1663800
Add theme upload form config
LukeTowers Dec 3, 2024
abdb18f
Added winter/packager + ovberrides and bumped php version
jaxwilko Dec 6, 2024
b80e34f
Added wip
jaxwilko Dec 6, 2024
ac5733c
Added fix to allow install to create files
jaxwilko Dec 6, 2024
b22d11b
Added objects for source types
jaxwilko Dec 6, 2024
6c4bbe8
WIP
jaxwilko Dec 9, 2024
5d705b9
Added wip
jaxwilko Dec 19, 2024
db52bcd
Added fix for installing specific package
jaxwilko Dec 19, 2024
f250393
Added abstract stubs
jaxwilko Dec 19, 2024
be09f6c
Added support for updating composer plugins
jaxwilko Dec 19, 2024
d9830f3
Added wip
jaxwilko Dec 19, 2024
2c1d4ca
Migrated core code to storm
jaxwilko Dec 20, 2024
68721cf
Added wip
jaxwilko Dec 20, 2024
dd3fc6c
Added wip
jaxwilko Dec 30, 2024
644052f
Moved commands into directories
jaxwilko Dec 30, 2024
69b11d8
Refactored stuff
jaxwilko Dec 30, 2024
fc7e32a
Added theme extension logic
jaxwilko Dec 30, 2024
1391495
Added market place support
jaxwilko Jan 2, 2025
a1b7c3a
Added plugin code detection from path using child process
jaxwilko Jan 2, 2025
312e6bd
Added support for installing from arbitary paths
jaxwilko Jan 3, 2025
56ead48
Added theme successfully installed message
jaxwilko Jan 3, 2025
f4b67bb
Added plugin successfully installed message and fixed no updates requ…
jaxwilko Jan 3, 2025
19a09cd
Added more messages to improve ux
jaxwilko Jan 3, 2025
8593b0b
Added wip
jaxwilko Jan 3, 2025
e6dc1ad
Hooked up old update checker ui with new update system
jaxwilko Jan 3, 2025
4e1f7e8
Update composer.json
LukeTowers Jan 4, 2025
43bbaf2
Moved stubs for create commands
jaxwilko Jan 4, 2025
fced1de
Added better reporting for module upgrades
jaxwilko Jan 4, 2025
f144fda
Removed stubbed function as implemented in parent class
jaxwilko Jan 4, 2025
bc61e32
Added default return
jaxwilko Jan 4, 2025
1d268b0
Added fix to ensure upgrades succeed for uninstalled plugins
jaxwilko Jan 4, 2025
62ec335
Added fix for reporting
jaxwilko Jan 4, 2025
bfc3cd1
Added support for preserving modules
jaxwilko Jan 4, 2025
9fa2063
Removed call to setOutputNotes
jaxwilko Jan 4, 2025
ebd5d2d
Added fixes for tests
jaxwilko Jan 4, 2025
c2b62c2
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko Jan 4, 2025
9395f2b
Removed packager from winter deps
jaxwilko Jan 4, 2025
9a5055f
Added style fixes
jaxwilko Jan 4, 2025
bb953e9
Reverted php requirement change
jaxwilko Jan 4, 2025
43acf5c
Added findThemesInPath method
jaxwilko Jan 4, 2025
5de0809
Added method for unpacking a zip and returning all sources inside
jaxwilko Jan 4, 2025
e3aeefa
Fix typo
LukeTowers Jan 5, 2025
729e46e
Moved logic into parent
jaxwilko Jan 5, 2025
6900cae
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko Jan 5, 2025
d8d9850
Apply suggestions from code review
jaxwilko Jan 5, 2025
4e33930
Added notice when cms.disableCoreUpdates is enabled
jaxwilko Jan 5, 2025
db75757
Removed misleading comment
jaxwilko Jan 5, 2025
c8bbe35
Added fix to refer to property instead of method
jaxwilko Jan 5, 2025
8da2212
Added use of plugin manager to check for plugin code
jaxwilko Jan 5, 2025
f950ce3
Removed old update manager
jaxwilko Jan 5, 2025
16a4841
Removed incorrect imports
jaxwilko Jan 5, 2025
f9773db
Removed unused class
jaxwilko Jan 5, 2025
1120f01
Made plugin guessing even simplier
jaxwilko Jan 5, 2025
09a7a88
Apply suggestions from code review
jaxwilko Jan 5, 2025
d328417
Wip
jaxwilko Jan 6, 2025
9d27012
Update modules/system/controllers/updates/assets/src/components/Produ…
LukeTowers Jan 7, 2025
bd3ce1e
Update modules/system/controllers/updates/_install_plugins.php
LukeTowers Jan 7, 2025
a8540d0
Moved eslint to prevent compiled js being linted
jaxwilko Jan 7, 2025
8959acd
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
jaxwilko Jan 7, 2025
d75512c
Added fix for eslint ignore
jaxwilko Jan 7, 2025
dbbda7c
Report missing version.yaml as no update rather than failed update
jaxwilko Jan 8, 2025
f062d51
Added fix for eslint
jaxwilko Jan 8, 2025
a1c5214
Added compiled js
jaxwilko Jan 8, 2025
22aaef0
Re-added old updates.js file
jaxwilko Jan 8, 2025
60a7089
Added install support for plugins
jaxwilko Jan 8, 2025
3c77118
Added logic to remove composer plugin on uninstall
jaxwilko Jan 15, 2025
93e0e84
Added fix to better handle caching of local data
jaxwilko Jan 20, 2025
b9ad3f8
Improved ui
jaxwilko Jan 20, 2025
0970906
Added support for creating module asset configs
jaxwilko Feb 12, 2025
00e32bd
Added vite for updates/install page
jaxwilko Feb 12, 2025
81a051f
Added missing files for module configging
jaxwilko Feb 12, 2025
0ae1eb2
Added ui fixes to install page
jaxwilko Feb 13, 2025
cfba2f3
Added theme upload string
jaxwilko Feb 13, 2025
a5b92ab
Manual develop merge
jaxwilko Feb 13, 2025
1e74099
Merge branch 'wip/support-uploading-packages' into wip/support-upload…
LukeTowers Mar 12, 2025
2d8030d
Manual merge
jaxwilko Mar 12, 2025
944b67e
Added storm branch pick
jaxwilko Mar 12, 2025
a10577c
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers Apr 2, 2025
ef7888d
Added little fixes
jaxwilko Jul 9, 2025
42ff54e
Manual merge develop
jaxwilko Jul 9, 2025
e174017
Added wip and backend ui
jaxwilko Jul 28, 2025
f26e7a3
Added fixes for marketplace container
jaxwilko Jul 28, 2025
5b0beda
Added missing manifest
jaxwilko Jul 28, 2025
ff8a4d7
Manual develop merge
jaxwilko Jul 28, 2025
b117db2
Move pagination below filters
LukeTowers Jul 28, 2025
ec4e736
Added fix for pagination overflowing page
jaxwilko Jul 28, 2025
9f99dcc
Added support for passing in element size in pagination
jaxwilko Jul 28, 2025
7d22af2
Added fixes for updates popup
jaxwilko Jul 28, 2025
53552b8
Added update indicator on product component
jaxwilko Jul 28, 2025
20e08fc
Added fix for jittery popout
jaxwilko Jul 28, 2025
5f62bd5
Added fixes to allow installing via the marketplace ui
jaxwilko Jul 28, 2025
b8ae320
Added fix for removing a plugin not rolling back the db
jaxwilko Jul 28, 2025
55407b3
Added pagination to the bottom of marketplace as well as top
jaxwilko Jul 30, 2025
20d402f
Added improved install ui and vue tippy for titles
jaxwilko Jul 30, 2025
0d10921
Merged plugin list and plugin manage
jaxwilko Jul 31, 2025
0eadc7d
Added some prettyness to the plugin manage page
jaxwilko Jul 31, 2025
8923ede
Added tweaks to plugins update page
jaxwilko Aug 1, 2025
af086c9
Added ui tweaks
jaxwilko Aug 1, 2025
9da2a04
Added support for pinning frozen plugins
jaxwilko Aug 1, 2025
c228b51
Added wip to update interface
jaxwilko Aug 6, 2025
6730f92
Replace usage of Composer::info() with Composer::show()
LukeTowers Aug 6, 2025
88d23c4
Merge branch 'wip/support-uploading-packages-update-manager-changes' …
LukeTowers Aug 6, 2025
6c54df9
Make use of Composer::getLatestSupportedVersion()
LukeTowers Aug 6, 2025
9f41d86
Add todo
LukeTowers Aug 6, 2025
7c586c7
Use command.beforeRun event
LukeTowers Aug 6, 2025
0e86ad3
Tidy imports
LukeTowers Aug 6, 2025
baba774
Comment
LukeTowers Aug 6, 2025
1a8a9e9
Style tweaks
LukeTowers Aug 7, 2025
86d59ef
Remove unused method
LukeTowers Aug 7, 2025
acde89e
Tweaks
LukeTowers Aug 7, 2025
85def52
Default to only running migrations from the UpdateManager->update() m…
LukeTowers Aug 7, 2025
0f3be8f
Use faster composer methods from storm
LukeTowers Aug 8, 2025
83b458e
Improve handling for removing plugins that don't exist
LukeTowers Aug 8, 2025
ada4ca2
Fix usage of composer
LukeTowers Aug 8, 2025
9dcf8a9
Add comment
LukeTowers Aug 8, 2025
e2141de
Update composer.json
LukeTowers Aug 13, 2025
04a57eb
Add support for getVersion to Theme
LukeTowers Aug 13, 2025
166fa56
Code tidying
LukeTowers Aug 13, 2025
80652d6
Tidy
LukeTowers Aug 13, 2025
4f31b68
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers Aug 13, 2025
39650a8
Lazy load core module console commands
LukeTowers Aug 13, 2025
a9f9664
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers Aug 13, 2025
b8af81d
Added fix to ensure the right app is available at the right time
jaxwilko Aug 14, 2025
d26dde9
Added fix to ensure tests are compatible with newer versions of vite
jaxwilko Aug 14, 2025
a4d137a
Added fix for npm:version command description
jaxwilko Aug 14, 2025
f706326
Merge branch 'develop' into wip/support-uploading-packages-update-man…
LukeTowers Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"require": {
"php": ">=8.1",
"winter/storm": "dev-develop as 1.2",
"winter/storm": "dev-wip/support-uploading-packages-update-manager-changes as 1.2",
Copy link
Member

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.

"winter/wn-system-module": "dev-develop",
"winter/wn-backend-module": "dev-develop",
"winter/wn-cms-module": "dev-develop",
Expand Down Expand Up @@ -81,7 +81,8 @@
"config": {
"allow-plugins": {
"composer/installers": true,
"wikimedia/composer-merge-plugin": true
"wikimedia/composer-merge-plugin": true,
"php-http/discovery": false
}
}
}
12 changes: 7 additions & 5 deletions modules/backend/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ public function boot()
*/
protected function registerConsole()
{
$this->registerConsoleCommand('create.controller', \Backend\Console\CreateController::class);
$this->registerConsoleCommand('create.formwidget', \Backend\Console\CreateFormWidget::class);
$this->registerConsoleCommand('create.reportwidget', \Backend\Console\CreateReportWidget::class);
$this->registerConsoleCommand('user.create', \Backend\Console\UserCreate::class);
$this->registerConsoleCommand('winter.passwd', \Backend\Console\WinterPasswd::class);
$this->commands([
\Backend\Console\CreateController::class,
\Backend\Console\CreateFormWidget::class,
\Backend\Console\CreateReportWidget::class,
\Backend\Console\UserCreate::class,
\Backend\Console\WinterPasswd::class,
]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/backend/classes/AuthManager.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Backend\Classes;

use Config;
use System\Classes\PluginManager;
use System\Classes\Extensions\PluginManager;
use Winter\Storm\Auth\Manager as StormAuthManager;
use Winter\Storm\Exception\SystemException;

Expand Down
2 changes: 1 addition & 1 deletion modules/backend/classes/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function callAction($method, $parameters)
* Pass unhandled URLs to the CMS Controller, if it exists
*
* @param string $url
* @return Response
* @return \Illuminate\Http\Response
*/
protected function passToCmsController($url)
{
Expand Down
10 changes: 5 additions & 5 deletions modules/backend/classes/NavigationManager.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Backend\Classes;

use Event;
use BackendAuth;
use System\Classes\PluginManager;
use Validator;
use SystemException;
use Log;
use Config;
use Event;
use Log;
use System\Classes\Extensions\PluginManager;
use SystemException;
use Validator;

/**
* Manages the backend navigation.
Expand Down
6 changes: 3 additions & 3 deletions modules/backend/classes/WidgetManager.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php namespace Backend\Classes;

use Str;
use BackendAuth;
use SystemException;
use System\Classes\PluginManager;
use Event;
use Str;
use System\Classes\Extensions\PluginManager;
use SystemException;

/**
* Widget manager
Expand Down
2 changes: 1 addition & 1 deletion modules/backend/widgets/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Illuminate\Support\Facades\Lang;
use System\Classes\ImageResizer;
use System\Classes\MediaLibrary;
use System\Classes\PluginManager;
use System\Classes\Extensions\PluginManager;
use System\Helpers\DateTime as DateTimeHelper;
use Winter\Storm\Database\Model;
use Winter\Storm\Exception\ApplicationException;
Expand Down
36 changes: 26 additions & 10 deletions modules/cms/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php namespace Cms;
<?php

namespace Cms;

use Backend;
use Backend\Classes\WidgetManager;
use Backend\Facades\Backend;
use Backend\Facades\BackendAuth;
use Backend\Facades\BackendMenu;
use Backend\Models\UserRole;
Expand All @@ -11,6 +13,7 @@
use Cms\Classes\Page as CmsPage;
use Cms\Classes\Router;
use Cms\Classes\Theme;
use Cms\Classes\ThemeManager;
use Cms\Models\ThemeData;
use Cms\Models\ThemeLog;
use Cms\Twig\DebugExtension;
Expand All @@ -24,6 +27,7 @@
use System\Classes\MarkupManager;
use System\Classes\SettingsManager;
use Twig\Cache\FilesystemCache as TwigCacheFilesystem;
use Winter\Storm\Console\Command;
use Winter\Storm\Support\Facades\Event;
use Winter\Storm\Support\Facades\Url;
use Winter\Storm\Support\ModuleServiceProvider;
Expand Down Expand Up @@ -58,6 +62,17 @@ public function register()
$this->registerBackendWidgets();
$this->registerBackendSettings();
}

/*
* Console specific
*/
if ($this->app->runningInConsole()) {
Command::extend(function (Command $command) {
$command->bindEvent('command.beforeRun', function () use ($command) {
ThemeManager::instance()->setOutput($command->getOutput());
});
});
}
}

/**
Expand All @@ -78,14 +93,15 @@ public function boot()
*/
protected function registerConsole()
{
$this->registerConsoleCommand('create.component', \Cms\Console\CreateComponent::class);
$this->registerConsoleCommand('create.theme', \Cms\Console\CreateTheme::class);

$this->registerConsoleCommand('theme.install', \Cms\Console\ThemeInstall::class);
$this->registerConsoleCommand('theme.remove', \Cms\Console\ThemeRemove::class);
$this->registerConsoleCommand('theme.list', \Cms\Console\ThemeList::class);
$this->registerConsoleCommand('theme.use', \Cms\Console\ThemeUse::class);
$this->registerConsoleCommand('theme.sync', \Cms\Console\ThemeSync::class);
$this->commands([
\Cms\Console\CreateComponent::class,
\Cms\Console\CreateTheme::class,
\Cms\Console\ThemeInstall::class,
\Cms\Console\ThemeRemove::class,
\Cms\Console\ThemeList::class,
\Cms\Console\ThemeUse::class,
\Cms\Console\ThemeSync::class,
]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions modules/cms/classes/ComponentManager.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace Cms\Classes;

use Illuminate\Support\Facades\App;
use Str;
use System\Classes\PluginManager;
use System\Classes\Extensions\PluginManager;
use SystemException;
use Illuminate\Support\Facades\App;

/**
* Component manager
Expand Down
37 changes: 35 additions & 2 deletions modules/cms/classes/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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';

Expand All @@ -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();
}
Expand Down Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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
In modules/cms/classes/Theme.php around lines 728 to 743, the current code uses
key(array_slice($versions, -1, 1)) which reindexes the array and returns 0
instead of the actual last version key; replace that logic with array_key_last
to get the real last key, assign it to $this->version and return its trimmed
string value (fall back to '0' if array_key_last returns null/false). Make the
change so you compute $lastKey = array_key_last($versions); if ($lastKey ===
null || $lastKey === false) return $this->version = '0'; otherwise return
$this->version = trim((string)$lastKey).


public function getIdentifier(): string
{
return $this->getId();
}
}
Loading
Loading