Skip to content
Merged
Changes from 3 commits
Commits
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
36 changes: 36 additions & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function update($installer)

// This needs to stay for 2.5 update compatibility
$this->deleteUnexistingFiles();

// Ensure templates are moved to the correct mode
$this->fixTemplateMode();
$this->updateManifestCaches();
$this->updateDatabase();
$this->updateAssets($installer);
Expand Down Expand Up @@ -8533,4 +8536,37 @@ protected function moveRemainingTemplateFiles()
}
}
}

/**
* Ensure the core templates are correctly moved to the new mode.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
protected function fixTemplateMode()
{
$db = Factory::getDbo();

array_map(function($template) use ($db)
{
$clientId = $template === 'atum' ? 1 : 0;
$query = $db->getQuery(true)
->update($db->quoteName('#__template_styles'))
->set($db->quoteName('inheritable') . ' = ' . $db->quote(1))
->where($db->quoteName('template') . ' = ' . $db->quote($template))
->where($db->quoteName('client_id') . ' = ' . $db->quote($clientId));

try
{
$db->setQuery($query)->execute();
}
catch (Exception $e)
{
echo Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '<br>';

return;
}
}, ['atum', 'cassiopeia']);
}
}