/** * Indexes the object after it has been written to the database. */ public function onAfterWrite() { // Obey index filter rules $objs = ZendSearchLuceneWrapper::getAllIndexableObjects($this->owner->ClassName); ZendSearchLuceneWrapper::delete($this->owner); foreach ($objs as $obj) { if (!is_object($obj)) { continue; } if (!is_object($this->owner)) { continue; } if ($obj[0] == $this->owner->class && $obj[1] == $this->owner->ID) { ZendSearchLuceneWrapper::index($this->owner); } } parent::onAfterWrite(); }
/** * For folders, will need to add or remove the htaccess rules * Assumptions: * - the folder exists (after write!) * - no one else is trying to put htaccess rules here * - (follows from above) existing htaccess file was put there by this module * @todo Add better support for existing htaccess files */ function onAfterWrite() { parent::onAfterWrite(); if ($this->owner instanceof Folder) { $htaccess = $this->owner->getFullPath() . SecureFileController::get_access_filename(); if ($this->owner->Secured && !file_exists($htaccess)) { file_put_contents($htaccess, $this->htaccessContent()); } elseif (!$this->owner->Secured && file_exists($htaccess)) { unlink($htaccess); } } }
/** * Intenionally unimplemented, use DataObject::write() with * $writeComponents=true instead. The solution is not perfect, * but there is no way to workaround Sapphire's component * cache in this case. */ public function onAfterWrite() { parent::onAfterWrite(); }
public function onAfterWrite() { parent::onAfterWrite(); self::add_members_to_customer_group(); }
function onAfterWrite() { //check for the attributes used so that they can be added to VariationAttributes parent::onAfterWrite(); $this->cleaningUpVariationData(); }
/** * standard SS method * try to finalise order if payment has been made. */ function onAfterWrite() { parent::onAfterWrite(); $order = $this->owner->PaidObject(); if ($order && $order instanceof Order && $order->IsSubmitted()) { $order->tryToFinaliseOrder(); } }