本文整理汇总了PHP中eZCLI::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP eZCLI::notice方法的具体用法?PHP eZCLI::notice怎么用?PHP eZCLI::notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZCLI
的用法示例。
在下文中一共展示了eZCLI::notice方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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->error($msg);
} else {
eZDebug::writeError($msg, 'SQLIImport');
}
break;
case self::WARNINGLOG:
if (!$isWebOutput) {
self::$cli->warning($msg);
} else {
eZDebug::writeWarning($msg, 'SQLIImport');
}
break;
case self::NOTICELOG:
default:
if (!$isWebOutput) {
self::$cli->notice($msg);
} else {
eZDebug::writeNotice($msg, 'SQLIImport');
}
break;
}
}
示例2: askQuestion
/**
* @param string$question
* @param array $possibleReplies
* @param string $callback
* @param bool $emptyReply
* @return bool|string
*/
function askQuestion ( $question, $possibleReplies = array(), $callback = "validateReply", $emptyReply = false )
{
$response = false;
$first = true;
$this->cli->error( "$question ?" );
if ($callback != 'validateReplyRegex')
{
$this->showReplies ( $possibleReplies );
}
while ( $response === false )
{
if ( !$first )
{
$this->cli->error( "Incorrect Reply, please retry" );
}
else
{
$first = false;
}
$response = trim(fgets(STDIN));
if ( $response == '' && $emptyReply )
{
$this->cli->notice( "No given reply" );
return false;
}
$response = call_user_func( array ( $this, $callback ), $response, $possibleReplies );
}
if ( count($possibleReplies) > 0 && $callback != 'validateReplyRegex' )
{
$reply = $possibleReplies[$response];
}
else
{
$reply = $response;
}
$this->cli->notice( "Given reply : $reply" );
return $response;
}
示例3: alignApplicationWithPublisherFolder
/**
* Adds an application folder to the publisher folder if it's not yet added
* @param mixed $applicationId
* @param mixed $publisherFolderId
* @param eZCLI $cli
*/
function alignApplicationWithPublisherFolder( $applicationId, $publisherFolderId, eZCLI $cli )
{
$application = $applicationId;
$publisherFolder = $publisherFolderId;
if (! $application instanceof ApplicationLocalized )
{
$application = ApplicationLocalized::getLocalizedApplicationById( $applicationId, false );
}
if ( $application == null )
{
throw new Exception( "Application localized with id {$applicationId} does not exist." );
}
if (! $publisherFolder instanceof MMSynchPublisherFolder )
{
$publisherFolder = MMSynchPublisherFolder::fetch( $publisherFolderId );
}
if ( $publisherFolder == null )
{
throw new Exception( "Publisher folder with id {$publisherFolderId} does not exist." );
}
$remoteId = 'application_folder-' . $application->cluster_identifier . '-' . $application->applicationObject->identifier;
$applicationFolderObject = eZContentObject::fetchByRemoteID( $remoteId );
if ( $applicationFolderObject == null )
{
throw new Exception( "Application folder object with remote id {$remoteId} doesn't exist" );
}
$applicationFolderId = $applicationFolderObject->attribute( 'id' );
//use getContent with true to create problems
$path = $publisherFolder->getContent( )->fields->path->toString();
if ( $path )
{
$contentobject = $publisherFolder->getContent()->getRawContentObject();
$languages = $contentobject->availableLanguages();
foreach ( $languages as $language )
{
$dataMap = $contentobject->dataMap();
$contentObjectAttributeTargetCS = $dataMap['target_cs'];
$objectIds = explode( '-', $contentObjectAttributeTargetCS->toString() );
if ( !in_array( $applicationFolderId, $objectIds ) )
{
$objectIds[] = $applicationFolderId;
$contentObjectAttributeTargetCS->fromString( implode( '-', $objectIds ) );
$contentObjectAttributeTargetCS->store();
}
else
{
$cli->notice( "Ommiting application folder with path {$remoteId}" );
}
}
}
}
示例4: setClusterFrontendUrlData
function setClusterFrontendUrlData(array $clusterDomains, eZDBInterface $db, eZCLI $cli, $dumpSql)
{
$db->beginQuery();
foreach ($clusterDomains as $clusterIdentifier => $url)
{
$query = sprintf("UPDATE bo_cluster SET frontend_url = '%s' WHERE identifier='%s';", $url, $clusterIdentifier);
if ($dumpSql) {
$cli->notice($query);
continue;
}
$cli->notice("Setting frontend_url to {$url} for cluster {$clusterIdentifier}");
$db->query($query);
}
return $db->commitQuery();
}
示例5: runImport
//.........这里部分代码省略.........
// Default values
$handlerClassName = $this->importINI->variable($handlerSection, 'ClassName');
$handlerEnabled = true;
$debug = false;
$defaultParentNodeID = $this->importINI->variable('ImportSettings', 'DefaultParentNodeID');
$streamTimeout = $this->importINI->variable('ImportSettings', 'StreamTimeout');
if ($this->importINI->hasVariable($handlerSection, 'Enabled')) {
$handlerEnabled = $this->importINI->variable($handlerSection, 'Enabled') === 'true';
}
if ($this->importINI->hasVariable($handlerSection, 'Debug')) {
$debug = $this->importINI->variable($handlerSection, 'Debug') === 'enabled';
}
if ($this->importINI->hasVariable($handlerSection, 'DefaultParentNodeID')) {
$localParentNodeID = $this->importINI->variable($handlerSection, 'DefaultParentNodeID');
$defaultParentNodeID = is_int($localParentNodeID) ? (int) $localParentNode : $defaultParentNodeID;
}
if ($this->importINI->hasVariable($handlerSection, 'StreamTimeout')) {
$streamTimeout = (int) $this->importINI->variable($handlerSection, 'StreamTimeout');
}
// Check $defaultParentNodeID and throw an exception if not consistent
$parentNode = eZContentObjectTreeNode::fetch($defaultParentNodeID, false, false);
if (!$parentNode) {
throw new SQLIImportRuntimeException('Error : invalid DefaultParentNodeID ( ' . $defaultParentNodeID . ' )');
}
unset($parentNode);
// Check handler class validity
if (!class_exists($handlerClassName)) {
throw new SQLIImportRuntimeException('Error : invalid handler class "' . $handlerClassName . '". Did you regenerate autolads ?');
}
// ####################################
// ##### IMPORT HANDLER PROCESSING
// ####################################
// Instantiate the handler with appropriate options and process it.
// Handler must implement ISQLIImportHandler and extend SQLIImportAbstractHandler
$handlerOptions = $aImportItems[$i]->attribute('options');
$importHandler = new $handlerClassName($handlerOptions);
if (!$importHandler instanceof ISQLIImportHandler || !$importHandler instanceof SQLIImportAbstractHandler) {
throw new SQLIImportRuntimeException('Error : invalid handler "' . $handlerClassName . '". Must implement ISQLIImportHandler and extend SQLIImportAbstractHandler.');
}
$importHandler->handlerConfArray = $this->importINI->group($handlerSection);
$importHandler->initialize();
// Get process length to calculate advancement percentage to track advancement
$processLength = $importHandler->getProcessLength();
$percentageAdvancementStep = 100 / $processLength;
$handlerName = $importHandler->getHandlerName();
$handlerIdentifier = $importHandler->getHandlerIdentifier();
// Progress bar implementation
$progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
$progressBar = new ezcConsoleProgressbar($this->output, $processLength, $progressBarOptions);
$progressBar->start();
$this->cli->warning('Now processing "' . $handlerName . '" handler.');
$isInterrupted = false;
while ($row = $importHandler->getNextRow()) {
try {
$progressBar->advance();
$startTime = time();
$importHandler->process($row);
} catch (Exception $e) {
SQLIImportLogger::logError('An error occurred during "' . $handlerIdentifier . '" import process : ' . $e->getMessage());
}
$aImportItems[$i]->updateProgress($percentageAdvancementStep, $importHandler->getProgressionNotes());
// Now calculate process time for this iteration
$endTime = time();
$diffTime = $endTime - $startTime;
$oldProcessTime = $aImportItems[$i]->attribute('process_time');
$aImportItems[$i]->setAttribute('process_time', $oldProcessTime + $diffTime);
$aImportItems[$i]->store(array('process_time'));
// Interruption handling
if ($aImportItems[$i]->isInterrupted()) {
$this->cli->notice();
SQLIImportLogger::logNotice('Interruption has been requested for current import ! Cleaning and aborting process...');
$isInterrupted = true;
break;
}
}
$importHandler->cleanup();
$progressBar->finish();
$this->cli->notice();
unset($importHandler);
if (!$isInterrupted) {
$aImportItems[$i]->setAttribute('status', SQLIImportItem::STATUS_COMPLETED);
$aImportItems[$i]->setAttribute('percentage', 100);
// Force percentage to 100%
$aImportItems[$i]->store();
}
// ####################################
// ##### END IMPORT HANDLER PROCESSING
// ####################################
} catch (Exception $e) {
SQLIImportLogger::logError($e->getMessage());
$aImportItems[$i]->setAttribute('status', SQLIImportItem::STATUS_FAILED);
$aImportItems[$i]->store();
if (isset($importHandler)) {
$importHandler->cleanup();
unset($importHandler);
}
continue;
}
}
}
示例6: printFields
function printFields($id, array $fields, eZCLI $cli)
{
$cli->notice("Fields for object with id {$id}");
foreach ($fields as $field)
{
$cli->output($field);
}
$cli->output();
}