Permalink
Browse files

bug 554198: Separating index.php into prod / dev versions with respec…

…tive error handling flags; moved error page template for easier development; updated README with install hints; made config-local.php-dist defaults more prod-friendly
  • Loading branch information...
1 parent c17b4b4 commit ff592155d894c8c7915c906e91504642e8da0d82 @lmorchard committed Mar 30, 2010
View
@@ -25,6 +25,12 @@ without "-dist" and modified for your installation.
* Optionally, you can do away with the .htaccess and move the rules to your
main Apache config.
+* For a development installation, copy index.php-dev-dist to index.php
+ * This should leave error display and logging enabled
+
+* For a production/staging installation, copy index.php-prod-dist to index.php
+ * This should disable error display and logging, along with settings specified below.
+
* Set up Apache config something like the following for a virtual host:
<VirtualHost *:80>
@@ -89,12 +95,6 @@ without "-dist" and modified for your installation.
## Developer Notes
-### Debugging
-If you want the error page to display a stack trace, remove application/views/kohana_error_page.php
-or replace it with the system/views/kohana_error_page.php.
-
-Be sure not to check in your modified file!
-
### Localization
* To update locales after code / template changes:
@@ -1,11 +1,11 @@
<?php
$config['core.needs_installation'] = false;
$config['core.site_domain'] = 'dev.plugindir.mozilla.org';
-$config['core.log_threshold'] = 4;
-$config['core.internal_cache'] = FALSE; //60;
-$config['core.internal_cache_key'] = '8675309'; //120;
-$config['core.display_errors'] = TRUE;
-$config['core.render_stats'] = TRUE;
+$config['core.log_threshold'] = 0;
+$config['core.internal_cache'] = 60;
+$config['core.internal_cache_key'] = '8675309';
+$config['core.display_errors'] = FALSE;
+$config['core.render_stats'] = FALSE;
$config['model.database'] = 'default';
View
@@ -2,14 +2,17 @@
RewriteEngine On
# Installation directory
-RewriteBase /kohana/
+RewriteBase /
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
+# Protect *-dist files
+RewriteRule -dist$ - [F,L]
+
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
-RewriteRule .* index.php/$0 [PT,L]
+RewriteRule .* index.php/$0 [PT,L]
File renamed without changes.
View
@@ -0,0 +1,111 @@
+<?php
+/**
+ * This file acts as the "front controller" to your application. You can
+ * configure your application, modules, and system directories here.
+ * PHP error_reporting level may also be changed.
+ *
+ * @see http://kohanaphp.com
+ */
+
+/**
+ * Define the website environment status. When this flag is set to TRUE, some
+ * module demonstration controllers will result in 404 errors. For more information
+ * about this option, read the documentation about deploying Kohana.
+ *
+ * @see http://docs.kohanaphp.com/installation/deployment
+ */
+define('IN_PRODUCTION', TRUE);
+
+/**
+ * Website application directory. This directory should contain your application
+ * configuration, controllers, models, views, and other resources.
+ *
+ * This path can be absolute or relative to this file.
+ */
+$kohana_application = '../application';
+
+/**
+ * Kohana modules directory. This directory should contain all the modules used
+ * by your application. Modules are enabled and disabled by the application
+ * configuration file.
+ *
+ * This path can be absolute or relative to this file.
+ */
+$kohana_modules = '../modules';
+
+/**
+ * Kohana system directory. This directory should contain the core/ directory,
+ * and the resources you included in your download of Kohana.
+ *
+ * This path can be absolute or relative to this file.
+ */
+$kohana_system = '../system';
+
+/**
+ * Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are
+ * sure that your environment is compatible with Kohana, you can comment this
+ * line out. When running an application on a new server, uncomment this line
+ * to check the PHP version quickly.
+ */
+version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.');
+
+/**
+ * Set the error reporting level. Unless you have a special need, E_ALL is a
+ * good level for error reporting.
+ */
+if (defined('E_DEPRECATED') && defined('E_USER_DEPRECATED')) {
+ error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED);
+} else {
+ error_reporting(E_ALL & ~E_STRICT);
+}
+
+/**
+ * Turning off display_errors will effectively disable Kohana error display
+ * and logging. You can turn off Kohana errors in application/config/config.php
+ */
+ini_set('display_errors', FALSE);
+
+/**
+ * If you rename all of your .php files to a different extension, set the new
+ * extension here. This option can left to .php, even if this file has a
+ * different extension.
+ */
+define('EXT', '.php');
+
+//
+// DO NOT EDIT BELOW THIS LINE, UNLESS YOU FULLY UNDERSTAND THE IMPLICATIONS.
+// ----------------------------------------------------------------------------
+// $Id: index.php 3915 2009-01-20 20:52:20Z zombor $
+//
+
+$kohana_pathinfo = pathinfo(__FILE__);
+// Define the front controller name and docroot
+define('DOCROOT', $kohana_pathinfo['dirname'].DIRECTORY_SEPARATOR);
+define('KOHANA', $kohana_pathinfo['basename']);
+
+// If the front controller is a symlink, change to the real docroot
+is_link(KOHANA) and chdir(dirname(realpath(__FILE__)));
+
+// If kohana folders are relative paths, make them absolute.
+$kohana_application = file_exists($kohana_application) ? $kohana_application : DOCROOT.$kohana_application;
+$kohana_modules = file_exists($kohana_modules) ? $kohana_modules : DOCROOT.$kohana_modules;
+$kohana_system = file_exists($kohana_system) ? $kohana_system : DOCROOT.$kohana_system;
+
+// Define application and system paths
+define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/');
+define('MODPATH', str_replace('\\', '/', realpath($kohana_modules)).'/');
+define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/');
+
+// Clean up
+unset($kohana_application, $kohana_modules, $kohana_system);
+
+if (file_exists(DOCROOT.'install'.EXT))
+{
+ // Load the installation tests
+ include DOCROOT.'install'.EXT;
+}
+else
+{
+ // Initialize Kohana
+ require SYSPATH.'core/Bootstrap'.EXT;
+}

0 comments on commit ff59215

Please sign in to comment.