Ignore:
Timestamp:
Jul 2, 2009, 8:19:35 PM (15 years ago)
Author:
maron
Message:

úprava exportu sql podle verze, u exportu mangosu exportuje pouze tabulky mangosu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r230 r231  
    5656  if(in_array($Group['Id'], $Setting['groups']))
    5757  {
    58         if($Group['MangosTable'] == '')
     58        if($Group['MangosTable'] != '')
    5959        {
    60           $Group['MangosTable'] = $Group['TablePrefix'];
    61           $Group['MangosTableIndex'] = 'entry';
    62         }
    63     $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry';
    64     //echo($Query);
    65     $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
    66     $ID = $Database->SQLCommand($Query);
    67     while($Line = mysql_fetch_array($ID))
    68     {
    69           $Values = '';
    70           foreach($Group['Items'] as $GroupItem)
    71           {
    72             if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
    73             $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"';
    74           }
    75       $Values = substr($Values, 2);
    76       $Buffer .= 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE `'.$Group['MangosTableIndex'].'` = '.$Line['entry'].';'."\n";
     60      $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.GetBuildNumber($Setting['Version']).' AND VersionEnd >= '.GetBuildNumber($Setting['Version']).' AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry';     
     61      //echo($Query);
     62      $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
     63      $ID = $Database->SQLCommand($Query);
     64      while($Line = mysql_fetch_array($ID))
     65      {
     66            $Values = '';
     67            foreach($Group['Items'] as $GroupItem)
     68            {
     69              if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
     70              $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"';
     71            }
     72        $Values = substr($Values, 2);
     73        $Buffer .= 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE `'.$Group['MangosTableIndex'].'` = '.$Line['entry'].';'."\n";
     74      }
    7775    }   
    7876  }
     
    218216          $Group['MangosTableIndex'] = 'entry';
    219217        }
    220     $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry';     
     218    $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.GetBuildNumber($Setting['Version']).' AND VersionEnd >= '.GetBuildNumber($Setting['Version']).' AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry';       
    221219    //echo($Query);
    222220    $Buffer .= '    <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
Note: See TracChangeset for help on using the changeset viewer.