Get all storage file informations for a given ID.

@param integer $fileId
@throws NotFoundHttpException
@return array
@since 1.2.0
333659
public function actionFileInfo($id)
    {
        $model = StorageFile::find()->where(['id' => $id])->with(['user', 'images', 'tags'])->one();
        
        if (!$model) {
            throw new NotFoundHttpException("Unable to find the given storage file.");
        }
        
        return $model->toArray([], ['user', 'file', 'images', 'source', 'tags']);
    }
1034128
public function getFilesArrayItem($fileId)
    {
        return isset($this->filesArray[$fileId]) ? $this->filesArray[$fileId] : false;
    }
1189723
private function includeFileForId($id)
	{
		$fileName = $this->getFilename($id);

		if (\file_exists($fileName)) {
			return include $fileName;
		}

		return null;
	}
862349
protected function isGranted($fileID)
    {
        // Since permissions are applied to the non-variant only,
        // map back to the original file before checking
        $parsedFileID = $this->getProtectedResolutionStrategy()->stripVariant($fileID);

        // Make sure our File ID got understood
        if ($parsedFileID && $originalID = $parsedFileID->getFileID()) {
            $session = Controller::curr()->getRequest()->getSession();
            $granted = $session->get(self::GRANTS_SESSION) ?: array();
            return !empty($granted[$originalID]);
        }

        // Our file ID didn't make sense
        return false;
    }
1340812
public function downloadFile($fileId)
    {
        $file = $this->getFile($fileId);
        $options = [
            CURLOPT_HEADER => 0,
            CURLOPT_HTTPGET => 1,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(),
        ];

        return $this->executeCurl($options);
    }
1233745
public function bulkUploadAction($folderId)
    {
        $em = $this->getDoctrine()->getManager();

        /* @var Folder $folder */
        $folder = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($folderId);

        return ['folder' => $folder];
    }
504520
public function link($fileId)
    {
        $links = session(static::SESSION_KEY, []);

        $links[ $fileId ] = true;

        session()->put(static::SESSION_KEY, $links);

        return $this;
    }
1192196
public function get($id)
    {
        $file_name = $this->getFileName($id);

        if (!is_file($file_name) || !is_readable($file_name)) {
            return false;
        }

        $lines    = file($file_name);
        $lifetime = array_shift($lines);
        $lifetime = (int) trim($lifetime);

        if ($lifetime !== 0 && $lifetime < time()) {
            @unlink($file_name);
            return false;
        }
        $serialized = join('', $lines);
        $data       = unserialize($serialized);
        return $data;
    }
486023
public function get_files() {
        // The files array can contain stored file ids, so we need to get instances if asked.
        foreach ($this->files as $id => $listfile) {
            if (is_numeric($listfile)) {
                $fs = get_file_storage();

                if ($file = $fs->get_file_by_id($id)) {
                    $this->files[$id] = $file;
                } else {
                    unset($this->files[$id]); // Index is out of date and referencing a file that does not exist.
                }
            }
        }

        return $this->files;
    }
1190049
public function saveFileToTmpDir($fileId)
    {
        $baseTmpPath = $this->getBaseTmpPath();

        $uploader = $this->uploaderFactory->create(['fileId' => $fileId]);
        $uploader->setAllowedExtensions($this->getAllowedExtensions());
        $uploader->setAllowRenameFiles(true);
        $uploader->setFilesDispersion(true);

        $result = $uploader->save($this->mediaDirectory->getAbsolutePath($baseTmpPath));

        if (!$result) {
            throw new LocalizedException(
                __('File can not be saved to the destination folder.')
            );
        }
        /**
         * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
         */
        $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']);
        $result['path'] = str_replace('\\', '/', $result['path']);
        $result['url'] =  $this->getBaseUrl() . $this->getFilePath($baseTmpPath, $result['file']);

        if (isset($result['file'])) {
            try {
                $relativePath = rtrim($baseTmpPath, '/') . '/' . ltrim($result['file'], '/');
                $this->coreFileStorageDatabase->saveFile($relativePath);
            } catch (\Exception $e) {
                $this->logger->critical($e);
                throw new LocalizedException(
                    __('Something went wrong while saving the file(s).')
                );
            }
        }

        return $result;
    }
1293692
public function all($bucketId)
    {
        $this->ensureAuthorized();
        $list = array();
        $nexFile = null;
        do {
            $response = $this->client->b2ListFileNames($this->apiURL, $this->token, $bucketId, $nexFile, 1000);
            if ($response->isOk()) {
                $files = $response->get('files');
                $nexFile = $response->get('nextFileName');
                if (!is_null($files)) {
                    array_merge($list, $files);
                }
                if (is_null($nexFile)) {
                    return $list;
                }
            }
        } while (true);

        return $list;
    }
1054967
private function getPage($pageId)
    {
        if (!$page = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:Page')->findOneBy(array('id' => $pageId, 'page_type' => 'page')))
        {
            throw new NotFoundHttpException(
                $this->get('translator')->trans('fulgurio.lightcms.page_not_found', array(), 'admin')
            );
        }
        return $page;
    }
463161
public function openDownloadStream($id)
    {
        $file = $this->collectionWrapper->findFileById($id);

        if ($file === null) {
            throw FileNotFoundException::byId($id, $this->getFilesNamespace());
        }

        return $this->openDownloadStreamByFile($file);
    }
720406
public function unlink($fileId)
    {
        if ( ! $this->isIdLinked($fileId)) {
            return $this;
        }

        $links = session(static::SESSION_KEY, []);

        unset($links[ $fileId ]);

        session()->put(static::SESSION_KEY, $links);

        return $this;
    }
615749
public function getFileLink($fileId, $target)
    {
        $file = Yii::$app->storage->getFile($fileId);
        if ($file) {
            $file->setTarget($target);
        }
        return $file;
    }
345327
public function getFromId($FileUploadId)
    {
        $rest = $this->callService('GET', self::API_UPLOAD . $FileUploadId);

        return $rest->getModel(models\FileSystem\FileUpload::class);
    }
999294
public function getFileSetIDs()
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $rows = $db->fetchAll('select fsID from FileSetFiles where fID = ?', [$this->getFileID()]);
        $ids = array_map('intval', array_map('array_pop', $rows));

        return $ids;
    }