Global reset of approval to fix broken versions

Permalink
If you're like me and you create an automatic job to unapprove pages based on specific criteria, and then you mess it up, this might be useful. At one point, the entire table of versions got unapproved. this sucks. Concrete5 goes a little haywire when there is more than one approved version of a page, so the only solution is to re-approve only one version of each page.

Try this:

-- unapprove the entire database:
UPDATE `CollectionVersions` SET cvIsApproved = 0;

-- approve only the latest version of each page:
UPDATE `CollectionVersions` AS v1
INNER JOIN (SELECT `cID`, MAX(`cvID`) as 'cvID' FROM `CollectionVersions` GROUP BY `cID`) v2
ON v1.`cID` = v2.`cID` AND v1.`cvID` = v2.`cvID`
SET `cvIsApproved` = 1

Vahan
 

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.