Changeset 729 for trunk/Application


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.
Location:
trunk/Application
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/System.php

    r657 r729  
    2424  var $ShowPage;
    2525  var $Setup;
     26  var $CommandLine;
    2627
    2728  function __construct()
     
    3839    if(substr($this->RootURLFolder, -10, 10) == '/index.php')
    3940      $this->RootURLFolder = substr($this->RootURLFolder, 0, -10);
     41    $this->CommandLine = array();
    4042  }
    4143
     
    132134  }
    133135
    134   function Run()
     136  function RunCommon()
    135137  {
    136138        global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
     
    177179    if($this->Setup->CheckState())
    178180    {
    179       $this->ModuleManager->Start();
    180     }
     181      $this->ModuleManager->Start();   
     182    }
     183  }
     184 
     185  function Run()
     186  {
     187    $this->RunCommon();
    181188    if($this->ShowPage)
    182189    {
     
    186193  }
    187194
     195  function RunCommandLine()
     196  {
     197        global $argv;
     198       
     199        $this->RunCommon();
     200        if(count($argv) > 1)
     201        {
     202      if(array_key_exists($argv[1], $this->CommandLine))
     203      {
     204        $Command = $this->CommandLine[$argv[1]];
     205        if(is_string($Command['Callback'][0]))
     206              {
     207                $Class = new $Command['Callback'][0]($this);
     208                $Output = $Class->$Command['Callback'][1]();           
     209              } else $Output = call_user_func($Command['Callback']);
     210              echo($Output);
     211      } else echo('Command "'.$argv[1].'" not supported.'."\n");       
     212        }
     213        //print_r($argv);
     214  }
     215 
     216  function RegisterCommandLine($Name, $Callback)
     217  {
     218        $this->CommandLine[$Name] = array('Name' => $Name, 'Callback' => $Callback);
     219  }
     220 
    188221  function RegisterPageBar($Name)
    189222  {
  • trunk/Application/Version.php

    r728 r729  
    11<?php
    22
    3 $Revision = 728; // Subversion revision
    4 $DatabaseRevision = 726; // SQL structure revision
    5 $ReleaseTime = strtotime('2015-01-05');
     3$Revision = 729; // Subversion revision
     4$DatabaseRevision = 729; // SQL structure revision
     5$ReleaseTime = strtotime('2015-01-11');
Note: See TracChangeset for help on using the changeset viewer.