diff --git a/admin_settings.php b/admin_settings.php index 50d99a4e..4127bddd 100644 --- a/admin_settings.php +++ b/admin_settings.php @@ -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") . "\";"); } diff --git a/lib/classes/integrity/class.IntegrityCheck.php b/lib/classes/integrity/class.IntegrityCheck.php index 9dde20c2..1bc2ef58 100644 --- a/lib/classes/integrity/class.IntegrityCheck.php +++ b/lib/classes/integrity/class.IntegrityCheck.php @@ -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 */ diff --git a/lib/navigation/00.froxlor.main.php b/lib/navigation/00.froxlor.main.php index 6c993167..19374612 100644 --- a/lib/navigation/00.froxlor.main.php +++ b/lib/navigation/00.froxlor.main.php @@ -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'], diff --git a/lng/english.lng.php b/lng/english.lng.php index 7bee0b20..15571b41 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -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?'; \ No newline at end of file diff --git a/lng/german.lng.php b/lng/german.lng.php index cb6c1d52..7ca6ea22 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -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üfung'; +$lng['admin']['integrityid'] = '#'; +$lng['admin']['integrityname'] = 'Name'; +$lng['admin']['integrityresult'] = 'Ergebnis'; +$lng['admin']['integrityfix'] = 'Probleme automatisch beheben'; +$lng['question']['admin_integritycheck_reallyfix'] = 'Möchten Sie wirklich versuchen sätliche Datenbank - Integritätsprobleme automatisch zu beheben?'; diff --git a/templates/Sparkle/admin/settings/integritycheck.tpl b/templates/Sparkle/admin/settings/integritycheck.tpl new file mode 100644 index 00000000..335957d8 --- /dev/null +++ b/templates/Sparkle/admin/settings/integritycheck.tpl @@ -0,0 +1,28 @@ +$header +
+
+

+   + {$lng['admin']['integritycheck']} +

+
+ +
+ + + + + + + + + + + + + {$integritycheck} + +
{$lng['admin']['integrityid']}{$lng['admin']['integrityname']}{$lng['admin']['integrityresult']}
{$lng['admin']['integrityfix']}
+
+
+$footer diff --git a/templates/Sparkle/admin/settings/integritycheck_row.tpl b/templates/Sparkle/admin/settings/integritycheck_row.tpl new file mode 100644 index 00000000..3a59b2b2 --- /dev/null +++ b/templates/Sparkle/admin/settings/integritycheck_row.tpl @@ -0,0 +1,5 @@ + + {$displayid} + {$check} + OKFAIL +