Define application name when connecting on PostgreSQL >= 9.0
authorioguix <ioguix@free.fr>
Tue, 14 Sep 2010 23:48:53 +0000 (01:48 +0200)
committerioguix <ioguix@free.fr>
Tue, 14 Sep 2010 23:48:53 +0000 (01:48 +0200)
classes/Misc.php
libraries/lib.inc.php

index eeed5eecb15620033019ead2b99a8fd218477a2d..2dc28b2a309a26b675d0d7eae2b3875a9034bf0f 100644 (file)
                                exit;
                        }
                        $this->setServerInfo('platform', $platform, $server_id);
+                       $this->setServerInfo('pgVersion', $_connection->conn->pgVersion, $server_id);
 
                        // Create a database wrapper class for easy manipulation of the
                        // connection.
index 4561348c9b86c09ab19356375e29004ccd0e152b..b9dcf98538aa7ca6aaa4a930a168704d38515958 100644 (file)
            }
                $_server_info = $misc->getServerInfo();
 
+               /* starting with PostgreSQL 9.0, we can set the application name */
+               if(isset($_server_info['pgVersion']) && $_server_info['pgVersion'] >= 9)
+                       putenv("PGOPTIONS=--application_name={$appName}_{$appVersion}");
+
                // Redirect to the login form if not logged in
                if (!isset($_server_info['username'])) {
                        include('./login.php');