database - SilverStripe CMS unpublish without user interaction -
a site of mine has strange behavior. time time of pages unpublished without user interaction.
in page history there no entry activity. pages children of secured page.
the unpublished pages not same. varies in page , in period.
the apache access files give no information access outside.
for testing changed content of these pages. after waiting few days 1 of these pages unpublished again. content of page did not change. can exclude possibility of nightly recovery of database provider.
how can possible?
system: silverstripe 3.1.12 (cms/framework)
we can use onbeforeunpublish
notify of when page unpublished debug problem. through sitetree
extension.
we declare sitetree
extension in our config.yml
file (or alternative yml
file):
sitetree: extensions: - sitetreeextension
in extension class add onbeforeunpublish
function email when ever page unpublished:
class sitetreeextension extends dataextension { public function onbeforeunpublish() { $member = member::currentuser(); $config = siteconfig::current_site_config(); $pageeditlink = director::absolutebaseurl() . 'admin/pages/edit/show/' . $this->owner->id; $content = '<p>page has been unpublished</p>'; $content .= '<p><strong>page name</strong><br />'; $content .= '<a href="' . $pageeditlink . '">' . $this->owner->title . '</a></p>'; $content .= '<p><strong>page id</strong><br />'; $content .= '<a href="' . $pageeditlink . '">' . $this->owner->id . '</a></p>'; if ($member) { $membereditlink = director::absolutebaseurl() . 'admin/security/editform/field/members/item/' . $member->id . '/edit'; $content .= '<p><strong>member email</strong><br />'; $content .= '<a href="' . $membereditlink . '">' . $member->email . '</a></p>'; $content .= '<p><strong>member id</strong><br />'; $content .= '<a href="' . $membereditlink . '">' . $member->id . '</a></p>'; } $email = email::create( 'from@example.com', 'to@example.com', $config->title . ' - page unpublished', $content ); $email->send(); } }
in above code email content has log of page unpublished , member unpublished page.
this doesn't fix problem should track , debug issue.
Comments
Post a Comment