Changeset 452 for trunk/lib/App.inc.php
- Timestamp:
- Dec 25, 2013 12:47:12 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r441 r452 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 86 86 'session_name' => '_session', 87 87 'session_use_cookies' => true, 88 88 89 89 // Pass the session-id through URLs if cookies are not enabled? 90 90 // Disable this to prevent session ID theft. … … 190 190 // Initialize default parameters. 191 191 $this->_params = array_merge($this->_params, $this->_param_defaults); 192 192 193 193 // Begin timing script. 194 194 require_once dirname(__FILE__) . '/ScriptTimer.inc.php'; … … 362 362 $this->setParam(array('site_url' => sprintf('%s://%s', ('on' == getenv('HTTPS') ? 'https' : 'http'), getenv('HTTP_HOST')))); 363 363 } 364 364 365 365 // In case site_email isn't set, use something halfway presentable. 366 366 if (isset($_SERVER['HTTP_HOST']) && '' != $_SERVER['HTTP_HOST'] && '' == $this->getParam('site_email')) { … … 375 375 // Character set. This should also be printed in the html header template. 376 376 header('Content-type: text/html; charset=' . $this->getParam('character_set')); 377 377 378 378 // Set the version of the codebase we're using. 379 379 $codebase_version_file = dirname(__FILE__) . '/../docs/version.txt'; … … 404 404 $this->db->close(); 405 405 } 406 $mem_current = memory_get_usage(); 407 $mem_peak = memory_get_peak_usage(); 406 408 $this->timer->stop('_app'); 407 $this->logMsg(sprintf('Script ended gracefully. Execution time: %s. Number of db queries: %s. ', $this->timer->getTime('_app'), $num_queries), LOG_DEBUG, __FILE__, __LINE__);409 $this->logMsg(sprintf('Script ended gracefully. Execution time: %s. Number of db queries: %s. Memory usage: %s. Peak memory: %s.', $this->timer->getTime('_app'), $num_queries, $mem_current, $mem_peak), LOG_DEBUG, __FILE__, __LINE__); 408 410 } 409 411 … … 434 436 return false; 435 437 } 436 438 437 439 // Avoid duplicate full-stops.. 438 440 $message = trim(preg_replace('/\.{2}$/', '.', $message)); … … 454 456 } 455 457 } 456 458 457 459 /** 458 460 * Returns an array of the raised messages. … … 472 474 return isset($_SESSION['_app'][$this->_ns]['messages']) ? $_SESSION['_app'][$this->_ns]['messages'] : array(); 473 475 } 474 476 475 477 /** 476 478 * Resets the message list. … … 486 488 return false; 487 489 } 488 490 489 491 $_SESSION['_app'][$this->_ns]['messages'] = array(); 490 492 } … … 507 509 return false; 508 510 } 509 511 510 512 $messages = $this->getRaisedMessages(); 511 513 if (!empty($messages)) { … … 590 592 trigger_error(sprintf('Codebase error: log directory (%s) not found or writable.', $this->getParam('log_directory')), E_USER_NOTICE); 591 593 } 592 594 593 595 // Before we get any further, let's see if ANY log events are configured to be reported. 594 596 if ((false === $this->getParam('log_file_priority') || $priority > $this->getParam('log_file_priority')) … … 626 628 $site_hash = md5(empty($_SERVER['SERVER_NAME']) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['SERVER_NAME']); 627 629 $lock_dir = $this->getParam('tmp_dir') . "/codebase_msgs_$site_hash/"; 628 // Just use the file and line for the msg_id to limit the number of possible messages 630 // Just use the file and line for the msg_id to limit the number of possible messages 629 631 // (the message string itself shan't be used as it may contain innumerable combinations). 630 632 $lock_file = $lock_dir . md5($file . ':' . $line); … … 647 649 } 648 650 } 649 651 650 652 // Data to be stored for a log event. 651 653 $event = array( … … 685 687 mb_send_mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers); 686 688 } 687 689 688 690 // SCREEN ACTION 689 691 if (false !== $this->getParam('log_screen_priority') && $priority <= $this->getParam('log_screen_priority')) { … … 693 695 // Restore original locale. 694 696 setlocale(LC_TIME, $locale); 695 697 696 698 return true; 697 699 } … … 771 773 772 774 /** 773 * dropQuery() is the opposite of carryQuery(). The specified value will not appear in 775 * dropQuery() is the opposite of carryQuery(). The specified value will not appear in 774 776 * url()/ohref()/printHiddenSession() modified URLs unless explicitly written in. 775 * 777 * 776 778 * @access public 777 779 * @param mixed $query_key The key (or keys, as an array) of the query argument to remove.
Note: See TracChangeset
for help on using the changeset viewer.