Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
38 changes: 31 additions & 7 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -6394,6 +6394,9 @@ public function postflight($action, $installer)
return true;
}

// Update UCM content types.
$this->updateContentTypes();

$db = Factory::getDbo();
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/Table/');

Expand Down Expand Up @@ -6449,9 +6452,6 @@ public function postflight($action, $installer)
}
}

// Update UCM content types.
$this->updateContentTypes();

return true;
}

Expand Down Expand Up @@ -6736,12 +6736,19 @@ private function updateContentTypes(): void
{
// Content types to update.
$contentTypes = [
'com_content.article',
'com_contact.contact',
'com_newsfeeds.newsfeed',
'com_tags.tag',
'com_banners.banner',
'com_banners.client',
'com_users.note',
'com_content.category',
'com_contact.category',
'com_newsfeeds.category',
'com_banners.category',
'com_users.category',
'com_users.user',
];

// Get table definitions.
Expand Down Expand Up @@ -6773,16 +6780,33 @@ private function updateContentTypes(): void
{
list($component, $tableType) = explode('.', $contentType->type_alias);

$tablePrefix = 'Joomla\\Component\\' . ucfirst(substr($component, 4)) . '\\Administrator\\Table\\';
$tableType = ucfirst($tableType) . 'Table';
// Special case for core table classes.
if ($contentType->type_alias === 'com_users.users' || $tableType === 'category')
{
$tablePrefix = 'Joomla\\CMS\Table\\';
$tableType = ucfirst($tableType);
}
else
{
$tablePrefix = 'Joomla\\Component\\' . ucfirst(substr($component, 4)) . '\\Administrator\\Table\\';
$tableType = ucfirst($tableType) . 'Table';
}

// Bind type alias.
$typeAlias = $contentType->type_alias;

// Update table definition.
$table = json_decode($contentType->table);
$table->special->type = $tableType;

// Update table definitions.
$table->special->type = $tableType;
$table->special->prefix = $tablePrefix;

// Some content types don't have this property.
if (!empty($table->common->prefix))
{
$table->common->prefix = 'Joomla\\CMS\\Table\\';
}

$table = json_encode($table);

// Execute the query.
Expand Down
Loading