Changeset 4418

Show
Ignore:
Timestamp:
07/17/07 18:37:36 (6 years ago)
Author:
p_lindheimer
Message:

add cronmanager table and default enabling of online updates at install time

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.3/SQL/newinstall.sql

    r4404 r4418  
    442442); 
    443443 
     444CREATE TABLE IF NOT EXISTS `cronmanager` ( 
     445  `module` varchar(24) NOT NULL default '', 
     446  `id` varchar(24) NOT NULL default '', 
     447  `time` varchar(5) default NULL, 
     448  `freq` int(11) NOT NULL default '0', 
     449  `lasttime` int(11) NOT NULL default '0', 
     450  `command` varchar(255) NOT NULL default '', 
     451  PRIMARY KEY  (`module`,`id`) 
     452); 
     453 
    444454 
    445455/*!40000 ALTER TABLE `zap` DISABLE KEYS */; 
  • freepbx/branches/2.3/SQL/newinstall.sqlite3.sql

    r4404 r4418  
    441441) 
    442442 
     443CREATE TABLE IF NOT EXISTS `cronmanager` ( 
     444  `module` varchar(24) NOT NULL default '', 
     445  `id` varchar(24) NOT NULL default '', 
     446  `time` varchar(5) default NULL, 
     447  `freq` int(11) NOT NULL default '0', 
     448  `lasttime` int(11) NOT NULL default '0', 
     449  `command` varchar(255) NOT NULL default '', 
     450  PRIMARY KEY  (`module`,`id`) 
     451); 
    443452 
    444453/*!40000 ALTER TABLE `zap` DISABLE KEYS */; 
  • freepbx/branches/2.3/upgrades/2.3.0beta2/tables.php

    r4409 r4418  
    373373} 
    374374 
     375outn("creating cronmanager table.."); 
     376$sql = " CREATE TABLE IF NOT EXISTS `cronmanager` ( 
     377          `module` varchar(24) NOT NULL default '', 
     378          `id` varchar(24) NOT NULL default '', 
     379          `time` varchar(5) default NULL, 
     380          `freq` int(11) NOT NULL default '0', 
     381          `lasttime` int(11) NOT NULL default '0', 
     382          `command` varchar(255) NOT NULL default '', 
     383          PRIMARY KEY  (`module`,`id`) 
     384        ) 
     385        "; 
     386$check = $db->query($sql); 
     387if(DB::IsError($check)) { 
     388  out("ERROR: Can not create cronmanager table"); 
     389} 
     390out("Done"); 
     391 
     392outn("enabling online update checking.."); 
     393$sql = "SELECT * FROM cronmanager WHERE module = 'module_admin' AND id = 'UPDATES'"; 
     394$result = $db->getAll($sql, DB_FETCHMODE_ASSOC); 
     395if (DB::IsError($result)) { // error - table must not be there 
     396  out("can't update cronmanager table"); 
     397} else { 
     398  if (count($result)) { 
     399    out("already enabled"); 
     400  } else { 
     401    $freq = 24; 
     402    $night_time = array(19,20,21,22,23,0,1,2,3,4,5); 
     403    $run_time = $night_time[rand(0,10)]; 
     404    $command = $amp_conf['AMPBIN']."/module_admin listonline"; 
     405   
     406    $sql = "INSERT INTO cronmanager  
     407            (module, id, time, freq, lasttime, command) 
     408            VALUES 
     409            ('module_admin', 'UPDATES', '$run_time', $freq, 0, '$command') 
     410          "; 
     411    $check = $db->query($sql); 
     412    if(DB::IsError($check)) { 
     413      out("ERROR: can not insert update information in cronmanager"); 
     414    } else { 
     415      out("Done"); 
     416    } 
     417  } 
     418} 
     419 
    375420?>