Changeset 230
- Timestamp:
- Jan 17, 2007 10:10:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/DB.inc.php
r209 r230 141 141 } 142 142 143 // Die or continue without connection? 144 if ($this->getParam('db_die_on_failure')) { 145 echo "\n\n<!-- Script execution stopped out of embarrassment. There was a database error. -->"; 146 die; 147 } else { 148 return false; 149 } 143 // Die if db_die_on_failure = true, or just continue without connection 144 return $this->_fail(); 150 145 } 151 146 … … 178 173 return mysql_close($this->dbh); 179 174 } 175 176 /* 177 * Die only if db_die_on_failure is true. This will be set to false for some cases 178 * when a database is not required for web app functionality. 179 * 180 * @access public 181 * @param string $msg Print $msg when dying. 182 * @return bool false If we don't die. 183 * @author Quinn Comendant <quinn@strangecode.com> 184 * @version 1.0 185 * @since 15 Jan 2007 15:59:00 186 */ 187 function _fail() 188 { 189 if ($this->getParam('db_die_on_failure')) { 190 echo _("This page is temporarily unavailable. Please try again in a few minutes."); 191 die; 192 } else { 193 return false; 194 } 195 } 180 196 181 197 /** … … 254 270 // Error checking. 255 271 if (!$qid || mysql_error($this->dbh)) { 272 $app->logMsg(sprintf('MySQL error %s: %s in query: %s', mysql_errno($this->dbh), mysql_error($this->dbh), $debugqry), LOG_EMERG, __FILE__, __LINE__); 256 273 if ($this->getParam('db_debug')) { 257 274 echo '<pre style="padding:2em; background:#ddd; font:9px monaco;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>'; 258 } else { 259 echo _("This page is temporarily unavailable. It should be back up in a few minutes."); 260 } 261 $app->logMsg(sprintf('MySQL error %s: %s in query: %s', mysql_errno($this->dbh), mysql_error($this->dbh), $debugqry), LOG_EMERG, __FILE__, __LINE__); 262 if ($this->getParam('db_die_on_failure')) { 263 echo "\n\n<!-- Script execution stopped out of embarrassment. -->"; 264 die; 265 } 275 } 276 // Die if db_die_on_failure = true, or just continue without connection 277 return $this->_fail(); 266 278 } 267 279
Note: See TracChangeset
for help on using the changeset viewer.