Development

Changeset 8271

You must first sign up to be able to contribute.

Changeset 8271

Show
Ignore:
Timestamp:
04/04/08 12:55:18 (8 months ago)
Author:
pookey
Message:

Adding support for customising error 500 pages on a per application basis.

Symfony will now check for error 500 pages in the following order, including the first
one it finds:

apps/$app/config/error_500.php
config/error_500.php
web/errors/error500.php

If none of the above can be found, symfony will use it's own.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/exception/sfException.class.php

    r7792 r8271  
    109109    if (!sfConfig::get('sf_debug')) 
    110110    { 
    111       $file = sfConfig::get('sf_web_dir').'/errors/error500.php'; 
    112  
    113       include is_readable($file) ? $file : dirname(__FILE__).'/data/error500.php'; 
    114  
    115       return; 
     111      $files = array(); 
     112 
     113      // first check for app/project specific error page, can only do this if we have a context 
     114      if (class_exists('sfContext', false) && sfContext::hasInstance()) 
     115      { 
     116        $appname = sfContext::getInstance()->getConfiguration()->getApplication(); 
     117        $files[] = sfConfig::get('sf_apps_dir').'/'.$appname.'/config/error_500.php'; 
     118        $files[] = sfConfig::get('sf_root_dir').'/config/error_500.php'; 
     119      } 
     120      $files[] = sfConfig::get('sf_web_dir').'/errors/error500.php'; 
     121      $files[] = dirname(__FILE__).'/data/error500.php'; 
     122 
     123      foreach($files as &$file) 
     124      { 
     125        if (is_readable($file)) 
     126        { 
     127          include $file; 
     128          return; 
     129        } 
     130      } 
     131 
    116132    } 
    117133