Changeset 380 for trunk/export
- Timestamp:
- Mar 11, 2010, 7:21:43 PM (15 years ago)
- Location:
- trunk/export
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r377 r380 25 25 if($DbResult->num_rows == 0) die('Export '.$this->Id.' neexistuje'); 26 26 $this->Export = $DbResult->fetch_assoc(); 27 27 28 28 // Filter selected languages 29 29 $this->WhereLang = ''; 30 30 $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE `Export`='.$this->Id.' ORDER BY `Sequence`'); 31 echo($this->Database->error); 31 32 while($Language = $DbResult->fetch_assoc()) 32 $this->WhereLang .= ' OR ( Language= '.$Language['Language'].')';33 $this->WhereLang .= ' OR (`Language` = '.$Language['Language'].')'; 33 34 if($this->WhereLang == '') $this->WhereLang = 1; 34 35 else $this->WhereLang = '('.substr($this->WhereLang, 4).')'; … … 52 53 } else 53 54 { 54 $this->WhereUsers = '( UserIN ('.$this->SelectedUsers.'))';55 $this->OrderByUserList = ' ORDER BY FIELD( User, '.$this->SelectedUsers.')';55 $this->WhereUsers = '(`User` IN ('.$this->SelectedUsers.'))'; 56 $this->OrderByUserList = ' ORDER BY FIELD(`User`, '.$this->SelectedUsers.')'; 56 57 } 57 58 … … 221 222 function ExportToDBC() 222 223 { 223 global $TranslationTree, $LanguageList, $Config;224 global $TranslationTree, $LanguageList, $Config; 224 225 225 226 $this->LoadFilters(); 226 227 227 228 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 228 while($Group = $DbResult->fetch_assoc()) 229 { 230 echo($Group['Name'].'... '); 231 if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) { 232 233 $i = 1; 234 $columns = ''; 235 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 236 $columns .= ' `T`.`'.$Column['Column'].'` AS `Text`'.$i.','; 237 $i = $i+1; 238 } 239 240 $querty = '"SELECT '.$columns.' `T`.`Entry` AS `Entry` FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')) AS `T` GROUP BY `T`.`Entry`"'; 229 echo('Počet generovaných skupin: '.$DbResult->num_rows.'<br/>'."\n"); 230 while($Group = $DbResult->fetch_assoc()) 231 { 232 echo($Group['Name'].', '); 233 if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 234 { 235 $i = 1; 236 $columns = ''; 237 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 238 { 239 $columns .= ' `T`.`'.$Column['Column'].'` AS `Text'.$i.'`,'; 240 $i = $i + 1; 241 } 242 $Query = 'SELECT '.$columns.' `T`.`Entry` AS `Entry` FROM (SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')) AS `T` GROUP BY `T`.`Entry`'; 243 $Query = str_replace('`', '\`', $Query); 244 $Query = '"'.str_replace(' ', '\ ', $Query).'"'; 241 245 242 $params = '-u '.$Config['Database']['User'].' -p '.$Config['Database']['Password'].' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$querty;246 $params = '-u '.$Config['Database']['User'].' -p '.$Config['Database']['Password'].' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$Query; 243 247 244 // echo('./DBCExport '.$params); 248 //echo('./DBCExport '.$params); 249 exec('./DBCExport '.$params); 245 250 246 exec('./DBCExport '.$params);247 248 echo('Hotovo <br />249 ');250 251 } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n"); 251 252 } 253 echo('Hotovo <br />'); 252 254 } 253 255
Note:
See TracChangeset
for help on using the changeset viewer.