Guest User

Untitled

a guest
Jul 17th, 2013
128
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. /**
  4. * Focus Lab, LLC Master Config
  5. *
  6. * This is the master config file for our ExpressionEngine sites
  7. * The settings will contain database credentials and numerous "config overrides"
  8. * used throughout the site. This file is used as first point of configuration
  9. * but there are environment-specific files as well. The idea is that the environment
  10. * config files contain config overrides that are specific to a single environment.
  11. *
  12. * Some config settings are used in multiple (but not all) environments. You will
  13. * see the use of conditionals around the ENV constant in this file. This constant is
  14. * defined in ./config/config.env.php
  15. *
  16. * All config files are stored in the ./config/ directory and this master file is "required"
  17. * in system/expressionengine/config/config.php and system/expressionengine/config/database.php
  18. *
  19. * require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.master.php';
  20. *
  21. * This config setup is a combination of inspiration from Matt Weinberg and Leevi Graham
  22. * @link http://eeinsider.com/articles/multi-server-setup-for-ee-2/
  23. * @link http://ee-garage.com/nsm-config-bootstrap
  24. *
  25. * @package Focus Lab Master Config
  26. * @version 1.1.1
  27. * @author Focus Lab, LLC <dev@focuslabllc.com>
  28. * @see https://github.com/focuslabllc/ee-master-config
  29. */
  30.  
  31.  
  32. // Require our environment declatation file if it hasn't
  33. // already been loaded in index.php or admin.php
  34. if ( ! defined('ENV'))
  35. {
  36. require 'config.env.php';
  37. }
  38.  
  39.  
  40. // Setup our initial arrays
  41. $env_db = $env_config = $env_global = $master_global = array();
  42.  
  43.  
  44. /**
  45. * Database override magic
  46. *
  47. * If this equates to TRUE then we're in the database.php file
  48. * We don't want these settings bothered with in our config.php file
  49. */
  50. if (isset($db['expressionengine']))
  51. {
  52. /**
  53. * Load our environment-specific config file
  54. * which contains our database credentials
  55. *
  56. * @see config/config.local.php
  57. * @see config/config.dev.php
  58. * @see config/config.stage.php
  59. * @see config/config.prod.php
  60. */
  61. require 'config.' . ENV . '.php';
  62.  
  63. // Dynamically set the cache path (Shouldn't this be done by default? Who moves the cache path?)
  64. $env_db['cachedir'] = APPPATH . 'cache/db_cache/';
  65.  
  66. // Merge our database setting arrays
  67. $db['expressionengine'] = array_merge($db['expressionengine'], $env_db);
  68.  
  69. // No need to have this variable accessible for the rest of the app
  70. unset($env_db);
  71. }
  72. // End if (isset($db['expressionengine'])) {}
  73.  
  74.  
  75.  
  76. /**
  77. * Config override magic
  78. *
  79. * If this equates to TRUE then we're in the config.php file
  80. * We don't want these settings bothered with in our database.php file
  81. */
  82. if (isset($config))
  83. {
  84.  
  85. /**
  86. * Dynamic path settings
  87. *
  88. * Make it easy to run the site in multiple environments and not have to switch up
  89. * path settings in the database after each migration
  90. * As inspired by Matt Weinberg: http://eeinsider.com/articles/multi-server-setup-for-ee-2/
  91. */
  92. $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
  93. $base_url = $protocol . $_SERVER['HTTP_HOST'];
  94. $base_path = $_SERVER['DOCUMENT_ROOT'];
  95. $system_folder = 'pixels';
  96. $images_folder = 'images';
  97. $images_path = $base_path . '/' . $images_folder;
  98. $images_url = $base_url . '/' . $images_folder;
  99.  
  100. $env_config['index_page'] = '';
  101. $env_config['site_index'] = '';
  102. $env_config['base_url'] = $base_url . '/';
  103. $env_config['site_url'] = $env_config['base_url'];
  104. $env_config['cp_url'] = $env_config['base_url'] . '/admin.php';
  105. $env_config['theme_folder_path'] = $base_path . '/themes/';
  106. $env_config['theme_folder_url'] = $base_url . '/themes/';
  107. $env_config['emoticon_path'] = $images_url . '/smileys/';
  108. $env_config['emoticon_url'] = $images_url . '/smileys/';
  109. $env_config['captcha_path'] = $images_path . '/captchas/';
  110. $env_config['captcha_url'] = $images_url . '/captchas/';
  111. $env_config['avatar_path'] = $images_path . '/avatars/';
  112. $env_config['avatar_url'] = $images_url . '/avatars/';
  113. $env_config['photo_path'] = $images_path . '/member_photos/';
  114. $env_config['photo_url'] = $images_url . '/member_photos/';
  115. $env_config['sig_img_path'] = $images_path . '/signature_attachments/';
  116. $env_config['sig_img_url'] = $images_url . '/signature_attachments/';
  117. $env_config['prv_msg_upload_path'] = $images_path . '/pm_attachments/';
  118. // $env_config['third_party_path'] = $base_path . '/../third_party/';
  119.  
  120.  
  121.  
  122. /**
  123. * Custom upload directory paths
  124. *
  125. * The array keys must match the ID from exp_upload_prefs
  126. */
  127. // $env_config['upload_preferences'] = array(
  128. // 1 => array(
  129. // 'name' => 'Default Uploads',
  130. // 'server_path' => $images_path . '/uploads',
  131. // 'url' => $images_url . '/uploads/'
  132. // ),
  133. // 2 => array(
  134. // 'name' => 'Second Folder',
  135. // 'server_path' => $images_path . '/another_one',
  136. // 'url' => $images_url . '/another_one/'
  137. // )
  138. // );
  139.  
  140.  
  141. /**
  142. * Template settings
  143. *
  144. * Working locally we want to reference our template files.
  145. * In staging and production we do not use flat files (for ever-so-slightly better performance)
  146. * This approach requires that we synchronize templates after each deployment of template changes
  147. *
  148. * For the distributed Focus Lab, LLC Master Config file this is commented out
  149. * You can enable this "feature" by uncommenting the second 'save_tmpl_files' line
  150. */
  151. $env_config['save_tmpl_files'] = 'y';
  152. // $env_config['save_tmpl_files'] = (ENV == 'prod') ? 'n' : 'y';
  153. $env_config['tmpl_file_basepath'] = $base_path . '/../templates';
  154. $env_config['hidden_template_indicator'] = '_';
  155.  
  156.  
  157.  
  158. /**
  159. * Debugging settings
  160. *
  161. * These settings are helpful to have in one place
  162. * for debugging purposes
  163. */
  164. $env_config['is_system_on'] = 'y';
  165. $env_config['allow_extensions'] = 'y';
  166. $env_config['email_debug'] = (ENV_DEBUG) ? 'y' : 'n' ;
  167. // If we're not in production show the profile on the front-end but not in the CP
  168. $env_config['show_profiler'] = ( ! ENV_DEBUG OR (isset($_GET['D']) && $_GET['D'] == 'cp')) ? 'n' : 'y' ;
  169. // Show template debugging if we're not in production
  170. $env_config['template_debugging'] = (ENV_DEBUG) ? 'y' : 'n' ;
  171. /**
  172. * Set debug to '2' if we're in dev mode, otherwise just '1'
  173. *
  174. * 0: no PHP/SQL errors shown
  175. * 1: Errors shown to Super Admins
  176. * 2: Errors shown to everyone
  177. */
  178. $env_config['debug'] = (ENV_DEBUG) ? '2' : '1' ;
  179.  
  180.  
  181.  
  182. /**
  183. * Tracking & Performance settings
  184. *
  185. * These settings may impact what happens on certain page loads
  186. * and turning them off could help with performance in general
  187. */
  188. $env_config['disable_all_tracking'] = 'y'; // If set to 'y' some of the below settings are disregarded
  189. $env_config['enable_sql_caching'] = 'n';
  190. $env_config['disable_tag_caching'] = 'n';
  191. $env_config['enable_online_user_tracking'] = 'n';
  192. $env_config['dynamic_tracking_disabling'] = '500';
  193. $env_config['enable_hit_tracking'] = 'n';
  194. $env_config['enable_entry_view_tracking'] = 'n';
  195. $env_config['log_referrers'] = 'n';
  196. $env_config['gzip_output'] = 'y';
  197.  
  198.  
  199.  
  200. /**
  201. * 3rd Party Add-on config items as needed
  202. */
  203.  
  204.  
  205.  
  206.  
  207. /**
  208. * Member-based settings
  209. */
  210. $env_config['profile_trigger'] = rand(0,time()); // randomize the member profile trigger word because we'll never need it
  211.  
  212.  
  213.  
  214. /**
  215. * Other system settings
  216. */
  217. $env_config['new_version_check'] = 'n'; // no slowing my CP homepage down with this
  218. $env_config['daylight_savings'] = ((bool) date('I')) ? 'y' : 'n'; // Autodetect DST
  219. $env_config['use_category_name'] = 'y';
  220. $env_config['reserved_category_word'] = 'category';
  221. $env_config['word_separator'] = 'dash'; // dash|underscore
  222.  
  223.  
  224.  
  225.  
  226. /**
  227. * Load our environment-specific config file
  228. * May contain override values from similar above settings
  229. *
  230. * @see config/config.local.php
  231. * @see config/config.dev.php
  232. * @see config/config.stage.php
  233. * @see config/config.prod.php
  234. */
  235. require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.' . ENV . '.php';
  236.  
  237.  
  238.  
  239.  
  240. /**
  241. * Setup our template-level global variables
  242. *
  243. * As inspired by NSM Bootstrap Config
  244. * @see http://ee-garage.com/nsm-config-bootstrap
  245. */
  246. global $assign_to_config;
  247. if( ! isset($assign_to_config['global_vars']))
  248. {
  249. $assign_to_config['global_vars'] = array();
  250. }
  251.  
  252. // Start our array with environment variables. This gives us {global:env} and {global:env_full} tags for our templates.
  253. $master_global = array(
  254. 'global:env' => ENV,
  255. 'global:env_full' => ENV_FULL
  256. );
  257.  
  258.  
  259.  
  260. /**
  261. * Merge arrays to form final datasets
  262. *
  263. * We've created our base config and global key->value stores
  264. * We've also included the environment-specific arrays now
  265. * Here we'll merge the arrays to create our final array dataset which
  266. * respects "most recent data" first if any keys are duplicated
  267. *
  268. * This is how our environment settings are "king" over any defaults
  269. */
  270. $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $master_global, $env_global); // global var arrays
  271. $config = array_merge($config, $env_config); // config setting arrays
  272.  
  273. }
  274. // End if (isset($config)) {}
  275.  
  276.  
  277. /* End of file config.master.php */
  278. /* Location: ./config/config.master.php */
RAW Paste Data