本文整理汇总了PHP中ClusterTool::resetCurrentCluster方法的典型用法代码示例。如果您正苦于以下问题:PHP ClusterTool::resetCurrentCluster方法的具体用法?PHP ClusterTool::resetCurrentCluster怎么用?PHP ClusterTool::resetCurrentCluster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClusterTool
的用法示例。
在下文中一共展示了ClusterTool::resetCurrentCluster方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setClusterIdentifier
/**
* Changes clusterIdentifier state internally !
*
* @param string $clusterIdentifier
*/
public static function setClusterIdentifier ($clusterIdentifier)
{
if ($clusterIdentifier == "")
ClusterTool::resetCurrentCluster();
elseif ( in_array($clusterIdentifier, ClusterTool::globCluster()) || $clusterIdentifier == 'cluster_master' )
ClusterTool::setCurrentCluster($clusterIdentifier);
}
示例2: array
if( is_null($filename) )
$script->shutdown(1, 'No File provided - Aborting');
if( !($f = fopen($filename, 'r')) )
$script->shutdown(2, 'Could not open source file - Aborting');
$db = eZDB::instance();
ClusterTool::setCurrentCluster($cluster);
$appsById = array();
foreach( $db->arrayQuery( sprintf( "SELECT application_id FROM mm_application_localized WHERE cluster_identifier = '%s'", $cluster ) ) as $row )
$appsById[$row['application_id']] = CacheApplicationTool::buildLocalizedApplicationByApplication($row['application_id'] );
uasort( $appsById, function($a, $b){ return strnatcasecmp( $a->applicationObject->attribute('identifier'), $b->applicationObject->attribute('identifier') ); });
ClusterTool::resetCurrentCluster();
$dumpCmd = 'mysqldump -h'.$db->Server.' -u'.$db->User.' -p'.$db->Password.' '.$db->DB.' mm_application mm_application_localized > "'.eZINI::instance()->variable('FileSettings', 'VarDir').'/mm_application_import_dump.'.date('YmdHis').'.sql"';
$dump = exec($dumpCmd);
$headers = fgetcsv($f, null, ',', '"');
while ( $r= fgetcsv($f, null, ',', '"') )
{
$row = array_combine($headers, $r);
// we map the fields
foreach( array(
'App Name (icon)' => 'name',
示例3: getData
/**
* @see ezfSolrDocumentFieldBase::getData()
* @return array
*/
public function getData()
{
$data = parent::getData();
$content = $this->ContentObjectAttribute->content();
/* @var $content array */
foreach ( array_merge( self::taxonomyAttribute(), array_keys($content) ) as $taxonomyIdentifier )
{
$taxonomyValues = isset( $content[$taxonomyIdentifier] ) ? $content[$taxonomyIdentifier] : array();
$subattrSourceIdValues = array();
$subattrSourceIdFieldName = self::getCustomSubattributeFieldName(
$taxonomyIdentifier,
'source_id');
foreach ( $taxonomyValues as $taxonomyValue )
{
if( preg_match( '#^symptom_.*$#', $taxonomyValue ) )
{
$sourceKey = $taxonomyValue;
$subattrSourceIdValues[] = $sourceKey;
// we need a few more things for the symptoms
/* @type $node eZContentObjectTreeNode */
$contentObject = $this->ContentObjectAttribute->object();
$node = $contentObject->mainNode();
$clusters = NodeTool::getArticleClusters($node);
foreach( $clusters as $cluster )
{
ClusterTool::setCurrentCluster($cluster);
$ini = eZINI::fetchFromFile('extension/'.$cluster.'/settings/site.ini');
$node->setCurrentLanguage( $ini->variable('RegionalSettings', 'ContentObjectLocale') );
$applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByIdentifier( MerckManualShowcase::mainApplicationIdentifier() );
if ( !$applicationLocalized )
continue;
$customSymptomAttributeKey = 'attr_custom_symptom_'.$cluster.'_s';
$labelTranslations = FacetFilteringTool::getTaxonomyTranslation( 'symptom' );
$label = $labelTranslations[$sourceKey];
$url = preg_replace( '#^[^/]+#', '', MerckManualFunctionCollection::getMerckManualNodeUrl( 'meck-manual-showcase', $node, $ini->variable('RegionalSettings', 'ContentObjectLocale') ) );
ClusterTool::resetCurrentCluster();
$customSymptomAttributeValueParts = array(
mb_strtolower(mb_substr(StringTool::removeAccents( StringTool::CJK2Pinyin($label) ), 0, 1)),
$label,
$url
);
$data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts );
}
}
else if ( preg_match('#^222\.[0-9]+$#', $taxonomyValue ) )
{
$sourceKey = $taxonomyValue;
$subattrSourceIdValues[] = $sourceKey;
/* @type $node eZContentObjectTreeNode */
/* @type $dataMap eZContentObjectAttribute[] */
$contentObject = $this->ContentObjectAttribute->object();
$node = $contentObject->mainNode();
$clusters = NodeTool::getArticleClusters($node);
$customSymptomAttributeValueParts = array(
$content['layer_natom'][0],
$content['sub_layer_natom'][0],
);
foreach( $clusters as $cluster )
{
ClusterTool::setCurrentCluster($cluster);
$customSymptomAttributeKey = 'attr_custom_layer_sublayer_natom_'.$cluster.'_s';
$data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts );
ClusterTool::resetCurrentCluster();
}
}
else
$subattrSourceIdValues[] = trim( $taxonomyValue );
}
$data[$subattrSourceIdFieldName] = empty($subattrSourceIdValues) ? '' : $subattrSourceIdValues;
}
return $data;
}
示例4: modify
//.........这里部分代码省略.........
if ( !empty($mediaDatamap['question']->DataText) )
{
self::addValueToDoc( $docList, 'attr_media_content_quiz_question_' . $cluster . '_ms', trim(strip_tags($mediaDatamap['question']->DataText)), false );
}
if ( !$mediaDatamap['points']->hasContent() )
continue;
$totalQuizzes+= $mediaDatamap['points']->content();
}
}
}
$withMediaDuration = true;
$typeMedias = NodeOperatorHelper::getPictosMedia( $contentMainNode, $withMediaDuration );
$typeMediasSerialized = base64_encode( json_encode($typeMedias) );
// getPictosMedia as solr field
self::addValueToDoc( $docList, 'attr_media_content_types_' . $cluster . '_bst', $typeMediasSerialized, false );
// getMediaCount as solr field
$mediaCount = NodeOperatorHelper::getMediaCount($contentMainNode);
self::addValueToDoc( $docList, 'attr_media_content_count_' . $cluster . '_i', $mediaCount, false );
// Used only for Quizz
if ( $totalQuizzes > 0 )
self::addValueToDoc( $docList, 'attr_media_content_quiz_points_' . $cluster . '_i', $totalQuizzes, false );
}
unset($isHidden);
}
ClusterTool::resetCurrentCluster();
$concernedNode = $contentMainNode;
$concernedNode->setCurrentLanguage($articleLanguageArray[0]);
if ( $contentMainNode->attribute('depth') > 4 )
{
$concernedNode = $contentMainNode->fetchParent();
$concernedNode->setCurrentLanguage($articleLanguageArray[0]);
}
/* @type $concernedDM eZContentObjectAttribute[] */
$concernedDM = $concernedNode->dataMap();
$tags = $concernedDM['tags'];
$MerckManualAboutSectionId = eZIni::instance('merck.ini')->variable('MerckManualAboutSettings', 'SectionSourceId');
$taxonomiesAttribute = $concernedDM['serialized_taxonomies'];
if( $taxonomiesAttribute instanceof eZContentObjectAttribute && $taxonomiesAttribute->hasContent() )
{
$taxonomies = $taxonomiesAttribute->content();
foreach( array_keys($publisherFolderRelations['clusters']) as $cluster )
{
self::addValueToDoc(
$docList,
"attr_exclude_from_search_{$cluster}_b",
$MerckManualAboutSectionId && in_array($MerckManualAboutSectionId, $taxonomies['section']),
false
);
}
}