Example #1
0
 /**
  * Triggered before the Page is stored to filesystem.
  *
  * @return void
  */
 public function onBeforeUpdate()
 {
     if ($this->page->getAttribute('is_hidden')) {
         return;
     }
     // Url hasn't change
     if (!$this->hasUrlChanged()) {
         return;
     }
     // Parameters and regex are not supported
     if ($this->newUrlContainsParams()) {
         return;
     }
     // Don't create a redirect loop; that would be silly ;-)
     if ($this->getNewUrl() === $this->getOriginalUrl()) {
         return;
     }
     $this->createRedirect();
 }