2014-04-23 10:51:50 +08:00
< ? php
/**
* This file is loaded automatically by the app / webroot / index . php file after core . php
*
* This file should load / create any application wide configuration settings , such as
* Caching , Logging , loading additional configuration files .
*
* You should also use this file to include any files that provide global functions / constants
* that your application uses .
*
2018-03-22 01:09:55 +08:00
* CakePHP ( tm ) : Rapid Development Framework ( https :// cakephp . org )
* Copyright ( c ) Cake Software Foundation , Inc . ( https :// cakefoundation . org )
2014-04-23 10:51:50 +08:00
*
* Licensed under The MIT License
* For full copyright and license information , please see the LICENSE . txt
* Redistributions of files must retain the above copyright notice .
*
2018-03-22 01:09:55 +08:00
* @ copyright Copyright ( c ) Cake Software Foundation , Inc . ( https :// cakefoundation . org )
* @ link https :// cakephp . org CakePHP ( tm ) Project
2014-04-23 10:51:50 +08:00
* @ package app . Config
* @ since CakePHP ( tm ) v 0.10 . 8.2117
2018-03-22 01:09:55 +08:00
* @ license https :// opensource . org / licenses / mit - license . php MIT License
2014-04-23 10:51:50 +08:00
*/
// Setup a 'default' cache configuration for use in the application.
2017-04-15 03:31:42 +08:00
Cache :: config ( 'default' , array ( 'engine' => 'Apc' ));
2014-04-23 10:51:50 +08:00
/**
* The settings below can be used to set additional paths to models , views and controllers .
*
* App :: build ( array (
* 'Model' => array ( '/path/to/models/' , '/next/path/to/models/' ),
* 'Model/Behavior' => array ( '/path/to/behaviors/' , '/next/path/to/behaviors/' ),
* 'Model/Datasource' => array ( '/path/to/datasources/' , '/next/path/to/datasources/' ),
* 'Model/Datasource/Database' => array ( '/path/to/databases/' , '/next/path/to/database/' ),
* 'Model/Datasource/Session' => array ( '/path/to/sessions/' , '/next/path/to/sessions/' ),
* 'Controller' => array ( '/path/to/controllers/' , '/next/path/to/controllers/' ),
* 'Controller/Component' => array ( '/path/to/components/' , '/next/path/to/components/' ),
* 'Controller/Component/Auth' => array ( '/path/to/auths/' , '/next/path/to/auths/' ),
* 'Controller/Component/Acl' => array ( '/path/to/acls/' , '/next/path/to/acls/' ),
* 'View' => array ( '/path/to/views/' , '/next/path/to/views/' ),
* 'View/Helper' => array ( '/path/to/helpers/' , '/next/path/to/helpers/' ),
* 'Console' => array ( '/path/to/consoles/' , '/next/path/to/consoles/' ),
* 'Console/Command' => array ( '/path/to/commands/' , '/next/path/to/commands/' ),
* 'Console/Command/Task' => array ( '/path/to/tasks/' , '/next/path/to/tasks/' ),
* 'Lib' => array ( '/path/to/libs/' , '/next/path/to/libs/' ),
* 'Locale' => array ( '/path/to/locales/' , '/next/path/to/locales/' ),
* 'Vendor' => array ( '/path/to/vendors/' , '/next/path/to/vendors/' ),
* 'Plugin' => array ( '/path/to/plugins/' , '/next/path/to/plugins/' ),
* ));
*
*/
/**
* Custom Inflector rules can be set to correctly pluralize or singularize table , model , controller names or whatever other
* string is passed to the inflection functions
*
* Inflector :: rules ( 'singular' , array ( 'rules' => array (), 'irregular' => array (), 'uninflected' => array ()));
* Inflector :: rules ( 'plural' , array ( 'rules' => array (), 'irregular' => array (), 'uninflected' => array ()));
*
*/
/**
* Plugins need to be loaded manually , you can either load them one by one or all of them in a single call
* Uncomment one of the lines below , as you need . Make sure you read the documentation on CakePlugin to use more
* advanced ways of loading plugins
*
* CakePlugin :: loadAll (); // Loads all plugins at once
* CakePlugin :: load ( 'DebugKit' ); //Loads a single plugin named DebugKit
*
*/
2015-06-11 10:58:58 +08:00
CakePlugin :: load ( 'Crud' );
2018-01-02 03:43:02 +08:00
CakePlugin :: load ( 'CakePHP-Enum-Behavior' );
2014-04-23 10:51:50 +08:00
/**
* You can attach event listeners to the request lifecycle as Dispatcher Filter . By default CakePHP bundles two filters :
*
* - AssetDispatcher filter will serve your asset files ( css , images , js , etc ) from your themes and plugins
* - CacheDispatcher filter will read the Cache . check configure variable and try to serve cached content generated from controllers
*
* Feel free to remove or add filters as you see fit for your application . A few examples :
*
* Configure :: write ( 'Dispatcher.filters' , array (
* 'MyCacheFilter' , // will use MyCacheFilter class from the Routing/Filter package in your app.
* 'MyCacheFilter' => array ( 'prefix' => 'my_cache_' ), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
* 'MyPlugin.MyFilter' , // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
* array ( 'callable' => $aFunction , 'on' => 'before' , 'priority' => 9 ), // A valid PHP callback type to be called on beforeDispatch
* array ( 'callable' => $anotherMethod , 'on' => 'after' ), // A valid PHP callback type to be called on afterDispatch
*
* ));
*/
Configure :: write ( 'Dispatcher.filters' , array (
'AssetDispatcher' ,
'CacheDispatcher'
));
/**
* Configures default file logging options
*/
App :: uses ( 'CakeLog' , 'Log' );
CakeLog :: config ( 'debug' , array (
'engine' => 'File' ,
'types' => array ( 'notice' , 'info' , 'debug' ),
2017-06-09 00:21:51 +08:00
'file' => 'cake_debug' ,
2017-07-14 23:46:36 +08:00
'path' => '@ZM_LOGDIR@/'
2014-04-23 10:51:50 +08:00
));
CakeLog :: config ( 'error' , array (
'engine' => 'File' ,
'types' => array ( 'warning' , 'error' , 'critical' , 'alert' , 'emergency' ),
2017-06-09 00:21:51 +08:00
'file' => 'cake_error' ,
2017-07-14 23:46:36 +08:00
'path' => '@ZM_LOGDIR@/'
2017-04-15 03:24:29 +08:00
));
CakeLog :: config ( 'custom_path' , array (
'engine' => 'File' ,
2017-07-14 23:46:36 +08:00
'path' => '@ZM_LOGDIR@/'
2014-04-23 10:51:50 +08:00
));
2015-06-14 00:32:37 +08:00
Configure :: write ( 'ZM_CONFIG' , '@ZM_CONFIG@' );
2017-07-14 23:46:36 +08:00
Configure :: write ( 'ZM_CONFIG_SUBDIR' , '@ZM_CONFIG_SUBDIR@' );
2015-06-14 00:32:37 +08:00
Configure :: write ( 'ZM_VERSION' , '@VERSION@' );
Configure :: write ( 'ZM_API_VERSION' , '@API_VERSION@' );
2018-04-07 02:52:56 +08:00
require_once ( " ../../../includes/config.php " );
2018-04-07 02:38:32 +08:00
global $configvals ;
2015-06-14 00:32:37 +08:00
2018-04-07 02:38:32 +08:00
# Now that our array our finalized, and the config has been defined.
# Add them to the cakephp Config
2017-07-14 23:46:36 +08:00
foreach ( $configvals as $key => $value ) {
2018-04-07 02:52:56 +08:00
Configure :: write ( $key , $value );
2015-06-14 00:32:37 +08:00
}
2018-04-07 02:38:32 +08:00
if ( 0 ) {
// No longer needed, but I want to keep the code for reference
//
2018-01-02 02:10:39 +08:00
// For Human-readability, use ZM_SERVER_HOST or ZM_SERVER_NAME in zm.conf, and convert it here to a ZM_SERVER_ID
if ( ! defined ( 'ZM_SERVER_ID' ) ) {
App :: uses ( 'ClassRegistry' , 'Utility' );
$ServerModel = ClassRegistry :: init ( 'Server' );
if ( defined ( 'ZM_SERVER_NAME' ) and ZM_SERVER_NAME ) {
$Server = $ServerModel -> find ( 'first' , array ( 'conditions' => array ( 'Name' => ZM_SERVER_NAME ) ) );
if ( ! $Server ) {
Error ( 'Invalid Multi-Server configration detected. ZM_SERVER_NAME set to ' . ZM_SERVER_NAME . ' in zm.conf, but no corresponding entry found in Servers table.' );
} else {
define ( 'ZM_SERVER_ID' , $Server [ 'Server' ][ 'Id' ] );
}
} else if ( defined ( 'ZM_SERVER_HOST' ) and ZM_SERVER_HOST ) {
$Server = $ServerModel -> find ( 'first' , array ( 'conditions' => array ( 'Name' => ZM_SERVER_HOST ) ) );
if ( ! $Server ) {
Error ( 'Invalid Multi-Server configration detected. ZM_SERVER_HOST set to ' . ZM_SERVER_HOST . ' in zm.conf, but no corresponding entry found in Servers table.' );
} else {
define ( 'ZM_SERVER_ID' , $Server [ 'Server' ][ 'Id' ] );
}
}
}
2018-04-05 23:33:24 +08:00
}