public function initRepository() { require_once $this->getBaseDir() . "/aS3StreamWrapper/lib/wrapper/aS3StreamWrapper.class.php"; if (!in_array("s3", stream_get_wrappers())) { $wrapper = new aS3StreamWrapper(); $wrapper->register(array('protocol' => 's3', 'acl' => AmazonS3::ACL_OWNER_FULL_CONTROL, 'key' => $this->repository->getOption("API_KEY"), 'secretKey' => $this->repository->getOption("SECRET_KEY"), 'region' => $this->repository->getOption("REGION"))); } if (is_array($this->pluginConf)) { $this->driverConf = $this->pluginConf; } else { $this->driverConf = array(); } $path = $this->repository->getOption("PATH"); $recycle = $this->repository->getOption("RECYCLE_BIN"); ConfService::setConf("PROBE_REAL_SIZE", false); $wrapperData = $this->detectStreamWrapper(true); $this->wrapperClassName = $wrapperData["classname"]; $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId(); if ($recycle != "") { RecycleBinManager::init($this->urlBase, "/" . $recycle); } }
// // <?php // $testCredentials = array('key' => 'your key id', 'secretKey' => 'your secret key', 'region' => 'us-west-1'); // $publicBucket = 'yourpublicbucket'; // $privateBucket = 'yourprivatebucket'; // // ** DO NOT ** TEST WITH BUCKETS YOU CARE ABOUT! USE NEW BUCKET NAMES! This code may append additional strings // to your bucket names to make more bucket names for tests of rename() and so on. // // If you don't have your keys yet, go make an Amazon Web Services account. // Don't specify an acl setting as we test it both ways here. require './aS3StreamWrapperTestSettings.php'; $wrapper = new aS3StreamWrapper(); // Files we make with this protocol default to private $privateOptions = array_merge($testCredentials, array('protocol' => 's3private', 'acl' => AmazonS3::ACL_PRIVATE)); $wrapper->register($privateOptions); // Files we make with this protocol default to public $publicOptions = array_merge($testCredentials, array('protocol' => 's3public', 'acl' => AmazonS3::ACL_PUBLIC)); $wrapper->register($publicOptions); $content = "This is some awesome content for you."; $passCount = 0; $failCount = 0; echo "Cleaning up previous run\n"; @recursiveRemove("s3private://{$privateBucket}"); @recursiveRemove("s3public://{$publicBucket}"); @recursiveRemove("s3private://{$privateBucket}-aux"); @recursiveRemove("s3private://{$privateBucket}-aux2"); test(mkdir("s3private://{$privateBucket}"), true, "mkdir of private test bucket"); test(mkdir("s3public://{$publicBucket}"), true, "mkdir of public test bucket"); // Demonstrate that we have support for default ACLs at the protocol level file_put_contents("s3public://{$publicBucket}/public.txt", $content);