0

We're having a bit of a problem with the unique URL system in Craft. An entry was deleted, and a new one has been created to replace it. However the new entry should have the same URL as the old removed one, but Craft is insisting on appending -2, -3, etc to the entry URL.

Is this a bug? There is currently no way to recover a deleted page in the CMS, and I can't find a way to purge previously deleted entry URLs without editing the database directly.

Has anyone got any idea? Is this a bug, or is there a solution? Obviously when handed over to a client I can't ask them to just pop into MySQL and remove old entries.

Thanks, Ian

4
  • Hey Ian - Just tried this on my local machine and was able to create a new entry with an old URL without any issue. Are you using a channel, structure, or single for this section? – Aaron Berkowitz Sep 30 '15 at 14:28
  • Hi Aaron, I've not noticed this problem before either. Not sure why it's behaving like this now. I'm guessing it's a bug of some kind. It's a structure item. – Ian Nebbiolo Sep 30 '15 at 14:31
  • Can you submit a ticket through the control panel so I can take a closer look at your logs and database? – Aaron Berkowitz Sep 30 '15 at 14:35
  • I've submitted a ticket. This seems to be occurring on three of our current builds all running 2.4.2691. They were all created from the same Craft build we use as a starting point. I'm not getting that error on a client site built from scratch (now running 2.4.2684). – Ian Nebbiolo Sep 30 '15 at 14:41
2

As it turned out, database tables on this Craft project were missing foreign key constraints, and since Craft relies on the CASCADING DELETE/UPDATE functionality of these foreign keys, it was not deleting all associated rows across tables for a deleted entry. This can happen when migrating a database backup to a server that only supports MyISAM and not InnoDB because MyISAM will silently drop the foreign key constraints.

If this happens, you can use the Craft Foreign Key Restoration Tool to try and restore the missing foreign keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.