/**
  * @param AJXP_Node $ajxpNode
  * @param String $scope
  * @param String $userId
  * @return void
  */
 protected function loadMetaFileData($ajxpNode, $scope, $userId)
 {
     $currentFile = $ajxpNode->getUrl();
     $fileKey = $ajxpNode->getPath();
     if (isset($this->options["METADATA_FILE_LOCATION"]) && $this->options["METADATA_FILE_LOCATION"] == "outside") {
         // Force scope
         $scope = AJXP_METADATA_SCOPE_REPOSITORY;
     }
     if ($scope == AJXP_METADATA_SCOPE_GLOBAL) {
         $metaFile = dirname($currentFile) . "/" . $this->options["METADATA_FILE"];
         //if(self::$currentMetaName == $metaFile && is_array(self::$metaCache))return;
         // Cannot store metadata inside zips...
         if (preg_match("/\\.zip\\//", $currentFile)) {
             self::$fullMetaCache = array();
             self::$metaCache = array();
             return;
         }
         $fileKey = basename($fileKey);
     } else {
         // already loaded?
         //if(is_array(self::$fullMetaCache)) return;
         $metaFile = $this->globalMetaFile . "_" . $ajxpNode->getRepositoryId();
     }
     self::$metaCache = array();
     if ((!isset(self::$fullMetaCache) || self::$currentMetaName != $metaFile) && @is_file($metaFile) && is_readable($metaFile)) {
         self::$currentMetaName = $metaFile;
         $rawData = file_get_contents($metaFile);
         self::$fullMetaCache = unserialize($rawData);
     }
     if (isset(self::$fullMetaCache) && is_array(self::$fullMetaCache)) {
         if (isset(self::$fullMetaCache[$fileKey][$userId])) {
             self::$metaCache = self::$fullMetaCache[$fileKey][$userId];
         } else {
             if ($this->options["UPGRADE_FROM_METASERIAL"] == true && count(self::$fullMetaCache) && !isset(self::$fullMetaCache["AJXP_METASTORE_UPGRADED"])) {
                 self::$fullMetaCache = $this->upgradeDataFromMetaSerial(self::$fullMetaCache);
                 if (isset(self::$fullMetaCache[$fileKey][$userId])) {
                     self::$metaCache = self::$fullMetaCache[$fileKey][$userId];
                 }
                 // Save upgraded version
                 file_put_contents($metaFile, serialize(self::$fullMetaCache));
             }
         }
     } else {
         self::$fullMetaCache = array();
         self::$metaCache = array();
     }
 }
 /**
  * @param AJXP_Node $ajxpNode
  * @param String $scope
  * @param String $userId
  * @return void
  */
 protected function loadMetaFileData($ajxpNode, $scope, $userId)
 {
     $currentFile = $ajxpNode->getUrl();
     $fileKey = $ajxpNode->getPath();
     if ($fileKey == null) {
         $fileKey = "/";
     }
     if (isset($this->options["METADATA_FILE_LOCATION"]) && $this->options["METADATA_FILE_LOCATION"] == "outside") {
         // Force scope
         $scope = AJXP_METADATA_SCOPE_REPOSITORY;
     }
     if ($scope == AJXP_METADATA_SCOPE_GLOBAL) {
         $metaFile = dirname($currentFile) . "/" . $this->options["METADATA_FILE"];
         if (preg_match("/\\.zip\\//", $currentFile)) {
             self::$fullMetaCache[$metaFile] = array();
             self::$metaCache = array();
             return;
         }
         $fileKey = basename($fileKey);
     } else {
         $metaFile = $this->globalMetaFile . "_" . $ajxpNode->getRepositoryId();
         $metaFile = $this->updateSecurityScope($metaFile, $ajxpNode->getRepositoryId(), $ajxpNode->getUser());
     }
     self::$metaCache = array();
     if (!isset(self::$fullMetaCache[$metaFile])) {
         self::$currentMetaName = $metaFile;
         $rawData = @file_get_contents($metaFile);
         if ($rawData !== false) {
             self::$fullMetaCache[$metaFile] = unserialize($rawData);
         }
     }
     if (isset(self::$fullMetaCache[$metaFile]) && is_array(self::$fullMetaCache[$metaFile])) {
         if ($userId == AJXP_METADATA_ALLUSERS && is_array(self::$fullMetaCache[$metaFile][$fileKey])) {
             foreach (self::$fullMetaCache[$metaFile][$fileKey] as $uId => $data) {
                 self::$metaCache = array_merge_recursive(self::$metaCache, $data);
             }
         } else {
             if (isset(self::$fullMetaCache[$metaFile][$fileKey][$userId])) {
                 self::$metaCache = self::$fullMetaCache[$metaFile][$fileKey][$userId];
             } else {
                 if ($this->options["UPGRADE_FROM_METASERIAL"] == true && count(self::$fullMetaCache[$metaFile]) && !isset(self::$fullMetaCache[$metaFile]["AJXP_METASTORE_UPGRADED"])) {
                     self::$fullMetaCache[$metaFile] = $this->upgradeDataFromMetaSerial(self::$fullMetaCache[$metaFile]);
                     if (isset(self::$fullMetaCache[$metaFile][$fileKey][$userId])) {
                         self::$metaCache = self::$fullMetaCache[$metaFile][$fileKey][$userId];
                     }
                     // Save upgraded version
                     file_put_contents($metaFile, serialize(self::$fullMetaCache[$metaFile]));
                 }
             }
         }
     } else {
         self::$fullMetaCache[$metaFile] = array();
         self::$metaCache = array();
     }
 }