raise_message('syslog_info', __('Please rename either your config.php.dist or config_local.php.dist files in the syslog directory, and change setup your database before installing.', 'syslog'), MESSAGE_LEVEL_ERROR);
if (substr($_SERVER['SCRIPT_FILENAME'], -18) != 'syslog_process.php' && !in_array(get_current_page(), $files)) {
return;
}
$present = syslog_db_fetch_row('SHOW TABLES FROM `' . $syslogdb_default . "` LIKE 'syslog'");
$old_pia = false;
if (cacti_sizeof($present)) {
$old_table = syslog_db_fetch_row('SHOW COLUMNS FROM `' . $syslogdb_default . "`.`syslog` LIKE 'time'");
if (cacti_sizeof($old_table)) {
$old_pia = true;
}
}
/* don't let this script timeout */
ini_set('max_execution_time', 0);
$version = plugin_syslog_version();
$current = $version['version'];
$old = db_fetch_cell("SELECT version FROM plugin_config WHERE directory='syslog'");
if ($current != $old) {
if ($old_pia || $old < 2) {
print__('Syslog 2.0 Requires an Entire Reinstall. Please uninstall Syslog and Remove all Data before Installing. Migration is possible, but you must plan this in advance. No automatic migration is supported.', 'syslog') . "\n";
exit;
} elseif ($old == 2) {
syslog_db_execute('ALTER TABLE syslog_statistics
ADD COLUMN id BIGINT UNSIGNED auto_increment FIRST,
DROP PRIMARY KEY,
ADD PRIMARY KEY(id),
ADD UNIQUE INDEX (`host_id`,`facility_id`,`priority_id`,`program_id`,`insert_time`)');
cacti_log('WARNING: You have installed the Syslog plugin, but you have not properly set a config.php or config_local.php', false, 'POLLER');
}
}
functionsyslog_install_advisor($syslog_exists) {
global$config, $syslog_retentions;
top_header();
syslog_config_arrays();
$fields_syslog_update = array(
'upgrade_type' => array(
'method' => 'drop_array',
'friendly_name' => __('What upgrade/install type do you wish to use', 'syslog'),
'description' => __('When you have very large tables, performing a Truncate will be much quicker. If you are concerned about archive data, you can choose either Inline, which will freeze your browser for the period of this upgrade, or background, which will create a background process to bring your old syslog data from a backup table to the new syslog format. Again this process can take several hours.', 'syslog'),
print"<h2 style='color:red;'>" . __('WARNING: Syslog Upgrade is Time Consuming!!!', 'syslog') . "</h2>\n";
print"<p>" . __('The upgrade of the \'main\' syslog table can be a very time consuming process. As such, it is recommended that you either reduce the size of your syslog table prior to upgrading, or choose the background option</p> <p>If you choose the background option, your legacy syslog table will be renamed, and a new syslog table will be created. Then, an upgrade process will be launched in the background. Again, this background process can quite a bit of time to complete. However, your data will be preserved</p> <p>Regardless of your choice, all existing removal and alert rules will be maintained during the upgrade process.</p> <p>Press <b>\'Upgrade\'</b> to proceed with the upgrade, or <b>\'Cancel\'</b> to return to the Plugins menu.', 'syslog') . "</p></td></tr>";
} else {
unset($fields_syslog_update['upgrade_type']);
print"<p>" . __('You have several options to choose from when installing Syslog. The first is the Database Architecture. You should elect to utilize Table Partitioning to prevent the size of the tables from becoming excessive thus slowing queries.', 'syslog') . '</p><p>' . __('You can also set the MySQL storage engine. If you have not tuned you system for InnoDB storage properties, it is strongly recommended that you utilize the MyISAM storage engine.', 'syslog') . '</p><p>' . __('You can also select the retention duration. Please keep in mind that if you have several hosts logging to syslog, this table can become quite large. So, if not using partitioning, you might want to keep the size smaller.', 'syslog') . "</p></td></tr>";
$syslog_exists = sizeof(syslog_db_fetch_row('SHOW TABLES FROM `' . $syslogdb_default . "` LIKE 'syslog'"));
top_header();
$fields_syslog_update = array(
'uninstall_method' => array(
'method' => 'drop_array',
'friendly_name' => __('What uninstall method do you want to use?', 'syslog'),
'description' => __('When uninstalling syslog, you can remove everything, or only components, just in case you plan on re-installing in the future.', 'syslog'),