|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of Command Line Interface functions 00004 // 00005 // Created on: <05-Aug-2003 13:00:00 amos> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file cli.php 00032 */ 00033 00034 /*! 00035 \class eZCLI ezcli.php 00036 \brief CLI handling 00037 00038 Provides functionality to work with the CLI (Command Line Interface). 00039 The CLI can be run from either a terminal (shell) or a web interface. 00040 00041 A typical usage: 00042 \code 00043 $cli = eZCLI::instance(); 00044 00045 $cli->setUseStyles( true ); // enable colors 00046 00047 $cli->output( "This is a text string" ); 00048 00049 \endcode 00050 00051 */ 00052 00053 //include_once( 'lib/ezutils/classes/ezini.php' ); 00054 require_once( 'lib/ezutils/classes/ezdebug.php' ); 00055 //include_once( 'lib/ezutils/classes/ezdebugsetting.php' ); 00056 00057 class eZCLI 00058 { 00059 const TERMINAL_ENDOFLINE_STRING = "\n"; 00060 00061 /*! 00062 Initializes object and detects if the CLI is used. 00063 */ 00064 function eZCLI() 00065 { 00066 $endl = "<br/>"; 00067 $webOutput = true; 00068 if ( isset( $_SERVER['argv'] ) ) 00069 { 00070 $endl = self::TERMINAL_ENDOFLINE_STRING; 00071 $webOutput = false; 00072 } 00073 $this->EndlineString = $endl; 00074 $this->WebOutput = $webOutput; 00075 $this->TerminalStyles = array( 'warning' => "\033[1;35m", 00076 'warning-end' => "\033[0;39m", 00077 'error' => "\033[1;31m", 00078 'error-end' => "\033[0;39m", 00079 'failure' => "\033[1;31m", 00080 'failure-end' => "\033[0;39m", 00081 'notice' => "\033[0;32m", 00082 'notice-end' => "\033[0;39m", 00083 'debug' => "\033[0;30m", 00084 'debug-end' => "\033[0;39m", 00085 'timing' => "\033[1;34m", 00086 'timing-end' => "\033[0;39m", 00087 'success' => "\033[1;32m", 00088 'success-end' => "\033[0;39m", 00089 'file' => "\033[1;38m", 00090 'file-end' => "\033[0;39m", 00091 'dir' => "\033[1;34m", 00092 'dir-end' => "\033[0;39m", 00093 'link' => "\033[0;36m", 00094 'link-end' => "\033[0;39m", 00095 'exe' => "\033[1;32m", 00096 'exe-end' => "\033[0;39m", 00097 'archive' => "\033[1;31m", 00098 'archive-end' => "\033[0;39m", 00099 'image' => "\033[1;35m", 00100 'image-end' => "\033[0;39m", 00101 00102 'red' => "\033[1;31m", 00103 'red-end' => "\033[0;39m", 00104 'green' => "\033[1;32m", 00105 'green-end' => "\033[0;39m", 00106 'yellow' => "\033[1;33m", 00107 'yellow-end' => "\033[0;39m", 00108 'blue' => "\033[1;34m", 00109 'blue-end' => "\033[0;39m", 00110 'magenta' => "\033[1;35m", 00111 'magenta-end' => "\033[0;39m", 00112 'cyan' => "\033[1;36m", 00113 'cyan-end' => "\033[0;39m", 00114 'white' => "\033[1;37m", 00115 'white-end' => "\033[0;39m", 00116 'gray' => "\033[1;30m", 00117 'gray-end' => "\033[0;39m", 00118 00119 'dark-red' => "\033[0;31m", 00120 'dark-red-end' => "\033[0;39m", 00121 'dark-green' => "\033[0;32m", 00122 'dark-green-end' => "\033[0;39m", 00123 'dark-yellow' => "\033[0;33m", 00124 'dark-yellow-end' => "\033[0;39m", 00125 'dark-blue' => "\033[0;34m", 00126 'dark-blue-end' => "\033[0;39m", 00127 'dark-magenta' => "\033[0;35m", 00128 'dark-magenta-end' => "\033[0;39m", 00129 'dark-cyan' => "\033[0;36m", 00130 'dark-cyan-end' => "\033[0;39m", 00131 'dark-white' => "\033[0;37m", 00132 'dark-white-end' => "\033[0;39m", 00133 'dark-gray' => "\033[0;30m", 00134 'dark-gray-end' => "\033[0;39m", 00135 00136 'red-bg' => "\033[1;41m", 00137 'red-bg-end' => "\033[0;39m", 00138 'green-bg' => "\033[1;42m", 00139 'green-bg-end' => "\033[0;39m", 00140 'yellow-bg' => "\033[1;43m", 00141 'yellow-bg-end' => "\033[0;39m", 00142 'blue-bg' => "\033[1;44m", 00143 'blue-bg-end' => "\033[0;39m", 00144 'magenta-bg' => "\033[1;45m", 00145 'magenta-bg-end' => "\033[0;39m", 00146 'cyan-bg' => "\033[1;46m", 00147 'cyan-bg-end' => "\033[0;39m", 00148 'white-bg' => "\033[1;47m", 00149 'white-bg-end' => "\033[0;39m", 00150 00151 'text' => "\033[0;39m", 00152 'text-end' => "\033[0;39m", 00153 'variable' => "\033[1;34m", 00154 'variable-end' => "\033[0;39m", 00155 'symbol' => "\033[0;37m", 00156 'symbol-end' => "\033[0;39m", 00157 'emphasize' => "\033[1;38m", 00158 'emphasize-end' => "\033[0;39m", 00159 'header' => "\033[1;38m", 00160 'header-end' => "\033[0;39m", 00161 'strong' => "\033[1;39m", 00162 'strong-end' => "\033[0;39m", 00163 'mark' => "\033[1;30m", 00164 'mark-end' => "\033[0;39m", 00165 'bold' => "\033[1;38m", 00166 'bold-end' => "\033[0;39m", 00167 'italic' => "\033[0;39m", 00168 'italic-end' => "\033[0;39m", 00169 'underline' => "\033[0;39m", 00170 'underline-end' => "\033[0;39m", 00171 'paragraph' => "\033[0;39m", 00172 'paragraph-end' => "\033[0;39m", 00173 'normal' => "\033[0;39m", 00174 'normal-end' => "\033[0;39m", 00175 00176 ); 00177 00178 $this->WebStyles = array( 'warning' => "<font color=\"orange\">", 00179 'warning-end' => "</font>", 00180 'error' => "<font color=\"red\">", 00181 'error-end' => "</font>", 00182 'failure' => "<font color=\"red\">", 00183 'failure-end' => "</font>", 00184 'notice' => "<font color=\"green\">", 00185 'notice-end' => "</font>", 00186 'debug' => "<font color=\"brown\">", 00187 'debug-end' => "</font>", 00188 'timing' => "<font color=\"blue\">", 00189 'timing-end' => "</font>", 00190 'success' => "<font color=\"green\">", 00191 'success-end' => "</font>", 00192 'file' => "<i>", 00193 'file-end' => "</i>", 00194 'dir' => "<font color=\"blue\">", 00195 'dir-end' => "</font>", 00196 'link' => "<font color=\"cyan\">", 00197 'link-end' => "</font>", 00198 'symbol' => "<i>", 00199 'symbol-end' => "</i>", 00200 'emphasize' => "<i>", 00201 'emphasize-end' => "</i>", 00202 'header' => "<h1>", 00203 'header-end' => "</h1>", 00204 'strong' => "<b>", 00205 'strong-end' => "</b>", 00206 'mark' => "", 00207 'mark-end' => "", 00208 'bold' => "<b>", 00209 'bold-end' => "</b>", 00210 'italic' => "<i>", 00211 'italic-end' => "</i>", 00212 'underline' => "<u>", 00213 'underline-end' => "</u>", 00214 'paragraph' => "<p>", 00215 'paragraph-end' => "</p>", 00216 'normal' => "", 00217 'normal-end' => "" ); 00218 00219 $this->EmptyStyles = array(); 00220 foreach ( $this->TerminalStyles as $styleName => $styleValue ) 00221 { 00222 $this->EmptyStyles[$styleName] = false; 00223 } 00224 $this->UseStyles = false; 00225 $this->IsQuiet = false; 00226 } 00227 00228 /*! 00229 \return the string used to end lines. This is either the \n if CLI is used 00230 or <br/> if the script is run in a webinterface. 00231 */ 00232 function endlineString() 00233 { 00234 return $this->EndlineString; 00235 } 00236 00237 /*! 00238 \return \c true if the current script is run in a webinterface. 00239 */ 00240 function isWebOutput() 00241 { 00242 return $this->WebOutput; 00243 } 00244 00245 /*! 00246 \return the style for the name \a $name. The style is specific for terminals. 00247 */ 00248 function terminalStyle( $name ) 00249 { 00250 if ( isset( $this->TerminalStyles[$name] ) ) 00251 { 00252 return $this->TerminalStyles[$name]; 00253 } 00254 return false; 00255 } 00256 00257 /*! 00258 \return the style for the name \a $name. The style is specific for web. 00259 */ 00260 function webStyle( $name ) 00261 { 00262 return $this->WebStyles[$name]; 00263 } 00264 00265 /*! 00266 \return a hash with all terminal styles. 00267 */ 00268 function terminalStyles() 00269 { 00270 return $this->TerminalStyles; 00271 } 00272 00273 /*! 00274 \return a hash with all web styles. 00275 */ 00276 function webStyles() 00277 { 00278 return $this->WebStyles; 00279 } 00280 00281 /*! 00282 \return a hash with empty styles. 00283 */ 00284 function emptyStyles() 00285 { 00286 return $this->EmptyStyles; 00287 } 00288 00289 /*! 00290 \return the style for the name \a $name. The style is taken from the current interface type. 00291 */ 00292 function style( $name ) 00293 { 00294 if ( $this->UseStyles ) 00295 { 00296 if ( $this->isWebOutput() ) 00297 return $this->webStyle( $name ); 00298 else 00299 return $this->terminalStyle( $name ); 00300 } 00301 return false; 00302 } 00303 00304 /*! 00305 \return the text \a $text wrapped in the style \a $styleName. 00306 */ 00307 function stylize( $styleName, $text ) 00308 { 00309 $preStyle = $this->style( $styleName ); 00310 $postStyle = $this->style( $styleName . '-end' ); 00311 return $preStyle . $text . $postStyle; 00312 } 00313 00314 /*! 00315 \static 00316 \returns an ANSI sequence which will store the current position. 00317 */ 00318 static function storePosition() 00319 { 00320 return "\033[s"; 00321 } 00322 00323 /*! 00324 \static 00325 \returns an ANSI sequence which will restore the current position. 00326 */ 00327 static function restorePosition() 00328 { 00329 return "\033[u"; 00330 } 00331 00332 /*! 00333 \return an ANSI sequence which will tell the console go to the specified column. 00334 */ 00335 function gotoColumn( $column ) 00336 { 00337 if ( !$this->UseStyles ) 00338 { 00339 return "\t\t"; 00340 } 00341 else 00342 { 00343 return "\033[" . $column . "G"; 00344 } 00345 } 00346 00347 /*! 00348 Controls whether styles are to be used or not. If disabled 00349 empty strings are returned when asking for styles. 00350 \note This only controls the style() function. 00351 */ 00352 function setUseStyles( $useStyles ) 00353 { 00354 if ( getenv('TERM') != '' ) 00355 { 00356 $this->UseStyles = $useStyles; 00357 } 00358 } 00359 00360 /*! 00361 \return \c true if styles are enabled. 00362 */ 00363 function useStyles() 00364 { 00365 return $this->UseStyles; 00366 } 00367 00368 /*! 00369 Outputs the string \a $string to the current interface. 00370 If \a $addEOL is true then the end-of-line string is added. 00371 */ 00372 function output( $string = false, $addEOL = true ) 00373 { 00374 if ( $this->isQuiet() ) 00375 return; 00376 print( $string ); 00377 if ( $addEOL ) 00378 print( $this->endlineString() ); 00379 } 00380 00381 /*! 00382 Outputs the string \a $string to the current interface as a notice. 00383 If \a $addEOL is true then the end-of-line string is added. 00384 */ 00385 function notice( $string = false, $addEOL = true ) 00386 { 00387 if ( $this->isQuiet() ) 00388 return; 00389 fputs( STDERR, $string ); 00390 if ( $addEOL ) 00391 fputs( STDERR, $this->endlineString() ); 00392 } 00393 00394 /*! 00395 Outputs the string \a $string to the current interface as an warning. 00396 If \a $addEOL is true then the end-of-line string is added. 00397 */ 00398 function warning( $string = false, $addEOL = true ) 00399 { 00400 if ( $this->isQuiet() ) 00401 return; 00402 $string = $this->stylize( 'warning', $string ); 00403 fputs( STDERR, $string ); 00404 if ( $addEOL ) 00405 fputs( STDERR, $this->endlineString() ); 00406 } 00407 00408 /*! 00409 Outputs the string \a $string to the current interface as an error. 00410 If \a $addEOL is true then the end-of-line string is added. 00411 */ 00412 function error( $string = false, $addEOL = true ) 00413 { 00414 if ( $this->isQuiet() ) 00415 return; 00416 $string = $this->stylize( 'error', $string ); 00417 fputs( STDERR, $string ); 00418 if ( $addEOL ) 00419 fputs( STDERR, $this->endlineString() ); 00420 } 00421 00422 /*! 00423 Sets whether the output(), notice(), warning() and error() methods should print out anything. 00424 \sa isQuiet, isLoud 00425 */ 00426 function setIsQuiet( $isQuiet ) 00427 { 00428 $this->IsQuiet = $isQuiet; 00429 } 00430 00431 /*! 00432 \return \c true if output is not allowed. 00433 \sa isLoud 00434 */ 00435 function isQuiet() 00436 { 00437 return $this->IsQuiet; 00438 } 00439 00440 /*! 00441 \return \c true if output is allowed. 00442 \sa isQuiet 00443 */ 00444 function isLoud() 00445 { 00446 return !$this->IsQuiet; 00447 } 00448 00449 static function parseOptionString( $configString, &$optionConfig ) 00450 { 00451 $len = strlen( $configString ); 00452 $i = 0; 00453 if ( !is_array( $optionConfig ) ) 00454 { 00455 $optionConfig = array( 'list' => array(), 00456 'short' => array(), 00457 'long' => array() ); 00458 } 00459 while ( $i < $len ) 00460 { 00461 $option = $configString[$i]; 00462 if ( $option == '[' ) 00463 { 00464 $end = strpos( $configString, ']', $i + 1 ); 00465 if ( $end === false ) 00466 { 00467 eZDebug::writeError( "Missing end marker ] in option string at position $i", 00468 'eZCLI::parseOptionString' ); 00469 return $optionConfig; 00470 } 00471 $optionList = substr( $configString, $i + 1, $end - $i - 1 ); 00472 $i += 1 + ( $end - $i ); 00473 $startMarkerPos = strpos( $optionList, '[' ); 00474 if ( $startMarkerPos !== false ) 00475 { 00476 eZDebug::writeError( "Start marker [ found in option string at position, it should not be present. Skipping current option" . ( $i + 1 + $startMarkerPos ), 00477 'eZCLI::parseOptionString' ); 00478 continue; 00479 } 00480 $optionList = explode( '|', $optionList ); 00481 } 00482 else 00483 { 00484 $text = $option; 00485 ++$i; 00486 if ( $i < $len and 00487 in_array( $configString[$i], array( ':', ';' ) ) ) 00488 { 00489 $text .= $configString[$i]; 00490 ++$i; 00491 } 00492 if ( $i < $len and 00493 in_array( $configString[$i], array( '?', '*', '+' ) ) ) 00494 { 00495 $text .= $configString[$i]; 00496 ++$i; 00497 } 00498 $optionList = array( $text ); 00499 } 00500 $optionStoreName = false; 00501 unset( $optionConfigList ); 00502 $optionConfigList = array(); 00503 foreach ( $optionList as $optionItem ) 00504 { 00505 $optionLen = strlen( $optionItem ); 00506 $hasValue = false; 00507 $optionName = $optionItem; 00508 $quantifierText = false; 00509 $quantifier = array( 'min' => 0, 00510 'max' => 0 ); 00511 if ( $optionLen > 0 and in_array( $optionName[$optionLen - 1], array( '?', '*', '+' ) ) ) 00512 { 00513 $quantifierText = $optionName[$optionLen - 1]; 00514 $optionName = substr( $optionName, 0, $optionLen - 1 ); 00515 --$optionLen; 00516 if ( $quantifierText == '?' ) 00517 $quantifier = array( 'min' => 0, 00518 'max' => 1 ); 00519 else if ( $quantifierText == '*' ) 00520 $quantifier = array( 'min' => 0, 00521 'max' => false ); 00522 else if ( $quantifierText == '+' ) 00523 $quantifier = array( 'min' => 1, 00524 'max' => false ); 00525 } 00526 if ( $optionLen > 0 and in_array( $optionName[$optionLen - 1], array( ':', ';' ) ) ) 00527 { 00528 $valueText = $optionName[$optionLen - 1]; 00529 $optionName = substr( $optionName, 0, $optionLen - 1 ); 00530 --$optionLen; 00531 if ( $valueText == ':' ) 00532 $hasValue = true; 00533 else if ( $valueText == ';' ) 00534 $hasValue = 'optional'; 00535 } 00536 $optionLen = strlen( $optionName ); 00537 if ( $optionLen == 0 ) 00538 continue; 00539 $optionStoreName = $optionName; 00540 $optionConfigItem = array( 'name' => $optionName, 00541 'has-value' => $hasValue, 00542 'quantifier' => $quantifier, 00543 'store-name' => false, 00544 'is-long-option' => strlen( $optionName ) > 1 ); 00545 $optionConfigList[] = $optionConfigItem; 00546 } 00547 foreach ( array_keys( $optionConfigList ) as $optionConfigItemKey ) 00548 { 00549 $optionConfigItem =& $optionConfigList[$optionConfigItemKey]; 00550 $optionName = $optionConfigItem['name']; 00551 $optionConfigItem['store-name'] = $optionStoreName; 00552 $optionConfig['list'][] = $optionConfigItem; 00553 if ( $optionConfigItem['is-long-option'] ) 00554 $optionConfig['long'][$optionName] = $optionConfigItem; 00555 else 00556 $optionConfig['short'][$optionName] = $optionConfigItem; 00557 } 00558 } 00559 return $optionConfig; 00560 } 00561 00562 function getOptions( $config, $argumentConfig, $arguments = false ) 00563 { 00564 $program = false; 00565 if ( $arguments === false ) 00566 { 00567 $arguments = $GLOBALS['argv']; 00568 $program = $arguments[0]; 00569 array_shift( $arguments ); 00570 } 00571 00572 if ( is_string( $config ) ) 00573 $config = eZCLI::parseOptionString( $config, $optionConfig ); 00574 if ( is_string( $argumentConfig ) ) 00575 $argumentConfig = eZCLI::parseOptionString( $argumentConfig, $tmpArgumentConfig ); 00576 00577 $options = array(); 00578 00579 $helpOption = false; 00580 $helpText = false; 00581 if ( isset( $config['short']['h'] ) ) 00582 $helpOption = '-h'; 00583 else if ( isset( $config['short']['help'] ) ) 00584 $helpOption = '--help'; 00585 if ( $helpOption ) 00586 $helpText = "\n" . "Try `$program $helpOption' for more information."; 00587 00588 $options['arguments'] = array(); 00589 00590 $arguments = array_values( $arguments ); 00591 $argumentCount = count( $arguments ); 00592 for ( $i = 0; $i < $argumentCount; ++$i ) 00593 { 00594 $argument = $arguments[$i]; 00595 $argumentLen = strlen( $argument ); 00596 if ( $argumentLen > 1 and 00597 $argument[0] == '-' ) 00598 { 00599 $argumentValue = false; 00600 if ( $argumentLen > 2 and 00601 $argument[1] == '-' ) 00602 { 00603 $optionName = substr( $argument, 2 ); 00604 $assignPosition = strpos( $optionName, '=' ); 00605 if ( $assignPosition !== false ) 00606 { 00607 $argumentValue = substr( $optionName, $assignPosition + 1 ); 00608 $optionName = substr( $optionName, 0, $assignPosition ); 00609 } 00610 $optionType = 'long'; 00611 $optionPrefix = '--'; 00612 $checkNext = false; 00613 } 00614 else 00615 { 00616 $optionName = $argument[1]; 00617 if ( $argumentLen > 2 ) 00618 { 00619 $argumentValue = substr( $argument, 2 ); 00620 } 00621 $optionType = 'short'; 00622 $optionPrefix = '-'; 00623 $checkNext = true; 00624 } 00625 $configItem =& $config[$optionType][$optionName]; 00626 if ( isset( $configItem ) ) 00627 { 00628 $value = true; 00629 $hasValue = $configItem['has-value']; 00630 $hasMultipleValues = ( $configItem['quantifier']['min'] > 1 or 00631 $configItem['quantifier']['max'] === false or 00632 $configItem['quantifier']['max'] > 1 ); 00633 if ( $hasValue ) 00634 { 00635 $hasArgumentValue = false; 00636 if ( $argumentValue !== false ) 00637 { 00638 $value = $argumentValue; 00639 } 00640 else if ( $checkNext and $configItem['has-value'] !== 'optional' ) 00641 { 00642 ++$i; 00643 if ( $i < $argumentCount ) 00644 { 00645 $hasArgumentValue = true; 00646 } 00647 else 00648 { 00649 --$i; 00650 $this->error( "$program: option `$optionPrefix$optionName' requires an argument" . $helpText ); 00651 return false; 00652 } 00653 if ( $hasArgumentValue ) 00654 $value = $arguments[$i]; 00655 } 00656 else 00657 { 00658 if ( $configItem['has-value'] !== 'optional' ) 00659 { 00660 $this->error( "$program: option `$optionPrefix$optionName' requires an argument" . $helpText ); 00661 return false; 00662 } 00663 } 00664 } 00665 $optionStoreName = $configItem['store-name']; 00666 if ( !$optionStoreName ) 00667 $optionStoreName = $optionName; 00668 if ( $hasMultipleValues ) 00669 { 00670 if ( !isset( $options[$optionStoreName] ) ) 00671 $options[$optionStoreName] = array(); 00672 $options[$optionStoreName][] = $value; 00673 } 00674 else 00675 { 00676 $options[$optionStoreName] = $value; 00677 } 00678 } 00679 else 00680 { 00681 $this->error( "$program: invalid option `$optionPrefix$optionName'" . $helpText ); 00682 return false; 00683 } 00684 } 00685 else 00686 { 00687 $options['arguments'][] = $argument; 00688 } 00689 } 00690 foreach ( $config['list'] as $configItem ) 00691 { 00692 $optionStoreName = $configItem['store-name']; 00693 if ( $optionStoreName and !isset( $options[$optionStoreName] ) ) 00694 $options[$optionStoreName] = null; 00695 } 00696 return $options; 00697 } 00698 00699 /*! 00700 \return the unique instance for the cli class. 00701 */ 00702 static function instance() 00703 { 00704 if ( !isset( $GLOBALS['eZCLIInstance'] ) || 00705 !( $GLOBALS['eZCLIInstance'] instanceof eZCLI ) ) 00706 { 00707 $GLOBALS['eZCLIInstance'] = new eZCLI(); 00708 } 00709 00710 return $GLOBALS['eZCLIInstance']; 00711 } 00712 00713 /*! 00714 \return \c true if instance of eZCLI already exists otherwise \c false. 00715 */ 00716 static function hasInstance() 00717 { 00718 return isset( $GLOBALS['eZCLIInstance'] ) && $GLOBALS['eZCLIInstance'] instanceof eZCLI; 00719 } 00720 } 00721 00722 ?>