Ejemplo n.º 1
0
 /**
  * Get a stream from DSPACE and make it local (cache it)
  * @param Bitstream $bitstream
  * @return mixed
  */
 public static function makeLocal(Bitstream $bitstream)
 {
     $originalName = $bitstream->getName();
     $originalName = str_replace(array(' ', '/'), '_', $originalName);
     $filePath = public_path() . '/resourcecache/' . $originalName;
     if (!file_exists($filePath)) {
         $stream = $bitstream->retrieveStream();
         if (!file_exists(public_path() . '/resourcecache/' . $originalName)) {
             file_put_contents(public_path() . '/resourcecache/' . $originalName, $stream);
         }
     } else {
     }
     return $originalName;
 }