@param string $containerName
@param string $fileName
@param string|null $relativePath

@return bool
550237
public function deleteFile($containerName, $fileName, $relativePath)
    {
        $fullFileName = $this->getFullFileName($containerName, $fileName, $relativePath);

        return $this->filesystem->delete($fullFileName);
    }
760285
protected function getLockPath(FilePath $filePath)
    {
        $name = $filePath->getName();
        $relativeLockPath = $filePath->getParentPath()->appendFile('.' . $name . '.lock');

        return $relativeLockPath;
    }
1315280
public function handle($absolutePath, $relativePath)
    {
        if (!$this->itemSource) {
            throw new \common_Exception('Missing required parameter: item source');
        }

        // store locally, in a safe directory
        $safePath = '';
        if (dirname($relativePath) !== '.') {
            $safePath = str_replace('../', '', dirname($relativePath)) . '/';
        }

        $info = $this->itemSource->add($absolutePath, basename($absolutePath), $safePath);
        \common_Logger::i('Asset file \'' . $absolutePath . '\' copied.');
        return $info;
    }
511827
public function loadContainer($containerPath)
    {
        $containerPath = realpath($containerPath);

        if (false === $containerPath) {
            return false;
        }

        $this->container = new ContainerBuilder();

        try {
            $loader = new XmlFileLoader($this->container, new FileLocator(dirname($containerPath)));
            $loader->load(basename($containerPath));

            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
382326
@Override
    protected boolean hasChildren(final String relative) throws IOException {
        ZipFile zip = createZipFile();
        if (null == zip) {
            return false;
        }
        Enumeration<? extends ZipEntry> entries = zip.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = entries.nextElement();
            if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) {
                return true;
            }
        }

        zip.close();
        return false;
    }
1101867
public function createDocument(TransferInterface $transfer, $containerName)
    {
        $this->checkTransferMethods($transfer);

        if ($transfer->getFileName() === null) {
            throw new NoFileNameSetException(
                'No filename defined for Transfer.'
            );
        }

        $fileName = $transfer->getFileName();
        $relativePath = $transfer->getRelativePath();

        if (!$this->documentExists($transfer, $containerName)) {

            $fullFilePath = $this->createFullFilePath($fileName);
            $this->renderFile($transfer, $containerName, $fullFilePath);

            $fileInfo = new \SplFileInfo($fullFilePath);

            $this->fileUploadFacade->saveFile($containerName, $fileInfo, $relativePath);
        }

        return $transfer;
    }
204822
public function deleteDocument(TransferInterface $transfer, $containerName)
    {
        $this->checkTransferMethods($transfer);

        $fileName = $transfer->getFileName();
        $relativePath = $transfer->getRelativePath();

        return $this->fileUploadFacade->deleteFile($containerName, $fileName, $relativePath);
    }
922208
protected function copyContentFromThemeToSite($sitePath, $relativeThemePath)
    {
        if ($this->fs->exists($sitePath.'/'.$relativeThemePath) === false) {
            throw new \RuntimeException('The theme has not been installed correctly.');
        }

        $finder = new Finder();
        $finder->in($sitePath.'/'.$relativeThemePath.'/src/content')
            ->exclude(['assets'])
            ->files();

        foreach ($finder as $file) {
            $this->fs->copy($file->getRealpath(), $sitePath.'/src/content/'.$file->getRelativePathname(), true);
        }
    }
907517
public function getSourceFile(string $relativeFilename): string
    {
        $filename = '';
        if (!empty($this->config['source_file_paths']) && is_array($this->config['source_file_paths'])) {
            foreach ($this->config['source_file_paths'] as $path) {
                $filename = "$path/$relativeFilename";
                if (file_exists("$path/$relativeFilename")) {
                    $filename = "$path/$relativeFilename";
                    break;
                }
            }
        }

        if (!$filename) {
            throw new Exception\RuntimeException(
                "Source file \"$relativeFilename\" not found in configuration."
            );
        }

        return $filename;
    }
646732
public function getViewFromAnnotation($callerName, $relativePath)
    {
        $method = str_replace(__CLASS__ . '::', '', $callerName);
        if (!method_exists(__CLASS__, $method)) {
            return '';
        }

        $parser = new ViewParser();
        $reflection = new \ReflectionClass($this);
        $method = $reflection->getMethod($callerName);

        // checks the doc header of the class
        $tokens = $parser->parse($method->getDocComment());

        /**
         * @var \chilimatic\lib\view\AbstractView $class
         */
        $class = new $tokens[0];

        if ($relativePath && $tokens[1]) {
            $class->setTemplateFile($relativePath . '/' . $tokens[1]);
        }

        return $class;
    }
1264451
public function isApplicable($relativePath)
    {
        $xincluded = array();
        /** @var Element $xincludeElement */
        foreach ($this->getQtiItem()->getComposingElements('oat\taoQtiItem\model\qti\Xinclude') as $xincludeElement) {
            $xincluded[] = $xincludeElement->attr('href');
            \common_Logger::i("Xinclude component found in resource '" .
                $this->getQtiItem()->getIdentifier() . "' with href '" . $xincludeElement->attr('href') . "'.");
        }

        return in_array($relativePath, $xincluded);
    }
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;
    }
1092635
public function readFileStream($containerName, $fileName, $relativePath)
    {
        return $this->fileUploadFacade->readFileStream($containerName, $fileName, $relativePath);
    }
9245
public function send_relative_file($relativepath) {
        if ($this->repository && $this->repository->supports_relative_file()) {
            $relativepath = clean_param($relativepath, PARAM_PATH);
            $this->repository->send_relative_file($this, $relativepath);
        } else {
            send_file_not_found();
        }
    }
335113
public function isApplicable($relativePath)
    {
        $xincluded = array();
        /** @var Element $xincludeElement */
        foreach ($this->getQtiModel()->getComposingElements('oat\taoQtiItem\model\qti\Xinclude') as $xincludeElement) {
            $xincluded[] = $xincludeElement->attr('href');
            \common_Logger::i("Xinclude component found in resource '" .
                $this->getQtiModel()->getIdentifier() . "' with href '" . $xincludeElement->attr('href') . "'.");
        }

        return (!empty($this->sharedStorage) && in_array($relativePath, $xincluded));
    }
1126322
public function isApplicable($relativePath)
    {
        //adapt the file path before comparing them to expected files
        $relativePathAdapted = preg_replace('/^\.\//', '', $relativePath);
        if ($this->portableItemParser->hasPortableElement()
            && $this->portableItemParser->isPortableElementAsset($relativePathAdapted)
        ) {
            return true;
        }
        return false;
    }
802694
public function addPath($relativePath)
    {
        if ($relativePath != '/' &&
            is_string($relativePath) &&
            strlen($relativePath) > 0
        ) {
            // Add a leading slash if needed
            if ($relativePath[0] !== '/' &&
                substr($this->path, -1, 1) !== '/'
            ) {
                $relativePath = '/' . $relativePath;
            }

            $this->setPath($this->path . $relativePath);
        }
    }