Example #1
0
 /**
  * @throws AnwUnexpectedException
  */
 protected function doUpdate($nChangeType, $sChangeComment = "", $nTime = null, $sChangeInfo = "", $bClearCachedOutputForPageGroupsLinking = true)
 {
     if ($this->isArchive()) {
         throw new AnwUnexpectedException("An archive can't be updated");
     }
     if (!$this->exists()) {
         throw new AnwUnexpectedException("Can't update an unexisting page");
     }
     if (!$nTime) {
         $nTime = time();
     }
     //update some attributes
     $this->touchInfos($nTime);
     //get new change ID
     $oChange = new AnwChange($nChangeType, $this, $nTime, $sChangeComment, $sChangeInfo);
     AnwStorage::transactionStart();
     try {
         //save
         $this->getPageGroup()->update();
         //update pagegroup
         AnwStorage::updatePage($this, $oChange);
         //notify change
         $this->notifyChanged($bClearCachedOutputForPageGroupsLinking);
         AnwStorage::transactionCommit();
     } catch (AnwException $e) {
         AnwStorage::transactionRollback();
         throw $e;
     }
 }