本文整理汇总了PHP中eZCLI类的典型用法代码示例。如果您正苦于以下问题:PHP eZCLI类的具体用法?PHP eZCLI怎么用?PHP eZCLI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZCLI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: moveIfNeeded
function moveIfNeeded($oldPath, $newPath) {
global $fileToRemove;
$success = true;
$cli = eZCLI::instance();
if (!file_exists($newPath)) {
if (!file_exists($oldPath)) {
$cli->warning('Source file not exist : ' . $oldPath);
return false;
}
eZDir::mkdir( dirname( $newPath ), false, true );
$success = copy($oldPath, $newPath);
$cli = eZCLI::instance();
if ($success) {
$fileToRemove[] = $oldPath;
$cli->notice('Move ' . $oldPath . ' => ' . $newPath);
} else {
$cli->warning('Fail to move ' . $oldPath . ' => ' . $newPath);
}
} else {
$fileToRemove[] = $oldPath;
}
return $success;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:28,代码来源:image_refactor.php
示例3: changeSiteAccessSetting
function changeSiteAccessSetting($siteAccess)
{
$cli = eZCLI::instance();
if (in_array($siteAccess, eZINI::instance()->variable('SiteAccessSettings', 'AvailableSiteAccessList'))) {
$cli->output("Using siteaccess {$siteAccess} for nice url update");
} else {
$cli->notice("Siteaccess {$siteAccess} does not exist, using default siteaccess");
}
}
开发者ID:legende91,项目名称:ez,代码行数:9,代码来源:updateniceurls.php
示例4: changeSiteAccessSetting
function changeSiteAccessSetting($siteAccess)
{
$cli = eZCLI::instance();
if (file_exists('settings/siteaccess/' . $siteAccess)) {
$cli->output("Using siteaccess {$siteAccess} for nice url update");
} else {
$cli->notice("Siteaccess {$siteAccess} does not exist, using default siteaccess");
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:9,代码来源:ezpm.php
示例5: execute
public static function execute($exclusiveParentID = 1)
{
$db = eZDB::instance();
$cli = eZCLI::instance();
//1. delete the assignments from eznode_assignment table
// delete the assignments which don't have relevant entry in ezconentobject_tree
// select the data that doesn't exist in either eznode_assignment or ezcontentobject_tree
$deletedAssignmentList = $db->arrayQuery("SELECT * FROM eznode_assignment WHERE id NOT IN " . "(SELECT assign.id FROM eznode_assignment assign, ezcontentobject_tree tree WHERE " . "assign.contentobject_id = tree.contentobject_id AND assign.parent_node = tree.parent_node_id)");
$deletedCount = 0;
foreach ($deletedAssignmentList as $deletedAssignment) {
// select the content object which is published.
//If the object of the assignment is in trash or draft, it's not the one to be deleted
$tempAssignID = $deletedAssignment["id"];
$content = eZContentObject::fetch($deletedAssignment["contentobject_id"], false);
if ($content && $deletedAssignment['parent_node'] != $exclusiveParentID) {
if ($content["status"] == eZContentObject::STATUS_PUBLISHED) {
// iterate the data to be deleted, delete them
$cli->notice('Node assignment [ id: ' . $deletedAssignment['id'] . ' ] for contentobject [ id: ' . $deletedAssignment['contentobject_id'] . ' ] is not consistent with entries in contentobject_tree' . ' table thus will be removed.');
$sql = "DELETE FROM eznode_assignment WHERE id = " . $tempAssignID;
$result = $db->query($sql);
if ($result === false) {
$cli->notice('Node assignment [ id: ' . $deletedAssignment['id'] . ' ] ' . 'could not be removed. Please restore your database from backup and try again.');
return;
}
$deletedCount++;
}
}
}
//2. Delete the duplicated entries which have same contentobject_id, contentobject_version and is_main
// The process of deleting duplicated entries deletes the old entries, keeps the latest entry in the
// duplicated entry list.
$tempDeleteList = array();
$duplicatedContentList = $db->arrayQuery("SELECT contentobject_id, contentobject_version, is_main, parent_node\n FROM eznode_assignment\n GROUP BY contentobject_id, contentobject_version, is_main, parent_node\n HAVING COUNT(*) > 1");
foreach ($duplicatedContentList as $duplicatedContent) {
$assignmentList = $db->arrayQuery("SELECT * FROM eznode_assignment" . " WHERE contentobject_id = " . $duplicatedContent['contentobject_id'] . " AND contentobject_version = " . $duplicatedContent["contentobject_version"] . " AND parent_node =" . $duplicatedContent["parent_node"] . " ORDER BY id DESC");
$assignmentListCount = count($assignmentList);
//Find the duplicated entries( array index start from 1 ) and delete them. Leave the one entry( array index is 0 )
for ($i = 1; $i < $assignmentListCount; $i++) {
if ($assignmentList[$i]["parent_node"] != $exclusiveParentID) {
$tempAssignID = $assignmentList[$i]["id"];
$cli->notice('Node assignment [ id: ' . $tempAssignID . ' ] for contentobject [ id: ' . $assignmentList[$i]["contentobject_id"] . '] is duplicated thus will be removed.');
$sql = "DELETE FROM eznode_assignment WHERE id = " . $tempAssignID;
$result = $db->query($sql);
if ($result === false) {
$cli->notice('Node assignment [ id: ' . $tempAssignID . ' ] ' . 'could not be removed. Please restore your database from backup and try again.');
return;
}
$deletedCount++;
}
}
}
if ($deletedCount != 0) {
$cli->output($deletedCount . ' node assignments have been deleted.');
} else {
$cli->output('None of available node assignments has been deleted.');
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:57,代码来源:updatenodeassignment.php
示例6: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
$cli = eZCLI::instance();
if (file_exists('settings/siteaccess/' . $optionData)) {
$siteaccess = $optionData;
$cli->output("Using siteaccess {$siteaccess} for cronjob");
} else {
$cli->notice("Siteaccess {$optionData} does not exist, using default siteaccess");
}
}
开发者ID:netbliss,项目名称:ezpublish,代码行数:10,代码来源:ezmark.php
示例7: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
$cli = eZCLI::instance();
if (in_array($optionData, eZINI::instance()->variable('SiteAccessSettings', 'AvailableSiteAccessList'))) {
$siteaccess = $optionData;
$cli->output("Using siteaccess {$siteaccess} for content object name update");
} else {
$cli->notice("Siteaccess {$optionData} does not exist, using default siteaccess");
}
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:10,代码来源:updatecontentobjectname.php
示例8: updateClass
function updateClass($classId, $scheduledScript)
{
$cli = eZCLI::instance();
/*
// If the class is not stored yet, store it now
$class = eZContentClass::fetch( $classId, true, eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $class )
{
$cli->output( "Storing class" );
$class->storeDefined( $class->fetchAttributes() );
}
*/
// Fetch the stored class
$class = eZContentClass::fetch($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
if (!$class) {
$cli->error('No class in a modified version status with ID: ' . $classId);
return;
}
// Fetch attributes and definitions
$attributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
$oldClassAttributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_DEFINED);
// Delete object attributes which have been removed.
foreach ($oldClassAttributes as $oldClassAttribute) {
$attributeExist = false;
$oldClassAttributeID = $oldClassAttribute->attribute('id');
foreach ($attributes as $newClassAttribute) {
if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
$attributeExist = true;
}
}
if (!$attributeExist) {
foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
$objectAttribute->removeThis($objectAttribute->attribute('id'));
}
}
}
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
// Add object attributes which have been added.
foreach ($attributes as $newClassAttribute) {
$attributeExist = false;
foreach ($oldClassAttributes as $oldClassAttribute) {
if ($oldClassAttribute->attribute('id') == $newClassAttribute->attribute('id')) {
$attributeExist = true;
break;
}
}
if (!$attributeExist) {
$objects = null;
$newClassAttribute->initializeObjectAttributes($objects);
}
}
if ($scheduledScript !== false) {
$scheduledScript->updateProgress(100);
}
}
开发者ID:legende91,项目名称:ez,代码行数:55,代码来源:syncobjectattributes.php
示例9: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
$ini = eZINI::instance();
$cli = eZCLI::instance();
$availableSiteAccessList = $ini->variable('SiteAccessSettings', 'AvailableSiteAccessList');
if (in_array($optionData, $availableSiteAccessList)) {
$siteaccess = $optionData;
$cli->output("Using siteaccess {$siteaccess} for database cleanup");
} else {
$cli->notice("Siteaccess {$optionData} does not exist, using default siteaccess");
}
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:12,代码来源:cleanup.php
示例10: run
/**
* Executes the purge operation
*
* @todo Endless loop on fetch list. The expired items are returned over and over again
*/
public function run()
{
$cli = eZCLI::instance();
if ( $this->optMemoryMonitoring == true )
{
eZLog::rotateLog( self::LOG_FILE );
$cli->output( "Logging memory usage to " . self::LOG_FILE );
}
if ( $this->optIterationSleep > 0 )
$sleep = ( $this->optIterationSleep * 1000000 );
else
$sleep = false;
$limit = array( 0, $this->optIterationLimit );
$cli->output( "Purging expired items:" );
self::monitor( "start" );
// Fetch a limited list of purge items from the handler itself
$clusterHandler = eZClusterFileHandler::instance();
while ( $filesList = $clusterHandler->fetchExpiredItems( $this->optScopes, $limit, $this->optExpiry ) )
{
self::monitor( "iteration start" );
foreach( $filesList as $file )
{
$cli->output( "- $file" );
if ( $this->optDryRun == false )
{
self::monitor( "purge" );
$fh = eZClusterFileHandler::instance( $file );
$fh->purge( false, false );
unset( $fh );
}
}
if ( $sleep !== false )
usleep( $sleep );
// the offset only has to be increased in dry run mode
// since each batch is not deleted
if ( $this->optDryRun == true )
{
$limit[0] += $limit[1];
}
self::monitor( "iteration end" );
}
self::monitor( "end" );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:56,代码来源:ezscriptclusterpurge.php
示例11: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
$cli = eZCLI::instance();
if (file_exists('settings/siteaccess/' . $optionData)) {
$siteaccess = $optionData;
return "Using siteaccess {$siteaccess} for cronjob";
} elseif (isExtensionSiteaccess($optionData)) {
$siteaccess = $optionData;
eZExtension::prependExtensionSiteAccesses($siteaccess);
return "Using extension siteaccess {$siteaccess} for cronjob";
} else {
return "Siteaccess {$optionData} does not exist, using default siteaccess";
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:runcronjobs.php
示例12: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
global $cronPart;
$cli = eZCLI::instance();
if (file_exists('settings/siteaccess/' . $optionData)) {
$siteaccess = $optionData;
$cli->output("Using siteaccess {$siteaccess} for cronjob");
} elseif (isExtensionSiteaccess($optionData)) {
$siteaccess = $optionData;
$cli->output("Using extension siteaccess {$siteaccess} for cronjob");
eZExtension::prependExtensionSiteAccesses($siteaccess);
} else {
$cli->notice("Siteaccess {$optionData} does not exist, using default siteaccess");
}
}
开发者ID:nlescure,项目名称:ezpublish,代码行数:15,代码来源:runcronjobs.php
示例13: changeSiteAccessSetting
function changeSiteAccessSetting(&$siteaccess, $optionData)
{
global $isQuiet;
$cli = eZCLI::instance();
if (file_exists('settings/siteaccess/' . $optionData)) {
$siteaccess = $optionData;
if (!$isQuiet) {
$cli->notice("Using siteaccess {$siteaccess} for database cleanup");
}
} else {
if (!$isQuiet) {
$cli->notice("Siteaccess {$optionData} does not exist, using default siteaccess");
}
}
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:15,代码来源:cleanup.php
示例14: save
/**
* Saves the xml content
*
* @param $filename Path to file
*/
function save($filename = 'sitemap.xml')
{
$file = eZClusterFileHandler::instance($filename);
if ($file->exists()) {
eZDebug::writeDebug("Time: " . date('d.m.Y H:i:s') . ". Action: " . $filename . " exists. File will be remove.");
if (!$isQuiet) {
$cli = eZCLI::instance();
$cli->output("Time: " . date('d.m.Y H:i:s') . ". Action: " . $filename . " exists. File will be remove.");
$cli->output("\n");
}
$file->delete();
}
$xml = $this->dom->saveXML();
return $file->storeContents($xml, 'sitemap', 'text/xml');
}
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:20,代码来源:xrowsitemaplist.php
示例15: testConnection
function testConnection($parameters)
{
$cli = eZCLI::instance();
#$connection = eZClusterSMTP::connect( $parameters );
$connection = eZClusterSMTP::instance($parameters);
if (count($connection->errors) == 0) {
$cli->output("Connected to " . $parameters['host']);
return true;
} else {
$cli->output("ERROR while connecting to " . $parameters['host']);
foreach ($connection->errors as $error) {
$cli->output("Server Respond: " . $error);
}
return false;
}
$connection->quit();
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:17,代码来源:cluster_send.php
示例16: warning
function warning($text, $position = false)
{
if ($position) {
$str = $position['file'] . ':' . $position['from'][0] . ' C' . $position['from'][1];
if (isset($position['to'])) {
$str .= ' -> L' . $position['to'][0] . ' C' . $position['to'][1];
}
$str .= ':';
}
$str .= $text;
if (class_exists('ezcli')) {
$cli = eZCLI::instance();
$cli->warning($str);
} else {
eZDebug::writeWarning($str, __METHOD__);
}
}
开发者ID:legende91,项目名称:ez,代码行数:17,代码来源:ezcodemapper.php
示例17: runOperation
function runOperation(&$node)
{
$object = $node->attribute('object');
$object_id = $object->attribute('id');
$objectLocales = $object->attribute('available_languages');
// If the new locale does not exist for object, create it
if (!in_array($this->newLocale, $objectLocales)) {
// Create a new version of the original in another locale.
$cli = eZCLI::instance();
$cli->output("Copying the single translation in {$this->orgLocale} to {$this->newLocale}");
$newVersion = $object->createNewVersionIn($this->newLocale, $this->orgLocale, false, true, eZContentObjectVersion::STATUS_DRAFT);
$publishResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object_id, 'version' => $newVersion->attribute('version')));
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
}
return true;
}
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:17,代码来源:nodecreatetranslation.php
示例18: generateCSS
private static function generateCSS( $force = false )
{
$cli = eZCLI::instance();
$cli->output("\n Generating css files");
foreach ( glob('extension/*/design/*/stylesheets/*.less') as $lessFilePath )
{
$lessFile = new KLessFile($lessFilePath);
if ( $force )
{
$lessFile->compile();
}
else
{
$lessFile->compileIfNeeded();
}
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:18,代码来源:KLessCache.php
示例19: generateCache
/**
* @param $clusters
* @param $options
* @return void
*/
function generateCache($clusters, $options) {
$cli = eZCLI::instance();
foreach ( $clusters as $clusterPath )
{
$clusterIdentifier = basename( $clusterPath );
$configurations = MMRssGenerator::createConfigurationsForCluster( $clusterIdentifier );
foreach ( $configurations as $type => $configType )
{
foreach ( $configType as $frequency => $config )
{
$cli->output( "$clusterIdentifier - $type - $frequency" );
$params = array(
'type' => $type,
'frequency' => $frequency,
);
//set date to daily, weekly and monthly
if(isset($options['begin' . ucfirst($frequency)]) && !empty($options['begin' . ucfirst($frequency)])) {
//test if end frequence is set
if(!isset($options['end' . ucfirst($frequency)])) {
$options['end' . ucfirst($frequency)] = '*';
}
if(empty($options['end' . ucfirst($frequency)])) {
$options['end' . ucfirst($frequency)] = '*';
}
//add frequence date parameters
$params['beginDate'] = $options['begin' . ucfirst($frequency)];
$params['endDate'] = $options['end' . ucfirst($frequency)];
//if date params set, use different path
$params['path'] = "/rssManualCache/";
}
$rssGenerator = new MMRssGenerator( $params, $clusterIdentifier );
$rssGenerator->getXML( true );
}
}
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:48,代码来源:generate_all_rss_custom.php
示例20: fixupTrashedImageXml
/**
* Fix xml attributes for empty images that have been trashed.
*
* @param $imageAttribute
* @param $optDryRun bool if in dry-run mode (do not update DB row)
*/
function fixupTrashedImageXml($imageAttribute, $optDryRun)
{
if (stripos($imageAttribute['data_text'], ' dirpath="/trashed" ') === false || stripos($imageAttribute['data_text'], ' is_valid="" ') === false) {
return;
}
$id = $imageAttribute['id'];
$contentId = $imageAttribute['contentobject_id'];
$version = $imageAttribute['version'];
eZCLI::instance()->notice("Processing image {$contentId} ({$version}) ...");
if (($doc = simplexml_load_string($imageAttribute['data_text'])) === false) {
continue;
}
$doc['filename'] = '';
$doc['basename'] = '';
$doc['dirpath'] = '';
$doc['url'] = '';
$imageXml = $doc->asXml();
if (!$optDryRun) {
eZDB::instance()->query("UPDATE ezcontentobject_attribute SET data_text='{$imageXml}' WHERE id='{$id}' and version='{$version}'");
}
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:27,代码来源:fixtrashedimagereferences.php
注:本文中的eZCLI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论