source: trunk/Modules/NetworkShare/update.php

Last change on this file was 894, checked in by chronos, 4 years ago
  • Modified: Further improved models initialization system.
File size: 1.3 KB
Line 
1<?php
2
3//$Perioda = 3600*3; // prochazet po tech hodinach
4
5$Dnes = date('Y-m-d');
6//while (1)
7//{
8 $Hosts = array();
9 $StartTime = GetMicrotime();
10 $DbResult = $Database->query("SELECT * FROM `NetworkDevice` WHERE `Online`=1 AND (`Block`=0 OR `Name`='centrala') AND (`Name` != 'GATE') AND (`User` > 0)");
11 while ($Row = $DbResult->fetch_array())
12 {
13 //echo('Host: '.$Host."...\n");
14
15 //echo(.','.$Row['date']."\n");
16 $HostID = 100;
17 $StartTime2 = GetMicrotime();
18 if ($Dnes != $Row['LastShareCheck'])
19 {
20 echo("Kontroluji ".$Row['Name']."...\n");
21 passthru('env browse_host='.$Row['Name'].' browse_id='.$HostID.' php -q -c php.ini -f browse.php');
22 }
23 else echo("Vynechavam ".$Row['Name']."...\n");
24 // Aktualizuj datum prochazeni
25 $Database->update('NetworkDevice', "Id='".$Row['Id']."'", array('LastShareCheck' => $Dnes));
26 }
27 $Rozdil = GetMicrotime() - $StartTime + 10;
28
29 // Oprav a zoptimalizuj tabulku
30 //$Database->select_db('share');
31 echo('Opravuji tabulku...');
32 $Database->query('REPAIR TABLE NetworkShareItem');
33 echo("\nOptimalizuji tabulku...");
34 $Database->query('OPTIMIZE TABLE NetworkShareItem');
35
36 echo("\nDoba procháení ".date("H:i:s",$Rozdil-3600)."\n\n");
37 //$Cekat = $Perioda-$Rozdil;
38 //echo("Cekam ".date("H:i:s",$Cekat-3600)." minut...\n");
39 //Sleep($Cekat);
40//}
Note: See TracBrowser for help on using the repository browser.