[vhffs-dev] [805] renaming Vhffs::Robots::Postgres to Vhffs::Robots::Pgsql (part two) |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 805
Author: gradator
Date: 2007-08-29 23:32:47 +0000 (Wed, 29 Aug 2007)
Log Message:
-----------
renaming Vhffs::Robots::Postgres to Vhffs::Robots::Pgsql (part two)
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Makefile.am
Added Paths:
-----------
trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm
Removed Paths:
-------------
trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm
Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am 2007-08-29 23:31:51 UTC (rev 804)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am 2007-08-29 23:32:47 UTC (rev 805)
@@ -48,7 +48,7 @@
Robots/Group.pm \
Robots/Mailing.pm \
Robots/Mysql.pm \
- Robots/Postgres.pm \
+ Robots/Pgsql.pm \
Robots/Repository.pm \
Robots/Svn.pm \
Robots/User.pm \
Copied: trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm (from rev 804, trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm)
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Robots/Pgsql.pm 2007-08-29 23:32:47 UTC (rev 805)
@@ -0,0 +1,123 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+
+package Vhffs::Robots::Pgsql;
+
+use Vhffs::Services::Pgsql;
+use Vhffs::Constants;
+use Vhffs::Functions;
+
+use strict;
+
+sub update_db
+{
+ my $main = shift;
+ my $pg = shift;
+
+ my $db = pgsql_admin_db_connect( $main );
+
+ if( defined $pg )
+ {
+ $db->do("ALTER USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'");
+ $pg->set_status( Vhffs::Constants::ACTIVATED );
+ $pg->commit;
+ $pg->blank_password;
+ }
+}
+
+
+
+sub create_db
+{
+ my $main = shift;
+ my $pg = shift;
+
+ my $db = pgsql_admin_db_connect( $main );
+
+ if( defined $pg )
+ {
+ $db->do("CREATE DATABASE ".$pg->get_dbname );
+ $db->do("CREATE USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'");
+ $pg->set_status( Vhffs::Constants::ACTIVATED );
+ $pg->commit;
+ $pg->blank_password;
+ }
+}
+
+sub delete_db
+{
+ my $main = shift;
+ my $pg = shift;
+
+ my $db = pgsql_admin_db_connect( $main );
+
+ if( ( defined $pg ) && ( $pg->get_status == Vhffs::Constants::TO_DELETE ) )
+ {
+ $pg->add_history("Ok, robots will erased all data");
+ $db->do("DROP DATABASE ".$pg->get_dbname );
+ $db->do("DROP USER " . $pg->get_dbusername );
+ $pg->add_history("All data will be erased");
+
+ if( $pg->delete < 0 )
+ {
+ $pg->add_history("Cannot be delete from database");
+ }
+ }
+}
+
+
+
+sub pgsql_admin_db_connect
+{
+ use DBI;
+ my $vhffs = shift;
+ my $dbuser = $vhffs->get_config->get_pgsql_admin_username;
+ my $dbpass = $vhffs->get_config->get_pgsql_admin_pass;
+ my $dbhost = $vhffs->get_config->get_pgsql_admin_host;
+ my $dbi;
+ if( $dbhost eq "localhost" )
+ {
+ $dbi = DBI->connect( "DBI:Pg:",$dbuser,$dbpass ) or return -1;
+ }
+ else
+ {
+ $dbi = DBI->connect( "DBI:Pg:host=$dbhost",$dbuser,$dbpass ) or return -1;
+ }
+
+ return $dbi;
+}
+
+
+
+
+1;
+
Deleted: trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm 2007-08-29 23:31:51 UTC (rev 804)
+++ trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm 2007-08-29 23:32:47 UTC (rev 805)
@@ -1,123 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-package Vhffs::Robots::Pgsql;
-
-use Vhffs::Services::Pgsql;
-use Vhffs::Constants;
-use Vhffs::Functions;
-
-use strict;
-
-sub update_db
-{
- my $main = shift;
- my $pg = shift;
-
- my $db = pgsql_admin_db_connect( $main );
-
- if( defined $pg )
- {
- $db->do("ALTER USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'");
- $pg->set_status( Vhffs::Constants::ACTIVATED );
- $pg->commit;
- $pg->blank_password;
- }
-}
-
-
-
-sub create_db
-{
- my $main = shift;
- my $pg = shift;
-
- my $db = pgsql_admin_db_connect( $main );
-
- if( defined $pg )
- {
- $db->do("CREATE DATABASE ".$pg->get_dbname );
- $db->do("CREATE USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'");
- $pg->set_status( Vhffs::Constants::ACTIVATED );
- $pg->commit;
- $pg->blank_password;
- }
-}
-
-sub delete_db
-{
- my $main = shift;
- my $pg = shift;
-
- my $db = pgsql_admin_db_connect( $main );
-
- if( ( defined $pg ) && ( $pg->get_status == Vhffs::Constants::TO_DELETE ) )
- {
- $pg->add_history("Ok, robots will erased all data");
- $db->do("DROP DATABASE ".$pg->get_dbname );
- $db->do("DROP USER " . $pg->get_dbusername );
- $pg->add_history("All data will be erased");
-
- if( $pg->delete < 0 )
- {
- $pg->add_history("Cannot be delete from database");
- }
- }
-}
-
-
-
-sub pgsql_admin_db_connect
-{
- use DBI;
- my $vhffs = shift;
- my $dbuser = $vhffs->get_config->get_pgsql_admin_username;
- my $dbpass = $vhffs->get_config->get_pgsql_admin_pass;
- my $dbhost = $vhffs->get_config->get_pgsql_admin_host;
- my $dbi;
- if( $dbhost eq "localhost" )
- {
- $dbi = DBI->connect( "DBI:Pg:",$dbuser,$dbpass ) or return -1;
- }
- else
- {
- $dbi = DBI->connect( "DBI:Pg:host=$dbhost",$dbuser,$dbpass ) or return -1;
- }
-
- return $dbi;
-}
-
-
-
-
-1;
-