ConfigCommand: new cli command, used for benchmarks
This commit is contained in:
parent
035eaf2185
commit
ae32d78174
|
@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue