Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/page_revisions/page_revision_eh.php
Show First 20 Lines • Show All 366 Lines • ▼ Show 20 Line(s) | |||||
{ | { | ||||
$sql = 'SELECT MAX(RevisionNumber) | $sql = 'SELECT MAX(RevisionNumber) | ||||
FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . ' | FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . ' | ||||
WHERE PageId = ' . $this->Application->GetVar('m_cat_id'); | WHERE PageId = ' . $this->Application->GetVar('m_cat_id'); | ||||
$max_revision = (int)$this->Conn->GetOne($sql); | $max_revision = (int)$this->Conn->GetOne($sql); | ||||
return $max_revision + 1; | return $max_revision + 1; | ||||
} | } | ||||
/** | |||||
* Updates searchable page content | |||||
* | |||||
* @param kEvent $event Event. | |||||
* | |||||
* @return void | |||||
*/ | |||||
protected function OnAfterPageContentChangedHook(kEvent $event) | |||||
{ | |||||
/** @var kDBItem $content */ | |||||
$content = $event->MasterEvent->getObject(); | |||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(array('skip_autoload' => true)); | |||||
$revision_id = $content->GetDBField('RevisionId'); | |||||
$object->Load($revision_id); | |||||
/** @var PageHelper $page_helper */ | |||||
$page_helper = $this->Application->recallObject('PageHelper'); | |||||
$object->SetDBFieldsFromHash($page_helper->getRevisionContent($revision_id)); | |||||
$object->Update(); | |||||
} | |||||
} | } |