Ignore:
Timestamp:
Sep 14, 2010, 7:14:43 PM (14 years ago)
Author:
grum
Message:

Implement basic/advanced modes, release 0.5.1
bug:1857

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/amd_install.class.inc.php

    r6891 r6919  
    5050      $this->loadConfig();
    5151      $this->config['installed']=AMD_VERSION2;
     52      $this->config['newInstall']='y';
    5253      $this->saveConfig();
    5354
     
    121122      unset($tables_def);
    122123
    123       $tables_insert=array(
     124
     125      $tablesInsert=array(
    124126"INSERT INTO `".$this->tables['groups']."` VALUES(1, 0)",
    125127"INSERT INTO `".$this->tables['groups_names']."` VALUES(1, '".$user['language']."', '".$lang['g003_default_group_name']."')",
     
    135137    ('magic.ShotInfo.Flash.Fired', 8, 1)"
    136138      );
    137       foreach($tables_insert as $sql)
     139      foreach($tablesInsert as $sql)
    138140      {
    139141        pwg_query($sql);
    140142      }
     143
    141144
    142145      return($result);
     
    279282        pwg_query($sql);
    280283      }
    281 
    282       $listToAnalyze=Array(Array(), Array());
    283       /*
    284        * select 25 pictures into the caddie
    285        */
    286       $sql="SELECT ti.id, ti.path
    287             FROM ".CADDIE_TABLE." tc
    288               LEFT JOIN ".IMAGES_TABLE." ti ON ti.id = tc.element_id
    289             WHERE tc.user_id = ".$user['id']."
    290               AND ti.id IS NOT NULL
    291             ORDER BY RAND() LIMIT 25;";
    292       $result=pwg_query($sql);
    293       if($result)
    294       {
    295         while($row=pwg_db_fetch_assoc($result))
    296         {
    297           $listToAnalyze[0][]=$row;
    298           $listToAnalyze[1][]=$row['id'];
    299         }
    300       }
    301       /*
    302        * if caddie is empty, of is have less than 25 pictures, select other
    303        * pictures from the gallery
    304        */
    305       if(count($listToAnalyze[0])<25)
    306       {
    307         if(count($listToAnalyze[0])>0)
    308         {
    309           $excludeList="WHERE ti.id NOT IN(".implode(",", $listToAnalyze[1]).") ";
    310         }
    311         else
    312         {
    313           $excludeList="";
    314         }
    315         $sql="SELECT ti.id, ti.path, ti.has_high
    316               FROM ".IMAGES_TABLE." ti ".$excludeList."
    317               ORDER BY RAND() LIMIT ".(25-count($listToAnalyze[0])).";";
    318         $result=pwg_query($sql);
    319         if($result)
    320         {
    321           while($row=pwg_db_fetch_assoc($result))
    322           {
    323             $listToAnalyze[0][]=$row;
    324           }
    325         }
    326       }
    327 
    328       /*
    329        * analyze the 25 selected pictures
    330        */
    331       if(count($listToAnalyze[0])>0)
    332       {
    333         // $path = path of piwigo's on the server filesystem
    334         $path=dirname(dirname(dirname(__FILE__)));
    335 
    336         foreach($listToAnalyze[0] as $val)
    337         {
    338           if($val['has_high']===true and $this->config['amd_UseMetaFromHD']=='y')
    339           {
    340             $this->analyzeImageFile($path."/".dirname($val['path'])."/pwg_high/".basename($val['path']), $val['id']);
    341           }
    342           else
    343           {
    344             $this->analyzeImageFile($path."/".$val['path'], $val['id']);
    345           }
    346 
    347         }
    348 
    349         $this->makeStatsConsolidation();
    350       }
    351284    }
    352285
Note: See TracChangeset for help on using the changeset viewer.