How to use SQL to find pages
Description
This may be appropriate if you have specific requirements and conditions. Otherwise we recommend using the techniques from How to find Confluence pages and then do something
- You are familiar with SQL
- Confluence Server and you have access to the Confluence database
- You want to do exact content search and have a large number of pages which would prevent you from using the Search Content approach because it would take too long.
Steps
- Construct a SQL query that selects the pages you are interested in. Test against your database.
select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')
- Figure out the runFromSql parameters for accessing your database.
Put it all together in a single command:
confluence -a runFromSql --common "-a modifyPage --content \"before existing content\" " --database confluence-3.5.13 --driver postgresql --sql "select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')"