示例#1
0
文件: Module.php 项目: Liv1020/cms
 /**
  * @return CheckComponent[]
  */
 public function loadChecksComponents()
 {
     $result = [];
     $dir = new Dir($this->basePath . "/" . static::CHECKS_DIR_NAME);
     if ($dir->isExist()) {
         if ($files = $dir->findFiles()) {
             foreach ($files as $file) {
                 $className = $this->checkNamespace . "\\" . $file->getFileName();
                 if (class_exists($className)) {
                     $component = new $className();
                     if (is_subclass_of($component, CheckComponent::className())) {
                         $result[$component->className()] = $component;
                     }
                 }
             }
         }
     }
     return $result;
 }
示例#2
0
 /**
  * Проверка папка пустая или нет
  * @param $dirPath
  */
 protected function _checkIsEmptyDir($dirPath)
 {
     if ($dirPath instanceof Dir) {
         $dir = $dirPath;
     } else {
         $dir = new Dir($dirPath);
     }
     if ($dir->findFiles() || $dir->findDirs()) {
         $this->stdoutN('Папка assets (' . $dir->getPath() . ') не очищена. В ней остались файлы');
     } else {
         $this->stdoutN('Папка assets (' . $dir->getPath() . ') очищена.');
     }
 }