Ignore:
Timestamp:
Jan 8, 2016, 11:00:11 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Network configure actions now can be executed through cmd.php interface using "php cmd.php config <action>".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfig/NetworkConfig.php

    r738 r781  
    33class ModuleNetworkConfig extends AppModule
    44{
     5  var $ConfigItems;
     6
    57  function __construct($System)
    68  {
     
    1214    $this->Description = 'Network device remote configuration';
    1315    $this->Dependencies = array('Network');
     16    $this->ConfigItems = array();
    1417  }
    1518
     
    4851      ),
    4952    ));
     53    $this->System->RegisterCommandLine('config', array($this, 'Config'));
     54  }
     55
     56  function RegisterConfigItem($Name, $ClassName)
     57  {
     58    $this->ConfigItems[$Name] = $ClassName;
     59  }
     60
     61  function UnregisterConfigItem($Name)
     62  {
     63    unset($this->ConfigItems[$Name]);
     64  }
     65
     66  function Config($Parameters)
     67  {
     68    $Output = '';
     69    if($Parameters >= 3)
     70    {
     71      $ConfigItemName = $Parameters[2];
     72      if(array_key_exists($ConfigItemName, $this->ConfigItems))
     73      {
     74        $ClassName = $this->ConfigItems[$ConfigItemName];
     75        $ConfigItem = new $ClassName($this->System);
     76        $ConfigItem->Run();
     77      } else $Output = 'Config item '.$ConfigItemName.' not found';
     78    } else $Output = 'Not enough parameters';
     79    return($Output);
     80  }
     81}
     82
     83class NetworkConfigItem extends Model
     84{
     85  function Run()
     86  {
    5087
    5188  }
Note: See TracChangeset for help on using the changeset viewer.