Class: I2CE: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 59: Line 59:
Get the system status.  http://www.ursula1000.com/
Get the system status.  http://www.ursula1000.com/
*Signature: static public function allSystemsAreGoGo($site_module_file,$check_time)
*Signature: static public function allSystemsAreGoGo($site_module_file,$check_time)
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] 'gogo' means we are good. 'needs_installation'  means we need to initialize. 'needs_upgrade'
*Parameters:
Parameters:
*$site_module_file  
*$site_module_file  
*$check_time  
*$check_time  
**Default Value: false
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>'gogo' means we are good. 'needs_installation'  means we need to initialize. 'needs_upgrade'
===bringUpSystem()===
===bringUpSystem()===
*Signature: static protected function bringUpSystem($site_module_file)
*Signature: static protected function bringUpSystem($site_module_file)
Parameters:
*Parameters:
*$site_module_file  
*$site_module_file  
===dbConnect()===
===dbConnect()===
connect to the database
connect to the database
*Signature: static protected function dbConnect($dsn)
*Signature: static protected function dbConnect($dsn)
*Returns: true on sucess
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $dsn <br/>;
* [http://www.php.net/manual/en/language.types.string.php string ] $dsn<br/>;
*Returns: true<br/>on sucess
===getAccessedBaseURL()===
===getAccessedBaseURL()===
Returns the base url from which the site was accessed.  If no
Returns the base url from which the site was accessed.  If no .htaccess is used, ths will include the index.php.  If rewrites are used (via .htacces) this will no include the index.php. Point is... this is the base url from which the site was accessed, no questions asked.  This of course assumes that you are now accessing the site via the command line
.htaccess is used, ths will include the index.php.  If rewrites
are used (via .htacces) this will no include the
index.php. Point is... this is the base url from which the site
was accessed, no questions asked.  This of course assumes that
you are now accessing the site via the command line
*Signature: static public function getAccessedBaseURL($include_http)
*Signature: static public function getAccessedBaseURL($include_http)
*Parameters:
*$include_http
***Default Value: true
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
Parameters:
*$include_http
**Default Value: true
===getConfig()===
===getConfig()===
Get the configuration storage
Get the configuration storage @param string $instance.  Defaults to 'default'
@param string $instance.  Defaults to 'default'
*Signature: static public function getConfig()
*Signature: static public function getConfig()
*Returns: [[Class: I2CE_MagicData | I2CE_MagicData]]
*Returns: [[Class: I2CE_MagicData | I2CE_MagicData]]
Line 96: Line 90:
Parse the debug backtrace to get the method that raised the error.
Parse the debug backtrace to get the method that raised the error.
*Signature: static protected function getPrevMethod($debug,$start_depth,$trace_depth)
*Signature: static protected function getPrevMethod($debug,$start_depth,$trace_depth)
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.array.php array ] $debug
* [http://www.php.net/manual/en/language.types.array.php array ] $debug
*$start_depth  
*$start_depth  
**Default Value: 1
***Default Value: 1
*$trace_depth  
*$trace_depth  
**Default Value: 1  
***Default Value: 1  
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getRuntimeVariable()===
===getRuntimeVariable()===
Gets a runtime variable.  For the CLI is the is from the
Gets a runtime variable.  For the CLI is the is from the environment which may be overwridden by a ---long-option from the command line.  Otherwise it is set by SetEnv in a .htaccess file (which is stored in $_SERVER)
environment which may be overwridden by a ---long-option from
the command line.  Otherwise it is set by SetEnv in a .htaccess
file (which is stored in $_SERVER)
*Signature: static public function getRuntimeVariable($var,$val)
*Signature: static public function getRuntimeVariable($var,$val)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $var<br/>the variable name
** [http://www.php.net/manual/en/language.types.string.php string ] $var <br/>the variable name
* [http://www.php.net/manual/en/language.types.string.php string ] $val<br/>the defualt value;  Defaults to the zero length string
** [http://www.php.net/manual/en/language.types.string.php string ] $val <br/>the defualt value;  Defaults to the zero length string
**Default Value: ''
***Default Value: ''
===handleError()===
===handleError()===
*Signature: public function handleError($err_no,$err_string,$err_file,$err_line,$err_context)
*Signature: public function handleError($err_no,$err_string,$err_file,$err_line,$err_context)
Parameters:
*Parameters:
*$err_no  
*$err_no  
*$err_string  
*$err_string  
*$err_file  
*$err_file  
**Default Value: false
***Default Value: false
*$err_line  
*$err_line  
**Default Value: false  
***Default Value: false  
*$err_context  
*$err_context  
**Default Value: false
***Default Value: false
===hasWarnings()===
===hasWarnings()===
See if there were any warning messages set before the site was initialized
See if there were any warning messages set before the site was initialized
Line 130: Line 121:
===initialize()===
===initialize()===
Gets the core system going.
Gets the core system going.
then we use $db
*Signature: static public function initialize($db_user,$db_pass,$db_name,$user_db,$site_module_file,$bring_up_system)
*Signature: static public function initialize($db_user,$db_pass,$db_name,$user_db,$site_module_file,$bring_up_system)
*Returns: boolean.  True on sucess
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $db_user <br/>the database user
* [http://www.php.net/manual/en/language.types.string.php string ] $db_user<br/>the database user
** [http://www.php.net/manual/en/language.types.string.php string ] $db_pass <br/>the database user's password
* [http://www.php.net/manual/en/language.types.string.php string ] $db_pass<br/>the database user's password
** [http://www.php.net/manual/en/language.types.string.php string ] $db_name <br/>the name of the database all data is stored in
* [http://www.php.net/manual/en/language.types.string.php string ] $db_name<br/>the name of the database all data is stored in
** [http://www.php.net/manual/en/language.types.string.php string ] $user_db <br/>the name of the database which contains the user table.  If null then we use $db
* [http://www.php.net/manual/en/language.types.string.php string ] $user_db<br/>the name of the database which contains the user table.  If null
** [http://www.php.net/manual/en/language.types.string.php string ] $site_module_file <br/>the configttion file for the site module
* [http://www.php.net/manual/en/language.types.string.php string ] $site_module_file<br/>the configttion file for the site module
*$bring_up_system  
*$bring_up_system  
**Default Value: true
***Default Value: true
*Returns: boolean.<br/>True on sucess
===longExecution()===
===longExecution()===
*Signature: static public function longExecution($limits)
*Signature: static public function longExecution($limits)
Parameters:
*Parameters:
*$limits  
*$limits  
**Default Value: null
***Default Value: null
===pearError()===
===pearError()===
Check to see if a object is a pear error and raise an error if it is.
Check to see if a object is a pear error and raise an error if it is.
*Signature: static public function pearError($obj,$message,$type,$redirect)
*Signature: static public function pearError($obj,$message,$type,$redirect)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $obj
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $obj
* [http://www.php.net/manual/en/language.types.string.php string ] $message<br/>The error message to display if it is an error.
** [http://www.php.net/manual/en/language.types.string.php string ] $message <br/>The error message to display if it is an error.
* integer $type<br/>The error type to raise.
** integer $type <br/>The error type to raise.
**Default Value: E_USER_NOTICE
***Default Value: E_USER_NOTICE
* [http://www.php.net/manual/en/language.types.string.php string ] $redirect<br/>The page to redirect to if this is a critical error.
** [http://www.php.net/manual/en/language.types.string.php string ] $redirect <br/>The page to redirect to if this is a critical error.
**Default Value: ""  
***Default Value: ""  
===popErrorHandler()===
===popErrorHandler()===
Pop an error handler off of the stack.
Pop an error handler off of the stack.
*Signature: static public function popErrorHandler()
*Signature: static public function popErrorHandler()
*Returns: $callback the callback popped off the stack
*Returns: $callback<br/>the callback popped off the stack
===pushErrorHandler()===
===pushErrorHandler()===
Push an error handler onto the stack.
Push an error handler onto the stack. @param $callback
@param $callback
*Signature: static public function pushErrorHandler($callback)
*Signature: static public function pushErrorHandler($callback)
Parameters:
*Parameters:
*$callback  
*$callback  
===raiseError()===
===raiseError()===
Raise an error and redirect the user for any critical errors.
Raise an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.
 
The default redirect will go to the home page for the site.
@param string/mixed $message The error message.
@global array
*Signature: static public function raiseError($message,$type,$redirect)
*Signature: static public function raiseError($message,$type,$redirect)
Parameters:
*Parameters:
*$message  
*$message  
**Default Value: null
***Default Value: null
* integer $type<br/>The error type.
** integer $type <br/>The error type.
**Default Value: E_USER_NOTICE
***Default Value: E_USER_NOTICE
* [http://www.php.net/manual/en/language.types.string.php string ] $redirect<br/>The page to redirect to for critical errors.
** [http://www.php.net/manual/en/language.types.string.php string ] $redirect <br/>The page to redirect to for critical errors. @global array
**Default Value: ""  
***Default Value: ""  
===resetFileSearch()===
===resetFileSearch()===
*Signature: public function resetFileSearch()
*Signature: public function resetFileSearch()
Line 186: Line 171:
*Signature: static public function rewrittenURLs()
*Signature: static public function rewrittenURLs()
===setConfig()===
===setConfig()===
Sets an instance magic data object
Sets an instance magic data object @param I2CE_MagicData $magicdata
@param I2CE_MagicData $magicdata
*Signature: static public function setConfig($magicData)
*Signature: static public function setConfig($magicData)
Parameters:
*Parameters:
*$magicData  
*$magicData  
===setTraceDepth()===
===setTraceDepth()===
Set the trace depth used in reporting error messages
Set the trace depth used in reporting error messages
Set to a negative number to report all,
0 to report none.
*Signature: static public function setTraceDepth($depth)
*Signature: static public function setTraceDepth($depth)
*Returns: integer. The previous value of trace depth.
*Parameters:
Parameters:
** integer $depth Set to a negative number to report all, 0 to report none.
* integer $depth
*Returns: integer.<br/>The previous value of trace depth.
===setupDatabaseReferences()===
===setupDatabaseReferences()===
Setup the references to database names in magic data
Setup the references to database names in magic data
*Signature: static protected function setupDatabaseReferences($user_db)
*Signature: static protected function setupDatabaseReferences($user_db)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $user_db<br/>defaults
** [http://www.php.net/manual/en/language.types.string.php string ] $user_db <br/>defaults
**Default Value: null
***Default Value: null
===setupFileSearch()===
===setupFileSearch()===
Create and populate the file search
Create and populate the file search
and values a path or an array of paths to add to the file
search
clear out the APC Cache.
*Signature: static public function setupFileSearch($paths,$clear_cache)
*Signature: static public function setupFileSearch($paths,$clear_cache)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.array.php array ] $paths<br/>An array with keys file search categories
** [http://www.php.net/manual/en/language.types.array.php array ] $paths <br/>An array with keys file search categories and values a path or an array of paths to add to the file search
**Default Value: array()
***Default Value: array()
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $clear_cache<br/>Default to false.  If true, we
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $clear_cache <br/>Default to false.  If true, we clear out the APC Cache.
**Default Value: false
***Default Value: false
===setupMagicData()===
===setupMagicData()===
Creates  the magic data instance.
Creates  the magic data instance. Sets the mafic data storage mechanisms to be used.
Sets the mafic data storage mechanisms to be used.
*Signature: static protected function setupMagicData()
*Signature: static protected function setupMagicData()
===setupSession()===
===setupSession()===
Line 227: Line 202:
*Signature: static protected function setupSession()
*Signature: static protected function setupSession()
===siteInitialized()===
===siteInitialized()===
Get/Set the site's initialization state.
Get/Set the site's initialization state. @param init.  Defaults to null in which case we return the site installation state.  if non-null, it is the new site initialization state.
 
@param init.  Defaults to null in which case we return the site
installation state.  if non-null, it is the new site
initialization state.
*Signature: static public function siteInitialized($init)
*Signature: static public function siteInitialized($init)
*Parameters:
*$init
***Default Value: null
*Returns: mixed.
*Returns: mixed.
Parameters:
*$init
**Default Value: null




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 23:40, 16 October 2009

This article desrcibes the class I2CE.

This class mainly handles throwing errors from withing I2CE

Variables

$site_initialized

True if the site has been initalized. @param static protected boolean $site_initalized

  • Type: static protected $site_initialized

$storage

$stored_messages

An array of the notice/warning messages received for this session

  • Type: static protected y $stored_messages

$errorType

  • Type: static public $errorType

$noticeErrors

  • Type: static public $noticeErrors

$warningErrors

  • Type: static public $warningErrors

$ignoreErrorsFromFilesMatching

  • Type: static public $ignoreErrorsFromFilesMatching

$ignoreErrors

  • Type: static public $ignoreErrors

$supress

  • Type: protected $supress

$site_warnings

Count of the number of erros and warings received when the site is not initialized @param static protected boolean $site_warnings

  • Type: static protected $site_warnings

$error_num

  • Type: protected $error_num

$errorHandler

Optional error handler callback.

  • Type: static private $errorHandler

$fileSearch

$trace_depth

. Defaults to 1. The number of previous methods to report when an error message is developed. Set to a negative number to report all, or 0 to report none.

  • Type: static protected nteger $trace_depth

Methods

allSystemsAreGoGo()

Get the system status. http://www.ursula1000.com/

  • Signature: static public function allSystemsAreGoGo($site_module_file,$check_time)
  • Parameters:
  • $site_module_file
  • $check_time
      • Default Value: false
  • Returns: string
    'gogo' means we are good. 'needs_installation' means we need to initialize. 'needs_upgrade'

bringUpSystem()

  • Signature: static protected function bringUpSystem($site_module_file)
  • Parameters:
  • $site_module_file

dbConnect()

connect to the database

  • Signature: static protected function dbConnect($dsn)
  • Parameters:
  • Returns: true
    on sucess

getAccessedBaseURL()

Returns the base url from which the site was accessed. If no .htaccess is used, ths will include the index.php. If rewrites are used (via .htacces) this will no include the index.php. Point is... this is the base url from which the site was accessed, no questions asked. This of course assumes that you are now accessing the site via the command line

  • Signature: static public function getAccessedBaseURL($include_http)
  • Parameters:
  • $include_http
      • Default Value: true
  • Returns: string

getConfig()

Get the configuration storage @param string $instance. Defaults to 'default'

getFileSearch()

  • Signature: static public function getFileSearch()

getPrevMethod()

Parse the debug backtrace to get the method that raised the error.

  • Signature: static protected function getPrevMethod($debug,$start_depth,$trace_depth)
  • Parameters:
  • $start_depth
      • Default Value: 1
  • $trace_depth
      • Default Value: 1
  • Returns: string

getRuntimeVariable()

Gets a runtime variable. For the CLI is the is from the environment which may be overwridden by a ---long-option from the command line. Otherwise it is set by SetEnv in a .htaccess file (which is stored in $_SERVER)

  • Signature: static public function getRuntimeVariable($var,$val)
  • Parameters:
    • string $var
      the variable name
    • string $val
      the defualt value; Defaults to the zero length string
      • Default Value:

handleError()

  • Signature: public function handleError($err_no,$err_string,$err_file,$err_line,$err_context)
  • Parameters:
  • $err_no
  • $err_string
  • $err_file
      • Default Value: false
  • $err_line
      • Default Value: false
  • $err_context
      • Default Value: false

hasWarnings()

See if there were any warning messages set before the site was initialized

  • Signature: static public function hasWarnings()
  • Returns: boolean

initialize()

Gets the core system going.

  • Signature: static public function initialize($db_user,$db_pass,$db_name,$user_db,$site_module_file,$bring_up_system)
  • Parameters:
    • string $db_user
      the database user
    • string $db_pass
      the database user's password
    • string $db_name
      the name of the database all data is stored in
    • string $user_db
      the name of the database which contains the user table. If null then we use $db
    • string $site_module_file
      the configttion file for the site module
  • $bring_up_system
      • Default Value: true
  • Returns: boolean.
    True on sucess

longExecution()

  • Signature: static public function longExecution($limits)
  • Parameters:
  • $limits
      • Default Value: null

pearError()

Check to see if a object is a pear error and raise an error if it is.

  • Signature: static public function pearError($obj,$message,$type,$redirect)
  • Parameters:
    • mixed $obj
    • string $message
      The error message to display if it is an error.
    • integer $type
      The error type to raise.
      • Default Value: E_USER_NOTICE
    • string $redirect
      The page to redirect to if this is a critical error.
      • Default Value: ""

popErrorHandler()

Pop an error handler off of the stack.

  • Signature: static public function popErrorHandler()
  • Returns: $callback
    the callback popped off the stack

pushErrorHandler()

Push an error handler onto the stack. @param $callback

  • Signature: static public function pushErrorHandler($callback)
  • Parameters:
  • $callback

raiseError()

Raise an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.

  • Signature: static public function raiseError($message,$type,$redirect)
  • Parameters:
  • $message
      • Default Value: null
    • integer $type
      The error type.
      • Default Value: E_USER_NOTICE
    • string $redirect
      The page to redirect to for critical errors. @global array
      • Default Value: ""

resetFileSearch()

  • Signature: public function resetFileSearch()

rewrittenURLs()

returns true if the url's have been written. false if not

  • Signature: static public function rewrittenURLs()

setConfig()

Sets an instance magic data object @param I2CE_MagicData $magicdata

  • Signature: static public function setConfig($magicData)
  • Parameters:
  • $magicData

setTraceDepth()

Set the trace depth used in reporting error messages

  • Signature: static public function setTraceDepth($depth)
  • Parameters:
    • integer $depth Set to a negative number to report all, 0 to report none.
  • Returns: integer.
    The previous value of trace depth.

setupDatabaseReferences()

Setup the references to database names in magic data

  • Signature: static protected function setupDatabaseReferences($user_db)
  • Parameters:
    • string $user_db
      defaults
      • Default Value: null

setupFileSearch()

Create and populate the file search

  • Signature: static public function setupFileSearch($paths,$clear_cache)
  • Parameters:
    • array $paths
      An array with keys file search categories and values a path or an array of paths to add to the file search
      • Default Value: array()
    • boolean $clear_cache
      Default to false. If true, we clear out the APC Cache.
      • Default Value: false

setupMagicData()

Creates the magic data instance. Sets the mafic data storage mechanisms to be used.

  • Signature: static protected function setupMagicData()

setupSession()

Setup the session variables

  • Signature: static protected function setupSession()

siteInitialized()

Get/Set the site's initialization state. @param init. Defaults to null in which case we return the site installation state. if non-null, it is the new site initialization state.

  • Signature: static public function siteInitialized($init)
  • Parameters:
  • $init
      • Default Value: null
  • Returns: mixed.