public static function getFileInfo($numericId, $path, $pharPath = null)
 {
     $storage = Storage::getStorageId($numericId);
     $config = \OC::$server->getConfig();
     $home = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/');
     $user = explode("::", $storage)[1];
     $urn = $home . '/' . $user . '/' . $path;
     if ($pharPath != null) {
         $urn = TarParser::PHAR_PROTOCOLE . $urn . $pharPath;
     }
     return array('urn' => $urn, 'user' => $user);
 }
Esempio n. 2
0
 /**
  * get the storage id of the storage for a file and the internal path of the file
  * unlike getPathById this does not limit the search to files on this storage and
  * instead does a global search in the cache table
  *
  * @param int $id
  * @deprecated use getPathById() instead
  * @return array first element holding the storage id, second the path
  */
 public static function getById($id)
 {
     $connection = \OC::$server->getDatabaseConnection();
     $sql = 'SELECT `storage`, `path` FROM `*PREFIX*filecache` WHERE `fileid` = ?';
     $result = $connection->executeQuery($sql, array($id));
     if ($row = $result->fetch()) {
         $numericId = $row['storage'];
         $path = $row['path'];
     } else {
         return null;
     }
     if ($id = Storage::getStorageId($numericId)) {
         return array($id, $path);
     } else {
         return null;
     }
 }
Esempio n. 3
0
 /**
  * Find mounts by numeric storage id
  *
  * @param int $id
  * @return MountPoint[]
  */
 public function findByNumericId($id)
 {
     $storageId = \OC\Files\Cache\Storage::getStorageId($id);
     return $this->findByStorageId($storageId);
 }
Esempio n. 4
0
 /**
  * get the storage id of the storage for a file and the internal path of the file
  * unlike getPathById this does not limit the search to files on this storage and
  * instead does a global search in the cache table
  *
  * @param int $id
  * @deprecated use getPathById() instead
  * @return array first element holding the storage id, second the path
  */
 public static function getById($id)
 {
     $sql = 'SELECT `storage`, `path` FROM `*PREFIX*filecache` WHERE `fileid` = ?';
     $result = \OC_DB::executeAudited($sql, array($id));
     if ($row = $result->fetchRow()) {
         $numericId = $row['storage'];
         $path = $row['path'];
     } else {
         return null;
     }
     if ($id = Storage::getStorageId($numericId)) {
         return array($id, $path);
     } else {
         return null;
     }
 }