Exemplo n.º 1
0
 public function testRegistersStreamWrapper()
 {
     StreamWrapper::register($this->client);
     $this->assertContains('s3', stream_get_wrappers());
     // Ensure no error is thrown for registering twice
     StreamWrapper::register($this->client);
 }
 public function registerStreamWrapper($protocol = "s3")
 {
     static $count = 0;
     if ($protocol === null) {
         $count++;
         $protocol = sprintf("s3f-%d", $count);
     }
     if (isset(self::$registeredWrappers[$protocol])) {
         if (self::$registeredWrappers[$protocol] === $this) {
             return $protocol;
         }
         throw new \LogicException("Protocol {$protocol}:// is already registered to another s3 resource");
     }
     StreamWrapper::register($this->s3Client, $protocol);
     self::$registeredWrappers[$protocol] = $this;
     return $protocol;
 }
Exemplo n.º 3
0
 /**
  * Register the Amazon S3 stream wrapper and associates it with this client object
  *
  * @return self
  */
 public function registerStreamWrapper()
 {
     StreamWrapper::register($this);
     return $this;
 }
Exemplo n.º 4
0
 public function stream_write($data)
 {
     $this->alter();
     return parent::stream_write($data);
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function url_stat($path, $flags)
 {
     $this->setUri($path);
     return parent::url_stat($path, $flags);
 }
Exemplo n.º 6
0
 /**
  * Register a new stream wrapper who overwrite the Amazon S3 stream wrapper with this client instance.
  * @param string $repositoryId
  * @return $this|void
  */
 public function registerStreamWrapper($repositoryId)
 {
     /* S3Client + s3 protocol +  cacheInterface */
     StreamWrapper::register($this, "s3." . $repositoryId, new s3CacheService());
 }
Exemplo n.º 7
0
{
    if (substr_compare($class, ENTITYNS, 0, strlen(ENTITYNS)) == 0) {
        $path = __DIR__ . "/entities";
        $toks = explode("\\", $class);
        foreach ($toks as $item) {
            $path = $path . "/" . $item;
        }
        $path = $path . ".php";
        if (file_exists($path)) {
            include $path;
        }
        return;
    }
    if (substr_compare($class, RSR, 0, strlen(RSR)) == 0) {
        $toks = explode("\\", $class);
        include __DIR__ . "/" . $toks[2] . "/" . $toks[3] . ".php";
        return;
    }
    $start = strlen($class) - strlen("Controller");
    if (substr_compare($class, "Controller", $start) == 0) {
        include __DIR__ . "/controllers/" . $class . ".php";
        return;
    }
}
spl_autoload_register('MyAutoLoader');
date_default_timezone_set('UTC');
$credentials = new Credentials('AKIAJIYBZPTDIRPEDJRQ', 'vbJnztNWV1Aa/kqBax31EocVnv8ZvW0Q7ZYgzTtK');
// Instantiate an Amazon S3 client.
$s3 = new S3Client(['version' => 'latest', 'region' => 'us-east-1', 'credentials' => $credentials]);
\Aws\S3\StreamWrapper::register($s3);