Symptom A PHP Fatal error occurs if a core_navigation_data item fails to get written to the db but it's data_id is saved in the core_navigation_tree. Run the following script to identify the core_navigation_data.id that is missing:
Diagnosis Run the following script if the script returns 1 then run the perscription script
SELECT COUNT(id) > 0 AS 'Tree has missing data'
FROM core_navigation_tree
WHERE data_id NOT IN (SELECT id FROM core_navigation_data);
Perscription Run the following script then the diagnosis script if the diagnosis script returns 1, run the following script again
SELECT @data_id := data_id
FROM core_navigation_tree
WHERE data_id NOT IN (SELECT id FROM core_navigation_data);
SELECT @module_id := id
FROM core_module
WHERE name
LIKE 'Page';
SELECT @user_id := id FROM `core_user` WHERE username LIKE 'mediashaker';
SELECT @data_seq := MAX(id) FROM `core_navigation_data_seq`;
SELECT @page_seq := MAX(id) FROM `pg_content_seq`;
UPDATE core_navigation_data_seq SET id = @data_seq+1;
UPDATE pg_content_seq SET id = @page_seq+1;
UPDATE core_navigation_tree SET type = 0, STATUS = 1 WHERE data_id = @data_id LIMIT 1;
INSERT INTO core_navigation_data (id, module_id, content_id, type, STATUS, member_level, created, created_by, modified, modified_by, title, image, header, summary, label, url, urn, template, start_time, end_time)
VALUES (
@data_id,
@module_id,
@page_seq+1,
0,
1,
0,
UNIX_TIMESTAMP(),
@user_id,
UNIX_TIMESTAMP(),
@user_id,
'delete me',
'',
'',
'',
'',
'',
'',
'',
NULL,
NULL
);
INSERT INTO pg_content (id, html, modified, created, created_by, modified_by, template)
VALUES(
@page_seq+1,
'delete me',
UNIX_TIMESTAMP(),
UNIX_TIMESTAMP(),
@user_id,
@user_id,
''
);
To fix the issue, insert a row into core_navigation_data using the data_id as id