+ Attention, you are going to overwrite the data of your current installation.
This means that if you do not have a backup you will irremissibly LOSE ALL THE STORED DATA, the configuration and everything relevant to your installation.
";
+
+ return $header;
+}
+
+
+//
+// This function adjusts path settings in pandora db for FreeBSD.
+//
+// All packages and configuration files except operating system's base files
+// are installed under /usr/local in FreeBSD. So, path settings in pandora db
+// for some programs should be changed from the Linux default.
+//
+function adjust_paths_for_freebsd($engine, $connection=false)
+{
+ $adjust_sql = [
+ "update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');",
+ "update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';",
+ "update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');",
+ "update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');",
+ "update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');",
+ "update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');",
+ "insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');",
+ ];
+
+ for ($i = 0; $i < count($adjust_sql); $i++) {
+ switch ($engine) {
+ case 'mysql':
+ $result = mysql_query($adjust_sql[$i]);
+ break;
+
+ case 'mysqli':
+ $result = mysqli_query($connection, $adjust_sql[$i]);
+ break;
+
+ case 'oracle':
+ // Delete the last semicolon from current query
+ $query = substr($adjust_sql[$i], 0, (strlen($adjust_sql[$i]) - 1));
+ $sql = oci_parse($connection, $query);
+ $result = oci_execute($sql);
+ break;
+
+ case 'pgsql':
+ pg_send_query($connection, $adjust_sql[$i]);
+ $result = pg_get_result($connection);
+ break;
+ }
+
+ if (!$result) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+
+function install_step1()
+{
+ global $banner;
+
+ echo "
+
+
+ ".print_logo_status(1, 6)."
+
+
Welcome to Pandora FMS installation Wizard
+
This wizard helps you to quick install Pandora FMS console and main database in your system.
+
In four steps, this installer will check all dependencies and will create your configuration, ready to use.
+
For more information, please refer to documentation.
+ Pandora FMS Development Team
+ ";
+ if (file_exists('include/config.php')) {
+ echo "
Warning: You already have a config.php file.
+ Configuration and database would be overwritten if you continued.
";
+ }
+
+ echo ' ';
+ echo '
';
+ $writable = check_writable('include', 'Checking if ./include is writable');
+ if (file_exists('include/config.php')) {
+ $writable += check_writable('include/config.php', 'Checking if include/config.php is writable');
+ }
+
+ echo '
';
+
+ echo "
Warning: This installer will overwrite and destroy
+ your existing Pandora FMS configuration and Database. Before continue,
+ please be sure that you have no valuable Pandora FMS data in your Database.
+
";
+
+ echo "
Upgrade:
+ If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup.
+
Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms..
+
For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS
+
If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.
+ ";
+
+ if (!file_exists('COPYING')) {
+ echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.";
+ echo '
';
+ } else {
+ echo "
';
+
+ echo "
+
+
+ Pandora FMS is an OpenSource Software project registered at
+ SourceForge
+
You have some incomplete
+ dependencies. Please correct them or this installer
+ will not be able to finish your installation.
+
+
+ Remember, if you install any PHP module to comply
+ with these dependences, you need to restart
+ your HTTP/Apache server after it to use the new
+ modules.
+
+ This wizard will create your Pandora FMS database,
+ and populate it with all the data needed to run for the first time.
+
+
+ You need a privileged user to create database schema, this is usually root user.
+ Information about root user will not be used or stored anymore.
+
+
+ You can also deploy the scheme into an existing Database.
+ In this case you need a privileged Database user and password of that instance.
+
+
+ Now, please, complete all details to configure your database and environment setup.
+
+
+ Warning: This installer will overwrite and destroy your existing
+ Pandora FMS configuration and Database. Before continue,
+ please be sure that you have no valuable Pandora FMS data in your Database.
+
+
";
+
+ if (extension_loaded('oci8')) {
+ echo "
For Oracle installation an existing Database with a privileged user is needed.