本文整理汇总了PHP中eZCache类的典型用法代码示例。如果您正苦于以下问题:PHP eZCache类的具体用法?PHP eZCache怎么用?PHP eZCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearActiveExtensionsCache
/**
* @todo Move to a common extension testing class
*/
private static function clearActiveExtensionsCache()
{
eZCache::clearByID('active_extensions');
// currently required so that cache will actually be considered expired
// this is a design issue in eZExpiryHandler we need to address soon as it deeply impacts testing any feature
// that relies on it, and also impacts runtime on high-trafic sites.
sleep(2);
}
示例2: generateJson
/**
* @param array $action
*/
function generateJson( $action )
{
$jsPath = "extension/{$action['identifier']}/design/oscar/javascript/";
if ( is_dir( $jsPath ) )
{
$convert = new ConvertTsToJSON( $jsPath . "com.lang.js", null, $action['param'] );
$convert->process();
eZCache::clearByID( array('ezjscore-packer'), 'template-block' );
}
}
示例3: testPurgeImageAliasForObject
public function testPurgeImageAliasForObject()
{
$imageObject = $this->createImage("Original image");
// generate a couple aliases
$dataMap = $imageObject->dataMap();
$aliasHandler = $dataMap['image']->attribute('content');
foreach (array('small', 'medium', 'large') as $aliasName) {
$alias = $aliasHandler->attribute($aliasName);
$aliasFiles[] = $alias['url'];
}
// create a new version
$imageObject = $this->createNewVersionWithImage($imageObject);
// generate a couple aliases
$dataMap = $imageObject->dataMap();
$imageAttribute = $dataMap['image'];
$imageAttributeId = $imageAttribute->attribute('id');
$aliasHandler = $imageAttribute->attribute('content');
$aliasFiles = array();
foreach (array('small', 'medium', 'large') as $aliasName) {
$alias = $aliasHandler->attribute($aliasName);
$aliasFiles[] = $alias['url'];
}
// we will check that the original alias wasn't removed
$originalAlias = $aliasHandler->attribute('original');
$originalAliasFile = $originalAlias['url'];
unset($originalAlias);
$aliasFiles = array_unique($aliasFiles);
foreach ($aliasFiles as $aliasFile) {
self::assertImageFileExists($imageAttributeId, $aliasFile);
}
self::assertImageFileExists($imageAttributeId, $originalAliasFile);
eZCache::purgeImageAlias(array('reporter' => function () {
}));
foreach ($aliasFiles as $aliasFile) {
self::assertImageFileNotExists($imageAttributeId, $aliasFile);
}
self::assertImageFileExists($imageAttributeId, $originalAliasFile);
}
示例4: initializePackage
//.........这里部分代码省略.........
foreach ($prefs as $prefEntry) {
if (!$prefEntry) {
continue;
}
$prefUserID = $prefEntry['user_id'];
foreach ($prefEntry['preferences'] as $pref) {
$prefName = $pref['name'];
$prefValue = $pref['value'];
if (!eZPreferences::setValue($prefName, $prefValue, $prefUserID)) {
$resultArray['errors'][] = array('code' => 'EZSW-070', 'text' => "Could not create ezpreference '{$prefValue}' for {$prefUserID}");
return false;
}
}
}
}
$publishAdmin = false;
$userAccount = eZUser::fetch(14);
if (!is_object($userAccount)) {
$resultArray['errors'][] = array('code' => 'EZSW-020', 'text' => "Could not fetch administrator user object");
return false;
}
$userObject = $userAccount->attribute('contentobject');
if (!is_object($userObject)) {
$resultArray['errors'][] = array('code' => 'EZSW-021', 'text' => "Could not fetch administrator content object");
return false;
}
$newUserObject = $userObject->createNewVersion(false, false);
if (!is_object($newUserObject)) {
$resultArray['errors'][] = array('code' => 'EZSW-022', 'text' => "Could not create new version of administrator content object");
return false;
}
$dataMap = $newUserObject->attribute('data_map');
$error = false;
if (trim($admin['email'])) {
if (!isset($dataMap['user_account'])) {
$resultArray['errors'][] = array('code' => 'EZSW-023', 'text' => "Administrator content object does not have a 'user_account' attribute");
return false;
}
$userAccount->setInformation(14, 'admin', $admin['email'], $admin['password'], $admin['password']);
$dataMap['user_account']->setContent($userAccount);
$dataMap['user_account']->store();
$publishAdmin = true;
$userAccount->store();
}
if (trim($admin['first_name']) or trim($admin['last_name'])) {
if (!isset($dataMap['first_name'])) {
$resultArray['errors'][] = array('code' => 'EZSW-023', 'text' => "Administrator content object does not have a 'first_name' field");
$error = true;
}
if (!isset($dataMap['last_name'])) {
$resultArray['errors'][] = array('code' => 'EZSW-024', 'text' => "Administrator content object does not have a 'last_name' field");
$error = true;
}
if ($error) {
return false;
}
$dataMap['first_name']->setAttribute('data_text', $admin['first_name']);
$dataMap['first_name']->store();
$dataMap['last_name']->setAttribute('data_text', $admin['last_name']);
$dataMap['last_name']->store();
$newUserObject->store();
$publishAdmin = true;
}
if ($publishAdmin) {
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $newUserObject->attribute('contentobject_id'), 'version' => $newUserObject->attribute('version')));
if ($operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE) {
$resultArray['errors'][] = array('code' => 'EZSW-025', 'text' => "Failed to properly publish the administrator object");
return false;
}
}
// Call user function for additional setup tasks.
if (function_exists('eZSitePostInstall')) {
eZSitePostInstall($parameters);
}
// get all siteaccesses. do it via 'RelatedSiteAccessesList' settings.
$adminSiteINI = eZINI::instance('site.ini' . '.append.php', "settings/siteaccess/{$adminSiteaccessName}");
$relatedSiteAccessList = $adminSiteINI->variable('SiteAccessSettings', 'RelatedSiteAccessList');
// Adding override for 'tiny_image' view for 'multi-option2' datatype
foreach ($relatedSiteAccessList as $siteAccess) {
$tmpOverrideINI = new eZINI('override.ini' . '.append.php', "settings/siteaccess/{$siteAccess}", null, null, null, true, true);
$tmpOverrideINI->setVariable('tiny_image', 'Source', 'content/view/tiny.tpl');
$tmpOverrideINI->setVariable('tiny_image', 'MatchFile', 'tiny_image.tpl');
$tmpOverrideINI->setVariable('tiny_image', 'Subdir', 'templates');
$tmpOverrideINI->setVariable('tiny_image', 'Match', array('class_identifier' => 'image'));
$tmpOverrideINI->save();
}
$accessMap = $parameters['access_map'];
// Call user function for some text which will be displayed at 'Finish' screen
if (function_exists('eZSiteFinalText')) {
$text = eZSiteFinalText($parameters);
if (!isset($this->PersistenceList['final_text'])) {
$this->PersistenceList['final_text'] = array();
}
$this->PersistenceList['final_text'][] = $text;
}
// ensure that evaluated policy wildcards in the user info cache
// will be up to date with the currently activated modules
eZCache::clearByID('user_info_cache');
return true;
}
示例5: generateSpriteForCluster
//.........这里部分代码省略.........
exec($cmd, $cmdOutput, $cmdStatus);
if ($cmdStatus != 0)
{
return array(
'errorCode' => $cmdStatus,
'generateSpriteCommand' => $cmd,
'error' => implode('\n', $cmdOutput),
);
}
$css = "
#app-catalog a.app-bar-access-app-library .poster{
background-image: none !important;
}
#app-catalog a .poster,
#hide-app a .poster,
.item-apps .batch .wrap > a .poster,
.item-related-app .batch .wrap > a .poster{
background-image:url(/esibuild/static/{$clusterIdentifier}/{$generatedSpriteName});
background-repeat: no-repeat;
}
";
$cssMobile = "
#app-catalog a.app-bar-access-app-library .poster{
background-image: none !important;
}
#app-catalog a .poster,
#hide-app a .poster,
.item-apps .batch .wrap > a .poster,
.item-related-app .batch .wrap > a .poster{
background-image:url(/esibuild/static/{$clusterIdentifier}/{$generatedSpriteName});
background-repeat: no-repeat;
background-size: {$mobileStep}px auto !important;
}
";
$offset = 0;
$offsetMobile = 0;
foreach( $cssList as $key => $cssStyle )
{
$css .= "
#app-catalog a .poster.$cssStyle,
#hide-app a .poster.$cssStyle,
.item-apps .batch .wrap > a .poster.$cssStyle,
.item-related-app .batch .wrap > a .poster.$cssStyle{
background-position: 0 -{$offset}px !important;
}
";
$cssMobile .= "
#app-catalog a .poster.$cssStyle,
#hide-app a .poster.$cssStyle,
.item-apps .batch .wrap > a .poster.$cssStyle{
background-position: 0 -{$offsetMobile}px !important;
}
";
$offset += $offsetStep;
$offsetMobile += $mobileStep;
$css .= "
#app-catalog a:hover .poster.$cssStyle,
#app-catalog a:active .poster.$cssStyle,
#app-catalog a.active .poster.$cssStyle,
#hide-app a:active .poster.$cssStyle,
#hide-app a.active .poster.$cssStyle,
.item-apps .batch:hover .wrap > a .poster.$cssStyle,
.item-related-app .batch:hover .wrap > a .poster.$cssStyle{
background-position: 0 -{$offset}px !important;
}
";
$cssMobile .= "
#app-catalog a:hover .poster.$cssStyle,
#app-catalog a:active .poster.$cssStyle,
#app-catalog a.active .poster.$cssStyle,
#hide-app a:active .poster.$cssStyle,
#hide-app a.active .poster.$cssStyle,
.item-apps .batch:hover .wrap > a .poster.$cssStyle,
.item-related-app .batch:hover .wrap > a .poster.$cssStyle{
background-position: 0 -{$offsetMobile}px !important;
}
";
$offset += $offsetStep;
$offsetMobile += $mobileStep;
}
if ( ! file_exists( $lessPath ) )
{
mkdir( $lessPath, 0755 );
}
if ( is_dir( $lessPath ) )
{
$lessFile = $lessPath."mod.icosprite.less";
file_put_contents( $lessFile, $css );
$lessFileMobile = $lessPath."mod.icosprite.mobile.less";
file_put_contents( $lessFileMobile, $cssMobile );
eZCache::clearByID( array('ezjscore-packer'), 'template-block' );
}
return array(
'errorCode' => 0,
'generateSpriteCommand' => $cmd
);
}
示例6: init
function init()
{
eZCache::clearByID( 'global_ini' );
return false; // Always show
}
示例7: elseif
$nodeID = $module->actionParameter('NodeID');
}
if ($module->hasActionParameter('ObjectID')) {
$objectID = $module->actionParameter('ObjectID');
}
if ($cacheType == 'All') {
eZCache::clearAll();
} elseif ($cacheType == 'Template') {
eZCache::clearByTag('template');
} elseif ($cacheType == 'Content') {
eZCache::clearByTag('content');
} elseif ($cacheType == 'TemplateContent') {
eZCache::clearByTag('template');
eZCache::clearByTag('content');
} elseif ($cacheType == 'Ini') {
eZCache::clearByTag('ini');
} elseif ($cacheType == 'Static') {
// get staticCacheHandler instance
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
$staticCacheHandler->generateCache(true, true);
$cacheCleared['static'] = true;
} elseif ($cacheType == 'ContentNode') {
$contentModule = eZModule::exists('content');
if ($contentModule instanceof eZModule) {
$contentModule->setCurrentAction('ClearViewCache', 'action');
$contentModule->setActionParameter('NodeID', $nodeID, 'action');
$contentModule->setActionParameter('ObjectID', $objectID, 'action');
$contentModule->run('action', array($nodeID, $objectID));
}
示例8: backupTables
if ($column > 0) {
$cli->output();
}
backupTables('impwcard');
}
// $cli->output( "Removing urlalias data which have been imported" );
// $db = eZDB::instance();
// $db->query( "DELETE FROM ezurlalias WHERE is_imported = 1" ); // Removing all aliases which have been imported
$rows = $db->arrayQuery("SELECT count(*) AS count FROM ezurlalias WHERE is_imported = 0");
$remaining = $rows[0]['count'];
if ($remaining > 0) {
$cli->output("There are {$remaining} remaining URL aliases in the old ezurlalias table, manual cleanup is needed.");
}
if ($importOldAliasWildcard) {
$cli->output("Removing old wildcard caches");
eZCache::clearByID('urlalias');
}
$cli->output("Import completed");
$cli->output("Import time taken: " . $cli->stylize('emphasize', formatTime(microtime(true) - $globalStartTime)));
}
if ($updateNodeAlias) {
$nodeGlobalStartTime = microtime(true);
// Start updating nodes
$topLevelNodesArray = $db->arrayQuery('SELECT node_id FROM ezcontentobject_tree WHERE depth = 1 ORDER BY node_id');
foreach (array_keys($topLevelNodesArray) as $key) {
$topLevelNodeID = $topLevelNodesArray[$key]['node_id'];
$rootNode = eZContentObjectTreeNode::fetch($topLevelNodeID);
if ($rootNode->updateSubTreePath()) {
++$totalChangedNodes;
}
$done = false;
示例9: clearByID
/**
* Finds all cache item which has ID equal to one of the IDs in $idList.
* You can also submit a single id to $idList.
*
* @param array $idList The cache ID list
* @param bool|array $cacheList The list of caches, default false
*/
static function clearByID($idList, $cacheList = false)
{
if (!$cacheList) {
$cacheList = eZCache::fetchList();
}
$cacheItems = array();
if (!is_array($idList)) {
$idList = array($idList);
}
foreach ($cacheList as $cacheItem) {
if (in_array($cacheItem['id'], $idList)) {
$cacheItems[] = $cacheItem;
}
}
foreach ($cacheItems as $cacheItem) {
eZCache::clearItem($cacheItem);
}
return true;
}
示例10: updateAutoload
// open settings/override/site.ini.append[.php] for writing
$writeSiteINI = eZINI::instance( 'site.ini.append', 'settings/override', null, null, false, true );
$writeSiteINI->setVariable( "ExtensionSettings", "ActiveExtensions", $toSave );
$writeSiteINI->save( 'site.ini.append', '.php', false, false );
eZCache::clearByTag( 'ini' );
eZSiteAccess::reInitialise();
$ini = eZINI::instance( 'module.ini' );
$currentModules = $ini->variable( 'ModuleSettings', 'ModuleList' );
if ( $currentModules != $oldModules )
{
// ensure that evaluated policy wildcards in the user info cache
// will be up to date with the currently activated modules
eZCache::clearByID( 'user_info_cache' );
}
updateAutoload( $tpl );
}
// open site.ini for reading (need to do it again to take into account the changes made to site.ini after clicking "Apply changes" button above
$siteINI = eZINI::instance();
$siteINI->load();
$selectedExtensionArray = $siteINI->variable( 'ExtensionSettings', "ActiveExtensions" );
$selectedAccessExtensionArray = $siteINI->variable( 'ExtensionSettings', "ActiveAccessExtensions" );
$selectedExtensions = array_merge( $selectedExtensionArray, $selectedAccessExtensionArray );
$selectedExtensions = array_unique( $selectedExtensions );
if ( $module->isCurrentAction( 'GenerateAutoloadArrays' ) )
{
示例11: getMIBTree
function getMIBTree()
{
// build list of oids corresponding to order status
$db = self::eZDBinstance();
$orderStatusIdoids = array();
$orderStatusNameoids = array();
$orderStatusCountoids = array();
$orderStatusArchiveCountoids = array();
if ($db) {
$status = $db->arrayQuery('select status_id, name from ezorder_status where is_active=1 order by id');
$db->close();
if (is_array($status)) {
$i = 1;
foreach ($status as $line) {
self::$orderstatuslist = array_merge(self::$orderstatuslist, array("2.1.5.1.1.1.{$i}" => $line['status_id'], "2.1.5.1.1.2.{$i}" => $line['name'], "2.1.5.1.1.3.{$i}" => $line['status_id'], "2.1.5.1.1.4.{$i}" => $line['status_id']));
$orderStatusIdoids[$i] = array('name' => 'orderStatusId' . $i, 'syntax' => 'INTEGER');
$orderStatusNameoids[$i] = array('name' => 'orderStatusname' . $i, 'syntax' => 'DisplayString');
$orderStatusCountoids[$i] = array('name' => 'orderStatusCount' . $i, 'syntax' => 'INTEGER');
$orderStatusArchiveCountoids[$i] = array('name' => 'orderStatusArchive' . $i, 'syntax' => 'INTEGER');
$i++;
}
}
//var_dump($orderStatusArchiveCountoids);
//die();
} else {
// what to do in this case? db is down - maybe we should raise an exception
// instead of producing a shortened oid list...
}
// build list of oids corresponding to caches and store for later their config
$i = 1;
$cacheoids = array();
foreach (eZCache::fetchList() as $cacheItem) {
if ($cacheItem['path'] != false) {
$id = $cacheItem['id'];
self::$cachelist = array_merge(self::$cachelist, array("2.2.{$i}.1" => $id, "2.2.{$i}.2" => $id, "2.2.{$i}.3" => $id, "2.2.{$i}.4" => $id));
$cachename = 'cache' . ucfirst(eZSNMPd::asncleanup($id));
$cacheoids[$i] = array('name' => $cachename, 'children' => array(1 => array('name' => "{$cachename}Name", 'syntax' => 'DisplayString', 'description' => 'The name of this cache.'), 2 => array('name' => "{$cachename}Status", 'syntax' => 'INTEGER', 'description' => 'Cache status: 1 for enabled, 0 for disabled.'), 3 => array('name' => "{$cachename}Count", 'syntax' => 'INTEGER', 'description' => 'Number of files in the cache (-1 if current cluster mode not supported).'), 4 => array('name' => "{$cachename}Size", 'syntax' => 'INTEGER', 'description' => 'Sum of size of all files in the cache (-1 if current cluster mode not supported).')));
$i++;
}
}
// build list of oids corresponding to storage dirs
/// @todo this way of finding storage dir is lame, as it depends on them having been created
/// it will also not work in cluster mode, as there will be no dirs on the fs...
$storagedir = eZSys::storageDirectory();
$files = @scandir($storagedir);
$i = 1;
$storagediroids = array();
foreach ($files as $file) {
if ($file != '.' && $file != '..' && is_dir($storagedir . '/' . $file)) {
self::$storagedirlist = array_merge(self::$storagedirlist, array("2.3.{$i}.1" => $storagedir . '/' . $file, "2.3.{$i}.2" => $storagedir . '/' . $file, "2.3.{$i}.3" => $storagedir . '/' . $file));
$storagedirname = 'storage' . ucfirst(eZSNMPd::asncleanup($file));
$storagediroids[$i] = array('name' => $storagedirname, 'children' => array(1 => array('name' => "{$storagedirname}Path", 'syntax' => 'DisplayString', 'description' => 'The path of this storage dir.'), 2 => array('name' => "{$storagedirname}Count", 'syntax' => 'INTEGER', 'description' => 'Number of files in the dir (-1 if current cluster mode not supported).'), 3 => array('name' => "{$storagedirname}Size", 'syntax' => 'INTEGER', 'description' => 'Sum of size of all files in the dir (-1 if current cluster mode not supported).')));
$i++;
}
}
return array('name' => 'eZPublish', 'children' => array(2 => array('name' => 'status', 'children' => array(1 => array('name' => 'database', 'children' => array(1 => array('name' => 'dbstatus', 'syntax' => 'INTEGER', 'description' => 'Availability of the database.'), 2 => array('name' => 'content', 'children' => array(1 => array('name' => 'contentObjects', 'syntax' => 'INTEGER', 'description' => 'The number of content objects.'), 2 => array('name' => 'contentObjectAttributes', 'syntax' => 'INTEGER', 'description' => 'The number of content object attributes.'), 3 => array('name' => 'contentObjectNodes', 'syntax' => 'INTEGER', 'description' => 'The number of content nodes.'), 4 => array('name' => 'contentObjectRelations', 'syntax' => 'INTEGER', 'description' => 'The number of content object relations.'), 5 => array('name' => 'contentObjectDrafts', 'syntax' => 'INTEGER', 'description' => 'The number of content objects in DRAFT state.'), 6 => array('name' => 'contentObjectClasses', 'syntax' => 'INTEGER', 'description' => 'The number of content object classes.'), 7 => array('name' => 'contentObjectInfoCollections', 'syntax' => 'INTEGER', 'description' => 'The number of information collections.'), 8 => array('name' => 'contentObjectsPendingIndexation', 'syntax' => 'INTEGER', 'description' => 'The number of objects pending a search-engine indexation.'), 9 => array('name' => 'pendingNotificationEvents', 'syntax' => 'INTEGER', 'description' => 'The number of pending notification events.'))), 3 => array('name' => 'users', 'children' => array(1 => array('name' => 'registeredusers', 'syntax' => 'INTEGER', 'description' => 'The number of existing user accounts.'))), 4 => array('name' => 'sessions', 'children' => array(1 => array('name' => 'allSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active sessions.'), 2 => array('name' => 'anonSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active anonymous users sessions.'), 3 => array('name' => 'registeredSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active registered users sessions.'))), 5 => array('name' => 'shop', 'children' => array(1 => array('name' => 'orderStatusTable', 'access' => eZMIBTree::access_not_accessible, 'syntax' => 'SEQUENCE OF OrderStatusEntry', 'description' => 'A table containing the number of orders per order state.', 'children' => array(0 => array('name' => 'OrderStatusEntry', 'syntax' => 'SEQUENCE', 'items' => array(1 => array('name' => 'orderStatusId', 'syntax' => 'INTEGER'), 2 => array('name' => 'orderStatusName', 'syntax' => 'DisplayString'), 3 => array('name' => 'orderStatusCount', 'syntax' => 'INTEGER'), 4 => array('name' => 'orderStatusArchiveCount', 'syntax' => 'INTEGER'))), 1 => array('name' => 'orderStatusEntry', 'access' => eZMIBTree::access_not_accessible, 'syntax' => 'OrderStatusEntry', 'description' => 'A table row describing the set of orders in status N.', 'index' => 'orderStatusId', 'children' => array(1 => array('name' => 'orderStatusId', 'syntax' => 'INTEGER (1..99)', 'description' => 'ID of this order status.', 'nochildreninmib' => true, 'children' => $orderStatusIdoids), 2 => array('name' => 'orderStatusName', 'syntax' => 'DisplayString', 'description' => 'The name of this order status.', 'nochildreninmib' => true, 'children' => $orderStatusNameoids), 3 => array('name' => 'orderStatusCount', 'syntax' => 'INTEGER', 'description' => 'Number of active orders in this status.', 'nochildreninmib' => true, 'children' => $orderStatusCountoids), 4 => array('name' => 'orderStatusArchiveCount', 'syntax' => 'INTEGER', 'description' => 'Number of archived orders in this status.', 'nochildreninmib' => true, 'children' => $orderStatusArchiveCountoids))))))), 6 => array('name' => 'asyncpublishing', 'children' => array(1 => array('name' => 'AsyncPublishingWorkingCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Working status'), 2 => array('name' => 'AsyncPublishingFinishedCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Finished status'), 3 => array('name' => 'AsyncPublishingPendingCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Pending status'), 4 => array('name' => 'AsyncPublishingDeferredCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Deferred status'), 5 => array('name' => 'AsyncPublishingUnknownCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Unknown status'))))), 2 => array('name' => 'cache', 'children' => $cacheoids), 3 => array('name' => 'storage', 'children' => $storagediroids), 4 => array('name' => 'external', 'children' => array(1 => array('name' => 'ldap', 'syntax' => 'INTEGER', 'description' => 'Connectivity to LDAP server (-1 if not configured).'), 2 => array('name' => 'web', 'syntax' => 'INTEGER', 'description' => 'Connectivity to the web. (probes a series of webservers defined in snmpd.ini, returns -1 if not configured).'), 3 => array('name' => 'email', 'syntax' => 'INTEGER', 'description' => 'Connectivity to mail server (NB: will send a test mail when probed to a recipient defined in snmpd.ini, returns -1 if not configured).'))), 5 => array('name' => 'cluster', 'children' => array(1 => array('name' => 'clusterdbstatus', 'syntax' => 'INTEGER', 'description' => 'Availability of the cluster database (-1 for NA).')))))));
}
示例12: array
if ( $module->isCurrentAction( 'ClearINICache' ) )
{
eZCache::clearByTag( 'ini' );
$cacheCleared['ini'] = true;
}
if ( $module->isCurrentAction( 'ClearTemplateCache' ) )
{
eZCache::clearByTag( 'template' );
$cacheCleared['template'] = true;
}
if ( $module->isCurrentAction( 'ClearCache' ) && $module->hasActionParameter( 'CacheList' ) && is_array( $module->actionParameter( 'CacheList' ) ) )
{
$cacheClearList = $module->actionParameter( 'CacheList' );
eZCache::clearByID( $cacheClearList );
$cacheItemList = array();
foreach ( $cacheClearList as $cacheClearItem )
{
foreach ( $cacheList as $cacheItem )
{
if ( $cacheItem['id'] == $cacheClearItem )
{
$cacheItemList[] = $cacheItem;
break;
}
}
}
$cacheCleared['list'] = $cacheItemList;
}
示例13: purgeItems
function purgeItems($cacheEntries, $cli, $name)
{
global $purgeSleep, $purgeMax, $purgeExpiry;
if ($name) {
$name = $cli->stylize('emphasize', $name);
}
$cli->output('Purging ' . $name . ': ', false);
$i = 0;
foreach ($cacheEntries as $cacheEntry) {
if ($i > 0) {
$cli->output(', ', false);
}
$cli->output($cli->stylize('emphasize', $cacheEntry['name']), false);
eZCache::clearItem($cacheEntry, true, 'reportProgress', $purgeSleep, $purgeMax, $purgeExpiry);
++$i;
}
$cli->output();
}
示例14: 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();
}
示例15: array
$noAction = false;
$tagName = $options['clear-tag'];
$cacheEntries = eZCache::fetchByTag($tagName, $cacheList);
if ($purge) {
$helper->purgeItems($cacheEntries, $tagName, $purgeSleep, $purgeMax, $purgeExpiry);
} else {
$helper->clearItems($cacheEntries, $tagName);
}
}
if ($options['clear-id']) {
$noAction = false;
$idName = $options['clear-id'];
$missingIDList = array();
$cacheEntries = array();
foreach (explode(',', $idName) as $id) {
$cacheEntry = eZCache::fetchByID($id, $cacheList);
if ($cacheEntry) {
$cacheEntries[] = $cacheEntry;
} else {
$missingIDList[] = $id;
}
}
if (count($missingIDList) > 0) {
$cli->warning('No such cache ID: ' . $cli->stylize('emphasize', implode(', ', $missingIDList)));
$script->shutdown(1);
}
if ($options['clear-id']) {
if ($purge) {
$helper->purgeItems($cacheEntries, $idName, $purgeSleep, $purgeMax, $purgeExpiry);
} else {
$helper->clearItems($cacheEntries, $idName);