cvs: phpweb /error index.php /include prepend.inc site.inc
| From: | Ilia Alshanetsky | Date: | Fri, 23 May 2003 13:35:56 +0000 |
| Subject: | cvs: phpweb /error index.php /include prepend.inc site.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-17965@lists.php.net to get a copy of this message | ||
iliaa Fri May 23 09:35:56 2003 EDT
Modified files:
/phpweb/include site.inc prepend.inc
/phpweb/error index.php
Log:
Optimized include logic.
# As it now stands phpweb uses EXTREMELY inefficient way of including files
# by relying on the include_path parameter. Which causes at least 2 useless
# stat() calls for every include. By prefixing all includes & requires for
# files from include/ with the __PHPWEB_INC_PATH__ constants this is avoided.
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.247 phpweb/include/site.inc:1.248
--- phpweb/include/site.inc:1.247 Sat May 17 08:45:51 2003
+++ phpweb/include/site.inc Fri May 23 09:35:56 2003
@@ -1,15 +1,15 @@
<?php // -*- C++ -*-
-// $Id: site.inc,v 1.247 2003/05/17 12:45:51 goba Exp $
+// $Id: site.inc,v 1.248 2003/05/23 13:35:56 iliaa Exp $
// Define $MIRRORS array, and some constants
-include_once 'mirrors.inc';
+include_once __PHPWEB_INC_PATH__ . 'mirrors.inc';
// Define $COUNTRIES array
-include_once 'countries.inc';
+include_once __PHPWEB_INC_PATH__ . 'countries.inc';
// Define $LANGUAGES array
-include_once 'languages.inc';
+include_once __PHPWEB_INC_PATH__ . 'languages.inc';
// Returns true if the current (or specified)
// site is the primary mirror site
Index: phpweb/include/prepend.inc
diff -u phpweb/include/prepend.inc:1.24 phpweb/include/prepend.inc:1.25
--- phpweb/include/prepend.inc:1.24 Thu May 15 09:27:40 2003
+++ phpweb/include/prepend.inc Fri May 23 09:35:56 2003
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: prepend.inc,v 1.24 2003/05/15 13:27:40 goba Exp $
+// $Id: prepend.inc,v 1.25 2003/05/23 13:35:56 iliaa Exp $
// Start measuring time spent on page
$page_creation_start = getmicrotime();
@@ -36,23 +36,27 @@
// Put the magic quotes setting to $MQ
$MQ = (boolean) get_magic_quotes_gpc();
-
+
+/* for performance reasons use this define when including files */
+$path = !strncmp(__FILE__, '/', 1) ? __FILE__ : realpath(__FILE__);
+define('__PHPWEB_INC_PATH__', dirname($path) . '/');
+
// Site details (mirror site information)
-include_once 'site.inc';
+include_once __PHPWEB_INC_PATH__ . 'site.inc';
// Choose language used for translated parts
-include_once 'langchooser.inc';
+include_once __PHPWEB_INC_PATH__ . 'langchooser.inc';
// Get country of the user and set it in a cookie
-include_once 'ip-to-country.inc';
+include_once __PHPWEB_INC_PATH__ . 'ip-to-country.inc';
// Common layout functions
-include_once 'layout.inc';
+include_once __PHPWEB_INC_PATH__ . 'layout.inc';
// This file is generated on rsync.php.net and propogated
// from there. It just defines $LAST_UPDATED, which is the
// mirror's last updated time.
-include_once 'last_updated.inc';
+include_once __PHPWEB_INC_PATH__ . 'last_updated.inc';
// Function used to import request vars to global scope.
// Walks through $array, and imports all values associated
Index: phpweb/error/index.php
diff -u phpweb/error/index.php:1.115 phpweb/error/index.php:1.116
--- phpweb/error/index.php:1.115 Thu May 22 20:10:11 2003
+++ phpweb/error/index.php Fri May 23 09:35:56 2003
@@ -1,6 +1,6 @@
<?php
-// $Id: index.php,v 1.115 2003/05/23 00:10:11 wez Exp $
+// $Id: index.php,v 1.116 2003/05/23 13:35:56 iliaa Exp $
/*
@@ -14,7 +14,7 @@
// Ensure that our environment is set up
include_once 'prepend.inc';
-include_once 'loadavg.inc';
+include_once __PHPWEB_INC_PATH__ . 'loadavg.inc';
// Get URI for this request (without the leading slash)
// See langchooser.inc for more info on STRIPPED_URI