Changeset 674 for trunk/admin/index.php
- Timestamp:
- Dec 29, 2013, 8:49:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/index.php
r673 r674 31 31 '<small>Nastaví špatné version end a Take na originální text, které vzniklo v důsledku importu a špatně indexovaného indexu Take</small><br/><br/>'. 32 32 '<a href="'.$System->Link('/admin/?action=dbcstructure').'">Připravit dbc strukturu</a><br/>'. 33 '<small>Otevře dbc soubory převedené do textové formy pro přípravu struktury pro import</small><br/><br/>'; 33 '<small>Otevře dbc soubory převedené do textové formy pro přípravu struktury pro import</small><br/><br/>'. 34 '<a href="'.$System->Link('/admin/?action=merge').'">Sjednocení textů</a><br/>'. 35 '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>'; 34 36 return($Output); 35 37 } … … 101 103 { 102 104 global $System,$TranslationTree; 103 104 foreach($TranslationTree as $Group) { 105 $Output = ''; 106 // foreach($TranslationTree as $Group) 107 $Group = $TranslationTree[1]; 108 { 105 109 106 110 $sql = 'SELECT `T`.`ID`,`T`.`Take`,`sub1`.`ID` as `origID`,T.`VersionStart`,T.`VersionEnd`,`sub1`.`VersionStart` as OrigStart,sub1.`VersionEnd` as `OrigEnd` FROM `'.$Group['TablePrefix'] .'` as `T` '. 107 111 ' JOIN `'.$Group['TablePrefix'].'` as `sub1` ON `sub1`.`Language` = 0 AND `T`.`Entry` = `sub1`.`Entry` AND `T`.`VersionStart` = `sub1`.`VersionStart` '. 108 ' WHERE `T`.`Take` != `sub1`.` Take`'.112 ' WHERE `T`.`Take` != `sub1`.`ID` AND `T`.`Language` != 0'. 109 113 // ' WHERE `T`.`Language` != 0 AND `T`.`VersionEnd` != `sub1`.`VersionEnd` AND `T`.`Take` NOT IN'. 110 114 // '(Select `ID` FROM `'.$Group['TablePrefix'].'` as `sub2` WHERE `sub2`.`Language` = 0 AND `T`.`Entry` = `sub2`.`Entry` AND `T`.`VersionStart` = `sub2`.`VersionStart`)'. … … 120 124 echo '<br / >Verze '.$Group['TablePrefix'].' opraveny!'; 121 125 } 122 return($Output); 126 return('Hotovo!'); 127 } 128 129 function StripText($Text) { 130 $Text = strtolower($Text); 131 $Text = str_replace(' ', '', $Text); 132 return ($Text); 133 } 134 135 function MergeSameText() 136 { 137 global $System,$TranslationTree; 138 $Output = ''; 139 // foreach($TranslationTree as $Group) 140 $Group = $TranslationTree[1]; 141 { 142 143 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 144 // ' JOIN `'.$Group['TablePrefix'].'` as `sub1` ON `sub1`.`Language` = 0 AND `T`.`Entry` = `sub1`.`Entry` AND `T`.`VersionStart` < `sub1`.`VersionStart` '. 145 ' WHERE `T`.`Language` = 0 '. 146 ' ORDER BY `T`.`VersionStart`'; //LIMIT 1000 147 //echo $sql; 148 $DbResult = $System->Database->query($sql); 149 echo ': <br />'.$Group['TablePrefix'].': '; 150 while($line = $DbResult->fetch_assoc()) 151 { 152 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 153 ' WHERE `T`.`Language` = 0 AND `T`.`VersionStart` > '.$line['VersionEnd'].' AND `T`.`Entry` = '.$line['Entry']. 154 ' ORDER BY `T`.`VersionStart` LIMIT 1'; //LIMIT 1000 155 // echo $sql; 156 $DbResult2 = $System->Database->query($sql); 157 if($DbResult2->num_rows > 0) { 158 $line2 = $DbResult2->fetch_assoc(); 159 160 $Same = true; 161 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 162 if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']])) 163 $Same = false; 164 } 165 if ($Same) { 166 echo $line['ID'].'='.$line2['ID'].' ('; 167 // $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `Take` = NULL WHERE ID='.$line2['ID']); 168 169 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 170 ' WHERE `T`.`Entry` = '.$line['Entry'].' AND `T`.`Take` = '.$line2['ID']; 171 $DbResult3 = $System->Database->query($sql); 172 if($DbResult3->num_rows > 0) { 173 $line3 = $DbResult3->fetch_assoc(); 174 echo $line3['ID'].' '; 175 $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].', `VersionStart` = '.$line['VersionStart'].', `Take` = '.$line['ID'].' WHERE ID='.$line3['ID']); 176 } 177 178 $System->Database->query('DELETE FROM`'.$Group['TablePrefix'].'` WHERE ID='.$line2['ID']); 179 $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].' WHERE ID='.$line['ID']); 180 echo '), '; 181 } 182 } 183 } 184 echo 'Texty '.$Group['TablePrefix'].' sjednoceny!'; 185 } 186 return('Hotovo!'); 123 187 } 124 188 … … 220 284 else if($_GET['action'] == 'repairversion') $Output .= $this->RepairVersionEnd(); 221 285 else if($_GET['action'] == 'dbcstructure') $Output .= $this->DbcStructure(); 286 else if($_GET['action'] == 'merge') $Output .= $this->MergeSameText(); 222 287 else $Output .= $this->ShowMenu(); 223 288 } else $Output .= $this->ShowMenu();
Note:
See TracChangeset
for help on using the changeset viewer.