files_browse() public méthode

Browse VFS backend.
public files_browse ( string $path ) : array
$path string The path to browse/fetch. This should be in UNC format with the "server" portion specifying backend name. e.g., \\file\mike\file.txt or \\sql\mike\file.txt
Résultat array An array of data arrays with the following structure: linkid: (string) The UNC path for this resource. name: (string) The display name of the resource. content-length: (integer) The byte size of the resource (if a file). modified: (Horde_Date) The modification time of the resource, if available. create: (Horde_Date) The creation time of the resource, if available. is_folder: (boolean) True if the resource is a folder. data: (Horde_Stream) The data, if resource is a file. content-type: (string) The MIME type of the file resource, if available. @since 2.12.0
Exemple #1
0
 /**
  * Returns array of items which contain contact information
  *
  * @param string $type   The search type; ['gal'|'mailbox']
  * @param array $query   The search query. An array containing:
  *  - query:          (array) The search query. Contains at least:
  *                    'query' and 'range'. The rest depends on the type of
  *                    search being performed.
  *                    DEFAULT: none, REQUIRED
  *  - range:          (string)   A range limiter.
  *                     DEFAULT: none (No range used).
  *  - rebuildresults: (boolean)  If true, invalidate any cached search.
  *                    DEFAULT: Use cached search results if available.
  *  - deeptraversal:  (boolean) If true, traverse sub folders.
  *                    @todo NOT IMPLEMENTED YET.
  *
  * @return array  An array containing:
  *  - rows:   An array of search results, limited by $query['range'].
  *  - status: The search store status code.
  *  - total:  The total number of matches (not limited by $query['range']
  */
 public function getSearchResults($type, array $query)
 {
     switch (Horde_String::lower($type)) {
         case 'gal':
             return $this->_searchGal($query);
         case 'mailbox':
             if (!empty($this->_cache)) {
                 $clear_cache = !empty($query['rebuildresults']);
                 unset($query['rebuildresults']);
                 $cache_key = $GLOBALS['registry']->getAuth() . ':HCASD:' . hash('md5', serialize($query));
                 if ($clear_cache) {
                     $this->_cache->expire($cache_key);
                 }
             }
             if (!empty($this->_cache) && $this->_cache->exists($cache_key, 0)) {
                 $results = json_decode($this->_cache->get($cache_key, 0), true);
             } else {
                 try {
                     $results = $this->_searchMailbox($query);
                     if (!empty($this->_cache)) {
                         $this->_cache->set($cache_key, json_encode($results));
                     }
                 } catch (Horde_ActiveSync_Exception $e) {
                     $this->_logger->err($e->getMessage());
                     $results = array();
                 }
             }
             $count = count($results);
             if (!empty($query['range'])) {
                 $range = explode('-', $query['range']);
                 $results = array_slice($results, $range[0], $range[1] - $range[0] + 1);
             }
             return array('rows' => $results, 'total' => $count, 'status' => Horde_ActiveSync_Request_Search::STORE_STATUS_SUCCESS);
         case 'documentlibrary':
             foreach ($query['query'][0] as $q) {
                 if (!empty($q['DocumentLibrary:LinkId'])) {
                     $results = $this->_connector->files_browse($q['DocumentLibrary:LinkId']);
                 }
             }
             return array('rows' => $results, 'total' => count($results), 'status' => Horde_ActiveSync_Request_Search::STORE_STATUS_SUCCESS);
     }
 }