Ignore:
Timestamp:
Jan 12, 2015, 12:20:30 AM (10 years ago)
Author:
chronos
Message:
  • Added: Generic Scheduler module for running tasks on specified time and with specified period.
  • Added: System execution from command line using cmd.php entry point.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Setup/Updates.php

    r726 r729  
    11701170       
    11711171        $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;');
     1172}
     1173
     1174function UpdateTo729($Manager)
     1175{
     1176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;');
     1177 
     1178  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` (
     1179  `Id` int(11) NOT NULL,
     1180  `Name` varchar(255) NOT NULL,
     1181  `Enabled` int(11) NOT NULL,
     1182  `Class` varchar(255) NOT NULL,
     1183  `Log` mediumtext NOT NULL,
     1184  `LastExecutedTime` datetime DEFAULT NULL,
     1185  `ScheduledTime` datetime NOT NULL,
     1186  `Period` int(11) NOT NULL
     1187) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     1188
     1189  $Manager->Execute('ALTER TABLE `Scheduler`
     1190 ADD PRIMARY KEY (`Id`);');
     1191 
     1192  $Manager->Execute('ALTER TABLE `Scheduler`
     1193MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1194
     1195  // IS menu item
     1196  $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1197`Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
     1198NULL , "", "Plánovač", "1", "/is/?t=Scheduler&a=list", NULL , NULL , NULL , "1");');
     1199  $ActionId = $Manager->Database->insert_id;
     1200  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Systém"');
     1201  if($DbResult->num_rows > 0)
     1202  {
     1203        $DbRow = $DbResult->fetch_assoc();
     1204    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1205      "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1206  }
     1207 
     1208  $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");');
    11721209}
    11731210
     
    12331270        722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
    12341271        725 => array('Revision' => 726, 'Function' => 'UpdateTo726'),
     1272        726 => array('Revision' => 729, 'Function' => 'UpdateTo729'),
    12351273    ));
    12361274  }
Note: See TracChangeset for help on using the changeset viewer.