KWeb  6.4
KWebBootstrap Class Reference

This is the KWeb bootstrapper. More...

Public Member Functions

 bootstrapConfigs ()
 Runs bootstrap configs.
 bootstrapEnvironment ()
 Prepares the environment, loads plugins, runs callbacks etc.
 startup ()
 Runs bootstrap configs.
 load ($config)
 Loads the configuration file.
 loadStartupConfigs ()
 registerPlugin ($dirPath, $className, array $options=array())
 Registers plugin with KWeb.

Static Public Member Functions

static buildBootstrap ()
 Builds KWebBootstrap object and returns it.
static run ($startup=true)
 This is the KWeb main entry point.
static overrideConfig ($data)
static checkEnvironment ()
static dynamicDefines ()
static setupEnvironment ()
static setBasicErrorHandling ()
static cleanupStracktrace ($stacktrace)
static buildErrorString ($errno, $state, $message, $file, $line, $stacktrace, $dump=false, $html=true)
static exceptionHandlerCallback ($exception)
static errorHandlerCallback ($errno, $message, $file, $line, array $context)
static errorHandler ($state, $display, $errno, $message, $file, $line, array $context)
static getBootStage ()

Data Fields

const ERROR_HANDLER_ENABLED = 1
 Handle errors.
const ERROR_HANDLER_DISPLAYALL = 2
 Display errors muted with error_reporting.
const ERROR_HANDLER_DISPLAYMUTED = 4
 Display errors muted with @ symbol.
const ERROR_HANDLER_FILE = 8
 Show file/line information.
const ERROR_HANDLER_STACKTRACE = 0x10
 Show stacktrace information.
const ERROR_HANDLER_SQL = 0x20
const ERROR_HANDLER_DUMP = 0x40
const ERROR_HANDLER_MESSAGE = 0x80
 Displays error message.
const ERROR_HANDLER_STATE = 0x100
const ERROR_HANDLER_STRICT = 0x2000
 Will treat every error as critical, use it only when debugging.
const ERROR_HANDLER_DEBUG = 0xFFF
const ERROR_HANDLER_MINIMUM = 0x81
const ERROR_HANDLER_MEDIUM = 0x89
 $dev_pass = false
 password to access /dev/ directory (at all)
 $dev_admin_pass = false
 password to access potentially harmful scripts in /dev/
 $secret = 'secret'
 secret
 $override_kweb
 directory with kweb's files (default: kweb/)
 $override_local
 directory with local files (default: local/)
 $path
 site's root path, where kweb/ and local/ are under
 $path_original
 $public_path
 site's public path, with all web accessible files if it's different then $path, then some folders like css/ img/ js/ dev/ xinha/ should be symlinked or copied to public directory
 $server_path = '/'
 Server path (root of the URL).
 $locale
 array of locale identifiers
 $output_buffering = true
 $cmdline
 $webrequest
 $config_files = array()
 List of configuration files to load after "local" and "dynamic".
 $config_override = array()
 Settings to override default KWebSetting (after loading config_files)
 $config_merge = array()
 Settings to merge with default KWebSetting (after loading config_files)
 $timezone
 $ktiming = false
 $ktiming_grouping = false
 $classmap = array()
 list of ClassMap overrides
 $classfiles = array()
 list of KWebFileDiscovery_class overrides
 $loopback_key
 loopback key used to validate loopback requests
 $plugins = array()
 list of registered plugins.

Static Public Attributes

static $config = null
static $overrideBasicConfig = array()
 configuration to override default bootstrap config (before changes by local)
static $overrideWholeConfig = array()
 configuration to override whole bootstrap config (with changes by local)
static $callbacks = array()
 list of callbacks - functions and files that will be called after bootstrapping and before startup
static $mode = 'web'
 mode of operation - web/cmdline/debug/test/remote
static $failTest = false
 Used to test failuers at different places in bootstrap pre, config, env, basics, ready.
static $errorHandling = 1
 should KWeb handle errors and Exceptions? default - ENABLED
static $errorsHidden = array()
static $errorsCaught = 0
static $timeStart
 Microtime of run() call.

Static Protected Member Functions

static staticDefines ()
static setupBasicClasses ()

Protected Attributes

 $bootStage = '-pre'
 $loadedConfigs = array()

Detailed Description

This is the KWeb bootstrapper.

It configures all the basics and sets up all constants.

Set the parameters and call run()

The process is run in this order:

  • kweb/config/bootstrap-local.php - in case you have to change the /local/ path
  • local/config/bootstrap.php - for website specific settings
  • local/config/bootstrap-local.php - for local server specific settings
  • the KClassLoader is instantiated (if it's not already present)
  • the KClassLoader is configured with basic FileDiscovery (unless they're already present)
  • any registered callbacks are run
Warning:
Remember, that during bootstrap you can't use any part of KWeb directly, including constants!

Member Function Documentation

KWebBootstrap::bootstrapConfigs ( )

Runs bootstrap configs.

KWebBootstrap::bootstrapEnvironment ( )

Prepares the environment, loads plugins, runs callbacks etc.

static KWebBootstrap::buildBootstrap ( ) [static]

Builds KWebBootstrap object and returns it.

Returns:
KWebBootstrap
static KWebBootstrap::buildErrorString ( errno,
state,
message,
file,
line,
stacktrace,
dump = false,
html = true 
) [static]
static KWebBootstrap::checkEnvironment ( ) [static]
static KWebBootstrap::cleanupStracktrace ( stacktrace) [static]
static KWebBootstrap::dynamicDefines ( ) [static]
static KWebBootstrap::errorHandler ( state,
display,
errno,
message,
file,
line,
array $  context 
) [static]
static KWebBootstrap::errorHandlerCallback ( errno,
message,
file,
line,
array $  context 
) [static]
static KWebBootstrap::exceptionHandlerCallback ( exception) [static]
Parameters:
$exceptionException
static KWebBootstrap::getBootStage ( ) [static]
KWebBootstrap::load ( config)

Loads the configuration file.

Warning:
This function handles overrides different way! KWeb file comes always first!
KWebBootstrap::loadStartupConfigs ( )
static KWebBootstrap::overrideConfig ( data) [static]
KWebBootstrap::registerPlugin ( dirPath,
className,
array $  options = array() 
)

Registers plugin with KWeb.

Parameters:
$dirPathDirectory path with the plugin
$classNameName of the plugin class (plugin file should be named "$dirPath/$className.php")
$optionsOptions array to pass to the plugins constructor
Warning:
During registration, none of the KWeb classes, or defines are ready! This also applies to class auto-loader!
Returns:
KWebPlugin
static KWebBootstrap::run ( startup = true) [static]

This is the KWeb main entry point.

This function sets up whole system's basics according to several config files and variables passed.

This is the same as calling:

$config = KWebBootstrap::buildBootstrap(); $config->bootstrapConfigs(); $config->bootstrapEnvironment(); if ($startup) { $config->startup(); }

Parameters:
bool$startup- Should it startup automatically?
Returns:
KWebBootstrap
static KWebBootstrap::setBasicErrorHandling ( ) [static]
static KWebBootstrap::setupBasicClasses ( ) [static, protected]
static KWebBootstrap::setupEnvironment ( ) [static]
KWebBootstrap::startup ( )

Runs bootstrap configs.

static KWebBootstrap::staticDefines ( ) [static, protected]

Field Documentation

KWebBootstrap::$bootStage = '-pre' [protected]
KWebBootstrap::$callbacks = array() [static]

list of callbacks - functions and files that will be called after bootstrapping and before startup

KWebBootstrap::$classfiles = array()

list of KWebFileDiscovery_class overrides

KWebBootstrap::$classmap = array()

list of ClassMap overrides

KWebBootstrap::$cmdline
KWebBootstrap::$config = null [static]
KWebBootstrap::$config_files = array()

List of configuration files to load after "local" and "dynamic".

KWebBootstrap::$config_merge = array()

Settings to merge with default KWebSetting (after loading config_files)

KWebBootstrap::$config_override = array()

Settings to override default KWebSetting (after loading config_files)

KWebBootstrap::$dev_admin_pass = false

password to access potentially harmful scripts in /dev/

KWebBootstrap::$dev_pass = false

password to access /dev/ directory (at all)

KWebBootstrap::$errorHandling = 1 [static]

should KWeb handle errors and Exceptions? default - ENABLED

KWebBootstrap::$errorsCaught = 0 [static]
KWebBootstrap::$errorsHidden = array() [static]
KWebBootstrap::$failTest = false [static]

Used to test failuers at different places in bootstrap pre, config, env, basics, ready.

KWebBootstrap::$ktiming = false
KWebBootstrap::$ktiming_grouping = false
KWebBootstrap::$loadedConfigs = array() [protected]
KWebBootstrap::$locale

array of locale identifiers

KWebBootstrap::$loopback_key

loopback key used to validate loopback requests

KWebBootstrap::$mode = 'web' [static]

mode of operation - web/cmdline/debug/test/remote

KWebBootstrap::$output_buffering = true
KWebBootstrap::$override_kweb

directory with kweb's files (default: kweb/)

KWebBootstrap::$override_local

directory with local files (default: local/)

KWebBootstrap::$overrideBasicConfig = array() [static]

configuration to override default bootstrap config (before changes by local)

KWebBootstrap::$overrideWholeConfig = array() [static]

configuration to override whole bootstrap config (with changes by local)

KWebBootstrap::$path

site's root path, where kweb/ and local/ are under

KWebBootstrap::$path_original
KWebBootstrap::$plugins = array()

list of registered plugins.

Plugins should be loaded in config/bootstrap*.php files using registerPlugin() function

KWebBootstrap::$public_path

site's public path, with all web accessible files if it's different then $path, then some folders like css/ img/ js/ dev/ xinha/ should be symlinked or copied to public directory

KWebBootstrap::$secret = 'secret'

secret

KWebBootstrap::$server_path = '/'

Server path (root of the URL).

After bootstrapping, KWebSetting::$server_path should be used

KWebBootstrap::$timeStart [static]

Microtime of run() call.

KWebBootstrap::$timezone
KWebBootstrap::$webrequest

Display errors muted with error_reporting.

Display errors muted with @ symbol.

Handle errors.

Show file/line information.

Displays error message.

Show stacktrace information.

Will treat every error as critical, use it only when debugging.


The documentation for this class was generated from the following file: