diff --git a/ieducar/intranet/s3_config.php b/ieducar/intranet/s3_config.php index 2853143..c965066 100644 --- a/ieducar/intranet/s3_config.php +++ b/ieducar/intranet/s3_config.php @@ -1,17 +1,21 @@ app->aws->bucketname; -$directory=$GLOBALS['coreExt']['Config']->app->database->dbname.'/'; -$key = $GLOBALS['coreExt']['Config']->app->aws->awsacesskey; -$secretKey = $GLOBALS['coreExt']['Config']->app->aws->awssecretkey; +$config = $GLOBALS['coreExt']['Config']->app; -if (!class_exists('S3')) - require_once 'S3.php'; +$bucket = $config->aws->bucketname; +$directory = $config->database->dbname.'/'; +$key = $config->aws->awsacesskey; +$secretKey = $config->aws->awssecretkey; -//instantiate the class -$s3 = new S3($key, $secretKey); +if (empty($bucket) || empty($key) || empty($secretKey)) { + throw new Exception("Defina as configs AWS."); +} + +if (!class_exists('S3')) { + require_once 'S3.php'; +} +$s3 = new S3($key, $secretKey); $s3->putBucket($bucket, S3::ACL_PUBLIC_READ); + ?> \ No newline at end of file -- libgit2 0.21.2