本文整理汇总了PHP中ConfService::loadDriverForRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::loadDriverForRepository方法的具体用法?PHP ConfService::loadDriverForRepository怎么用?PHP ConfService::loadDriverForRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::loadDriverForRepository方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAccessDriver
/**
* @return AjxpWrapperProvider
* @throws \Sabre\DAV\Exception\NotFound
*/
public function getAccessDriver()
{
if (!isset($this->accessDriver)) {
//$RID = $this->repository->getId();
//ConfService::switchRootDir($RID);
ConfService::getConfStorageImpl();
$this->accessDriver = ConfService::loadDriverForRepository($this->repository);
if (!$this->accessDriver instanceof AjxpWrapperProvider) {
throw new Sabre\DAV\Exception\NotFound($this->repository->getId());
}
$this->accessDriver->detectStreamWrapper(true);
}
return $this->accessDriver;
}
示例2: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (isset($httpVars["simple_uploader"]) || isset($httpVars["xhr_uploader"])) {
return;
}
/* If set resumeFileId and resumePartitionIndex, cross-session resume is requested. */
if (isset($httpVars["resumeFileId"]) && isset($httpVars["resumePartitionIndex"])) {
header("HTTP/1.1 200 OK");
print "fileId: " . $httpVars["resumeFileId"] . "\n";
print "partitionIndex: " . $httpVars["resumePartitionIndex"];
return;
}
/*if (self::$skipDecoding) {
}*/
if (isset($postProcessData["processor_result"]["ERROR"])) {
if (isset($httpVars["lastPartition"]) && isset($httpVars["partitionCount"])) {
/* we get the stream url (where all the partitions have been uploaded so far) */
$repository = ConfService::getRepository();
$dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
if ($httpVars["partitionCount"] > 1) {
/* we fetch the information that help us to construct the temp files name */
$fileId = $httpVars["fileId"];
$fileHash = md5($httpVars["fileName"]);
/* deletion of all the partitions that have been uploaded */
for ($i = 0; $i < $httpVars["partitionCount"]; $i++) {
if (file_exists($destStreamURL . "{$fileHash}.{$fileId}.{$i}")) {
unlink($destStreamURL . "{$fileHash}.{$fileId}.{$i}");
}
}
} else {
$fileName = $httpVars["fileName"];
unlink($destStreamURL . $fileName);
}
}
echo "Error: " . $postProcessData["processor_result"]["ERROR"]["MESSAGE"];
return;
}
if (!isset($httpVars["partitionRealName"]) && !isset($httpVars["lastPartition"])) {
return;
}
$repository = ConfService::getRepository();
$driver = ConfService::loadDriverForRepository($repository);
if (!$repository->detectStreamWrapper(false)) {
return false;
}
if ($httpVars["lastPartition"]) {
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
/* we check if the current file has a relative path (aka we want to upload an entire directory) */
$this->logDebug("Now dispatching relativePath dest:", $httpVars["relativePath"]);
$subs = explode("/", $httpVars["relativePath"]);
$userfile_name = array_pop($subs);
$folderForbidden = false;
$all_in_place = true;
$partitions_length = 0;
$fileId = $httpVars["fileId"];
$fileHash = md5($userfile_name);
$partitionCount = $httpVars["partitionCount"];
$fileLength = $_POST["fileLength"];
/*
*
* Now, we supposed that access driver has already saved uploaded file in to
* folderServer with file name is md5 relativePath value.
* We try to copy this file to right location in recovery his name.
*
*/
$userfile_name = md5($httpVars["relativePath"]);
if (self::$remote) {
$partitions = array();
$newPartitions = array();
$index_first_partition = -1;
$i = 0;
do {
$currentFileName = $driver->getFileNameToCopy();
$partitions[] = $driver->getNextFileToCopy();
if ($index_first_partition < 0 && strstr($currentFileName, $fileHash) != false) {
$index_first_partition = $i;
} else {
if ($index_first_partition < 0) {
$newPartitions[] = array_pop($partitions);
}
}
} while ($driver->hasFilesToCopy());
}
/* if partitionned */
if ($partitionCount > 1) {
if (self::$remote) {
for ($i = 0; $all_in_place && $i < $partitionCount; $i++) {
$partition_file = "{$fileHash}.{$fileId}.{$i}";
if (strstr($partitions[$i]["name"], $partition_file) != false) {
$partitions_length += filesize($partitions[$i]["tmp_name"]);
} else {
$all_in_place = false;
}
//.........这里部分代码省略.........
示例3: array
if ($loggedUser != null && $loggedUser->getPref("lang") != "") {
ConfService::setLanguage($loggedUser->getPref("lang"));
} else {
if (isset($_COOKIE["AJXP_lang"])) {
ConfService::setLanguage($_COOKIE["AJXP_lang"]);
}
}
$mess = ConfService::getMessages();
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
$confDriver = ConfService::getConfStorageImpl();
$loadRepo = ConfService::getRepository();
$Driver = ConfService::loadDriverForRepository($loadRepo);
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($optAction, $optArgs, array());
if ($xmlResult !== false && $xmlResult != "") {
AJXP_XMLWriter::header();
print $xmlResult;
AJXP_XMLWriter::close();
} else {
if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
}
}
示例4: deleteExpiredPubliclet
/**
* Find all expired legacy publiclets and remove them.
* @param $elementId
* @param $data
* @throws Exception
*/
private function deleteExpiredPubliclet($elementId, $data)
{
if (AuthService::getLoggedUser() == null || AuthService::getLoggedUser()->getId() != $data["OWNER_ID"]) {
AuthService::logUser($data["OWNER_ID"], "", true);
}
$repoObject = $data["REPOSITORY"];
if (!is_a($repoObject, "Repository")) {
$repoObject = ConfService::getRepositoryById($data["REPOSITORY"]);
}
$repoLoaded = false;
if (!empty($repoObject)) {
try {
ConfService::loadDriverForRepository($repoObject)->detectStreamWrapper(true);
$repoLoaded = true;
} catch (Exception $e) {
// Cannot load this repository anymore.
}
}
if ($repoLoaded && isset($data["FILE_PATH"])) {
AJXP_Controller::registryReset();
$ajxpNode = new AJXP_Node("pydio://" . $repoObject->getId() . $data["FILE_PATH"]);
}
$this->deleteShare($data['SHARE_TYPE'], $elementId, false, true);
if (isset($ajxpNode)) {
try {
$this->getMetaManager()->removeShareFromMeta($ajxpNode, $elementId);
} catch (Exception $e) {
}
gc_collect_cycles();
}
}
示例5: unifyChunks
public function unifyChunks($action, &$httpVars, &$fileVars)
{
$filename = AJXP_Utils::decodeSecureMagic($httpVars["name"]);
$tmpName = $fileVars["file"]["tmp_name"];
$chunk = $httpVars["chunk"];
$chunks = $httpVars["chunks"];
//error_log("currentChunk:".$chunk." chunks: ".$chunks);
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$wrapperName = $streamData["classname"];
$dir = AJXP_Utils::securePath($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
$driver = ConfService::loadDriverForRepository($repository);
$remote = false;
if (method_exists($driver, "storeFileToCopy")) {
$remote = true;
$destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($repository->getOption("TMP_UPLOAD"));
// Make tmp folder a bit more unique using secure_token
$tmpFolder = $destCopy . "/" . $httpVars["secure_token"];
if (!is_dir($tmpFolder)) {
@mkdir($tmpFolder, 0700, true);
}
$target = $tmpFolder . '/' . $filename;
$fileVars["file"]["destination"] = base64_encode($dir);
} else {
if (call_user_func(array($wrapperName, "isRemote"))) {
$remote = true;
$tmpFolder = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["secure_token"];
if (!is_dir($tmpFolder)) {
@mkdir($tmpFolder, 0700, true);
}
$target = $tmpFolder . '/' . $filename;
} else {
$target = $destStreamURL . $filename;
}
}
//error_log("Directory: ".$dir);
// Clean the fileName for security reasons
//$filename = preg_replace('/[^\w\._]+/', '', $filename);
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
}
if (isset($_SERVER["CONTENT_TYPE"])) {
$contentType = $_SERVER["CONTENT_TYPE"];
}
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
if (isset($tmpName) && is_uploaded_file($tmpName)) {
//error_log("tmpName: ".$tmpName);
// Open temp file
$out = fopen($target, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen($tmpName, "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
@unlink($tmpName);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
}
} else {
// Open temp file
$out = fopen($target, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen("php://input", "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
}
/* we apply the hook if we are uploading the last chunk */
if ($chunk == $chunks - 1) {
if (!$remote) {
AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($destStreamURL . $filename), false));
} else {
if (method_exists($driver, "storeFileToCopy")) {
//.........这里部分代码省略.........
示例6: getDriver
/**
* @return AbstractAccessDriver
*/
public function getDriver()
{
if (!isset($this->_accessDriver)) {
$repo = $this->getRepository();
if ($repo != null) {
$this->_accessDriver = ConfService::loadDriverForRepository($repo);
}
}
return $this->_accessDriver;
}
示例7: stream_close
/**
* Enter description here...
*
*/
public function stream_close()
{
if ($this->fp !== null) {
fclose($this->fp);
if (self::$linkNode !== null) {
ConfService::loadDriverForRepository(self::$linkNode->getRepository());
}
}
}
示例8: getNodes
public static function getNodes($checkStats = false, $touch = true)
{
if (isset(self::$output)) {
return self::$output;
}
$mess = ConfService::getMessages();
$repos = ConfService::getAccessibleRepositories();
$output = array();
$touchReposIds = array();
foreach ($repos as $repo) {
if (!$repo->hasOwner() || !$repo->hasContentFilter()) {
continue;
}
$repoId = $repo->getId();
if (strpos("ocs_remote_share_", $repoId) !== 0) {
$touchReposIds[] = $repoId;
}
$url = "pydio://" . $repoId . "/";
$meta = array("shared_repository_id" => $repoId, "ajxp_description" => "File shared by " . $repo->getOwner() . " " . AJXP_Utils::relativeDate($repo->getOption("CREATION_TIME"), $mess), "share_meta_type" => 1);
$cFilter = $repo->getContentFilter();
$filter = $cFilter instanceof ContentFilter ? array_keys($cFilter->filters)[0] : $cFilter;
if (!is_array($filter)) {
$label = basename($filter);
} else {
$label = $repo->getDisplay();
}
if (strpos($repoId, "ocs_remote_share") !== 0) {
// FOR REMOTE SHARES, DO NOT APPEND THE DOCUMENTNAME, WE STAT THE ROOT DIRECTLY
$url .= $label;
}
$status = null;
$remoteShare = null;
$name = pathinfo($label, PATHINFO_FILENAME);
$ext = pathinfo($label, PATHINFO_EXTENSION);
$node = new AJXP_Node($url);
$node->setLabel($label);
if ($checkStats) {
$node->getRepository()->driverInstance = null;
try {
ConfService::loadDriverForRepository($node->getRepository());
} catch (Exception $e) {
$ext = "error";
$meta["ajxp_mime"] = "error";
}
$node->getRepository()->detectStreamWrapper(true);
$stat = @stat($url);
if ($stat === false) {
$ext = "error";
$meta["ajxp_mime"] = "error";
$meta["share_meta_type"] = 2;
} else {
if (strpos($repoId, "ocs_remote_share_") === 0) {
// Check Status
$linkId = str_replace("ocs_remote_share_", "", $repoId);
$ocsStore = new \Pydio\OCS\Model\SQLStore();
$remoteShare = $ocsStore->remoteShareById($linkId);
$status = $remoteShare->getStatus();
if ($status == OCS_INVITATION_STATUS_PENDING) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
$ext = "invitation";
$meta["ajxp_mime"] = "invitation";
$meta["share_meta_type"] = 0;
} else {
$meta["remote_share_accepted"] = "true";
}
$meta["remote_share_id"] = $remoteShare->getId();
}
}
if ($ext == "invitation") {
$label .= " (" . $mess["inbox_driver.4"] . ")";
} else {
if ($ext == "error") {
$label .= " (" . $mess["inbox_driver.5"] . ")";
}
}
if (is_array($stat) && AuthService::getLoggedUser() != null) {
$acl = AuthService::getLoggedUser()->mergedRole->getAcl($repoId);
if ($acl == "r") {
self::disableWriteInStat($stat);
}
}
}
$index = 0;
$suffix = "";
while (isset($output[$name . $suffix . "." . $ext])) {
$index++;
$suffix = " ({$index})";
}
$output[$name . $suffix . "." . $ext] = ["label" => $label, "url" => $url, "remote_share" => $remoteShare, "meta" => $meta];
if (isset($stat)) {
$output[$name . $suffix . "." . $ext]['stat'] = $stat;
}
}
ConfService::loadDriverForRepository(ConfService::getRepository());
self::$output = $output;
if ($touch) {
if (count($touchReposIds) && AuthService::getLoggedUser() != null) {
$uPref = AuthService::getLoggedUser()->getPref("repository_last_connected");
if (empty($uPref)) {
$uPref = array();
//.........这里部分代码省略.........
示例9: array
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && $loggedUser->getPref("lang") != "") {
ConfService::setLanguage($loggedUser->getPref("lang"));
} else {
if (isset($_COOKIE["AJXP_lang"])) {
ConfService::setLanguage($_COOKIE["AJXP_lang"]);
}
}
$mess = ConfService::getMessages();
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
$confDriver = ConfService::getConfStorageImpl();
$Driver = ConfService::loadDriverForRepository(ConfService::getRepository());
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($optAction, $optArgs, array());
if ($xmlResult !== false && $xmlResult != "") {
AJXP_XMLWriter::header();
print $xmlResult;
AJXP_XMLWriter::close();
} else {
if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
}
}