Ignore:
Timestamp:
02/22/10 14:16:27 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Got Hotaru to pass the $h object to ezSQL so we can include user, page and plugin info in database error email notifications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/libs/extensions/ezSQL/mysql/ez_sql_mysql.php

    r1208 r1213  
    4848            $this->dbname = $dbname; 
    4949            $this->dbhost = $dbhost; 
     50        } 
     51         
     52        /********************************************************************** 
     53        *  Set $h - global Hotaru object 
     54        */ 
     55 
     56        function setHotaru($h) 
     57        { 
     58            $this->h = $h; 
    5059        } 
    5160 
     
    219228                    $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    220229                    $subject = SITE_NAME . " Database Error"; 
    221                     $body = "SQL query:\r\n"; 
     230                    $body = SITE_NAME . " Database Error\r\n\r\n"; 
     231                    $body .= "Date: " . date('d M Y H:i:s') . " (timezone: " . date_default_timezone_get() . ")\r\n\r\n"; 
     232                    $body .= "SQL query:\r\n"; 
    222233                    $body .= $query . "\r\n\r\n"; 
    223234                     
    224235                    $body .= "PHP error log:\r\n"; 
    225236                    $body .= $str . "\r\n\r\n"; 
     237                     
     238                    if(isset($this->h)) { 
     239                        $body .=  "Current User: " . $this->h->currentUser->name . " (id: " . $this->h->currentUser->id .")\r\n"; 
     240                        $body .=  "User Role: " . $this->h->currentUser->role . "\r\n"; 
     241                        $body .=  "Page Name: " . $this->h->pageName . "\r\n"; 
     242                        $body .=  "Sub Page: " . $this->h->subPage . "\r\n"; 
     243                        $body .=  "Plugin: " . $this->h->plugin->folder . "\r\n\r\n"; 
     244                    } 
    226245                     
    227246                    $body .= "If you need help, visit the forums at http://hotarucms.org\r\n"; 
Note: See TracChangeset for help on using the changeset viewer.