Пример #1
0
 /**
  * Check file system path
  *
  * @param   string $path
  * @param   bool $recursive
  * @param   bool $existence
  * @param   string $mode
  * @return  bool
  */
 protected function _checkPath($path, $recursive, $existence, $mode)
 {
     $res = true;
     $fullPath = dirname(AO::getRoot()) . $path;
     if ($mode == self::MODE_WRITE) {
         $setError = false;
         if ($existence) {
             if (!is_writable($fullPath)) {
                 $setError = true;
             }
         } else {
             if (file_exists($fullPath) && !is_writable($fullPath)) {
                 $setError = true;
             }
         }
         if ($setError) {
             $this->_getInstaller()->getDataModel()->addError(AO::helper('install')->__('Path "%s" must be writable', $fullPath));
             $res = false;
         }
     }
     if ($recursive && is_dir($fullPath)) {
         foreach (new DirectoryIterator($fullPath) as $file) {
             if (!$file->isDot() && $file->getFilename() != '.svn' && $file->getFilename() != '.htaccess') {
                 $res = $res && $this->_checkPath($path . DS . $file->getFilename(), $recursive, $existence, $mode);
             }
         }
     }
     return $res;
 }
Пример #2
0
 public function getAppDir()
 {
     return $this->getDataSetDefault('app_dir', AO::getRoot());
 }