当前位置: 首页>>代码示例>>PHP>>正文


PHP eZCLI::stylize方法代码示例

本文整理汇总了PHP中eZCLI::stylize方法的典型用法代码示例。如果您正苦于以下问题:PHP eZCLI::stylize方法的具体用法?PHP eZCLI::stylize怎么用?PHP eZCLI::stylize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZCLI的用法示例。


在下文中一共展示了eZCLI::stylize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeMessage

 /**
  * Displays a message on the appropriate output (cli or eZDebug)
  *
  * @param string $msg
  * @param string $logType
  */
 public static function writeMessage($msg, $logType = self::NOTICELOG)
 {
     self::$cli = eZCLI::instance();
     $isWebOutput = self::$cli->isWebOutput();
     switch ($logType) {
         case self::ERRORLOG:
             if (!$isWebOutput) {
                 self::$cli->output(self::$cli->stylize('error', $msg));
             } else {
                 eZDebug::writeError($msg, 'SQLIImport');
             }
             break;
         case self::WARNINGLOG:
             if (!$isWebOutput) {
                 self::$cli->output(self::$cli->stylize('warning', $msg));
             } else {
                 eZDebug::writeWarning($msg, 'SQLIImport');
             }
             break;
         case self::NOTICELOG:
         default:
             if (!$isWebOutput) {
                 self::$cli->output(self::$cli->stylize('notice', $msg));
             } else {
                 eZDebug::writeNotice($msg, 'SQLIImport');
             }
             break;
     }
 }
开发者ID:lolautruche,项目名称:sqliimport,代码行数:35,代码来源:sqliimportlogger.php

示例2: internalClear

 private function internalClear($purge, $cacheEntries, $name, $purgeSleep = null, $purgeMax = null, $purgeExpiry = null)
 {
     $this->cli->output(($purge ? 'Purging ' : 'Clearing ') . $this->cli->stylize('emphasize', $name ? $name : 'All cache') . ': ');
     $warnPaths = array();
     foreach ($cacheEntries as $cacheEntry) {
         $absPath = realpath(eZSys::cacheDirectory() . DIRECTORY_SEPARATOR . $cacheEntry['path']);
         $absPathElementCount = count(explode(DIRECTORY_SEPARATOR, rtrim($absPath, DIRECTORY_SEPARATOR)));
         // Refuse to delete root directory ('/' or 'C:\')
         // 2 => since one path element ('/foo') produces two exploded elements
         if ($absPath && $absPathElementCount < 2) {
             $this->cli->error('Refusing to delete root directory! Please check your cache settings. Path: ' . $absPath);
             $this->script->shutdown(1);
             exit;
         }
         // Warn if the cache entry is not function based, and the path is outside ezp root, and the path has less than 2 elements
         if ($absPath && (!$purge || !isset($cacheEntry['purge-function'])) && !isset($cacheEntry['function']) && $absPathElementCount < 3 && strpos(dirname($absPath) . DIRECTORY_SEPARATOR, realpath(eZSys::rootDir()) . DIRECTORY_SEPARATOR) === false) {
             $warnPaths[] = $absPath;
         }
     }
     if (!empty($warnPaths)) {
         $this->cli->warning('The following cache paths are outside of the eZ Publish root directory, and have less than 2 path elements. ' . 'Are you sure you want to ' . ($purge ? 'purge' : 'clear') . ' them?');
         foreach ($warnPaths as $warnPath) {
             $this->cli->output($warnPath);
         }
         if (function_exists("getUserInput")) {
             $input = getUserInput(($purge ? 'Purge' : 'Clear') . '? yes/no:', array('yes', 'no'));
         } else {
             $validInput = false;
             $readlineExists = function_exists("readline");
             while (!$validInput) {
                 if ($readlineExists) {
                     $input = readline($query);
                 } else {
                     echo $prompt . ' ';
                     $input = trim(fgets(STDIN));
                 }
                 if ($acceptValues === false || in_array($input, $acceptValues)) {
                     $validInput = true;
                 }
             }
         }
         if ($input === 'no') {
             $this->script->shutdown();
             exit;
         }
     }
     $firstItem = true;
     foreach ($cacheEntries as $cacheEntry) {
         if ($firstItem) {
             $firstItem = false;
         } else {
             $this->cli->output(', ', false);
         }
         $this->cli->output($this->cli->stylize('emphasize', $cacheEntry['name']), false);
         if ($purge) {
             eZCache::clearItem($cacheEntry, true, array($this, 'reportProgress'), $purgeSleep, $purgeMax, $purgeExpiry);
         } else {
             eZCache::clearItem($cacheEntry);
         }
     }
     $this->cli->output();
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:62,代码来源:ezcachehelper.php


注:本文中的eZCLI::stylize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。