Skip to content

Instantly share code, notes, and snippets.

@korenevskiy
Last active January 19, 2024 21:58
Show Gist options
  • Save korenevskiy/e56c34531f84ef3a540be1db3b721de8 to your computer and use it in GitHub Desktop.
Save korenevskiy/e56c34531f84ef3a540be1db3b721de8 to your computer and use it in GitHub Desktop.
Add content in MySQL in Joomla CMS
-- Query to add articles to the database
INSERT INTO `joom_content`(`asset_id`, `state`,`created_by`,`created_by_alias`,`access`,`version`,`featured`,`publish_up`,`language`, `created`,`modified`, `images`,`urls`,`attribs`,`metadata`,
`catid`, `alias`, `title`, `introtext`, `fulltext`, `note`, `ordering`, `metadesc`) VALUES
(0,1, 1,"",1,1,0, 0,'*', NOW(),NOW(), '{}','{}','{}','{}',
2, '__alias__', 'Title!', 'Intro!', '<p>Full Text</p>', 'Note', 0, 'metadesc');
-- Mandatory Query to add the process of articles required for the work
-- It runs 1 time for all articles after adding articles.
INSERT INTO joom_workflow_associations (item_id, stage_id, extension)
SELECT c.id `item_id`, s.id `stage_id`, 'com_content.article' `extension`
FROM joom_workflow_stages s, joom_content c
WHERE s.default AND s.published AND
NOT EXISTS (SELECT * FROM joom_workflow_associations WHERE item_id = c.id);
-- Query alias generation for all articles. This is necessary if there are no aliases.
UPDATE `joom_content` WHERE `alias` = '__alias__' AND `catid` = 2
SET `alias` = CONCAT('article_', id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment