[vhffs-dev] [1413] Remove PostgreSQL charset selection on database creation ( robots were not using this anymore). |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [1413] Remove PostgreSQL charset selection on database creation ( robots were not using this anymore).
- From: subversion@xxxxxxxxxxxxx
- Date: Thu, 28 May 2009 08:00:02 +0200
Revision: 1413
Author: beuss
Date: 2009-05-28 08:00:01 +0200 (Thu, 28 May 2009)
Log Message:
-----------
Remove PostgreSQL charset selection on database creation (robots were not using this anymore). Fixes #0000257
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm
trunk/vhffs-panel/pgsql/create.pl
trunk/vhffs-panel/templates/pgsql/create.tmpl
Added Paths:
-----------
trunk/vhffs-compat/4.2.sql
Modified: trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2009-05-26 13:16:24 UTC (rev 1412)
+++ trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2009-05-28 06:00:01 UTC (rev 1413)
@@ -107,12 +107,12 @@
sub create_pgsql
{
- my( $main , $dbname , $user , $group , $dbuser , $dbpass, $dbencoding, $description ) = @_;
+ my( $main , $dbname , $user , $group , $dbuser , $dbpass, $description ) = @_;
return -1 if( ! defined $user );
return -2 if( ! defined $group );
- my $pgsql = Vhffs::Services::Pgsql::create($main, $dbname, $dbuser, $dbpass, $dbencoding, $description, $user, $group);
+ my $pgsql = Vhffs::Services::Pgsql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group);
return undef if( ! defined $pgsql );
Modified: trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm 2009-05-26 13:16:24 UTC (rev 1412)
+++ trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm 2009-05-28 06:00:01 UTC (rev 1413)
@@ -54,48 +54,6 @@
use base qw(Vhffs::Object);
use DBI;
-my $supported_encodings = {
- BIG5 => 1,
- EUC_CN => 1,
- EUC_JP => 1,
- EUC_KR => 1,
- EUC_TW => 1,
- GB18030 => 1,
- GBK => 1,
- ISO_8859_5 => 1,
- ISO_8859_6 => 1,
- ISO_8859_7 => 1,
- ISO_8859_8 => 1,
- JOHAB => 1,
- KOI8 => 1,
- LATIN1 => 1,
- LATIN2 => 1,
- LATIN3 => 1,
- LATIN4 => 1,
- LATIN5 => 1,
- LATIN6 => 1,
- LATIN7 => 1,
- LATIN8 => 1,
- LATIN9 => 1,
- LATIN10 => 1,
- MULE_INTERNAL => 1,
- SJIS => 1,
- SQL_ASCII => 1,
- UHC => 1,
- UTF8 => 1,
- WIN866 => 1,
- WIN874 => 1,
- WIN1250 => 1,
- WIN1251 => 1,
- WIN1252 => 1,
- WIN1256 => 1,
- WIN1258 => 1
-};
-
-sub get_supported_encodings() {
- return $supported_encodings;
-}
-
=pod
=head2 check_dbname
@@ -167,9 +125,9 @@
=cut
sub create {
- my ($main, $dbname, $dbuser, $dbpass, $dbencoding, $description, $user, $group) = @_;
+ my ($main, $dbname, $dbuser, $dbpass, $description, $user, $group) = @_;
return undef unless(defined($user) && defined($group));
- return undef unless(check_dbname($dbname) && check_dbpass($dbpass) && check_dbuser($dbuser) && defined $supported_encodings->{$dbencoding});
+ return undef unless(check_dbname($dbname) && check_dbpass($dbpass) && check_dbuser($dbuser));
my $pg;
my $dbh = $main->get_db_object();
@@ -182,9 +140,9 @@
my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_PGSQL);
die('Unable to create parent object') unless defined ($parent);
- my $sql = 'INSERT INTO vhffs_pgsql(dbname, dbuser, dbpass, dbencoding, object_id) VALUES(?, ?, ?, ?, ?)';
+ my $sql = 'INSERT INTO vhffs_pgsql(dbname, dbuser, dbpass, object_id) VALUES(?, ?, ?, ?)';
my $sth = $dbh->prepare($sql);
- $sth->execute($dbname, $dbuser, $dbpass, $dbencoding, $parent->get_oid);
+ $sth->execute($dbname, $dbuser, $dbpass, $parent->get_oid);
$dbh->commit;
$pg = get_by_dbname($main, $dbname);
@@ -255,12 +213,6 @@
return 1;
}
-sub get_dbencoding
-{
- my $self = shift;
- return $self->{dbencoding};
-}
-
sub blank_password
{
my $self = shift;
@@ -271,7 +223,7 @@
}
sub _new {
- my ($class, $main, $pgsql_id, $owner_gid, $dbname, $dbuser, $dbpass, $dbencoding, $oid, $owner_uid, $date_creation, $state, $description) = @_;
+ my ($class, $main, $pgsql_id, $owner_gid, $dbname, $dbuser, $dbpass, $oid, $owner_uid, $date_creation, $state, $description) = @_;
my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, '', $state, Vhffs::Constants::TYPE_PGSQL);
return undef unless(defined $self);
@@ -279,7 +231,6 @@
$self->{dbname} = $dbname;
$self->{dbuser} = $dbuser;
$self->{dbpass} = $dbpass;
- $self->{dbencoding} = $dbencoding;
return $self;
}
@@ -297,7 +248,7 @@
sub get_by_dbname($$) {
my ($vhffs, $dbname) = @_;
- my $sql = q{SELECT m.pgsql_id, o.owner_gid, m.dbname, m.dbuser, m.dbpass, m.dbencoding, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
+ my $sql = q{SELECT m.pgsql_id, o.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
my $dbh = $vhffs->get_db_object();
my @params;
return undef unless(@params = $dbh->selectrow_array($sql, undef, $dbname));
@@ -313,7 +264,7 @@
=cut
sub fill_object {
my ($class, $obj) = @_;
- my $sql = q{SELECT pgsql_id, dbname, dbuser, dbpass, dbencoding FROM vhffs_pgsql
+ my $sql = q{SELECT pgsql_id, dbname, dbuser, dbpass FROM vhffs_pgsql
WHERE object_id = ?};
return $class->SUPER::_fill_object($obj, $sql);
}
@@ -325,7 +276,7 @@
my $postgres = [];
my @params;
- my $sql = 'SELECT p.pgsql_id, o.owner_gid, p.dbname, p.dbuser, p.dbpass, p.dbencoding, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id = o.object_id';
+ my $sql = 'SELECT p.pgsql_id, o.owner_gid, p.dbname, p.dbuser, p.dbpass o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id = o.object_id';
if(defined $state) {
$sql .= ' AND o.state = ?';
Added: trunk/vhffs-compat/4.2.sql
===================================================================
--- trunk/vhffs-compat/4.2.sql (rev 0)
+++ trunk/vhffs-compat/4.2.sql 2009-05-28 06:00:01 UTC (rev 1413)
@@ -0,0 +1,4 @@
+-- Probably not complete
+
+-- Server encoding is always used to avoid compatibility issues
+ALTER TABLE vhffs_pgsql DROP COLUMN dbencoding;
Modified: trunk/vhffs-panel/pgsql/create.pl
===================================================================
--- trunk/vhffs-panel/pgsql/create.pl 2009-05-26 13:16:24 UTC (rev 1412)
+++ trunk/vhffs-panel/pgsql/create.pl 2009-05-28 06:00:01 UTC (rev 1413)
@@ -75,7 +75,6 @@
$dbsuffix = $dbsuffix = $cgi->param('db_suffix');
my $dbname = $group->get_groupname.'_'.$dbsuffix;
my $dbuser = $dbname;
- my $dbencoding = $cgi->param('db_encoding');
$dbpass = $cgi->param('db_pass');
$description = $cgi->param('description');
@@ -87,9 +86,7 @@
$panel->add_error( gettext('Invalid database name, it must contain only numbers, lowercase letters and underscore (the latter isn\'t allowed in first or last position) and be between 3 and 32 characters.') );
} elsif(!Vhffs::Services::Pgsql::check_dbpass($dbpass)) {
$panel->add_error( gettext('Invalid password. It must be at least 3 chars') );
- } elsif(! defined Vhffs::Services::Pgsql::get_supported_encodings()->{$dbencoding}) {
- $panel->add_error( gettext('Invalid encoding') );
- } elsif(defined Vhffs::Panel::Pgsql::create_pgsql($vhffs, $dbname, $user, $group, $dbuser, $dbpass, $dbencoding, $description)) {
+ } elsif(defined Vhffs::Panel::Pgsql::create_pgsql($vhffs, $dbname, $user, $group, $dbuser, $dbpass, $description)) {
my $url = '/group/view.pl?group='.$group->get_groupname.'&msg='.gettext('The PostgreSQL DB was successfully created !');
$panel->redirect($url);
} else {
@@ -108,11 +105,7 @@
$template->param( DB_SUFFIX => gettext("PostgreSQL database name ") );
$template->param( DB_SUFFIX_VALUE => $dbsuffix );
$template->param( DB_PASS => gettext("PostgreSQL password for this database ") );
- $template->param( DB_SELECT_ENCODING => gettext("Database encoding"));
# CAN'T HTML::Template RENDER A SIMPLE ARRAY?! THIS SIMPLY SUCKS!
- my @encodings = map +{'encoding' => $_}, keys %{Vhffs::Services::Pgsql::get_supported_encodings()};
- @encodings = sort { return -1 if($a->{'encoding'} eq 'UTF8'); return 1 if($b->{encoding} eq 'UTF8'); return $a->{encoding} cmp $b->{encoding}} @encodings;
- $template->param( DB_ENCODINGS => \@encodings);
$template->param( GROUP => $group->get_groupname );
$template->param( SEND => gettext("Send") );
$template->param( DESCRIPTION => gettext("Description") );
Modified: trunk/vhffs-panel/templates/pgsql/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/pgsql/create.tmpl 2009-05-26 13:16:24 UTC (rev 1412)
+++ trunk/vhffs-panel/templates/pgsql/create.tmpl 2009-05-28 06:00:01 UTC (rev 1413)
@@ -19,16 +19,6 @@
<input type="password" name="db_pass" id="db_pass"/>
</p>
<p>
- <label for="db_encoding">
- <TMPL_VAR ESCAPE=1 NAME="DB_SELECT_ENCODING">
- </label>
- <select name="db_encoding" id="db_encoding">
- <TMPL_LOOP name="DB_ENCODINGS">
- <option value="<TMPL_VAR NAME="ENCODING">"><TMPL_VAR NAME="ENCODING"></option>
- </TMPL_LOOP>
- </select>
- </p>
- <p>
<label for="description">
<TMPL_VAR ESCAPE=1 NAME="DESCRIPTION">:
</label>