Bridge: install from release, copy user files + params after. Bump 03.10.12
Some checks failed
Repo Health / Access control (push) Successful in 2s
Auto-Update SHA Hash / Update SHA-256 Hash in updates.xml (release) Failing after 6s
Repo Health / Release configuration (push) Failing after 4s
Repo Health / Scripts governance (push) Successful in 5s
Repo Health / Repository health (push) Failing after 5s
Some checks failed
Repo Health / Access control (push) Successful in 2s
Auto-Update SHA Hash / Update SHA-256 Hash in updates.xml (release) Failing after 6s
Repo Health / Release configuration (push) Failing after 4s
Repo Health / Scripts governance (push) Successful in 5s
Repo Health / Repository health (push) Failing after 5s
1. Download & install MokoOnyx from Gitea release 2. Copy user files (custom themes, user.css/js) to MokoOnyx 3. Migrate template styles with params Fallback: if download fails, copy user files only (MokoOnyx must be installed manually) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,27 +46,23 @@ class MokoBridgeMigration
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. Download MokoOnyx ZIP
|
||||
// 1. Try downloading and installing MokoOnyx from Gitea release
|
||||
$installed = false;
|
||||
$zipPath = self::downloadRelease();
|
||||
if (!$zipPath) {
|
||||
$app->enqueueMessage(
|
||||
'MokoOnyx migration: could not download the MokoOnyx template package. '
|
||||
. 'Please install MokoOnyx manually from '
|
||||
. '<a href="https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx/releases" target="_blank">Gitea Releases</a>.',
|
||||
'warning'
|
||||
);
|
||||
return false;
|
||||
if ($zipPath) {
|
||||
$installed = self::installPackage($zipPath);
|
||||
@unlink($zipPath);
|
||||
}
|
||||
|
||||
// 2. Install MokoOnyx via Joomla's installer
|
||||
$installed = self::installPackage($zipPath);
|
||||
|
||||
// Clean up downloaded ZIP
|
||||
@unlink($zipPath);
|
||||
// 2. Fallback: copy from MokoCassiopeia and rename
|
||||
if (!$installed) {
|
||||
self::log('Bridge: download/install failed, falling back to file copy');
|
||||
$installed = self::copyAndRename();
|
||||
}
|
||||
|
||||
if (!$installed) {
|
||||
$app->enqueueMessage(
|
||||
'MokoOnyx migration: installation failed. '
|
||||
'MokoOnyx migration: automatic installation failed. '
|
||||
. 'Please install MokoOnyx manually from '
|
||||
. '<a href="https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx/releases" target="_blank">Gitea Releases</a>.',
|
||||
'warning'
|
||||
@@ -74,10 +70,13 @@ class MokoBridgeMigration
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. Migrate template styles
|
||||
// 3. Copy user files (custom themes, user.css, user.js)
|
||||
self::copyAndRename();
|
||||
|
||||
// 4. Migrate template styles and params
|
||||
self::migrateStyles();
|
||||
|
||||
// 4. Notify admin
|
||||
// 5. Notify admin
|
||||
self::notifyUser($app);
|
||||
|
||||
self::log('Bridge migration completed successfully.');
|
||||
@@ -245,6 +244,58 @@ class MokoBridgeMigration
|
||||
self::log('Migrated ' . count($oldStyles) . ' template style(s).');
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy user-specific files from MokoCassiopeia to MokoOnyx.
|
||||
* Only copies custom themes, user.css, and user.js — not the full template.
|
||||
* MokoOnyx must already be installed (via download or manual).
|
||||
*/
|
||||
private static function copyAndRename(): bool
|
||||
{
|
||||
$oldMedia = JPATH_ROOT . '/media/templates/site/' . self::OLD_NAME;
|
||||
$newMedia = JPATH_ROOT . '/media/templates/site/' . self::NEW_NAME;
|
||||
|
||||
if (!is_dir($newMedia)) {
|
||||
self::log('Bridge: MokoOnyx media dir not found — cannot copy user files', 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$copied = 0;
|
||||
|
||||
// Copy custom theme palettes
|
||||
$userFiles = [
|
||||
'css/theme/light.custom.css',
|
||||
'css/theme/dark.custom.css',
|
||||
'css/theme/light.custom.min.css',
|
||||
'css/theme/dark.custom.min.css',
|
||||
'css/user.css',
|
||||
'css/user.min.css',
|
||||
'js/user.js',
|
||||
'js/user.min.js',
|
||||
];
|
||||
|
||||
foreach ($userFiles as $relPath) {
|
||||
$srcFile = $oldMedia . '/' . $relPath;
|
||||
$dstFile = $newMedia . '/' . $relPath;
|
||||
if (is_file($srcFile) && !is_file($dstFile)) {
|
||||
$dstDir = dirname($dstFile);
|
||||
if (!is_dir($dstDir)) {
|
||||
mkdir($dstDir, 0755, true);
|
||||
}
|
||||
copy($srcFile, $dstFile);
|
||||
$copied++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy favicon directory
|
||||
$faviconSrc = JPATH_ROOT . '/images/favicons';
|
||||
if (is_dir($faviconSrc)) {
|
||||
self::log('Bridge: favicons already at images/favicons — shared between templates');
|
||||
}
|
||||
|
||||
self::log("Bridge: copied {$copied} user file(s) to MokoOnyx");
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function notifyUser($app): void
|
||||
{
|
||||
$app->enqueueMessage(
|
||||
|
||||
Reference in New Issue
Block a user