I have content that is automatically added to MODx directly to the database (and not with the API). Since updating to 2.2.2 I keep getting "Resource URI already exists for resource 521..." etc which is resulting in these generated pages throwing 404 errors.
The script does use the MODx API to refresh the cache but that isn't helping. The only way to resolve this issue so far is to set the
friendly_urls system setting to 'no' and then back to 'yes' in the Manager.
Basically I am trying to duplicate whatever is happening when you enable/disable friendly_urls. In the part where I refresh the cache I have this:
$friendly_urls = $modx->getObject('modSystemSetting', 'friendly_urls');
$friendly_urls->set('value', FALSE);
$friendly_urls->save();
refreshCache();
$friendly_urls = $modx->getObject('modSystemSetting', 'friendly_urls');
$friendly_urls->set('value', TRUE);
$friendly_urls->save();
I know what I am doing in the first place is 'hacky' at best but changing the friendly URLs setting via the API doesn't work. Any suggestions?