ConfigCommand: new cli command, used for benchmarks

This commit is contained in:
Thomas Gelf 2016-03-19 22:10:25 +01:00
parent 035eaf2185
commit ae32d78174
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<?php
namespace Icinga\Module\Director\Clicommands;
use Icinga\Application\Benchmark;
use Icinga\Module\Director\Cli\Command;
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
use Icinga\Module\Director\Data\Db\DbObject;
class ConfigCommand extends Command
{
public function renderAction()
{
$config = new IcingaConfig($this->db());
Benchmark::measure('Rendering config');
if ($config->hasBeenModified()) {
Benchmark::measure('Config rendered, storing to db');
$config->store();
Benchmark::measure('All done');
$checksum = $config->getHexChecksum();
printf(
'New config with checksum %s has been generated',
$checksum
);
} else {
$checksum = $config->getHexChecksum();
printf(
'Config with checksum %s already exists',
$checksum
);
}
}
public function filesAction()
{
}
public function fileAction()
{
}
}