@param int|Folder $folder
@param array $exclude_nodes

@return \Doctrine\DBAL\Driver\Statement
546099
public function getInFolder($folder, array $exclude_nodes = [])
    {
        if ($folder instanceof Folder) {
            $folder = $folder->getId();
        }

        $engine_nodes_table = $this->_class->getTableName();

        $sql = "
            SELECT id
            FROM $engine_nodes_table
            WHERE folder_id = '$folder'
            AND is_active = TRUE
            AND deleted_at IS NULL
        ";

        // Исключение ранее включенных нод.
        foreach ($exclude_nodes as $node_id) {
            $sql .= " AND id != '{$node_id}'";
        }

        $sql .= ' ORDER BY position';

        return $this->_em->getConnection()->query($sql);
    }
995900
public function createFolder($cb, $folder, $parentFolder = null)
    {
        $this->onResponse->push($cb);
        if ($parentFolder) {
            $folder =  $parentFolder . '/' . $folder ;
        }
        $this->writeln(self::TAG_CREATEFOLDER . " CREATE ".$this->escapeString($folder));
    }
606334
private function removeFolderInFileSystem(Folder $folder)
	{
		$folderPath = $folder->getPath(DIRECTORY_SEPARATOR, true);

		$folderExternalPath = $this->getExternalPath() . $folderPath;
		$folderInternalPath = $this->getInternalPath() . $folderPath;

		//remove empty _size folders (or whatever the prefix is); we expect these folders to be empty
		foreach (array($folderExternalPath, $folderInternalPath) as $path) {
			$sizeBase = $path . DIRECTORY_SEPARATOR . self::RESERVED_DIR_SIZE;
			if (is_dir($sizeBase)) {
				foreach (glob($sizeBase . DIRECTORY_SEPARATOR . '*') as $subSize) {
					@rmdir($subSize);
				}
				@rmdir($sizeBase);
			}
		}

		// we are ignoring that one of the folders might not exist
		$resultInternal = @rmdir($folderInternalPath);
		$resultExternal = @rmdir($folderExternalPath);
	}
609784
public function createFolder($folder, $allFolders = FALSE)
    {
        if (substr($folder, -1) != '/') $folder = $folder . '/';
        if (!is_dir($folder)) {
            @mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'.");
        }
    }
931559
public function getSearchQuery($excludedCategories = [])
    {
        $searchQuery = parent::getSearchQuery();

        if ($this->getAttribute() === 'category_ids') {
            $searchQuery = $this->getCategorySearchQuery($excludedCategories);
        }

        return $searchQuery;
    }
920382
public function setRootFolder( string $folder ) : VfsHandler
   {

      if ( ! @\is_dir( $folder ) )
      {
         throw new ArgumentException(
            'folder',
            $folder,
            'The defined VFS root directory not exists!'
         );
      }

      $this->_rootFolder = \rtrim( $folder, '/\\' );

      return $this;

   }
1056965
public static function findOneEntityByCriteria(array $criteria = [], array $exclude = [])
    {
        $class = static::class;

        /** @var EntityRepository $obj_collection */
        $obj_collection = new $class();
        $obj_collection->setLimit(1);

        foreach ($criteria as $k => $v) {
            $obj_collection->addSimpleWhereField($k, $v);
        }

        foreach ($exclude as $k => $v) {
            $obj_collection->addWhereFieldIsNot($k, $v);
        }

        return $obj_collection->getFirstObjectFromCollection();
    }
283827
public Exclude<Scan<T>> getOrCreateExclude()
   {
      Node node = childNode.getOrCreate("exclude");
      Exclude<Scan<T>> exclude = new ExcludeImpl<Scan<T>>(this, "exclude", childNode, node);
      return exclude;
   }
1324705
private function createBothFoldersInFileSystem(FileAbstraction $folder = null)
	{
		if ($folder instanceof File) {
			$folder = $folder->getParent();
		}

		$this->createFolderInFileSystem($this->getExternalPath(), $folder);
		$this->createFolderInFileSystem($this->getInternalPath(), $folder);
	}
885914
public function runInFolder($folder = null, $tasks = [])
    {
        // Convert to array
        if (!is_array($tasks)) {
            $tasks = [$tasks];
        }

        // Prepend folder
        array_unshift($tasks, 'cd '.$this->paths->getFolder($folder));

        return $this->run($tasks);
    }
923736
public function deleteFolder($folder)
    {
        $folder = trim($folder, '/') . '/';

        // Fail if this pseudo directory key already exists
        if (!$this->isDir($folder)) {
            $path = $this->bucket . "/" . $folder;
            throw new ExceptionStorage("Directory {$path} Not found or Not Is Diretory", static::E_NOT_IS_DIR);
        }

        return (bool) $this->clientS3->deleteMatchingObjects($this->bucket, $folder);
    }
397016
final private static function getDirectoryStructureDo($relativePath, $rootDirectory, $exclude3rdParty)
    {
        $thisRoot = $rootDirectory;
        if ($relativePath !== '') {
            $thisRoot .= '/'.$relativePath;
        }
        $subDirs = array();
        $hDir = @opendir($thisRoot);
        if ($hDir === false) {
            throw new \Exception("Unable to open directory $rootDirectory");
        }
        while (($entry = @readdir($hDir)) !== false) {
            if ($entry[0] === '.') {
                continue;
            }
            $fullPath = $thisRoot.'/'.$entry;
            if (!is_dir($fullPath)) {
                continue;
            }
            if ($exclude3rdParty) {
                if (($entry === 'vendor') || preg_match('%/libraries/3rdparty$%', $fullPath)) {
                    continue;
                }
            }
            $subDirs[] = $entry;
        }
        @closedir($hDir);
        $result = array();
        foreach ($subDirs as $subDir) {
            $rel = ($relativePath === '') ? $subDir : "$relativePath/$subDir";
            $result = array_merge($result, static::getDirectoryStructureDo($rel, $rootDirectory, $exclude3rdParty));
            $result[] = $rel;
        }

        return $result;
    }
1140604
public static function readDir($dir, $exclude = ".|..|.svn|.git", $recursive = false)
    {
        $file_list_array = array();
        $base_path = $dir;
        $exclude_array = explode("|", $exclude);
        $exclude_array = array_unique(array_merge($exclude_array, array('.', '..')));

        if ($recursive) {
            foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)) as $new_file) {
                if ($new_file->isDir()) continue;
                $object = str_replace($base_path, '', $new_file);
                if (!in_array(strtolower($object), $exclude_array)) {
                    $object = ltrim($object, '/');
                    if (is_file($new_file)) {
                        $key = md5($new_file . $object, false);
                        $file_list_array[$key] = array('path' => $new_file, 'file' => $object,);
                    }
                }
            }
        } else if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                if (!in_array(strtolower($file), $exclude_array)) {
                    $new_file = $dir . '/' . $file;
                    $object = $file;
                    $object = ltrim($object, '/');
                    if (is_file($new_file)) {
                        $key = md5($new_file . $object, false);
                        $file_list_array[$key] = array('path' => $new_file, 'file' => $object,);
                    }
                }
            }
            closedir($handle);
        }
        return $file_list_array;
    }
849328
public function getStatus(ExtendedFolderInterface $folder)
    {
        $status = 0;
        foreach ($this->findStatusByFolder($folder) as $folderStatus) {
            $status |= (int) $folderStatus;
        }

        return $status;
    }
59455
public static function copyResources($sourceDirectory, $destinationDirectory, $excludeFiles = array()){
        //copy the resources
        $exclude = array_merge($excludeFiles, array('.', '..', '.svn'));
        $success = true;
        foreach(scandir($sourceDirectory) as $file){
            if(!in_array($file, $exclude)){
                $success &= tao_helpers_File::copy(
                    $sourceDirectory.$file, $destinationDirectory.$file, true
                );
            }
        }
        return $success;
    }
1173654
public function createIndex($moduleName, $pageId, $exclude = array(),
                                $_defaultPath = self::FOLDER_PATH)
    {
        $this->tmpLogs = '';

        $pageContent = '';
        $folderPath = $_defaultPath . $moduleName;
        $lucenePath = $folderPath. '/' .self::FOLDER_NAME;

        // check if the module exists
        if(file_exists($folderPath)) {
            // check if the path exists
            if(!file_exists($lucenePath)) {

                $this->createDir($lucenePath);

                $this->tmpLogs = $this->createIndexForPages($lucenePath, $pageId, $exclude);
            }
            else {
                $this->changePermission($lucenePath);

                $this->tmpLogs = $this->createIndexForPages($lucenePath, $pageId, $exclude);

            }
        }


        return $this->tmpLogs;
    }
864256
public function transform($folder, array $params = array())
    {
        if (!$folder instanceof FolderInterface) {
            throw new TransformerParameterTypeException();
        }
        $facade = $this->newFacade();
        $facade->folderId = $folder->getId();
        $facade->name = $this->multiLanguageChoiceManager->choose($folder->getNames());
        $facade->createdAt = $folder->getCreatedAt();
        $facade->updatedAt = $folder->getUpdatedAt();
        if ($folder->getParent() instanceof FolderInterface) {
            $facade->parentId = $folder->getParent()->getId();
        } else {
            $facade->parentId = FolderInterface::ROOT_PARENT_ID;
        }
        $facade->siteId = $folder->getSiteId();

        return $facade;
    }