Added new PDO Database logstream into install script.

This means you can select now between the native MYSQL Server and the PDO
database driver. When using the PDO database driver, you choose between
different database storage engines.
This commit is contained in:
Andre Lorbach 2008-05-23 17:33:14 +02:00
parent 672e835343
commit b2fefbaf3f
7 changed files with 175 additions and 37 deletions

View File

@ -75,6 +75,8 @@ define('DB_OCI', 4);
define('DB_DB2', 5);
define('DB_FIREBIRD', 6);
define('DB_INFORMIX', 7);
define('DB_SQLITE', 8);
// --- Predefine fields array!
$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID;

View File

@ -236,10 +236,15 @@ function CreateSourceTypesList( $selectedSource )
$content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK'];
if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; }
// SOURCE_DB
// SOURCE_DB ( MYSQL NATIVE )
$content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB;
$content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB'];
if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; }
if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; }
// SOURCE_PDO ( PDO DB Wrapper)
$content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO;
$content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO'];
if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; }
}
function CreateDBTypesList( $selectedDBType )
@ -248,21 +253,57 @@ function CreateDBTypesList( $selectedDBType )
// DB_MYSQL
$content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL;
$content['DBTYPES'][DB_MYSQL]['DisplayName'] = "Mysql";
$content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL";
$content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL'];
if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; }
/* LATER ...
// DB_MSSQL
$content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL;
$content['DBTYPES'][DB_MSSQL]['DisplayName'] = "Microsoft SQL Server";
$content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL";
$content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL'];
if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; }
// DB_ODBC
$content['DBTYPES'][DB_ODBC]['type'] = DB_MSSQL;
$content['DBTYPES'][DB_ODBC]['DisplayName'] = "ODBC Database Source";
if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_MSSQL]['selected'] = ""; }
*/
$content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC;
$content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC";
$content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC'];
if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; }
// DB_PGSQL
$content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL;
$content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL";
$content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL'];
if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; }
// DB_OCI
$content['DBTYPES'][DB_OCI]['type'] = DB_OCI;
$content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI";
$content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI'];
if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; }
// DB_DB2
$content['DBTYPES'][DB_DB2]['type'] = DB_DB2;
$content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2";
$content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2'];
if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; }
// DB_FIREBIRD
$content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD;
$content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD";
$content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD'];
if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; }
// DB_INFORMIX
$content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX;
$content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX";
$content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX'];
if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; }
// DB_SQLITE
$content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE;
$content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE";
$content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE'];
if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; }
}
function CreatePagesizesList()

View File

@ -347,7 +347,7 @@ else if ( $content['INSTALL_STEP'] == 5 )
$totaldbdefs = str_replace( "`logcon_", "`" . $_SESSION["UserDBPref"], $totaldbdefs );
// Now split by sql command
$mycommands = split( ";\r\n", $totaldbdefs );
$mycommands = split( ";\n", $totaldbdefs );
// check for different linefeed
if ( count($mycommands) <= 1 )
@ -527,7 +527,7 @@ else if ( $content['INSTALL_STEP'] == 8 )
if ( !is_file($_SESSION['SourceDiskFile']) )
RevertOneStep( $content['INSTALL_STEP']-1, "Failed to open the syslog file " .$_SESSION['SourceDiskFile'] . "! Check if the file exists and phplogcon has sufficient rights to it<br>" );
}
else if ( $_SESSION['SourceType'] == SOURCE_DB)
else if ( $_SESSION['SourceType'] == SOURCE_DB || $_SESSION['SourceType'] == SOURCE_PDO )
{
if ( isset($_POST['SourceDBType']) )
$_SESSION['SourceDBType'] = DB_RemoveBadChars($_POST['SourceDBType']);
@ -594,26 +594,42 @@ else if ( $content['INSTALL_STEP'] == 8 )
}
//Add the first source!
$firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\r\n\r\n" .
"\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" .
"\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\r\n" .
"\$CFG['Sources']['Source1']['SourceType'] = " . $_SESSION['SourceType'] . ";\r\n";
$firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\n\n" .
"\$CFG['Sources']['Source1']['ID'] = 'Source1';\n" .
"\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n";
if ( $_SESSION['SourceType'] == SOURCE_DISK )
{
$firstsource .= "\$CFG['Sources']['Source1']['LogLineType'] = '" . $_SESSION['SourceLogLineType'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DiskFile'] = '" . $_SESSION['SourceDiskFile'] . "';\r\n" .
$firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;\n" .
"\$CFG['Sources']['Source1']['LogLineType'] = '" . $_SESSION['SourceLogLineType'] . "';\n" .
"\$CFG['Sources']['Source1']['DiskFile'] = '" . $_SESSION['SourceDiskFile'] . "';\n" .
"";
}
else if ( $_SESSION['SourceType'] == SOURCE_DB )
{
$firstsource .= "\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBType'] = '" . $_SESSION['SourceDBType'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\r\n" .
"\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\r\n" .
$firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DB;\n" .
"\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\n" .
"\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\n" .
"\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\n" .
"\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\n" .
"\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\n" .
"\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\n" .
"\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\n" .
"";
}
else if ( $_SESSION['SourceType'] == SOURCE_PDO )
{
// Need to create the LIST first!
CreateDBTypesList($_SESSION['SourceDBType']);
$firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_PDO;\n" .
"\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\n" .
"\$CFG['Sources']['Source1']['DBType'] = " . $content['DBTYPES'][$_SESSION['SourceDBType']]['typeastext'] . ";\n" .
"\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\n" .
"\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\n" .
"\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\n" .
"\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\n" .
"\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\n" .
"\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\n" .
"";
}
$patterns[] = "/\/\/ --- \%Insert Source Here\%/";

View File

@ -67,6 +67,30 @@ function togglevisibility(ElementNameToggle, ElementNameButton)
}
}
/*
* Helper function to hide a div area
*/
function showvisibility(ElementNameToggle, ElementNameButton)
{
var toggle = document.getElementById(ElementNameToggle);
// Button is optional
if (ElementNameButton != null)
{
var button = document.getElementById(ElementNameButton);
}
else
var button = null;
if (button != null)
{
button.className = "topmenu2 ExpansionMinus";
}
toggle.style.visibility = "visible";
toggle.style.display = "inline";
}
/*
* Helper function to hide a div area
*/

View File

@ -46,6 +46,15 @@ $content['LN_GEN_SOURCE_DB'] = "Datenbank";
$content['LN_GEN_RECORDSPERPAGE'] = "records per page";
$content['LN_GEN_PRECONFIGURED'] = "Preconfigured";
$content['LN_GEN_AVAILABLESEARCHES'] = "Available searches";
$content['LN_GEN_DB_MYSQL'] = "Mysql Server";
$content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server";
$content['LN_GEN_DB_ODBC'] = "ODBC Database Source";
$content['LN_GEN_DB_PGSQL'] = "PostgreSQL";
$content['LN_GEN_DB_OCI'] = "Oracle Call Interface";
$content['LN_GEN_DB_DB2'] = " IBM DB2";
$content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6";
$content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server";
$content['LN_GEN_DB_SQLITE'] = "SQLite 2";
// Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem phpLogCon Hauptordner entfernt!";

View File

@ -42,11 +42,20 @@ $content['LN_GEN_PAGERSIZE'] = "Records per page";
$content['LN_GEN_PAGE'] = "Page";
$content['LN_GEN_PREDEFINEDSEARCHES'] = "Predefined Searches";
$content['LN_GEN_SOURCE_DISK'] = "Diskfile";
$content['LN_GEN_SOURCE_DB'] = "Database";
$content['LN_GEN_SOURCE_DB'] = "MYSQL Native";
$content['LN_GEN_SOURCE_PDO'] = "Database (PDO)";
$content['LN_GEN_RECORDSPERPAGE'] = "records per page";
$content['LN_GEN_PRECONFIGURED'] = "Preconfigured";
$content['LN_GEN_AVAILABLESEARCHES'] = "Available searches";
$content['LN_GEN_DB_MYSQL'] = "Mysql Server";
$content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server";
$content['LN_GEN_DB_ODBC'] = "ODBC Database Source";
$content['LN_GEN_DB_PGSQL'] = "PostgreSQL";
$content['LN_GEN_DB_OCI'] = "Oracle Call Interface";
$content['LN_GEN_DB_DB2'] = " IBM DB2";
$content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6";
$content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server";
$content['LN_GEN_DB_SQLITE'] = "SQLite 2";
// Main Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your phpLogCon main directory!";

View File

@ -8,6 +8,35 @@
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<script language="javascript">
/*
* Helper function to show and hide areas of the filterview
*/
function toggleSourceTypeVisibility(FormFieldName)
{
var myfield = document.getElementById(FormFieldName);
if (myfield.value == 1)
{
showvisibility("HiddenDiskTypeOptions");
hidevisibility("HiddenDatabaseTypeOptions");
}
else if (myfield.value == 2)
{
showvisibility("HiddenDatabaseTypeOptions");
hidevisibility("HiddenDiskTypeOptions");
hidevisibility("HiddenDBTYpesOptions");
}
else if (myfield.value == 3)
{
showvisibility("HiddenDatabaseTypeOptions");
hidevisibility("HiddenDiskTypeOptions");
showvisibility("HiddenDBTYpesOptions");
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mainheader">
<tr>
<td rowspan="4" width="500" align="left" valign="top"><a href="index.php"><img src="{BASEPATH}images/main/Header-Logo.png" width="500" height="79" name="HeaderLogo"></a></td>
@ -265,7 +294,7 @@
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_SOURCETYPE}</b></td>
<td align="right" class="line1" width="100%">
<select id="SourceType" name="SourceType" size="1" OnChange="toggleFormareaVisibility('SourceType', 'HiddenDiskTypeOptions', 'HiddenDatabaseTypeOptions');">
<select id="SourceType" name="SourceType" size="1" OnChange="toggleSourceTypeVisibility('SourceType');">
<!-- BEGIN SOURCETYPES -->
<option {selected} value="{type}">{DisplayName}</option>
<!-- END SOURCETYPES -->
@ -278,7 +307,7 @@
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="600" align="center" class="with_border">
<tr><td align="center" class="cellmenu1" colspan="2"><b>{LN_CFG_DISKTYPEOPTIONS}</b></td></tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_LOGLINETYPE}</b></td>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_CFG_LOGLINETYPE}</b></td>
<td align="right" class="line0" width="100%">
<select name="SourceLogLineType" size="1">
<!-- BEGIN LOGLINETYPES -->
@ -297,12 +326,12 @@
<div id="HiddenDatabaseTypeOptions" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border">
<tr><td align="center" class="cellmenu1" colspan="2"><b>{LN_CFG_DATABASETYPEOPTIONS}</b></td></tr>
</table>
<div id="HiddenDBTYpesOptions" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border">
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_DBTABLETYPE}</b></td>
<td align="right" class="line0" width="100%"><input type="text" name="SourceDBTableType" size="40" maxlength="255" value="{SourceDBTableType}"></td>
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_DBSTORAGEENGINE}</b></td>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_CFG_DBSTORAGEENGINE}</b></td>
<td align="right" class="line1" width="100%">
<select name="SourceDBType" size="1">
<!-- BEGIN DBTYPES -->
@ -311,6 +340,14 @@
</select>
</td>
</tr>
</table>
</div>
<table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border">
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_CFG_DBTABLETYPE}</b></td>
<td align="right" class="line0" width="100%"><input type="text" name="SourceDBTableType" size="40" maxlength="255" value="{SourceDBTableType}"></td>
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_DBSERVER}</b></td>
<td align="right" class="line0" width="100%"><input type="text" name="SourceDBServer" size="40" maxlength="255" value="{SourceDBServer}"></td>
@ -332,7 +369,7 @@
<td align="right" class="line0" width="100%"><input type="password" name="SourceDBPassword" size="40" maxlength="255" value="{SourceDBPassword}"></td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_CFG_DBROWCOUNTING}</b></td>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_DBROWCOUNTING}</b></td>
<td align="right" class="line1" width="100%">
<input type="radio" name="SourceDBEnableRowCounting" value="true" {SourceDBEnableRowCounting_true}> Yes <input type="radio" name="SourceDBEnableRowCounting" value="false" {SourceDBEnableRowCounting_false}> No
</td>
@ -348,7 +385,7 @@
<script language="javascript">
// Manually perform initial Javascript Calls
toggleFormareaVisibility('SourceType', 'HiddenDiskTypeOptions', 'HiddenDatabaseTypeOptions');
toggleSourceTypeVisibility('SourceType');
</script>
<!-- ENDIF INSTALL_STEP="7" -->