]> git.mxchange.org Git - friendica.git/commitdiff
make sure db queries never get called if the database isn't open
authorFriendika <info@friendika.com>
Thu, 3 Mar 2011 23:41:08 +0000 (15:41 -0800)
committerFriendika <info@friendika.com>
Thu, 3 Mar 2011 23:41:08 +0000 (15:41 -0800)
boot.php
include/dba.php

index 3cf01b4a0d6b7ed56f5e3ffb0efcbb86ac50cb43..a97f858140863cc2569e8b903d6043b3b13614b3 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -3,7 +3,7 @@
 set_time_limit(0);
 
 define ( 'BUILD_ID',               1039   );
-define ( 'FRIENDIKA_VERSION',      '2.10.0908' );
+define ( 'FRIENDIKA_VERSION',      '2.10.0909' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.1'  );
 
 define ( 'EOL',                    "<br />\r\n"     );
index b05a1cabf48b8dce79ac22609d4cea389e433062..b89648bcac8d7644aed607b215a8a9ddc046c706 100644 (file)
@@ -20,12 +20,14 @@ class dba {
 
        function __construct($server,$user,$pass,$db,$install = false) {
                $this->db = @new mysqli($server,$user,$pass,$db);
-               if((mysqli_connect_errno()) && (! $install)) {
+               if(! mysql_connect_errno()) {
+                       $this->connected = true;
+               }
+               else {
                        $this->db = null;
-                       system_unavailable();
+                       if(! $install)
+                               system_unavailable();
                }
-               else
-                       $this->connected = true;    
        }
 
        public function getdb() {
@@ -34,7 +36,7 @@ class dba {
 
        public function q($sql) {
                
-               if(! $this->db )
+               if((! $this->db) || (! $this->connected))
                        return false;
                
                $result = @$this->db->query($sql);
@@ -92,7 +94,8 @@ class dba {
        }
 
        public function escape($str) {
-               return @$this->db->real_escape_string($str);
+               if($this->db && $this->connected)
+                       return @$this->db->real_escape_string($str);
        }
 
        function __destruct() {