fix: remove theme preview tab and test page #4
@@ -97,8 +97,8 @@ if ($params_favicon_source) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$faviconOutputDir = JPATH_ROOT . '/images/favicons';
|
||||
$faviconUrlBase = Uri::root(true) . '/images/favicons';
|
||||
$faviconOutputDir = JPATH_ROOT . '/media/templates/site/' . $this->template . '/images/favicons';
|
||||
$faviconUrlBase = Uri::root(true) . '/media/templates/site/' . $this->template . '/images/favicons';
|
||||
|
||||
if (MokoFaviconHelper::generate($faviconSourceAbs, $faviconOutputDir)) {
|
||||
$faviconHeadTags = MokoFaviconHelper::getHeadTags($faviconUrlBase);
|
||||
|
||||
@@ -100,14 +100,40 @@ class Tpl_MokoonyxInstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* Delete the favicon stamp file so favicons and site.webmanifest
|
||||
* are regenerated on the next page load after install/update.
|
||||
* Also removes the old /images/favicons/ location.
|
||||
*/
|
||||
private function clearFaviconStamp(): void
|
||||
{
|
||||
$stampFile = JPATH_ROOT . '/images/favicons/.favicon_generated';
|
||||
// Clear new location stamp
|
||||
$stampFile = JPATH_ROOT . '/media/templates/site/' . self::NEW_NAME . '/images/favicons/.favicon_generated';
|
||||
if (is_file($stampFile)) {
|
||||
@unlink($stampFile);
|
||||
$this->logMessage('Cleared favicon stamp — will regenerate on next page load.');
|
||||
}
|
||||
|
||||
// Remove old /images/favicons/ directory from previous versions
|
||||
$oldDir = JPATH_ROOT . '/images/favicons';
|
||||
if (is_dir($oldDir)) {
|
||||
$files = glob($oldDir . '/*');
|
||||
if ($files) {
|
||||
foreach ($files as $file) {
|
||||
@unlink($file);
|
||||
}
|
||||
}
|
||||
@unlink($oldDir . '/.favicon_generated');
|
||||
@rmdir($oldDir);
|
||||
$this->logMessage('Removed old favicon directory: images/favicons/');
|
||||
}
|
||||
|
||||
// Remove any favicon files left in the site root
|
||||
$rootFavicons = ['favicon.ico', 'favicon.png', 'apple-touch-icon.png', 'site.webmanifest'];
|
||||
foreach ($rootFavicons as $file) {
|
||||
$path = JPATH_ROOT . '/' . $file;
|
||||
if (is_file($path)) {
|
||||
@unlink($path);
|
||||
$this->logMessage('Removed root favicon: ' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user