Dotclear

Changeset 1103:f22f7ac9160c for inc/core


Ignore:
Timestamp:
02/24/13 10:07:55 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Optimize way to get media folders tree, from db rather than filesystem. Bruno's patch for not so well tuned hosts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.media.php

    r909 r1103  
    821821          $this->callFileHandler(files::getMimeType($media_file),'remove',$f); 
    822822     } 
     823 
     824     /** 
     825     * Root directories 
     826     * 
     827     * Returns an array of directory under {@link $root} directory. 
     828     * 
     829     * @uses fileItem 
     830     * @return array 
     831     */ 
     832     public function getDBDirs() 
     833     { 
     834          $media_dir = $this->relpwd ? $this->relpwd : '.'; 
     835           
     836          $strReq = 
     837          'SELECT distinct media_dir '. 
     838          'FROM '.$this->table.' '. 
     839          "WHERE media_path = '".$this->path."'"; 
     840          $rs = $this->con->select($strReq); 
     841          while ($rs->fetch()) { 
     842               if (is_dir($this->root.'/'.$rs->media_dir)) 
     843                    $dir[] = $rs->media_dir; 
     844          } 
     845           
     846          return $dir; 
     847     } 
    823848      
    824849     /** 
Note: See TracChangeset for help on using the changeset viewer.

Sites map