Ignore:
Timestamp:
Aug 5, 2009, 7:30:23 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Při aktualizaci realmu neanačítat soubory databáze serveru a naopak.
  • Opraveno: Zobrazování podstránek ladících výstupů realmů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/model/server.php

    r57 r62  
    4040    $this->Database->query('DROP USER "server'.$this->Id.'"@"localhost"');
    4141  }
    42  
    43   function ImportDatabase($Delete = false)
    44   {
    45     $this->Lock();
    46     $CommandList = array(
    47       'php www/shell.php ServerLock '.$this->Id,
    48     );
    49     if($Delete == true)
    50     {
    51       $CommandList = array_merge($CommandList, array(
    52       'mysql --silent --skip-column-names -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd',
    53       ));
    54     }
    55     // Lookup nearest database with full import
    56     $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Server['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC');
    57     $Database = $DbResult->fetch_assoc();
    58    
    59     $CommandList = array_merge($CommandList, array(
    60       'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/realmd.sql',
    61       'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$Database['Id'],
    62       'php www/shell.php ServerUnLock '.$this->Id,
    63     ));   
    64     $this->Task->Add('Inicializace databáze', $CommandList);
    65    
    66     if($Database['Id'] != $this->Server['Database']['Id'])
    67     {
    68       $NewDatabaseId = $this->Server['Database']['Id'];
    69       $this->Server['Database']['Id'] = $Database['Id'];
    70       $this->Update($NewDatabaseId, false, false);
    71     }
    72     return('Úloha načtení nové databáze zařazena do fronty.');
    73   }
    7442 
    7543  function Start()
     
    228196  }
    229197 
     198  function ImportDatabase($Delete = false)
     199  {
     200    $this->Lock();
     201    $CommandList = array(
     202      'php www/shell.php ServerLock '.$this->Id,
     203    );
     204    if($Delete == true)
     205    {
     206      $CommandList = array_merge($CommandList, array(
     207      'mysql --silent --skip-column-names -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd',
     208      ));
     209    }
     210    // Lookup nearest database with full import
     211    $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Server['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC');
     212    $Database = $DbResult->fetch_assoc();
     213   
     214    $CommandList = array_merge($CommandList, array(
     215      'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/realmd.sql',
     216      'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$Database['Id'],
     217      'php www/shell.php ServerUnLock '.$this->Id,
     218    ));   
     219    $this->Task->Add('Inicializace databáze', $CommandList);
     220   
     221    if($Database['Id'] != $this->Server['Database']['Id'])
     222    {
     223      $NewDatabaseId = $this->Server['Database']['Id'];
     224      $this->Server['Database']['Id'] = $Database['Id'];
     225      $this->Update($NewDatabaseId, false, false);
     226    }
     227    return('Úloha načtení nové databáze zařazena do fronty.');
     228  }
     229
    230230  function Update($DatabaseId, $DoBackup = true, $DoStop = true)
    231231  {
     
    264264      {
    265265        $Parts = explode('|', $Update);
    266         $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Id'].'/'.$Parts[1];
     266        if($Parts[0] == 'realmd')
     267          $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Id'].'/'.$Parts[1];
    267268        $Commands[] = $Command;
    268269      }     
Note: See TracChangeset for help on using the changeset viewer.