85 lines
3.3 KiB
PHP
85 lines
3.3 KiB
PHP
<?php
|
|
global $civicrm_root, $civicrm_setting, $civicrm_paths;
|
|
|
|
// CMS specific stuff
|
|
define('CIVICRM_UF', 'WordPress');
|
|
$civicrm_root = '/var/www/html/wp-content/plugins/civicrm/civicrm/';
|
|
|
|
define('CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/html/wp-content/uploads/civicrm/templates_c/');
|
|
|
|
// Constants set by env variables
|
|
define('CIVICRM_DSN', 'mysql://' . getenv('CIVICRM_DB_USER') . ':' . getenv('CIVICRM_DB_PASS') . '@' . getenv('CIVICRM_DB_HOST') . '/' . getenv('CIVICRM_DB_NAME') . '?new_link=true');
|
|
define('CIVICRM_UF_DSN', 'mysql://' . getenv('WORDPRESS_DB_USER') . ':' . getenv('WORDPRESS_DB_PASS') . '@' . getenv('WORDPRESS_DB_HOST') . '/' . getenv('WORDPRESS_DB_NAME') . '?new_link=true');
|
|
define('CIVICRM_UF_BASEURL', getenv('BASE_URL'));
|
|
|
|
define( 'CIVICRM_SITE_KEY', '{{ secret "civicrm_site_key" }}');
|
|
define( 'CIVICRM_SIGN_KEYS', 'jwt-hs256:hkdf-sha256:{{ secret "civicrm_sign_key" }}');
|
|
define( 'CIVICRM_CRED_KEYS', 'aes-cbc:hkdf-sha256:{{ secret "civicrm_cred_key" }}');
|
|
|
|
// Predefined constants
|
|
define('CIVICRM_LOGGING_DSN', CIVICRM_DSN);
|
|
define('CIVICRM_DOMAIN_ID', 1);
|
|
define('CIVICRM_MAIL_SMARTY', 0);
|
|
define('CIVICRM_DB_CACHE_CLASS', 'ArrayCache');
|
|
define('CIVICRM_PSR16_STRICT', FALSE);
|
|
define('CIVICRM_DEADLOCK_RETRIES', 3);
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' && !defined('CIVICRM_EXCLUDE_DIRS_PATTERN')) {
|
|
define('CIVICRM_EXCLUDE_DIRS_PATTERN', '@/(\.|node_modules|js/|css/|bower_components|packages/|sites/default/files/private)@');
|
|
}
|
|
|
|
$civicrm_paths['wp.frontend.base']['url'] = getenv('BASE_URL');
|
|
$civicrm_paths['wp.backend.base']['url'] = getenv('BASE_URL') . '/wp-admin/';
|
|
$civicrm_setting['domain']['userFrameworkResourceURL'] = getenv('BASE_URL') . '/wp-content/plugins/civicrm/civicrm';
|
|
|
|
|
|
// Include path
|
|
$include_path = '.' . PATH_SEPARATOR .
|
|
$civicrm_root . PATH_SEPARATOR .
|
|
$civicrm_root . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR .
|
|
get_include_path();
|
|
if (set_include_path($include_path) === FALSE) {
|
|
echo "Could not set the include path<p>";
|
|
exit();
|
|
}
|
|
|
|
if (!defined('CIVICRM_CLEANURL')) {
|
|
// check for Drupal clean URLs
|
|
if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
|
|
define('CIVICRM_CLEANURL', 1 );
|
|
}
|
|
elseif ( function_exists('config_get') && config_get('system.core', 'clean_url') != 0) {
|
|
define('CIVICRM_CLEANURL', 1 );
|
|
}
|
|
// check for WordPress clean URLs
|
|
elseif( function_exists('get_option') && get_option('permalink_structure') != '' ) {
|
|
define('CIVICRM_CLEANURL', 1 );
|
|
}
|
|
else {
|
|
define('CIVICRM_CLEANURL', 0 );
|
|
}
|
|
}
|
|
|
|
// force PHP to auto-detect Mac line endings
|
|
if (version_compare(PHP_VERSION, '8.1') < 0) {
|
|
ini_set('auto_detect_line_endings', '1');
|
|
}
|
|
|
|
// make sure the memory_limit is at least 64 MB
|
|
$memLimitString = trim(ini_get('memory_limit'));
|
|
$memLimitUnit = strtolower(substr($memLimitString, -1));
|
|
$memLimit = (int) $memLimitString;
|
|
switch ($memLimitUnit) {
|
|
case 'g': $memLimit *= 1024;
|
|
case 'm': $memLimit *= 1024;
|
|
case 'k': $memLimit *= 1024;
|
|
}
|
|
if ($memLimit >= 0 and $memLimit < 134217728) {
|
|
ini_set('memory_limit', '128M');
|
|
}
|
|
|
|
// Optimizations from https://docs.civicrm.org/sysadmin/en/latest/setup/optimizations/
|
|
define('CIVICRM_TEMPLATE_COMPILE_CHECK', FALSE);
|
|
|
|
require_once 'CRM/Core/ClassLoader.php';
|
|
CRM_Core_ClassLoader::singleton()->register();
|