protect() публичный Метод

Protect the folder by removing the .public file
public protect ( )
Пример #1
0
 /**
  * Protect a folder
  *
  * @throws InternalServerErrorException
  */
 public function protect()
 {
     if (!is_dir(TL_ROOT . '/' . $this->intId)) {
         throw new InternalServerErrorException('Resource "' . $this->intId . '" is not a directory.');
     }
     // Protect or unprotect the folder
     if (file_exists(TL_ROOT . '/' . $this->intId . '/.public')) {
         $objFolder = new \Folder($this->intId);
         $objFolder->protect();
         $this->import('Automator');
         $this->Automator->generateSymlinks();
         $this->log('Folder "' . $this->intId . '" has been protected', __METHOD__, TL_FILES);
     } else {
         $objFolder = new \Folder($this->intId);
         $objFolder->unprotect();
         $this->import('Automator');
         $this->Automator->generateSymlinks();
         $this->log('The protection from folder "' . $this->intId . '" has been removed', __METHOD__, TL_FILES);
     }
     $this->redirect($this->getReferer());
 }