root/dev/common/includes/db.php @ 401

Revision 401, 2.0 KB (checked in by kovell, 12 years ago)

Fixes: missing kill_export include included, troubleshooting shell_exec replaced, db.php allows >=4.1 instead of >4.1, apiuser mod comments update kill_details cache, ships names updated.

Line 
1<?php
2// cached query class will be loaded additionally once we received the config
3// see common/index.php for details
4require_once('common/includes/class.db.php');
5require_once('common/includes/class.config.php');
6
7if(!defined('DB_TYPE')) define('DB_TYPE', 'mysql');
8if(DB_TYPE == 'mysqli' and function_exists('mysqli_connect')) define('DB_TYPE_USED', 'mysqli');
9if(DB_TYPE_USED == 'mysqli') require_once('common/includes/class.db.mysqli.php');
10
11// get mysql server info and store it in a define so we know if its
12// safe to use subquerys or not. (mysqli only works on 4.1+)
13$conn = new DBConnection;
14$value = (float) mysql_get_server_info($conn->id_);
15if ($value >= 4.1)
16{
17        define('KB_MYSQL41', true);
18}
19else
20{
21        die("EDK 2.0 requires MySQL version 4.1+. Your version is ".$value);
22        define('KB_MYSQL41', false);
23}
24
25if(!$config) $config = new Config(KB_SITE);
26define('DB_HALTONERROR', (bool)config::get('cfg_sqlhalt'));
27define('DB_USE_QCACHE', (bool)config::get('cfg_qcache'));
28
29if (((bool)config::get('cfg_memcache')) == true && !strstr($_SERVER['REQUEST_URI'], "admin"))
30{
31    // mysqli version already loaded
32    if(DB_TYPE_USED != 'mysqli') require_once('common/includes/class.db_memcache.php');
33    $mc = new Memcache();
34    if(!@$mc->pconnect(config::get('cfg_memcache_server'), config::get('cfg_memcache_port'))) {
35       print "ERROR: Unable to connect to memcached server, disabling memcached. Please check your settings (server, port) and make sure the memcached server is running";
36       define("DB_USE_MEMCACHE", false);
37    } else {
38       define("DB_USE_MEMCACHE", true);
39    }
40} else {
41    define("DB_USE_MEMCACHE", false);
42}
43
44// mysqli version already loaded
45if (DB_USE_QCACHE && DB_TYPE_USED != 'mysqli')
46{
47    // the object overloading system will switch to cached queries now
48    require_once('common/includes/class.db_cache.php');
49}
50if (!$dir = config::get('cache_dir'))
51{
52    $dir = 'cache/data';
53}
54define('KB_CACHEDIR', $dir);
55
56?>
Note: See TracBrowser for help on using the browser.