getEnvVar() static public method

static public getEnvVar ( $var )
Esempio n. 1
0
 public static function createRepo($repo)
 {
     $repos = ['Local' => 'LocalFlyRepository', 'Rackspace' => 'RackspaceFlyRepository', 'Copy' => 'CopyFlyRepository', 'Dropbox' => 'DropboxFlyRepository', 'Azure' => 'AzureFlyRepository', 'S3V3' => 'S3V3FlyRepository'];
     $repo = ucfirst(strtolower($repo));
     $conf = function ($var) {
         return Helpers::getEnvVar($var);
     };
     if (isset($repos[$repo])) {
         $selected_repo = 'Locker\\Repository\\File\\' . $repos[$repo];
         return new $selected_repo($conf);
     } else {
         throw new \Exception('Valid `FS_REPO` not specified in ".env.' . \App::environment() . '.php". Valid values include: "' . implode('", "', array_keys($repos)) . '". You provided "' . $repo . '".');
     }
 }
 public function up()
 {
     $uploads = Helpers::getEnvVar('FS_LOCAL_ENDPOINT');
     $LRSs = $this->getDirectores($uploads);
     // Gets the attachments.
     $attachments = [];
     foreach ($LRSs as $lrs) {
         $attachments = array_merge($attachments, array_map(function ($dir) use($uploads, $lrs) {
             return $uploads . '/' . $lrs . '/attachments/' . $dir;
         }, $this->getDirectores($uploads . '/' . $lrs . '/attachments')));
     }
     // Migrates the attachments.
     foreach ($attachments as $attachment) {
         $file = $attachment . '/' . scandir($attachment)[2];
         $ext = pathinfo($file, PATHINFO_EXTENSION);
         file_put_contents($attachment . '.' . $ext, file_get_contents($file));
     }
     echo 'Migrated ' . count($attachments) . " attachments." . PHP_EOL;
 }
<?php

use Locker\Helpers\Helpers;
return array('driver' => 'file', 'lifetime' => 120, 'expire_on_close' => false, 'files' => Helpers::getEnvVar('SESSION_FILESTORE'), 'connection' => null, 'table' => 'sessions', 'lottery' => array(2, 100), 'cookie' => 'laravel_session', 'path' => '/', 'domain' => null, 'secure' => false);
 public function tearDown()
 {
     parent::tearDown();
     $dir = Helpers::getEnvVar('FS_LOCAL_ENDPOINT') . '/' . $this->lrs->_id;
     $this->deleteDirectory($dir);
     (new \Statement())->where('lrs_id', new \MongoId($this->lrs->_id))->delete();
 }
 public function tearDown()
 {
     parent::tearDown();
     $dir = Helpers::getEnvVar('LOCAL_FILESTORE') . '/' . $this->lrs->_id;
     $this->deleteDirectory($dir);
     (new \Statement())->where('lrs._id', $this->lrs->_id)->delete();
 }
 /**
  * Gets the directory for attachments with the given options.
  * @param Options $opts
  * @return String
  */
 private function getDir(Options $opts)
 {
     return Helpers::getEnvVar('LOCAL_FILESTORE') . '/' . $opts->getOpt('lrs_id') . '/attachments/';
 }
 public function getContentDir()
 {
     $dir = Helpers::getEnvVar('LOCAL_FILESTORE') . '/' . $this->lrs . '/documents/';
     if (!file_exists($dir)) {
         mkdir($dir, 0774, true);
     }
     return $dir;
 }