"Ghost pages" appearing in the CMS
elliot-sawyer opened this issue · comments
I have a client getting "ghost pages" appearing in the CMS after they archive some older pages which have only existed as a draft.
Expected behaviour: when I archive a page, I expect the title to appear with strikethrough formatting and an archived badge in the same position of the SiteTree
Actual behaviour: A page with no title appears in draft at the top of the SiteTree
Affected versions: 4.4.0+, 4.5.0-rc1
I've done a lot of testing back-and-forth restoring the database, and concluded the following things:
- The issue started between CWP2.2.3 and 2.3.0
- Getting more specific, a change in
silverstripe/versioned
from 1.3.6 to 1.4.0 triggers the break. - It affects new pages saved as a draft too
In Versioned::get_latest_version, reverting from this (1.4.0):
$baseClass = DataObject::getSchema()->baseDataClass($class);
$list = DataList::create($baseClass)
->setDataQueryParam([
"Versioned.mode" => 'latest_version_single',
"Versioned.id" => $id
]);
return $list->first();
Back to this (1.3.6):
$baseClass = DataObject::getSchema()->baseDataClass($class);
$list = DataList::create($baseClass)
->setDataQueryParam("Versioned.mode", "latest_versions");
return $list->byID($id);
fixes my particular issue. I don't fully understand the nature of this change, but legacy records in our particular database do not seem to work with it.
As a workaround, I have rolled the module back to 1.3.6, but going forward, I'd like to understand the cause of the error and attempt to fix it
NB: I've not been able to reproduce the issue on a fresh install of CWP. It seems to impact older records that were draft-only when 1.3.6 was installed. I suggest trying it with an older snapshot
This is still an issue in CWP 2.5.1. I've had to keep the version at 1.3.6 until it's resolved.
"silverstripe/versioned": "1.3.6 as 1.5.1"
Some more information for you: this issue disappears when versioned
is restored to the CWP default (1.5.1
currenly), and the ElementalPageExtension extension is removed from Page:
Page:
# extensions:
# - DNADesign\Elemental\Extensions\ElementalPageExtension
allowed_elements:
- DNADesign\Elemental\Models\ElementContent
...
This issue was caused by using the old silverstripe/elemental-blocks module, which pulled in an older version of dnadesign/silverstripe-elemental. We located the elements with old elemental-blocks and removed them from the database, then upgraded the module to use the newer silverstripe elements