Changeset 20


Ignore:
Timestamp:
Jun 12, 2009, 11:18:23 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Generování souboru realmlist.wtf.
  • Upraveno: Uchování portu realmd a worldd v databází namísto výpočtu z Id serveru.
  • Opraveno: Zobrazení hodnot dle skriptů typů v obecné tabulce.
Location:
trunk/www
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/config.sample.php

    r15 r20  
    3131  'MaxServerCount' => 20,
    3232  'CompilerParameters' => '',
     33  'BaseNetworkPortWorldd' => 8085,
     34  'BaseNetworkPortRealmd' => 3724,
     35  'MangosWorlddThreadCountMax' => 12,
    3336);
    3437
  • trunk/www/form_classes.php

    r16 r20  
    5454      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
    5555      'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
    56       'Homepage' => array('Type' => 'String', 'Caption' => 'Webové stránky', 'Default' => ''),
    57       'Type' => array('Type' => 'TServerType', 'Caption' => 'Typ', 'Default' => 0),
    58       'Database' => array('Type' => 'TDatabase', 'Caption' => 'Databáze', 'Default' => 0),
     56      'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
     57      'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
     58      'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
    5959      'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
    6060    ),
     
    8080      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    8181      'UserName' => array('Type' => 'String', 'Caption' => 'Správce', 'Default' => ''),
    82       'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Realmd port', 'Default' => ''),
     82      'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Realmlist', 'Default' => ''),
    8383      'Version' => array('Type' => 'Integer', 'Caption' => 'Verze', 'Default' => 0),
    8484      'Online' => array('Type' => 'OnlineState', 'Caption' => 'Stav', 'Default' => 0),
  • trunk/www/index.php

    r17 r20  
    1010  function ShowServerListOnRow($Row)
    1111  {
    12     $Row['NetworkPortRealmd'] = $this->System->Config['Web']['Host'].':'.$Row['NetworkPortRealmd'];
     12    $Row['NetworkPortRealmd'] = '<a href="realmlist.php?Id='.$Row['Id'].'">'.$this->System->Config['Web']['Host'].':'.$Row['NetworkPortRealmd'].'</a>';
    1313    $Row['Name'] = '<a href="?Action=ServerShow&amp;Id='.$Row['Id'].'">'.$Row['Name'].'</a>';
    1414    return($Row);
     
    230230          else
    231231          {
     232            $DbResult = $this->Database->query('SELECT MAX(NetworkPortRealmd), MAX(NetworkPortWorldd) FROM Server');
     233            $DbRow = $DbResult->fetch_row();
     234            $NewPortRealmd = $DbRow[0] + 1;
     235            if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];
     236            $NewPortWorldd = $DbRow[1] + 1;
     237            if($NewPortWorldd < $Config['BaseNetworkPortWorldd']) $NewPortWorldd = $Config['BaseNetworkPortWorldd'];
     238           
    232239            $Form = new Form('NewServer', array());
    233240            $Form->LoadValuesFromForm();
    234             $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => 1));
     241            $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => 1, 'NetworkPortWorldd' => $NewPortWorldd, 'NetworkPortRealmd' => $NewPortRealmd));
    235242            $LastInsertId = $this->Database->insert_id;
    236243            $Server = new Server($this->Database, $LastInsertId);
  • trunk/www/page.php

    r18 r20  
    3535        $Output .= ' <a href="?Action=ServerDebug">Ladící záznamy</a>';
    3636      } else $Output .= ' <a href="?Action=ServerAdd">Vytvořit vlastní server</a>';
    37       $Output .= ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
     37      $Output .= ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení účtu</a>';
    3838      if($this->System->Modules['User']->User['Role'] == USER_ROLE_ADMINISTRATOR)
    3939      {
     
    5555    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    5656    $Output = '<div id="Footer">
    57    <i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' |';
     57   <i>| Projekt: WoW hosting | Správce: '.$this->System->Config['Web']['Admin'].' | E-mail: '.$this->System->Config['Web']['AdminEmail'].' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a> |';
    5858    if($this->System->Config['Web']['ShowRuntimeInfo'] == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';
    5959        $Output .= '</i></div></body></html>';
  • trunk/www/server.php

    r19 r20  
    1010  var $Server;
    1111  var $Task;
    12   var $WorlddBaseNetworkPort = 8085;
    13   var $RealmdBaseNetworkPort = 3724;
    14   var $MangosWorlddThreadCountMax = 12;
    1512 
    1613  function __construct($Database, $Id)
     
    114111  {
    115112    $State = array();
    116     $State['RealmdPortState'] = $this->NetworkPortState('localhost', $this->RealmdBaseNetworkPort + $this->Server['Id']);
    117     $State['WorlddPortState'] = $this->NetworkPortState('localhost', $this->WorlddBaseNetworkPort + $this->Server['Id']);
     113    $State['RealmdPortState'] = $this->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);
     114    $State['WorlddPortState'] = $this->NetworkPortState('localhost', $this->Server['NetworkPortWorldd']);
    118115    $State['Online'] = $State['RealmdPortState'] and $State['WorlddPortState'];
    119116    $DbResult = $this->Database->query('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = "server'.$this->Id.'_characters"');
     
    132129    } else
    133130    {
    134       $State['OnlinePlayerCount'] = 0;
     131      $State['CharacterOnlineCount'] = 0;
    135132      $State['CharacterCount'] = 0;
    136133      $State['AccountCount'] = 0;
     
    143140    global $Config;
    144141   
    145     $this->Database->query('UPDATE server'.$this->Id.'_realmd.realmlist SET name="'.addslashes($this->Server['Name']).'", address="'.$Config['Web']['Host'].'", port='.($this->WorlddBaseNetworkPort + $this->Id));
     142    $this->Database->query('UPDATE server'.$this->Id.'_realmd.realmlist SET name="'.addslashes($this->Server['Name']).'", address="'.$Config['Web']['Host'].'", port='.($this->Server['NetworkPortWorldd']));
    146143  }
    147144 
     
    155152  function UpdateScripts()
    156153  {
     154    global $Config;
     155   
    157156    $ServerBinDir = '../server/'.$this->Id.'/bin/';
    158157    if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true);   
     
    165164      'info thread',
    166165    );
    167     for($I = 1; $I < $this->MangosWorlddThreadCountMax; $I++)
    168     $Content[] = 'thread apply '.$I.' bt full';
     166    for($I = 1; $I < $Config['MangosWorlddThreadCountMax']; $I++)
     167      $Content[] = 'thread apply '.$I.' bt full';
    169168    file_put_contents($ScriptFileName, implode("\n", $Content));
    170169    chmod($ScriptFileName, 0666);   
     
    213212    $Config->ParameterList['CharacterDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_characters';
    214213    $Config->ParameterList['ScriptDev2DatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_scriptdev2';
    215     $Config->ParameterList['WorldServerPort'] = $this->WorlddBaseNetworkPort + $this->Id;
     214    $Config->ParameterList['WorldServerPort'] = $this->Server['NetworkPortWorldd'];
    216215    $Config->ParameterList['Motd'] = $this->Server['Motd'];
    217216    $Config->ParameterList['DataDir'] = 'wowclient/'.$this->Server['Database']['Emulator']['ClientVersion']['Version'];
     
    227226    $Config->Load($EmulatorEtcDir.'realmd.conf.dist');
    228227    $Config->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_realmd';
    229     $Config->ParameterList['RealmServerPort'] = $this->RealmdBaseNetworkPort + $this->Id;
     228    $Config->ParameterList['RealmServerPort'] = $this->Server['NetworkPortRealmd'];
    230229    $Config->ParameterList['LogsDir'] = 'server/'.$this->Id.'/log';
    231230    $Config->Save($ServerEtcDir.'realmd.conf');
  • trunk/www/table.php

    r16 r20  
    8484      foreach($this->Definition['Items'] as $Index => $Item)
    8585      {
     86        $DbRow[$Index] = ExecuteTypeEvent($Item['Type'], 'OnView',
     87          array('Name' => $Index, 'Value' => $DbRow[$Index], 'Type' => $Item['Type']));
    8688        $Row[] = $DbRow[$Index];
    8789      }
  • trunk/www/task.php

    r16 r20  
    3030      file_put_contents($this->TempScript, $Task['CommandList']);
    3131      chmod($this->TempScript, 0755);
    32       passthru($this->TempScript, $Output);
    33       //exec($Script, $Output);
    34       $Output = ''; //implode("\n", $Output);
    35       //echo($Output);
     32      //passthru($this->TempScript, $Output);
     33      exec($this->TempScript, $Output);
     34      $Output = implode("\n", $Output);
     35      echo($Output);
    3636      $this->Database->query('UPDATE Task SET State="Finished", Output="'.addslashes($Output).'" WHERE Id='.$Task['Id']);
    3737    }
  • trunk/www/user.php

    r15 r20  
    103103          {
    104104            $this->Database->insert('User', array('Name' => $Name, 'Login' => $Login, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1, 'Role' => 2));
    105             $UserId = $Database->insert_id;
     105            $UserId = $this->Database->insert_id;
    106106           
    107107            $Subject = FromUTF8('Registrace nového účtu', 'iso2');
Note: See TracChangeset for help on using the changeset viewer.