This repository has been archived by the owner on Jan 15, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #5098
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
app/modules/Cronks/actions/Util/ReloadStatusAction.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
// {{{ICINGA_LICENSE_CODE}}} | ||
// ----------------------------------------------------------------------------- | ||
// This file is part of icinga-web. | ||
// | ||
// Copyright (c) 2009-2013 Icinga Developer Team. | ||
// All rights reserved. | ||
// | ||
// icinga-web is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// icinga-web is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with icinga-web. If not, see <http://www.gnu.org/licenses/>. | ||
// ----------------------------------------------------------------------------- | ||
// {{{ICINGA_LICENSE_CODE}}} | ||
|
||
class Cronks_Util_ReloadStatusAction extends CronksBaseAction { | ||
/** | ||
* Returns the default view if the action does not serve the request | ||
* method used. | ||
* | ||
* @return mixed <ul> | ||
* <li>A string containing the view name associated | ||
* with this action; or</li> | ||
* <li>An array with two indices: the parent module | ||
* of the view to be executed and the view to be | ||
* executed.</li> | ||
* </ul> | ||
*/ | ||
public function getDefaultViewName() { | ||
return 'Success'; | ||
} | ||
|
||
public function executeRead(AgaviParameterHolder $rd) { | ||
|
||
/** @var Cronks_Provider_ProgramStatusModel $model */ | ||
$model = $this->context->getModel('Provider.ProgramStatus', 'Cronks'); | ||
|
||
if (!$model->isApplicable() || $model->config_dump_in_progress === '1') { | ||
$this->setAttribute('config_reload', true); | ||
} else { | ||
$this->setAttribute('config_reload', false); | ||
} | ||
|
||
return $this->getDefaultViewName(); | ||
} | ||
|
||
public function executeWrite(AgaviParameterHolder $rd) { | ||
return $this->executeRead($rd); | ||
} | ||
|
||
public function isSecure() { | ||
return true; | ||
} | ||
|
||
public function getCredentials() { | ||
return array('icinga.user'); | ||
} | ||
|
||
public function handleError(AgaviRequestDataHolder $rd) { | ||
return $this->getDefaultViewName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ae:configurations | ||
xmlns="http://agavi.org/agavi/config/parts/validators/1.0" | ||
xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0" | ||
parent="%core.module_dir%/Cronks/config/validators.xml" | ||
> | ||
|
||
<ae:configuration> | ||
|
||
<validators> | ||
</validators> | ||
|
||
</ae:configuration> | ||
|
||
</ae:configurations> |
34 changes: 34 additions & 0 deletions
34
app/modules/Cronks/views/Util/ReloadStatusSuccessView.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
// {{{ICINGA_LICENSE_CODE}}} | ||
// ----------------------------------------------------------------------------- | ||
// This file is part of icinga-web. | ||
// | ||
// Copyright (c) 2009-2013 Icinga Developer Team. | ||
// All rights reserved. | ||
// | ||
// icinga-web is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// icinga-web is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with icinga-web. If not, see <http://www.gnu.org/licenses/>. | ||
// ----------------------------------------------------------------------------- | ||
// {{{ICINGA_LICENSE_CODE}}} | ||
|
||
class Cronks_Util_ReloadStatusSuccessView extends CronksBaseView { | ||
|
||
public function executeJson(AgaviRequestDataHolder $rd) { | ||
$output = array( | ||
'config_reload' => $this->getAttribute('config_reload') | ||
); | ||
|
||
return json_encode($output); | ||
} | ||
|
||
} |