function restoreArchive($nTime = null, $sChangeComment = "") { if (!$this->exists()) { throw new AnwUnexpectedException("Can't restore an unexisting page"); } if (!$this->isArchive()) { throw new AnwUnexpectedException("Can't restore a non archived page"); } if (!$nTime) { $nTime = time(); } //get new change ID $nChangeType = AnwChange::TYPE_PAGE_REVERT; $sChangeInfo = $this->getTime(); //before touchInfos! $oChange = new AnwChange($nChangeType, $this, $nTime, $sChangeComment, $sChangeInfo); //update some attributes $this->touchInfos($nTime); AnwStorage::transactionStart(); try { //save AnwStorage::restoreArchive($this, $oChange, '_storage_cbk_restoreArchive'); //set non-archive status //notify change $this->notifyChanged(); AnwStorage::transactionCommit(); } catch (AnwException $e) { AnwStorage::transactionRollback(); throw $e; } }