Fatal Error on Setting Up Page Defaults on Child Pages

Permalink
Got this when setting up some blocks on multiple child pages as page defaults.

I was able to get along fine even with the error, but I figured people here might want to know about it.

The error (had to copy it from the source, so some of the error might be encoded):

Fatal error:  Uncaught exception 'ADODB_Exception' with message 'mysql error: [1062: Duplicate entry '59-26-41-Nav' for key 1] in EXECUTE("insert into CollectionVersionBlockStyles (cID, cvID, bID, arHandle, csrID) values ('59', '26', '41', 'Nav', 0)")
' in /var/www/vhosts/proteuscreative.com/httpdocs/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php:78
Stack trace:
#0 /var/www/vhosts/proteuscreative.com/httpdocs/concrete/libraries/3rdparty/adodb/adodb.inc.php(1037): adodb_throw('mysql', 'EXECUTE', 1062, 'Duplicate entry...', 'insert into Col...', false, Object(ADODB_mysql))
#1 /var/www/vhosts/proteuscreative.com/httpdocs/concrete/libraries/3rdparty/adodb/adodb.inc.php(993): ADOConnection->_Execute('insert into Col...')
#2 [internal function]: ADOConnection->Execute('insert into Col...', Array)
#3 /var/www/vhosts/proteuscreative.com/httpdocs/concrete/libraries/database.php(73): call_user_func_array(Array, Array)
#4 [internal function]: Database->__call('Execute', Array)
#5 /var/www/vhosts/proteuscreative.com/httpdo in /var/www/vhosts/proteuscreative.com/httpdocs/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php on line 78


Screenshots attached

2 Attachments

Proteus
 
FatTony1952 replied on at Permalink Reply
FatTony1952
I get this same error. Anyone? Anyone?
FatTony1952 replied on at Permalink Reply
FatTony1952
I actually want to describe what I was doing at the time.

For some reason, my nav was missing on all of my 3-column template pages. I had previously added the nav to 'setup on child pages', but they mysteriously disappeared. When I went back to my page type defaults to add the nav back, I got the error.
FatTony1952 replied on at Permalink Reply
FatTony1952
Hey Proteus,

I tried a couple of things to see how they worked to fix this.

The method that worked best was, in your page type defaults edit, delete all of the added blocks, save the version, then go back into the page type edit and add them back in and apply to child pages.
andrew replied on at Permalink Reply
andrew
I believe I've just fixed this - it was a really stupid oversight on our part. Try this:

Open concrete/models/block.php, and find the deleteBlock() function.

Look for this line:


$q = "delete from CollectionVersionBlockStyles where cID = '$cID' and cvID = '$cvID' and bID = '$bID' and arHandle = '$arHandle'";
//$r = $db->query($q);

Notice that the query is commented out? Uncomment that line so that it just reads

$r = $db->query($q);

And try again. NOTE: You may have to try multiple times, because the first time you re-add the block again you may still have the items in the database. But this should eventually cause the problem to no longer happen.
Proteus replied on at Permalink Reply
Proteus
Thanks andrew and FatTony, I've since worked around the issue (forgot what I did actually, may have deleted and re-added the blocks like Tony suggested), but I may go and try this if I ever encounter the error again.