/** * Constructs a new memory file system. * * @param string $scheme File scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param string $root Root path for file system. */ public function __construct($scheme, MOXMAN_Util_Config $config, $root) { parent::__construct($scheme, $config, $root); $this->entries = array(); $this->pathLookup = array(); $this->addEntry($root, array("isFile" => false)); }
/** * Constructs a new LocalFileSystem. * * @param string $scheme File scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param string $root Root path for file system. */ public function __construct($scheme, MOXMAN_Util_Config $config, $root) { parent::__construct($scheme, $config, $root); // Force the root path to an absolute path $this->rootPath = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $this->rootPath); // Get wwwroot from config or resolve it, remove trailing slash. $wwwroot = preg_replace('/\\/$/', '', $config->get("filesystem.local.wwwroot")); if (!$wwwroot) { $sitePaths = MOXMAN_Util_PathUtils::getSitePaths(); $wwwroot = $sitePaths["wwwroot"]; } // If rootpath isn't within the resolved wwwroot then resolve the rootpath if (!MOXMAN_Util_PathUtils::isChildOf($this->rootPath, $wwwroot)) { $this->rootPath = realpath($this->rootPath); if (!$this->rootPath) { throw new MOXMAN_Exception("Configured filesystem.rootpath doesn't exist or couldn't be resolved."); } else { if (!MOXMAN_Util_PathUtils::isChildOf($this->rootPath, $wwwroot)) { throw new MOXMAN_Exception("The filesystem.rootpath isn't within the auto detected wwwroot." . "You need to configure filesystem.local.wwwroot."); } } } $this->setFileConfigProvider(new MOXMAN_Vfs_Local_FileConfigProvider($this, $config)); $this->setFileUrlProvider(new MOXMAN_Vfs_Local_FileUrlProvider()); $this->setFileUrlResolver(new MOXMAN_Vfs_Local_FileUrlResolver($this)); }
/** * Constructs a new memory file system. * * @param string $scheme File scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param string $root Root path for file system. */ public function __construct($scheme, MOXMAN_Util_Config $config, $root) { parent::__construct($scheme, $config, $root); $this->entries = array(); $this->pathLookup = array(); $this->addEntry($root, array("isFile" => false)); $this->setFileUrlResolver(new MOXMAN_Vfs_Memory_FileUrlResolver($this)); }
/** * Constructs a new LocalFileSystem. * * @param string $scheme File scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param string $root Root path for file system. */ public function __construct($scheme, MOXMAN_Util_Config $config, $root) { parent::__construct($scheme, $config, $root); // Force the root path to an absolute path $this->rootPath = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $this->rootPath); $this->setFileConfigProvider(new MOXMAN_Vfs_Local_FileConfigProvider($this, $config)); $this->setFileUrlProvider(new MOXMAN_Vfs_Local_FileUrlProvider()); $this->setFileUrlResolver(new MOXMAN_Vfs_Local_FileUrlResolver($this)); }
/** * Constructs a new Azure instance. * * @param String $scheme File system protocol scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param String $root Root path for file system. */ public function __construct($scheme, $config, $root) { parent::__construct($scheme, $config, $root); $this->setFileUrlResolver(new MOXMAN_Azure_FileUrlResolver($this)); // Parse URL and get containers $url = parse_url($this->getRootPath()); $containerName = $url["host"]; $this->containerConfigPrefix = "azure.containers." . $containerName . "."; $this->setContainerOption("key", $containerName); $containerName = $this->getContainerOption("container", $containerName); $this->setContainerOption("name", $containerName); // Handle development mode if ($this->getContainerOption("development")) { $this->setContainerOption("url", "http://127.0.0.1:10000"); $this->setContainerOption("account", "devstoreaccount1"); $this->setContainerOption("sharedkey", "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="); } // Verify that container is valid $account = $this->getContainerOption("account"); if (!$account || !$this->getContainerOption("sharedkey")) { throw new MOXMAN_Exception("Could not find account/sharedkey options for container " . $containerName . "."); } if (!$this->getContainerOption("url")) { $this->setContainerOption("url", "http://" . $account . ".blob.core.windows.net"); $urlprefix = $this->getContainerOption("urlprefix"); if (!$urlprefix) { $this->setContainerOption("urlprefix", "http://" . $account . ".blob.core.windows.net/" . $containerName); } else { // Normalize urlprefix and add container $url = parse_url($urlprefix); if (!isset($url["path"]) || $url["path"] == "/") { $url["path"] = "/" . $this->getContainerOption("name"); } $urlprefix = MOXMAN_Util_Url::buildUrl($url); $this->setContainerOption("urlprefix", $urlprefix); } $this->setContainerOption("path", "/" . $containerName); } else { $this->setContainerOption("path", "/" . $account . "/" . $containerName); $this->setContainerOption("urlprefix", "http://localhost:10000/devstoreaccount1/"); } // Setup HTTP client $this->httpClient = new MOXMAN_Http_HttpClient($this->getContainerOption("url")); // Debug output if ($this->getContainerOption("debug_level") > 0) { $this->httpClient->setLogFunction(array($this, "logHttpClient")); $this->httpClient->setLogLevel($this->getContainerOption("debug_level")); } }
public function __construct($scheme, $config, $root) { parent::__construct($scheme, $config, $root); $url = parse_url($this->getRootPath()); $accounts = $this->getConfig()->get("ftp.accounts"); if (!isset($accounts[$url["host"]])) { throw new MOXMAN_Exception("Could not find account name: " . $url["host"] . " for FTP."); } // Get account details and default them if needed $account = $accounts[$url["host"]]; $account["host"] = isset($account["host"]) ? $account["host"] : "localhost"; $account["port"] = isset($account["port"]) ? $account["port"] : 21; $account["timeout"] = isset($account["timeout"]) ? $account["timeout"] : 90; $account["user"] = isset($account["user"]) ? $account["user"] : "******"; $account["password"] = isset($account["password"]) ? $account["password"] : "******"; $account["rootpath"] = isset($account["rootpath"]) ? $account["rootpath"] : "/"; $account["wwwroot"] = isset($account["wwwroot"]) ? $account["wwwroot"] : ""; $this->account = $account; }
/** * Constructs a new AmazonS3 instance. * * @param String $scheme File system protocol scheme. * @param MOXMAN_Util_Config $config Config instance for file system. * @param String $root Root path for file system. */ public function __construct($scheme, $config, $root) { parent::__construct($scheme, $config, $root); $this->cache = new MOXMAN_Util_LfuCache(); $this->setFileUrlResolver(new MOXMAN_AmazonS3_FileUrlResolver($this)); // Parse URL and get buckets $url = parse_url($this->getRootPath()); $bucketName = $url["host"]; $bucketKey = $bucketName; $this->bucketConfigPrefix = "amazons3.buckets." . $bucketName . "."; $bucketName = $this->getBucketOption("bucket", $bucketName); $this->client = new MOXMAN_AmazonS3_Client(array("bucket" => $bucketName, "endpoint" => $this->getBucketOption("endpoint"), "publickey" => $this->getBucketOption("publickey"), "privatekey" => $this->getBucketOption("secretkey"), "acl" => $this->getBucketOption("acl", "public-read"), "cache_control" => $this->getBucketOption("acl", "cache_control"), "proxy" => $config->get("general.http_proxy"), "scheme" => $this->getBucketOption("scheme", "tls"))); // Setup urlprefix $urlPrefix = $this->getBucketOption("urlprefix"); if (!$urlPrefix) { $info = $this->client->getInfo(); $this->setBucketOption("urlprefix", "//" . $info["endpoint"]); } if ($this->getBucketOption("debug_level") > 0) { $this->client->setLogFunction(array($this, "logHttpClient")); $this->client->setLogLevel($this->getBucketOption("debug_level")); } $this->setBucketOption("key", $bucketKey); }