summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/db.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-12-11 10:03:32 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-12-11 10:03:32 +0000
commite6e07c8326c0082b8edf4924c166aaadbd99cdef (patch)
treea0ea4db63f8f6cb16e015c6ee8a3829a7430216a /frontends/php/include/db.inc.php
parentd977bea9e417e2272264157e5db82d79fbbc10f4 (diff)
downloadzabbix-e6e07c8326c0082b8edf4924c166aaadbd99cdef.tar.gz
zabbix-e6e07c8326c0082b8edf4924c166aaadbd99cdef.tar.xz
zabbix-e6e07c8326c0082b8edf4924c166aaadbd99cdef.zip
- improved installation wizard with permissions (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3584 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/db.inc.php')
-rw-r--r--frontends/php/include/db.inc.php54
1 files changed, 37 insertions, 17 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index d4552616..f4433f91 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -68,35 +68,55 @@
}
break;
case "SQLITE3":
- function init_db_access()
+ if(!function_exists('init_db_access'))
{
- global $ZBX_CONFIGURATION_FILE, $ZBX_SEM_ID;
-
- $ZBX_SEM_ID = false;
- if(function_exists('ftok') && function_exists('sem_get'))
- $ZBX_SEM_ID = sem_get(ftok($ZBX_CONFIGURATION_FILE, 'z'), 1);
+ function init_db_access()
+ {
+ global $ZBX_CONFIGURATION_FILE, $ZBX_SEM_ID;
+
+ $ZBX_SEM_ID = false;
+ if(function_exists('ftok') && function_exists('sem_get') &&
+ file_exists($ZBX_CONFIGURATION_FILE))
+ {
+ $ZBX_SEM_ID = sem_get(ftok($ZBX_CONFIGURATION_FILE, 'z'), 1);
+ }
+ }
}
- function lock_db_access()
+ if(!function_exists('lock_db_access'))
{
- global $ZBX_SEM_ID;
+ function lock_db_access()
+ {
+ global $ZBX_SEM_ID;
- if($ZBX_SEM_ID && function_exists('sem_acquire'))
- sem_acquire($ZBX_SEM_ID);
+ if($ZBX_SEM_ID && function_exists('sem_acquire'))
+ sem_acquire($ZBX_SEM_ID);
+ }
}
- function unlock_db_access()
+ if(!function_exists('unlock_db_access'))
{
- global $ZBX_SEM_ID;
+ function unlock_db_access()
+ {
+ global $ZBX_SEM_ID;
- if($ZBX_SEM_ID && function_exists('sem_release'))
- sem_release($ZBX_SEM_ID);
+ if($ZBX_SEM_ID && function_exists('sem_release'))
+ sem_release($ZBX_SEM_ID);
+ }
}
- $DB = sqlite3_open($DB_DATABASE);
- if(!$DB)
+ if(file_exists($DB_DATABASE))
{
- $error = "Error connecting to database";
+ $DB = sqlite3_open($DB_DATABASE);
+ if(!$DB)
+ {
+ $error = "Error connecting to database";
+ $result = false;
+ }
+ }
+ else
+ {
+ $error = "Missed database";
$result = false;
}