本文整理汇总了PHP中AJXP_Node类的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node类的具体用法?PHP AJXP_Node怎么用?PHP AJXP_Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AJXP_Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveMeta
/**
*
* @param AJXP_Node $oldFile
* @param AJXP_Node $newFile
* @param Boolean $copy
*/
public function moveMeta($oldFile, $newFile = null, $copy = false)
{
if ($oldFile == null) {
return;
}
$feedStore = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("feed");
if ($feedStore !== false) {
$feedStore->updateMetaObject($oldFile->getRepositoryId(), $oldFile->getPath(), $newFile != null ? $newFile->getPath() : null, $copy);
return;
}
if (!$copy && $this->metaStore->inherentMetaMove()) {
return;
}
$oldMeta = $this->metaStore->retrieveMetadata($oldFile, AJXP_META_SPACE_COMMENTS);
if (!count($oldMeta)) {
return;
}
// If it's a move or a delete, delete old data
if (!$copy) {
$this->metaStore->removeMetadata($oldFile, AJXP_META_SPACE_COMMENTS);
}
// If copy or move, copy data.
if ($newFile != null) {
$this->metaStore->setMetadata($newFile, AJXP_META_SPACE_COMMENTS, $oldMeta);
}
}
示例2: extractIndexableContent
/**
* @param AJXP_Node $ajxpNode
* @return null|string
*/
protected function extractIndexableContent($ajxpNode)
{
$ext = strtolower(pathinfo($ajxpNode->getLabel(), PATHINFO_EXTENSION));
if (in_array($ext, explode(",", $this->getFilteredOption("PARSE_CONTENT_TXT")))) {
return file_get_contents($ajxpNode->getUrl());
}
$unoconv = $this->getFilteredOption("UNOCONV");
$pipe = false;
if (!empty($unoconv) && in_array($ext, array("doc", "odt", "xls", "ods"))) {
$targetExt = "txt";
if (in_array($ext, array("xls", "ods"))) {
$targetExt = "csv";
} else {
if (in_array($ext, array("odp", "ppt"))) {
$targetExt = "pdf";
$pipe = true;
}
}
$realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
$unoconv = "HOME=" . AJXP_Utils::getAjxpTmpDir() . " " . $unoconv . " --stdout -f {$targetExt} " . escapeshellarg($realFile);
if ($pipe) {
$newTarget = str_replace(".{$ext}", ".pdf", $realFile);
$unoconv .= " > {$newTarget}";
register_shutdown_function("unlink", $newTarget);
}
$output = array();
exec($unoconv, $output, $return);
if (!$pipe) {
$out = implode("\n", $output);
$enc = 'ISO-8859-1';
$asciiString = iconv($enc, 'ASCII//TRANSLIT//IGNORE', $out);
return $asciiString;
} else {
$ext = "pdf";
}
}
$pdftotext = $this->getFilteredOption("PDFTOTEXT");
if (!empty($pdftotext) && in_array($ext, array("pdf"))) {
$realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
if ($pipe && isset($newTarget) && is_file($newTarget)) {
$realFile = $newTarget;
}
$cmd = $pdftotext . " " . escapeshellarg($realFile) . " -";
$output = array();
exec($cmd, $output, $return);
$out = implode("\n", $output);
$enc = 'UTF8';
$asciiString = iconv($enc, 'ASCII//TRANSLIT//IGNORE', $out);
return $asciiString;
}
return null;
}
示例3: computeIdForNode
/**
* @param AJXP_Node $node
* @param string $cacheType
* @param string $details
* @return string
*/
public static function computeIdForNode($node, $cacheType, $details = '')
{
$repo = $node->getRepository();
if ($repo == null) {
return "failed-id";
}
$scope = $repo->securityScope();
$additional = "";
if ($scope === "USER") {
$additional = AuthService::getLoggedUser()->getId() . "@";
} else {
if ($scope == "GROUP") {
$additional = ltrim(str_replace("/", "__", AuthService::getLoggedUser()->getGroupPath()), "__") . "@";
}
}
$scheme = parse_url($node->getUrl(), PHP_URL_SCHEME);
return str_replace($scheme . "://", $cacheType . "://" . $additional, $node->getUrl()) . ($details ? "##" . $details : "");
}
示例4: updateMetaShort
protected function updateMetaShort($file, $elementId, $shortUrl)
{
$driver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
$streamData = $driver->detectStreamWrapper(false);
$baseUrl = $streamData["protocol"] . "://" . ConfService::getRepository()->getId();
$node = new AJXP_Node($baseUrl . $file);
if ($node->hasMetaStore()) {
$metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
if ($elementId != -1) {
if (!is_array($metadata["element"][$elementId])) {
$metadata["element"][$elementId] = array();
}
$metadata["element"][$elementId]["short_form_url"] = $shortUrl;
} else {
$metadata['short_form_url'] = $shortUrl;
}
$node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
}
}
示例5: updateMetaShort
protected function updateMetaShort($file, $elementId, $shortUrl)
{
$context = new UserSelection(ConfService::getRepository());
$baseUrl = $context->currentBaseUrl();
$node = new AJXP_Node($baseUrl . $file);
if ($node->hasMetaStore()) {
$metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
if ($elementId != -1) {
if (!is_array($metadata["element"][$elementId])) {
$metadata["element"][$elementId] = array();
}
$metadata["element"][$elementId]["short_form_url"] = $shortUrl;
} else {
if (isset($metadata["shares"])) {
$key = array_pop(array_keys($metadata["shares"]));
$metadata["shares"][$key]["short_form_url"] = $shortUrl;
} else {
$metadata['short_form_url'] = $shortUrl;
}
}
$node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
}
}
示例6: switchAction
public function switchAction($action, $httpVars, $postProcessData)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . "/";
if ($action == "audio_proxy") {
$selection = new UserSelection($repository, $httpVars);
// Backward compat
$file = $selection->getUniqueFile();
if (!file_exists($destStreamURL . $file) && strpos($httpVars["file"], "base64encoded:") === false) {
// May be a backward compatibility problem, try to base64decode the filepath
$file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
if (!file_exists($destStreamURL . $file)) {
throw new Exception("Cannot find file!");
}
}
$cType = "audio/" . array_pop(explode(".", $file));
$localName = basename($file);
$node = new AJXP_Node($destStreamURL . $file);
if (method_exists($node->getDriver(), "filesystemFileSize")) {
$size = $node->getDriver()->filesystemFileSize($node->getUrl());
} else {
$size = filesize($node->getUrl());
}
header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
header("Content-Length: " . $size);
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
AJXP_Controller::applyHook("node.read", array($node));
$this->logInfo('Preview', 'Read content of ' . $node->getUrl());
//exit(1);
} else {
if ($action == "ls") {
if (!isset($httpVars["playlist"])) {
// This should not happen anyway, because of the applyCondition.
AJXP_Controller::passProcessDataThrough($postProcessData);
return;
}
// We transform the XML into XSPF
$xmlString = $postProcessData["ob_output"];
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xmlString);
$xElement = $xmlDoc->documentElement;
header("Content-Type:application/xspf+xml;charset=UTF-8");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
print "<trackList>";
foreach ($xElement->childNodes as $child) {
$isFile = $child->getAttribute("is_file") == "true";
$label = $child->getAttribute("text");
$ar = explode(".", $label);
$ext = strtolower(end($ar));
if (!$isFile || $ext != "mp3") {
continue;
}
print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
}
print "</trackList>";
AJXP_XMLWriter::close("playlist");
}
}
}
示例7: extractMeta
/**
* @param AJXP_Node $ajxpNode
*/
public function extractMeta(&$ajxpNode)
{
$currentFile = $ajxpNode->getUrl();
if (!$ajxpNode->isLeaf() || preg_match("/\\.zip\\//", $currentFile)) {
return;
}
if (!preg_match("/\\.jpg\$|\\.jpeg\$|\\.tif\$|\\.tiff\$/i", $currentFile)) {
return;
}
$definitions = $this->getMetaDefinition();
if (!count($definitions)) {
return;
}
if (!function_exists("exif_read_data")) {
return;
}
//if(!exif_imagetype($currentFile)) return ;
$realFile = $ajxpNode->getRealFile();
$exif = @exif_read_data($realFile, 0, TRUE);
$iptc = $this->extractIPTC($realFile);
if ($exif === false) {
return;
}
$additionalMeta = array();
foreach ($definitions as $def => $label) {
list($exifSection, $exifName) = explode("-", $def);
if ($exifSection == "COMPUTED_GPS" && !isset($exif["COMPUTED_GPS"])) {
$exif['COMPUTED_GPS'] = $this->convertGPSData($exif);
}
if (isset($exif[$exifSection]) && isset($exif[$exifSection][$exifName])) {
$additionalMeta[$def] = $exif[$exifSection][$exifName];
}
if ($exifSection == "IPTC" && isset($iptc[$exifName])) {
$additionalMeta[$def] = $iptc[$exifName];
}
}
$ajxpNode->mergeMetadata($additionalMeta);
}
示例8: extractMimeHeaders
/**
* @param AJXP_Node $ajxpNode
* @param Boolean $isParent
*/
public function extractMimeHeaders(&$ajxpNode, $isParent = false)
{
if ($isParent) {
return;
}
$currentNode = $ajxpNode->getUrl();
$metadata = $ajxpNode->metadata;
$wrapperClassName = $ajxpNode->wrapperClassName;
$noMail = true;
if ($metadata["is_file"] && ($wrapperClassName == "imapAccessWrapper" || preg_match("/\\.eml\$/i", $currentNode))) {
$noMail = false;
}
if ($wrapperClassName == "imapAccessWrapper" && !$metadata["is_file"]) {
$metadata["mimestring"] = "Mailbox";
}
$parsed = parse_url($currentNode);
if ($noMail || isset($parsed["fragment"]) && strpos($parsed["fragment"], "attachments") === 0) {
EmlParser::$currentListingOnlyEmails = FALSE;
return;
}
if (EmlParser::$currentListingOnlyEmails === NULL) {
EmlParser::$currentListingOnlyEmails = true;
}
if ($wrapperClassName == "imapAccessWrapper") {
$cachedFile = AJXP_Cache::getItem("eml_remote", $currentNode, null, array("EmlParser", "computeCacheId"));
$realFile = $cachedFile->getId();
if (!is_file($realFile)) {
$cachedFile->getData();
// trigger loading!
}
} else {
$realFile = $ajxpNode->getRealFile();
}
$cacheItem = AJXP_Cache::getItem("eml_mimes", $realFile, array($this, "mimeExtractorCallback"));
$data = unserialize($cacheItem->getData());
$data["ajxp_mime"] = "eml";
$data["mimestring"] = "Email";
$metadata = array_merge($metadata, $data);
if ($wrapperClassName == "imapAccessWrapper" && $metadata["eml_attachments"] != "0" && strpos($_SERVER["HTTP_USER_AGENT"], "ajaxplorer-ios") !== false) {
$metadata["is_file"] = false;
$metadata["nodeName"] = basename($currentNode) . "#attachments";
}
$ajxpNode->metadata = $metadata;
}
示例9: moveSharesFromMeta
/**
* @param array $shares
* @param String $operation
* @param AJXP_Node $oldNode
* @param AJXP_Node $newNode
* @param array $collectRepositories
* @param string|null $parentRepositoryPath
* @return array
* @throws Exception
*/
public function moveSharesFromMeta($shares, $operation = "move", $oldNode, $newNode = null, &$collectRepositories = array(), $parentRepositoryPath = null)
{
$privateShares = array();
$publicShares = array();
foreach ($shares as $id => $data) {
$type = $data["type"];
if ($operation == "delete") {
$this->deleteShare($type, $id, false, true);
continue;
}
if ($type == "minisite") {
$share = $this->loadShare($id);
$repo = ConfService::getRepositoryById($share["REPOSITORY"]);
} else {
if ($type == "repository") {
$repo = ConfService::getRepositoryById($id);
} else {
if ($type == "file") {
$publicLink = $this->loadShare($id);
}
}
}
if (isset($repo)) {
$oldNodeLabel = SystemTextEncoding::toUTF8($oldNode->getLabel());
$newNodeLabel = SystemTextEncoding::toUTF8($newNode->getLabel());
if ($newNode != null && $newNodeLabel != $oldNodeLabel && $repo->getDisplay() == $oldNodeLabel) {
$repo->setDisplay($newNodeLabel);
}
$cFilter = $repo->getContentFilter();
$path = $repo->getOption("PATH", true);
$save = false;
if (isset($cFilter)) {
if ($parentRepositoryPath !== null) {
$repo->addOption("PATH", $parentRepositoryPath);
} else {
$cFilter->movePath($oldNode->getPath(), $newNode->getPath());
$repo->setContentFilter($cFilter);
}
$save = true;
} else {
if (!empty($path)) {
$oldNodePath = SystemTextEncoding::toUTF8($oldNode->getPath());
$newNodePath = SystemTextEncoding::toUTF8($newNode->getPath());
$path = preg_replace("#" . preg_quote($oldNodePath, "#") . "\$#", $newNodePath, $path);
$repo->addOption("PATH", $path);
$save = true;
$collectRepositories[$repo->getId()] = $path;
}
}
if ($save) {
//ConfService::getConfStorageImpl()->saveRepository($repo, true);
ConfService::replaceRepository($repo->getId(), $repo);
}
$access = $repo->getOption("SHARE_ACCESS");
if (!empty($access) && $access == "PUBLIC") {
$publicShares[$id] = $data;
} else {
$privateShares[$id] = $data;
}
} else {
if (isset($publicLink) && is_array($publicLink) && isset($publicLink["FILE_PATH"])) {
$oldNodePath = SystemTextEncoding::toUTF8($oldNode->getPath());
$newNodePath = SystemTextEncoding::toUTF8($newNode->getPath());
$publicLink["FILE_PATH"] = str_replace($oldNodePath, $newNodePath, $publicLink["FILE_PATH"]);
$this->deleteShare("file", $id);
$this->storeShare($newNode->getRepositoryId(), $publicLink, "file", $id);
$privateShares[$id] = $data;
}
}
}
return array($privateShares, $publicShares);
}
示例10: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepositoryById($httpVars["repository_id"]);
if (!$repository->detectStreamWrapper(true)) {
return false;
}
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser === null && ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth")) {
AuthService::logUser("guest", null);
$loggedUser = AuthService::getLoggedUser();
}
if (!$loggedUser->canSwitchTo($repository->getId())) {
echo "You do not have permissions to access this resource";
return false;
}
}
$streamData = $repository->streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
$selection = new UserSelection($repository, $httpVars);
if ($action == "open_file") {
$file = $selection->getUniqueFile();
if (!file_exists($destStreamURL . $file)) {
echo "File does not exist";
return false;
}
$node = new AJXP_Node($destStreamURL . $file);
if (method_exists($node->getDriver(), "filesystemFileSize")) {
$filesize = $node->getDriver()->filesystemFileSize($node->getUrl());
} else {
$filesize = filesize($node->getUrl());
}
$fp = fopen($destStreamURL . $file, "rb");
$fileMime = "application/octet-stream";
//Get mimetype with fileinfo PECL extension
if (class_exists("finfo")) {
$finfo = new finfo(FILEINFO_MIME);
$fileMime = $finfo->buffer(fread($fp, 100));
}
//Get mimetype with (deprecated) mime_content_type
if (strpos($fileMime, "application/octet-stream") === 0 && function_exists("mime_content_type")) {
$fileMime = @mime_content_type($fp);
}
//Guess mimetype based on file extension
if (strpos($fileMime, "application/octet-stream") === 0) {
$fileExt = substr(strrchr(basename($file), '.'), 1);
if (empty($fileExt)) {
$fileMime = "application/octet-stream";
} else {
$regex = "/^([\\w\\+\\-\\.\\/]+)\\s+(\\w+\\s)*({$fileExt}\\s)/i";
$lines = file($this->getBaseDir() . "/resources/other/mime.types");
foreach ($lines as $line) {
if (substr($line, 0, 1) == '#') {
continue;
}
// skip comments
$line = rtrim($line) . " ";
if (!preg_match($regex, $line, $matches)) {
continue;
}
// no match to the extension
$fileMime = $matches[1];
}
}
}
fclose($fp);
// If still no mimetype, give up and serve application/octet-stream
if (empty($fileMime)) {
$fileMime = "application/octet-stream";
}
//Send headers
HTMLWriter::generateInlineHeaders(basename($file), $filesize, $fileMime);
$class = $streamData["classname"];
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
$node = new AJXP_Node($destStreamURL . $file);
AJXP_Controller::applyHook("node.read", array($node));
$this->logInfo('Download', 'Read content of ' . $node->getUrl());
}
}
示例11: recursiveIndexation
/**
*
* @param AJXP_Node $node
* @param int $depth
* @throws Exception
*/
public function recursiveIndexation($node, $depth = 0)
{
$repository = $node->getRepository();
$user = $node->getUser();
$messages = ConfService::getMessages();
if ($user == null && AuthService::usersEnabled()) {
$user = AuthService::getLoggedUser();
}
if ($depth == 0) {
$this->logDebug("Starting indexation - node.index.recursive.start - " . memory_get_usage(true) . " - " . $node->getUrl());
$this->setIndexStatus("RUNNING", str_replace("%s", $node->getPath(), $messages["core.index.8"]), $repository, $user);
AJXP_Controller::applyHook("node.index.recursive.start", array($node));
} else {
if ($this->isInterruptRequired($repository, $user)) {
$this->logDebug("Interrupting indexation! - node.index.recursive.end - " . $node->getUrl());
AJXP_Controller::applyHook("node.index.recursive.end", array($node));
$this->releaseStatus($repository, $user);
throw new Exception("User interrupted");
}
}
if (!ConfService::currentContextIsCommandLine()) {
@set_time_limit(120);
}
$url = $node->getUrl();
$this->logDebug("Indexing Node parent node " . $url);
$this->setIndexStatus("RUNNING", str_replace("%s", $node->getPath(), $messages["core.index.8"]), $repository, $user);
try {
AJXP_Controller::applyHook("node.index", array($node));
} catch (Exception $e) {
$this->logDebug("Error Indexing Node " . $url . " (" . $e->getMessage() . ")");
}
$handle = opendir($url);
if ($handle !== false) {
while (($child = readdir($handle)) != false) {
if ($child[0] == ".") {
continue;
}
$childNode = new AJXP_Node(rtrim($url, "/") . "/" . $child);
$childUrl = $childNode->getUrl();
if (is_dir($childUrl)) {
$this->logDebug("Entering recursive indexation for " . $childUrl);
$this->recursiveIndexation($childNode, $depth + 1);
} else {
try {
$this->logDebug("Indexing Node " . $childUrl);
AJXP_Controller::applyHook("node.index", array($childNode));
} catch (Exception $e) {
$this->logDebug("Error Indexing Node " . $childUrl . " (" . $e->getMessage() . ")");
}
}
}
closedir($handle);
} else {
$this->logDebug("Cannot open {$url}!!");
}
if ($depth == 0) {
$this->logDebug("End indexation - node.index.recursive.end - " . memory_get_usage(true) . " - " . $node->getUrl());
$this->setIndexStatus("RUNNING", "Indexation finished, cleaning...", $repository, $user);
AJXP_Controller::applyHook("node.index.recursive.end", array($node));
$this->releaseStatus($repository, $user);
$this->logDebug("End indexation - After node.index.recursive.end - " . memory_get_usage(true) . " - " . $node->getUrl());
}
}
示例12: moveShareIfPossible
/**
* @param String $type
* @param String $element
* @param AJXP_Node $oldNode
* @param AJXP_Node $newNode
* @return bool
*/
public function moveShareIfPossible($type, $element, $oldNode, $newNode)
{
if (!$this->sqlSupported) {
return false;
}
$this->confStorage->simpleStoreGet("share", $element, "serial", $data);
if ($oldNode->isLeaf() && $type == "minisite" && is_array($data)) {
$repo = ConfService::getRepositoryById($data["REPOSITORY"]);
$cFilter = $repo->getContentFilter();
if (isset($cFilter)) {
$cFilter->movePath($oldNode->getPath(), $newNode->getPath());
}
}
}
示例13: extractMeta
/**
*
* @param AJXP_Node $ajxpNode
* @param bool $contextNode
* @param bool $details
* @return void
*/
public function extractMeta(&$ajxpNode, $contextNode = false, $details = false)
{
$metadata = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
if (empty($metadata)) {
$metadata = array();
}
$ajxpNode->mergeMetadata($metadata);
}
示例14: enrichMetadata
/**
*
* @param AJXP_Node $ajxpNode
*/
public function enrichMetadata(&$ajxpNode)
{
$currentNode = $ajxpNode->getUrl();
$metadata = $ajxpNode->metadata;
$parsed = parse_url($currentNode);
if (isset($parsed["fragment"]) && strpos($parsed["fragment"], "attachments") === 0) {
list(, $attachmentId) = explode("/", $parsed["fragment"]);
$meta = imapAccessWrapper::getCurrentAttachmentsMetadata();
if ($meta != null) {
foreach ($meta as $attach) {
if ($attach["x-attachment-id"] == $attachmentId) {
$metadata["text"] = $attach["filename"];
$metadata["icon"] = AJXP_Utils::mimetype($attach["filename"], "image", false);
$metadata["mimestring"] = AJXP_Utils::mimetype($attach["filename"], "text", false);
}
}
}
}
if (!$metadata["is_file"] && $currentNode != "") {
$metadata["icon"] = "imap_images/ICON_SIZE/mail_folder_sent.png";
}
if (basename($currentNode) == "INBOX") {
$metadata["text"] = "Incoming Mails";
}
if (strstr($currentNode, "__delim__") !== false) {
$parts = explode("/", $currentNode);
$metadata["text"] = str_replace("__delim__", "/", array_pop($parts));
}
$ajxpNode->metadata = $metadata;
}
示例15: getPartialHash
/**
* @param AJXP_Node $node
* @param float $offset
* @param float $length
* @return String md5
*/
public function getPartialHash($node, $offset, $length)
{
$this->logDebug('Getting partial hash from ' . $offset . ' to ' . $length);
$fp = fopen($node->getUrl(), "r");
$ctx = hash_init('md5');
if ($offset > 0) {
fseek($fp, $offset);
}
hash_update_stream($ctx, $fp, $length);
$hash = hash_final($ctx);
$this->logDebug('Partial hash is ' . $hash);
fclose($fp);
return $hash;
}