Dotclear

Changeset 1103:f22f7ac9160c


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.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/media_item.php

    r1073 r1103  
    6060     # Prepare directories combo box 
    6161     $dirs_combo = array(); 
    62      foreach ($core->media->getRootDirs() as $v) { 
    63           if ($v->w) { 
    64                $dirs_combo['/'.$v->relname] = $v->relname; 
    65           } 
     62     foreach ($core->media->getDBDirs() as $v) { 
     63          $dirs_combo['/'.$v] = $v; 
    6664     } 
    6765     ksort($dirs_combo); 
  • 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