Does anyone have a DB query or another method to identify nodes that are using macros in version 13? I'm in the process of moving all macro content to Blocks, but finding every instance of every macro partial file requires opening and checking each node and we have a couple thousand nodes in our site.
Not sure how I would do it directly in the database.
But maybe you could use the Umbraco API to query every single node, and and then loops through every single property looking for a RTE to narrow it down.
Print the Ids of the nodes to the screen or logs.
Did you solve this problem yet? would be intrested to know how you approached it.
No luck yet. I tried doing what Ayo described in a Razor view, querying every single node, focusing on one property, and then seeing if that property contains "UMBRACO_MACRO," but Umbraco keeps throwing IPublishedContent does not contain a definition for 'Contains'...
Hi Jeremy, here's a SQL query you could try directly on the database...
SELECT
n.id AS [nodeId],
n.path AS [path],
n.text AS [nodeName],
pd.textValue AS [propertyData]
FROM
umbracoNode AS n INNER JOIN
umbracoDocument AS d ON d.nodeId = n.id INNER JOIN
umbracoContent AS c ON c.nodeId = n.id INNER JOIN
cmsPropertyType AS pt ON pt.contentTypeId = c.contentTypeId INNER JOIN
umbracoPropertyData AS pd ON pd.propertyTypeId = pt.id
WHERE
(d.published = 1 OR d.edited = 1) AND
pt.Alias = 'myPropertyToSearch' AND
pd.textValue LIKE '%UMBRACO_MACRO%'
ORDER BY
n.id ASC
;
Hope this helps; feel free to tweak they query as you need.
Upgrading to Umbraco Version 14: Finding Macros
Does anyone have a DB query or another method to identify nodes that are using macros in version 13? I'm in the process of moving all macro content to Blocks, but finding every instance of every macro partial file requires opening and checking each node and we have a couple thousand nodes in our site.
Not sure how I would do it directly in the database.
But maybe you could use the Umbraco API to query every single node, and and then loops through every single property looking for a RTE to narrow it down.
Print the Ids of the nodes to the screen or logs.
Did you solve this problem yet? would be intrested to know how you approached it.
No luck yet. I tried doing what Ayo described in a Razor view, querying every single node, focusing on one property, and then seeing if that property contains "UMBRACO_MACRO," but Umbraco keeps throwing IPublishedContent does not contain a definition for 'Contains'...
Hi Jeremy, here's a SQL query you could try directly on the database...
Hope this helps; feel free to tweak they query as you need.
Cheers,
- Lee
Thanks Lee, that was helpful. With some tweaking (Thanks to my colleague) it did the job.
is working on a reply...