Contao\DC_Folder::protect PHP Метод

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

Protect a folder
public protect ( )
    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());
    }