Created
October 10, 2012 00:00
-
-
Save amacneil/3862276 to your computer and use it in GitHub Desktop.
Simple ExpressionEngine bootstrap (config) file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
/* | |
* Put this file in your ExpressionEngine root folder (next to index.php) | |
*/ | |
/* | |
* OPTIONS (ALL PATHS ARE RELATIVE TO THE CURRENT DIRECTORY) | |
*/ | |
$bootstrap['images_dir'] = 'images'; | |
$bootstrap['themes_dir'] = 'themes'; | |
$bootstrap['templates_dir'] = 'templates'; | |
$bootstrap['third_party_dir'] = 'third_party'; | |
$bootstrap['cp_url'] = 'system/'; | |
$bootstrap['save_templates_as_files'] = TRUE; | |
$db['expressionengine']['hostname'] = 'localhost'; | |
$db['expressionengine']['username'] = ''; | |
$db['expressionengine']['password'] = ''; | |
$db['expressionengine']['database'] = ''; | |
/* | |
* DON'T EDIT BELOW THIS LINE | |
*/ | |
if ( ! defined('BOOTSTRAP_BASE_URL')) | |
{ | |
if (empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off') | |
{ | |
define('BOOTSTRAP_BASE_URL', 'http://'.$_SERVER['HTTP_HOST'].'/'); | |
} | |
else | |
{ | |
define('BOOTSTRAP_BASE_URL', 'https://'.$_SERVER['HTTP_HOST'].'/'); | |
} | |
define('BOOTSTRAP_BASE_PATH', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR); | |
/** | |
* Find the actual path from a relative path | |
*/ | |
function bootstrap_build_path($path) | |
{ | |
if (($realpath = realpath(BOOTSTRAP_BASE_PATH.$path)) === FALSE) | |
{ | |
exit(BOOTSTRAP_BASE_PATH.$path.' does not exist!'); | |
} | |
return $realpath.DIRECTORY_SEPARATOR; | |
} | |
/** | |
* Prefix base url, and remove double slashes | |
*/ | |
function bootstrap_build_url($url) | |
{ | |
return preg_replace("#(^|[^:])//+#", "\\1/", BOOTSTRAP_BASE_URL.$url.'/'); | |
} | |
} | |
$config['site_url'] = BOOTSTRAP_BASE_URL; | |
$config['base_url'] = BOOTSTRAP_BASE_URL; | |
$config['cp_url'] = bootstrap_build_url($bootstrap['cp_url']); | |
$config['avatar_path'] = bootstrap_build_path($bootstrap['images_dir'].'/avatars/'); | |
$config['avatar_url'] = bootstrap_build_url($bootstrap['images_dir'].'/avatars/'); | |
$config['captcha_path'] = bootstrap_build_path($bootstrap['images_dir'].'/captchas/'); | |
$config['captcha_url'] = bootstrap_build_url($bootstrap['images_dir'].'/captchas/'); | |
$config['captcha_path'] = bootstrap_build_path($bootstrap['images_dir'].'/captchas/'); | |
$config['captcha_url'] = bootstrap_build_url($bootstrap['images_dir'].'/captchas/'); | |
$config['emoticon_path'] = bootstrap_build_path($bootstrap['images_dir'].'/smileys/'); | |
$config['emoticon_url'] = bootstrap_build_url($bootstrap['images_dir'].'/smileys/'); | |
$config['photo_path'] = bootstrap_build_path($bootstrap['images_dir'].'/member_photos/'); | |
$config['photo_url'] = bootstrap_build_url($bootstrap['images_dir'].'/member_photos/'); | |
$config['prv_msg_upload_path'] = bootstrap_build_path($bootstrap['images_dir'].'/pm_attachments/'); | |
$config['prv_msg_upload_url'] = bootstrap_build_url($bootstrap['images_dir'].'/pm_attachments/'); | |
$config['sig_img_path'] = bootstrap_build_path($bootstrap['images_dir'].'/signature_attachments/'); | |
$config['sig_img_url'] = bootstrap_build_url($bootstrap['images_dir'].'/signature_attachments/'); | |
$config['theme_folder_path'] = bootstrap_build_path($bootstrap['themes_dir']); | |
$config['theme_folder_url'] = bootstrap_build_url($bootstrap['themes_dir']); | |
$config['third_party_path'] = bootstrap_build_path($bootstrap['third_party_dir']); | |
$config['tmpl_file_basepath'] = bootstrap_build_path($bootstrap['templates_dir']); | |
$config['snippet_file_basepath'] = bootstrap_build_path($bootstrap['templates_dir'].'/snippets/'); | |
$config['save_tmpl_files'] = $bootstrap['save_templates_as_files'] ? 'y' : 'n'; | |
// global environment variables | |
global $assign_to_config; | |
if ( ! isset($assign_to_config['global_vars'])) | |
{ | |
$assign_to_config['global_vars'] = array(); | |
} | |
$assign_to_config['global_vars']['global:env'] = getenv('EXP_ENV'); | |
/* End of file bootstrap.php */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add this to the bottom of system/expressionengine/config/config.php */ | |
require(realpath(dirname(__FILE__).'/../../../bootstrap.php')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add this to the bottom of system/expressionengine/config/database.php */ | |
require(realpath(dirname(__FILE__).'/../../../bootstrap.php')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you had problems updating your version of EE b/c the
$config
's are in another file?