/** * Test for eZPendingActions::removeByAction() */ public function testRemoveByAction() { // Insert several fixtures at one time. Can't use @dataProvider to do that $fixtures = $this->providerForTestFecthByAction(); foreach ($fixtures as $fixture) { $this->insertPendingAction($fixture[0], $fixture[1], $fixture[2]); } eZPendingActions::removeByAction('test'); $res = eZPendingActions::fetchByAction('test'); $this->assertTrue(empty($res)); }
<?php if (!$isQuiet) { $cli->output("Processing pending subtree re-index actions"); } // check that eZPlatformSearch is enabled and used $searchEngine = eZSearch::getEngine(); if (!$searchEngine instanceof eZPlatformSearch) { $script->shutdown(1, 'The current search engine plugin is not eZPlatformSearch'); } $limit = 50; $entries = eZPendingActions::fetchByAction('index_subtree'); if (!empty($entries)) { $parentNodeIDList = array(); foreach ($entries as $entry) { $parentNodeID = $entry->attribute('param'); $parentNodeIDList[] = (int) $parentNodeID; $offset = 0; while (true) { $nodes = eZContentObjectTreeNode::subTreeByNodeID(array('IgnoreVisibility' => true, 'Offset' => $offset, 'Limit' => $limit, 'Limitation' => array()), $parentNodeID); if (!empty($nodes) && is_array($nodes)) { foreach ($nodes as $node) { ++$offset; $cli->output("\tIndexing object ID #{$node->attribute('contentobject_id')}"); // delay commits with passing false for $commit parameter $searchEngine->addObject($node->attribute('object'), false); } // finish up with commit $searchEngine->commit(); // clear object cache to conserve memory eZContentObject::clearCache();
/** * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. * @version 2014.07.0 */ if (!$isQuiet) { $cli->output("Processing pending subtree re-index actions"); } // check that solr is enabled and used $eZSolr = eZSearch::getEngine(); if (!$eZSolr instanceof eZSolr) { $script->shutdown(1, 'The current search engine plugin is not eZSolr'); } $limit = 50; $entries = eZPendingActions::fetchByAction(eZSolr::PENDING_ACTION_INDEX_SUBTREE); if (!empty($entries)) { $parentNodeIDList = array(); foreach ($entries as $entry) { $parentNodeID = $entry->attribute('param'); $parentNodeIDList[] = (int) $parentNodeID; $offset = 0; while (true) { $nodes = eZContentObjectTreeNode::subTreeByNodeID(array('IgnoreVisibility' => true, 'Offset' => $offset, 'Limit' => $limit, 'Limitation' => array()), $parentNodeID); if (!empty($nodes) && is_array($nodes)) { foreach ($nodes as $node) { ++$offset; $cli->output("\tIndexing object ID #{$node->attribute('contentobject_id')}"); // delay commits with passing false for $commit parameter $eZSolr->addObject($node->attribute('object'), false); }
public function isLocked() { $action = eZPendingActions::fetchByAction(self::ACTION_KEY); if (empty($action)) { return false; } return true; }