Ignore:
Timestamp:
Jan 24, 2009, 5:55:02 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Změna kódování znaků souborů na UTF-8.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2/mangos_import.php

    r9 r40  
    2929      while($DbRow = $DbResult->fetch_array())
    3030      {
    31         $this->Database->replace('TextGroup', array('Language' => 1, 'User' => 1, 'Revision' => 1, 'Time' => 'NOW()', 'Group' => $Group['Id'], 'Index' => $DbRow[$Group['MangosTableIndex']]));
     31        $this->Database->query('REPLACE INTO `TextGroup` (`Language`, `User`, `Revision`, `Time`, `Group`, `Index`) VALUES (1, 2, 1, "NOW()", '.$Group['Id'].', '.$DbRow[$Group['MangosTableIndex']].')');
    3232        $TranslationGroupId = $this->Database->insert_id;
    3333        foreach($GroupItemList as $GroupItem)
     
    5151    // Import users
    5252    $this->Database->query('TRUNCATE TABLE `User`');
     53    $this->Database->insert('User', array('Name' => 'Anonym', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1));
     54    $AnonymousId = $this->Database->insert_id;
     55    $this->Database->insert('User', array('Name' => 'MaNGOS', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1));
     56    $MangosId = $this->Database->insert_id;
     57    $this->Database->insert('User', array('Name' => 'WoWEmu', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '',     'LastIpAddress' => '', 'Role' => 1));
     58    $WowemuId = $this->Database->insert_id;
     59    $this->Database->insert('User', array('Name' => 'Neznámý', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '',     'LastIpAddress' => '', 'Role' => 1));
     60    $UnknownUserId = $this->Database->insert_id;
     61    $UserIdIncrement = 4;
     62
     63    // Load old users
    5364    $DbResult = $this->Database->query('SELECT * FROM `quests`.`user`');
    5465    while($User = $DbResult->fetch_array())
     
    5970      if($User['gm'] == 1) $Role = 3;
    6071      if($User['gm'] == 2) $Role = 4;
    61       $this->Database->insert('User', array('Name' => $User['user'], 'Password' => $User['pass'], 'Email' => $User['Email'], 'TranslationLanguage' => $Language, 'LastLoginTime' => $User['LastLogin'], 'LastIpAddress' => $User['LastIP'], 'Role' => $Role, 'Id' => $User['ID']));
     72      $this->Database->insert('User', array('Name' => $User['user'], 'Password' => $User['pass'], 'Email' => $User['Email'], 'TranslationLanguage' => $Language, 'LastLoginTime' => $User['LastLogin'], 'LastIpAddress' => $User['LastIP'], 'Role' => $Role, 'Id' => ($User['ID'] + $UserIdIncrement)));
    6273    }
    63     $this->Database->insert('User', array('Name' => 'Anonym', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1));
    64     $this->Database->insert('User', array('Name' => 'MaNGOS', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1));
    65     $this->Database->insert('User', array('Name' => 'WoWEmu', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1));
    66     $UnknownUserId = $this->Database->insert_id;
    6774    $Output .= 'Uživatelé převedeni<br>';
    6875
    6976    // Import texts
    70     $this->Database->query('CREATE TABLE Transition (OldIndex INT, NewIndex INT, INDEX OldIndex ) ENGINE=MEMORY');
     77    $this->Database->query('CREATE TABLE Transition (OldIndex INT, NewIndex INT, INDEX (OldIndex) ) ENGINE=MEMORY');
    7178    //$this->Database->query('TRUNCATE TABLE `User`');
    7279    $DbResult = $this->Database->query('SELECT * FROM `quests`.`quests`');
     
    7582      if($Quest['Language'] > 0)
    7683      {
    77         if($Quest['User'] == 0) $Quest['User'] = $UnknownUserId;
     84        if($Quest['User'] == 0) $Quest['User'] = $UnknownUserId; else $Quest['User'] = $Quest['User'] + $UserIdIncrement;
    7885        if($Quest['Take'] > 0)
    7986        {
Note: See TracChangeset for help on using the changeset viewer.