Skip to content

Commit

Permalink
Introduce MigrateCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Jul 19, 2023
1 parent 6e75533 commit ce9d04b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions application/clicommands/MigrateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/* Icinga Web 2 X.509 Module | (c) 2023 Icinga GmbH | GPLv2 */

namespace Icinga\Module\X509\Clicommands;

use Icinga\Authentication\Auth;
use Icinga\Module\X509\Command;
use Icinga\Module\X509\ProvidedHook\Migration;

class MigrateCommand extends Command
{
/**
* Migrate the jobs config rom INI to the database
*
* USAGE
*
* icingacli x509 migrate jobs --author=<name>
*
* OPTIONS
*
* --author=<name>
* An Icinga Web 2 user used to mark as an author for all the migrated jobs.
*/
public function jobsAction()
{
$author = $this->params->getRequired('author');
Auth::getInstance()->getUser()->setUsername($author);

Migration::migrateJobs($this->getDb());
}
}

0 comments on commit ce9d04b

Please sign in to comment.