Ignore:
Timestamp:
Apr 1, 2013, 7:14:59 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Generování nastavení sítě. Generování front Queue nyní pracuje s přiřazením služeb k zařízením a podsítím.
  • Opraveno: Zjišťování adresáře souborů na disku dle id adresáře.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/Updates.php

    r505 r507  
    183183  `Message` varchar(255) NOT NULL DEFAULT '',
    184184  PRIMARY KEY (`Id`)
    185 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
    186  
     185) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     186}
     187
     188function UpdateTo507($Manager)
     189{
     190  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     191    "VALUES (NULL , 'Aktuality', NULL, '', '');");
     192  $Id = $Manager->Database->insert_id;
     193  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     194    "VALUES (NULL , 'Aktuality', '".$Id."', 'News', '');");
     195  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     196    "VALUES (NULL , 'Kategorie aktualit', '".$Id."', 'NewsCategory', '');");
     197  $Manager->Execute("INSERT INTO `FileDirectory` (`Id` ,`Name` ,`Parent`".
     198    ") VALUES (NULL , 'news', NULL);");
     199  $Manager->Execute("ALTER TABLE `File` ADD `Time` DATETIME NOT NULL ");
     200  // Convert Hire column to Service item
     201  $Manager->Execute("INSERT INTO `ServiceCategory` (
     202`Id` ,`Name`) VALUES (NULL , 'Pevný nájem');");
     203  $ServiceCategoryHire = $Manager->Database->insert_id; 
     204  $DbResult = $Manager->Execute("SELECT * FROM Member WHERE Hire>0");
     205  while($Member = $DbResult->fetch_assoc())
     206  {
     207    $Manager->Execute("INSERT INTO `Service` (
     208`Id` ,`Name` ,`Category` ,`Price` ,`VAT` ,`CustomerCount` ,`Action` ,`ReplaceId` ,
     209`Public` ,`InternetSpeedMin` ,`InternetSpeedMax` ,`UploadAsymmetry` ,`Memory` ,`MemorySwap` ,`Storage` ,`CPUCount`)
     210VALUES (
     211NULL , 'Nájem', '".$ServiceCategoryHire."', '-".$Member['Hire']."', '2', '', NULL , NULL , '', '', '', '', '', '', '', ''
     212);");
     213    $ServiceHire = $Manager->Database->insert_id; 
     214    $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Service`, `Customer`) VALUES ".
     215      "(".$ServiceHire.",".$Member['Id'].")");
     216  }
     217  $Manager->Execute("ALTER TABLE `Member` DROP `Hire`");
     218  // Each device and subnet have to be assigned to payed service to determine service parameters
     219  $Manager->Execute("ALTER TABLE `NetworkDevice` ADD `Service` INT NULL AFTER `Location` ,
     220ADD INDEX ( `Service` )");
     221  $Manager->Execute("ALTER TABLE `NetworkDevice` ADD FOREIGN KEY ( `Service` ) REFERENCES `ServiceCustomerRel` (
     222`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     223  $Manager->Execute("UPDATE `NetworkDevice` SET `Service` = (SELECT `Id` FROM `ServiceCustomerRel` WHERE `ServiceCustomerRel`.`Customer` = `NetworkDevice`.`Member` LIMIT 1)");
     224  $Manager->Execute("ALTER TABLE `NetworkSubnet` ADD `Service` INT NULL AFTER `Member` ,
     225ADD INDEX ( `Service` ) ");
     226  $Manager->Execute("ALTER TABLE `NetworkSubnet` ADD FOREIGN KEY ( `Service` ) REFERENCES `ServiceCustomerRel` (
     227`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     228  $Manager->Execute("UPDATE `NetworkSubnet` SET `Service` = (SELECT `Id` FROM `ServiceCustomerRel` WHERE `ServiceCustomerRel`.`Customer` = `NetworkSubnet`.`Member` LIMIT 1)");
    187229}
    188230
     
    197239  500 => array('Revision' => 502, 'Function' => 'UpdateTo502'),
    198240  502 => array('Revision' => 505, 'Function' => 'UpdateTo505'),
     241  505 => array('Revision' => 507, 'Function' => 'UpdateTo507'),
    199242);
    200243
Note: See TracChangeset for help on using the changeset viewer.