Changeset 5183 for extensions/AMetaData/amd_install.class.inc.php
- Timestamp:
- Mar 18, 2010, 11:47:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/amd_install.class.inc.php
r5040 r5183 27 27 private $tablef; 28 28 29 public function AMD_install($prefixeTable, $filelocation)29 public function __construct($prefixeTable, $filelocation) 30 30 { 31 31 parent::__construct($prefixeTable, $filelocation); 32 32 $this->tablef= new manage_tables($this->tables); 33 } 34 35 public function __destruct() 36 { 37 unset($this->tablef); 38 parent::__destruct(); 33 39 } 34 40 … … 126 132 pwg_query("DELETE FROM ".$this->tables['images_tags']); 127 133 pwg_query("UPDATE ".$this->tables['images']." SET analyzed='n', nbTags=0;"); 134 pwg_query("INSERT INTO ".$this->tables['images']." 135 SELECT id, 'n', 0 136 FROM ".IMAGES_TABLE." 137 WHERE id NOT IN (SELECT imageId FROM ".$this->tables['images'].")"); 128 138 /* 129 139 * fill the 'used_tags' table with default values … … 133 143 $sql="INSERT INTO ".$this->tables['used_tags']." VALUES('', '".$key."', '".(($val['translatable'])?'y':'n')."', '".$val['name']."', 0);"; 134 144 pwg_query($sql); 145 } 146 147 $listToAnalyze=Array(Array(), Array()); 148 /* 149 * select 25 pictures into the caddie 150 */ 151 $sql="SELECT ti.id, ti.path 152 FROM ".CADDIE_TABLE." tc 153 LEFT JOIN ".IMAGES_TABLE." ti ON ti.id = tc.element_id 154 ORDER BY RAND() LIMIT 25;"; 155 $result=pwg_query($sql); 156 if($result) 157 { 158 while($row=mysql_fetch_assoc($result)) 159 { 160 $listToAnalyze[0][]=$row; 161 $listToAnalyze[1][]=$row['id']; 162 } 163 } 164 /* 165 * if caddie is empty, of is have less than 25 pictures, select other 166 * pictures from the gallery 167 */ 168 if(count($listToAnalyze[0])<25) 169 { 170 if(count($listToAnalyze[0])>0) 171 { 172 $excludeList="WHERE ti.id NOT IN(".implode(",", $listToAnalyze[1]).") "; 173 } 174 else 175 { 176 $excludeList=""; 177 } 178 $sql="SELECT ti.id, ti.path 179 FROM ".IMAGES_TABLE." ti ".$excludeList." 180 ORDER BY RAND() LIMIT ".(25-count($listToAnalyze[0])).";"; 181 $result=pwg_query($sql); 182 if($result) 183 { 184 while($row=mysql_fetch_assoc($result)) 185 { 186 $listToAnalyze[0][]=$row; 187 } 188 } 189 } 190 191 /* 192 * analyze the 25 selected pictures 193 */ 194 if(count($listToAnalyze[0])>0) 195 { 196 // $path = path of piwigo's on the server filesystem 197 $path=dirname(dirname(dirname(__FILE__))); 198 199 foreach($listToAnalyze[0] as $val) 200 { 201 $this->analyzeImageFile($path."/".$val['path'], $val['id']); 202 } 203 204 $this->makeStatsConsolidation(); 135 205 } 136 206
Note: See TracChangeset
for help on using the changeset viewer.