public function __construct($root = null, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS) { // Get root path $root = $this->findRoot($root); // Override permissions with config $permissions = \Config::inst()->get(get_class($this), 'file_permissions'); parent::__construct($root, $writeFlags, $linkHandling, $permissions); // Configure server $this->configureServer(); }
/** * @param string $rootDir * @param int $writeFlags * @param int $linkHandling * @param array $permissions * @throws InstantiationException */ public function __construct($rootDir = null, $writeFlags = LOCK_EX, $linkHandling = parent::DISALLOW_LINKS, $permissions = []) { static::$permissions = ['file' => ['public' => 0744, 'private' => 0700], 'dir' => ['public' => 0755, 'private' => 0700]]; try { parent::__construct($rootDir, $writeFlags, $linkHandling, $permissions); } catch (Error $ex) { throw new InstantiationException("AdapterLocal could not be initalized.", $ex); } catch (Exception $ex) { throw new InstantiationException("AdapterLocal could not be initalized.", $ex); } }
public function __construct($root = null, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS) { // Get root path if (!$root) { // Empty root will set the path to assets $root = ASSETS_PATH; } elseif (strpos($root, './') === 0) { // Substitute leading ./ with BASE_PATH $root = BASE_PATH . substr($root, 1); } elseif (strpos($root, '../') === 0) { // Substitute leading ./ with parent of BASE_PATH, in case storage is outside of the webroot. $root = dirname(BASE_PATH) . substr($root, 2); } // Override permissions with config $permissions = \Config::inst()->get(get_class($this), 'file_permissions'); parent::__construct($root, $writeFlags, $linkHandling, $permissions); }
/** * Consructor * * @param array $backendConfig * * @throws \Exception if root folder is not writable */ public function __construct(array $backendConfig) { $this->backendConfig = $backendConfig; if (!isset($backendConfig['root']) || empty($backendConfig['root'])) { $baseUrl = $backendConfig['baseUrl']; $baseUrl = preg_replace("|^http(s)?://[^/]+|i", "", $baseUrl); $backendConfig['root'] = Path::combine(Utils::getRootPath(), Utils::decodeURLParts($baseUrl)); } if (!is_dir($backendConfig['root'])) { @mkdir($backendConfig['root'], $backendConfig['chmodFolders'], true); if (!is_dir($backendConfig['root'])) { throw new FolderNotFoundException(sprintf('The root folder of backend "%s" not found (%s)', $backendConfig['name'], $backendConfig['root'])); } } if (!is_writable($backendConfig['root'])) { throw new AccessDeniedException(sprintf('The root folder of backend "%s" is not writable (%s)', $backendConfig['name'], $backendConfig['root'])); } parent::__construct($backendConfig['root']); }
/** * Creates a temporary directory * * @param string $prefix * @param null $dir */ public function __construct($prefix = '', $dir = null) { $maxTries = 1024; if (empty($dir)) { $dir = sys_get_temp_dir(); } else { $dir = rtrim($dir, $this->pathSeparator); } do { $path = $dir . $this->pathSeparator . uniqid($prefix, true); if (!file_exists($path) && mkdir($path, 0700)) { break; } $maxTries--; } while ($maxTries > 0); if ($maxTries == 0) { throw new \RuntimeException("Couldn't create temporary directory, giving up"); } parent::__construct($path); }
/** * {@inheritdoc} */ public function __construct($root) { parent::__construct($root, 0, self::DISALLOW_LINKS); }
/** * @inheritdoc */ public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS) { parent::__construct($root, $writeFlags, $linkHandling); }
/** * @param string $root * @param string $publicUrlBase * @param int $writeFlags * @param array|int $linkHandling * @param array $permissions */ public function __construct($root, $publicUrlBase = null, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) { $this->publicUrlBase = $publicUrlBase; parent::__construct($root, $writeFlags, $linkHandling, $permissions); }
/** * Constructor. * * @param string $root * @param int $writeFlags * @param int $linkHandling * @param array $permissions */ public function __construct($root, $writeFlags = 0, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) { parent::__construct($root, $writeFlags, $linkHandling, $permissions); }
public function __construct($root, $writeFlags, $linkHandling, array $permissions) { $this->model = new FilesystemModel($this); parent::__construct($root, $writeFlags, $linkHandling, $permissions); }
/** * {@inheritdoc} */ public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) { $root = Path::canonicalize($root); parent::__construct($root, $writeFlags, $linkHandling, $permissions); }
public function __construct($root = null, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS) { // Override permissions with config $permissions = \Config::inst()->get(get_class($this), 'file_permissions'); parent::__construct($root ?: ASSETS_PATH, $writeFlags, $linkHandling, $permissions); }