Ejemplo n.º 1
0
 /**
  * Check xattr (filesystem) support
  *
  * @return  bool
  */
 private static function checkXattrFilesystemSupport($folder)
 {
     return xattr_supported($folder);
 }
Ejemplo n.º 2
0
 /**
  * @abstract
  * @param AJXP_Node $ajxpNode
  * @param String $nameSpace
  * @param bool|String $private
  * @param int $scope
  * @return array()
  */
 public function retrieveMetadata($ajxpNode, $nameSpace, $private = false, $scope = AJXP_METADATA_SCOPE_REPOSITORY)
 {
     $path = $ajxpNode->getRealFile();
     if (!file_exists($path)) {
         return array();
     }
     if (!xattr_supported($path)) {
         //throw new Exception("Filesystem does not support Extended Attributes!");
         return array();
     }
     if ($private == AJXP_METADATA_ALLUSERS) {
         $startKey = $this->getMetaKey($nameSpace, $scope, "");
         $arrMeta = array();
         $keyList = xattr_list($path);
         foreach ($keyList as $k) {
             if (strpos($k, $startKey) === 0) {
                 $mData = xattr_get($path, $k);
                 $decData = unserialize(base64_decode($mData));
                 if (is_array($decData)) {
                     $arrMeta = array_merge_recursive($arrMeta, $decData);
                 }
             }
         }
         return $arrMeta;
     } else {
         $key = $this->getMetaKey($nameSpace, $scope, $this->getUserId($private, $ajxpNode));
         $data = xattr_get($path, $key);
         $data = unserialize(base64_decode($data));
         if (empty($data) || !is_array($data)) {
             return array();
         }
         return $data;
     }
 }
Ejemplo n.º 3
0
Archivo: Node.php Proyecto: jasny/Q
 /**
  * ArrayAccess; Check if attribute exists.
  * 
  * @param string $att Attribute name
  * @return boolean
  */
 public function offsetExists($att)
 {
     return in_array($att, array('size', 'type', 'atime', 'ctime', 'mtime', 'mode', 'perms', 'uid', 'owner', 'gid', 'group', 'dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks')) || extension_loaded('xattr') && xattr_supported($this->_path) && xattr_get($this->_path, $att) !== false;
 }
Ejemplo n.º 4
0
 /**
  * @abstract
  * @param AJXP_Node $ajxpNode
  * @param String $nameSpace
  * @param bool $private
  * @param int $scope
  */
 public function retrieveMetadata($ajxpNode, $nameSpace, $private = false, $scope = AJXP_METADATA_SCOPE_REPOSITORY)
 {
     $path = $ajxpNode->getRealFile();
     if (!file_exists($path)) {
         return array();
     }
     $key = $this->getMetaKey($nameSpace, $scope, $this->getUserId($private));
     if (!xattr_supported($path)) {
         //throw new Exception("Filesystem does not support Extended Attributes!");
         return array();
     }
     $data = xattr_get($path, $key);
     $data = unserialize(base64_decode($data));
     if (empty($data) || !is_array($data)) {
         return array();
     }
     return $data;
 }