|
eZ Publish
[trunk]
|
Handles the basics of script execution. More...
Public Member Functions | |
| currentOptionConfig () | |
| currentOptions () | |
| exitCode () | |
| eZScript ($settings=array()) | |
| getOptions ($config= '', $argumentConfig= '', $optionHelp=false, $arguments=false, $useStandardOptions=true) | |
| initializationError () | |
| initialize () | |
| isInitialized () | |
| isLoud () | |
| isQuiet () | |
| iterate ($cli, $status, $text=false) | |
| resetIteration ($iterationMax=false, $startIndex=0) | |
| setAllowedDebugLevels ($allowedDebugLevels) | |
| setDebugMessage ($message) | |
| setExitCode ($code=false) | |
| setIsQuiet ($isQuiet) | |
| setIterationData ($trueString, $falseString, $numericStrings=false, $wrapNumeric=false) | |
| setShowVerboseOutput ($verbose) | |
| setUseDebugAccumulators ($useAccumulators) | |
| setUseDebugOutput ($useDebug) | |
| setUseDebugTimingPoints ($useTimingPoints) | |
| setUseExtensions ($useExtensions) | |
| setUseIncludeFiles ($useIncludeFiles) | |
| setUseModules ($useModules) | |
| setUser ($userLogin, $userPassword) | |
| setUseSession ($useSession) | |
| setUseSiteAccess ($siteAccess) | |
| showHelp ($useStandardOptions=false, $optionConfig=false, $optionHelp=false, $argumentConfig=false, $arguments=false) | |
| shutdown ($exitCode=false, $exitText=false) | |
| startup () | |
| usedSiteAccess () | |
| validateVersion () | |
| verboseOutputLevel () | |
Static Public Member Functions | |
| static | instance ($settings=array()) |
| Returns a shared instance of the eZScript class. | |
| updateDebugSettings ($useDebug=null) | |
| updateTextCodecSettings () | |
Public Attributes | |
| $DebugMessage | |
| $ExitCode | |
| $InitializationErrorMessage | |
| $IsQuiet | |
| $ShowVerbose | |
| $SiteAccess | |
| $UseDebugOutput | |
| $UseExtensions | |
| $UseModules | |
| $User | |
| $UseSession | |
Handles the basics of script execution.
By using this class for script execution startup, initializing and shutdown the amount code required to write a new script is reduced significantly.
It is also recommended to use the eZCLI class in addition to this class.
What this class will handle is:
This class consists of the static functions startup(), initialize() and shutdown().
A typical usage:
$script = eZScript::instance(); $script->startup(); // Read arguments and modify script accordingly $script->initialize(); // Do the actual script here $script->shutdown(); // Finish execution
Definition at line 48 of file ezscript.php.
Definition at line 498 of file ezscript.php.
false if no options are set. Definition at line 490 of file ezscript.php.
Definition at line 512 of file ezscript.php.
| eZScript::eZScript | ( | $ | settings = array() | ) |
| eZScript::getOptions | ( | $ | config = '', |
| $ | argumentConfig = '', |
||
| $ | optionHelp = false, |
||
| $ | arguments = false, |
||
| $ | useStandardOptions = true |
||
| ) |
Parse command line into options array. If stanadrd options are in use, carry out the associated task (eg. switch siteaccess ir logged-in user) /param $config see ezcli::parseOptionString /param $argumentConfig see ezcli::getOptions (unused for now) /param $optionHelp string echoed to screen when script invoked with -h/--help /param $arguments array of arguments. If false, command line is parsed automatically /param $useStandardOptions true or an array of standard options to be used. standard options are: 'debug', 'colors', 'log', 'siteaccess', 'verbose', 'user' (false), and can be set to false to be disabled
Definition at line 826 of file ezscript.php.
Definition at line 297 of file ezscript.php.
Initializes all settings which are required for the script to run, must be called after startup() and getOptions().
If you modify the eZScript object using the set* functions you must make sure that is done before this function is called.
Definition at line 180 of file ezscript.php.
Referenced by getOptions().
| static eZScript::instance | ( | $ | settings = array() | ) | [static] |
Returns a shared instance of the eZScript class.
| array | $settings | Used by the first generated instance, but ignored for subsequent calls. |
Definition at line 1040 of file ezscript.php.
Referenced by childHandler(), daemonSignalHandler(), getOptions(), initialize(), ezpContentPublishingProcess\publish(), setIsQuiet(), showHelp(), shutdown(), startup(), updateDebugSettings(), and updateTextCodecSettings().
Definition at line 292 of file ezscript.php.
| eZScript::isLoud | ( | ) |
true if output is allowed. Definition at line 542 of file ezscript.php.
Referenced by initialize().
true if output is not allowed. Definition at line 533 of file ezscript.php.
Referenced by initialize().
| eZScript::iterate | ( | $ | cli, |
| $ | status, | ||
| $ | text = false |
||
| ) |
Definition at line 563 of file ezscript.php.
| eZScript::resetIteration | ( | $ | iterationMax = false, |
| $ | startIndex = 0 |
||
| ) |
Definition at line 556 of file ezscript.php.
| eZScript::setAllowedDebugLevels | ( | $ | allowedDebugLevels | ) |
Sets which debug levels are to be shown on debug output, this must be an array with EZ_LEVEL_* definitions taken from eZDebug.
Definition at line 413 of file ezscript.php.
Referenced by getOptions().
| eZScript::setDebugMessage | ( | $ | message | ) |
Sets the text message which is shown before the debug list. There will be a default message which should suit most scripts.
Definition at line 363 of file ezscript.php.
Referenced by getOptions().
| eZScript::setExitCode | ( | $ | code = false | ) |
Sets the current exit code which will be set with an exit() call in shutdown(). If you don't want shutdown() to exit automatically set it to false.
Definition at line 507 of file ezscript.php.
| eZScript::setIsQuiet | ( | $ | isQuiet | ) |
Sets whether any output should be used or not.
Definition at line 522 of file ezscript.php.
Referenced by getOptions().
| eZScript::setIterationData | ( | $ | trueString, |
| $ | falseString, | ||
| $ | numericStrings = false, |
||
| $ | wrapNumeric = false |
||
| ) |
Definition at line 547 of file ezscript.php.
| eZScript::setShowVerboseOutput | ( | $ | verbose | ) |
Controls whether verbose output is used or not, use false to turn it off, true to turn it on or a number to select the verbose level (true == 1). The actual behaviour of verbose output depends on the script, however enabling it will make sure iteration looping displays the iteration name instead of a dot.
Definition at line 472 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseDebugAccumulators | ( | $ | useAccumulators | ) |
Sets whether accumulators should be shown on debug output or not.
Definition at line 382 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseDebugOutput | ( | $ | useDebug | ) |
Sets whether debug output should be enabled or not.
Definition at line 372 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseDebugTimingPoints | ( | $ | useTimingPoints | ) |
Sets whether timing points should be shown on debug output or not.
Definition at line 392 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseExtensions | ( | $ | useExtensions | ) |
Sets whether extension support is to be added or not.
Definition at line 432 of file ezscript.php.
| eZScript::setUseIncludeFiles | ( | $ | useIncludeFiles | ) |
Sets whether include files should be shown on debug output or not.
Definition at line 402 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseModules | ( | $ | useModules | ) |
Definition at line 455 of file ezscript.php.
| eZScript::setUser | ( | $ | userLogin, |
| $ | userPassword | ||
| ) |
Definition at line 460 of file ezscript.php.
Referenced by getOptions().
| eZScript::setUseSession | ( | $ | useSession | ) |
Sets whether session is to be used or not.
Definition at line 423 of file ezscript.php.
| eZScript::setUseSiteAccess | ( | $ | siteAccess | ) |
Sets the current site access to $siteAccess.
Definition at line 442 of file ezscript.php.
Referenced by getOptions().
| eZScript::showHelp | ( | $ | useStandardOptions = false, |
| $ | optionConfig = false, |
||
| $ | optionHelp = false, |
||
| $ | argumentConfig = false, |
||
| $ | arguments = false |
||
| ) |
Definition at line 640 of file ezscript.php.
Referenced by getOptions().
| eZScript::shutdown | ( | $ | exitCode = false, |
| $ | exitText = false |
||
| ) |
Shuts down the currently running script, the following things will be done:
If an exit code is set, PHP will exit with that code set (this means that this function never returns), otherwise this function returns normally.
Definition at line 312 of file ezscript.php.
Referenced by getOptions().
Checks if the script is run in CLI mode, if not it exits with a warning. The PHP local is also initialized if it is used.
Call this at the very start of your script and always before getOptions() and initialize().
Definition at line 145 of file ezscript.php.
| eZScript::updateDebugSettings | ( | $ | useDebug = null | ) | [static] |
Reads settings from site.ini and passes them to eZDebug.
Definition at line 1054 of file ezscript.php.
Referenced by initialize().
| eZScript::updateTextCodecSettings | ( | ) | [static] |
Reads settings from i18n.ini and passes them to eZTextCodec.
Definition at line 1093 of file ezscript.php.
Referenced by initialize().
false if none is set. Definition at line 450 of file ezscript.php.
Checks if the script is run on correct eZ Publish version.
Definition at line 108 of file ezscript.php.
false or a number in the range 1 and up. Definition at line 482 of file ezscript.php.
Referenced by iterate().
| eZScript::$DebugMessage |
Definition at line 1105 of file ezscript.php.
| eZScript::$ExitCode |
Definition at line 1112 of file ezscript.php.
| eZScript::$InitializationErrorMessage |
Definition at line 1104 of file ezscript.php.
| eZScript::$IsQuiet |
Definition at line 1113 of file ezscript.php.
| eZScript::$ShowVerbose |
Definition at line 1114 of file ezscript.php.
| eZScript::$SiteAccess |
Definition at line 1111 of file ezscript.php.
| eZScript::$UseDebugOutput |
Definition at line 1106 of file ezscript.php.
| eZScript::$UseExtensions |
Definition at line 1108 of file ezscript.php.
| eZScript::$UseModules |
Definition at line 1109 of file ezscript.php.
| eZScript::$User |
Definition at line 1110 of file ezscript.php.
| eZScript::$UseSession |
Definition at line 1107 of file ezscript.php.