updated perl files to support sqlite related database configurations
This commit is contained in:
parent
64a0b15c54
commit
a39ea1339a
@ -8,7 +8,7 @@ dnf install -y \
|
|||||||
mariadb-server mariadb httpd \
|
mariadb-server mariadb httpd \
|
||||||
php php-mysqli php-gd \
|
php php-mysqli php-gd \
|
||||||
perl-Digest-SHA \
|
perl-Digest-SHA \
|
||||||
perl-DBD-MySQL perl-LDAP \
|
perl-DBD-MySQL perl-DBD-SQLite perl-LDAP \
|
||||||
mod_dav_svn mod_perl diffutils
|
mod_dav_svn mod_perl diffutils
|
||||||
|
|
||||||
dnf install -y \
|
dnf install -y \
|
||||||
|
@ -6,7 +6,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|||||||
php libapache2-mod-php php-mysql php-gd \
|
php libapache2-mod-php php-mysql php-gd \
|
||||||
libapache2-mod-perl2 libapache2-mod-svn \
|
libapache2-mod-perl2 libapache2-mod-svn \
|
||||||
libswitch-perl libconfig-simple-perl libdigest-sha-perl \
|
libswitch-perl libconfig-simple-perl libdigest-sha-perl \
|
||||||
libdbd-mysql-perl libnet-ldap-perl libsvn-perl libmail-sendmail-perl \
|
libdbd-mysql-perl libdbd-sqlite3-perl libnet-ldap-perl libsvn-perl libmail-sendmail-perl \
|
||||||
php-dev libsvn-dev make
|
php-dev libsvn-dev make
|
||||||
|
|
||||||
svn co http://code.miflux.com/svn/codepot/trunk/codepot && \
|
svn co http://code.miflux.com/svn/codepot/trunk/codepot && \
|
||||||
|
@ -236,6 +236,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -246,6 +247,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -75,6 +75,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -86,6 +87,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -58,6 +58,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -69,6 +70,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -73,6 +73,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -84,6 +85,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -56,6 +56,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -67,6 +68,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -46,6 +46,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -57,6 +58,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
|
@ -51,6 +51,7 @@ sub open_database
|
|||||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||||
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
elsif ($dbtype eq 'oci8') { $dbtype = 'Oracle'; }
|
||||||
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
elsif ($dbtype eq 'mysqli') { $dbtype = 'mysql'; }
|
||||||
|
elsif ($dbtype eq 'sqlite') { $dbtype = 'SQLite'; }
|
||||||
|
|
||||||
my $dbstr;
|
my $dbstr;
|
||||||
my $dbuser;
|
my $dbuser;
|
||||||
@ -62,6 +63,12 @@ sub open_database
|
|||||||
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
$dbuser = $cfg->{database_username} . '/' . $cfg->{database_password} . '@' . $dbhost;
|
||||||
$dbpass = '';
|
$dbpass = '';
|
||||||
}
|
}
|
||||||
|
elsif ($dbtype eq 'SQLite')
|
||||||
|
{
|
||||||
|
$dbstr = "DBI:$dbtype:database=$dbhost;";
|
||||||
|
$dbuser = $cfg->{database_username};
|
||||||
|
$dbpass = $cfg->{database_password};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbstr = "DBI:$dbtype:database=$dbname;";
|
$dbstr = "DBI:$dbtype:database=$dbname;";
|
||||||
@ -186,11 +193,11 @@ sub toggle_user
|
|||||||
$dbh->begin_work ();
|
$dbh->begin_work ();
|
||||||
|
|
||||||
my $query = $dbh->prepare("UPDATE ${QC}${prefix}user_account${QC} SET ${QC}enabled${QC}=? WHERE ${QC}userid${QC}=?");
|
my $query = $dbh->prepare("UPDATE ${QC}${prefix}user_account${QC} SET ${QC}enabled${QC}=? WHERE ${QC}userid${QC}=?");
|
||||||
if (!$query || !$query->execute ($enabled, $userid) || $query->rows() <= 0)
|
if (!$query || !(my $execok = $query->execute($enabled, $userid)) || $query->rows() <= 0)
|
||||||
{
|
{
|
||||||
my $errstr = $dbh->errstr();
|
my $errstr = $execok? "user not found": $dbh->errstr();
|
||||||
$dbh->rollback ();
|
$dbh->rollback ();
|
||||||
print (STDERR "Cannot enable/disable a user - $errstr\n");
|
print (STDERR "Cannot enable/disable the user '$userid' - $errstr\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user