Added manuel integritycheck for admins

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas) 2014-02-11 16:40:53 +01:00
parent b726a8528b
commit e3e4dba90d
7 changed files with 86 additions and 0 deletions

View File

@ -264,4 +264,24 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} else {
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
}
} elseif ($page == 'integritycheck'
&& $userinfo['change_serversettings'] == '1'
) {
$integrity = new IntegrityCheck();
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$integrity->fixAll();
} elseif(isset($_GET['action'])
&& $_GET['action'] == "fix") {
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page));
}
$integritycheck = '';
foreach ($integrity->available as $id => $check) {
$displayid = $id + 1;
$result = $integrity->$check();
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
}
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
}

View File

@ -20,6 +20,22 @@
class IntegrityCheck {
// Store all available checks
public $available = array();
/**
* Constructor
* Parses all available checks into $this->available
*/
public function __construct() {
$this->available = get_class_methods($this);
unset($this->available[array_search('__construct', $this->available)]);
unset($this->available[array_search('checkAll', $this->available)]);
unset($this->available[array_search('fixAll', $this->available)]);
sort($this->available);
}
/**
* Check all occuring integrity problems at once
*/

View File

@ -235,6 +235,11 @@ return array (
'label' => $lng['admin']['updatecounters'],
'required_resources' => 'change_serversettings',
),
array (
'url' => 'admin_settings.php?page=integritycheck',
'label' => $lng['admin']['integritycheck'],
'required_resources' => 'change_serversettings',
),
array (
'url' => 'admin_phpsettings.php?page=overview',
'label' => $lng['menue']['phpsettings']['maintitle'],

View File

@ -1804,3 +1804,9 @@ $lng['tasks']['remove_ftpacc_files'] = 'Delete customer ftp-account data.';
$lng['tasks']['regenerating_crond'] = 'Rebuilding the cron.d-file';
$lng['serversettings']['system_crondreload']['title'] = 'Cron-daemon reload command';
$lng['serversettings']['system_crondreload']['description'] = 'Specify the command to execute in order to reload your systems cron-daemon';
$lng['admin']['integritycheck'] = 'Database validation';
$lng['admin']['integrityid'] = '#';
$lng['admin']['integrityname'] = 'Name';
$lng['admin']['integrityresult'] = 'Result';
$lng['admin']['integrityfix'] = 'Fix problems automatically';
$lng['question']['admin_integritycheck_reallyfix'] = 'Do you really want to try fixing all database integrity problems automatically?';

View File

@ -1530,3 +1530,9 @@ $lng['tasks']['remove_ftpacc_files'] = 'Kunden FTP-Konto Dateien löschen';
$lng['tasks']['regenerating_crond'] = 'Neuerstellung der cron.d-Datei';
$lng['serversettings']['system_crondreload']['title'] = 'Cron-Daemon reload Befehl';
$lng['serversettings']['system_crondreload']['description'] = 'Geben Sie hier den Befehl zum Neuladen des Cron-Daemons an';
$lng['admin']['integritycheck'] = 'Datenbankpr&uuml;fung';
$lng['admin']['integrityid'] = '#';
$lng['admin']['integrityname'] = 'Name';
$lng['admin']['integrityresult'] = 'Ergebnis';
$lng['admin']['integrityfix'] = 'Probleme automatisch beheben';
$lng['question']['admin_integritycheck_reallyfix'] = 'M&ouml;chten Sie wirklich versuchen s&auml;tliche Datenbank - Integrit&auml;tsprobleme automatisch zu beheben?';

View File

@ -0,0 +1,28 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/icons/res_recalculate_big.png" alt="" />&nbsp;
{$lng['admin']['integritycheck']}
</h2>
</header>
<section>
<table class="full">
<thead>
<tr>
<th>{$lng['admin']['integrityid']}</th>
<th>{$lng['admin']['integrityname']}</th>
<th>{$lng['admin']['integrityresult']}</th>
</tr>
</thead>
<tfoot>
<td colspan="3"><a href="{$linker->getLink(array('section' => 'settings', 'page' => $page, 'action' => 'fix'))}">{$lng['admin']['integrityfix']}</a></td>
</tfoot>
<tbody>
{$integritycheck}
</tbody>
</table>
</section>
</article>
$footer

View File

@ -0,0 +1,5 @@
<tr class="top">
<td>{$displayid}</td>
<td>{$check}</td>
<td><if $result == '1'>OK<else>FAIL</if></td>
</tr>