当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObject::clearCache方法代码示例

本文整理汇总了PHP中eZContentObject::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::clearCache方法的具体用法?PHP eZContentObject::clearCache怎么用?PHP eZContentObject::clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObject的用法示例。


在下文中一共展示了eZContentObject::clearCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 static function process()
 {
     $limit = 100;
     $offset = 0;
     $availableHandlers = eZNotificationEventFilter::availableHandlers();
     do {
         $eventList = eZNotificationEvent::fetchUnhandledList(array('offset' => $offset, 'length' => $limit));
         foreach ($eventList as $event) {
             $db = eZDB::instance();
             $db->begin();
             foreach ($availableHandlers as $handler) {
                 if ($handler === false) {
                     eZDebug::writeError("Notification handler does not exist: {$handlerKey}", __METHOD__);
                 } else {
                     $handler->handle($event);
                 }
             }
             $itemCountLeft = eZNotificationCollectionItem::fetchCountForEvent($event->attribute('id'));
             if ($itemCountLeft == 0) {
                 $event->remove();
             } else {
                 $event->setAttribute('status', eZNotificationEvent::STATUS_HANDLED);
                 $event->store();
             }
             $db->commit();
         }
         eZContentObject::clearCache();
     } while (count($eventList) == $limit);
     // If less than limit, we're on the last iteration
     eZNotificationCollection::removeEmpty();
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:eznotificationeventfilter.php

示例2: runOperation

 function runOperation(&$node)
 {
     $object = $node->attribute('object');
     $object_id = $object->attribute('id');
     $objectLocales = $object->attribute('available_languages');
     // If the alternative locale does not exist for object, create it
     if (!in_array($this->altLocale, $objectLocales)) {
         // The only translation is in locate to be removed - create a version in another locale first.
         echo "Copying the single translation in " . $this->remLocale . " to " . $this->altLocale . " so former could be removed.\n";
         $newVersion = $object->createNewVersionIn($this->altLocale, $this->remLocale, 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);
     }
     // Change objects main language to alternative language, if its current main language is to be removed.
     if ($object->attribute('initial_language_code') == $this->remLocale) {
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
         echo "Switching initial language to {$this->altLocale} so that " . $this->remLocale . " could be removed.\n";
         $updateResult = eZContentOperationCollection::updateInitialLanguage($object_id, $this->altLangID);
         $object->store();
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
     }
     // Now it should be safe to remove translation.
     return $object->removeTranslation($this->remLangID);
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:27,代码来源:noderemovetranslation.php

示例3: 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

示例4: checkObjectVisibility

/**
 * @param array $contentObjectList
 */
function checkObjectVisibility ($contentObjectList)
{
    foreach ( array_keys($contentObjectList) as $index )
    {
        $contentObjectId  = $contentObjectList[$index]['contentobject_id'];

        echo "Checking visibility of object $contentObjectId\n";

        $articleContentObject = eZContentObject::fetch($contentObjectId);

        if ( $articleContentObject && $articleContentObject->attribute('class_identifier') === "article" )
            ObjectVisibilityManager::updateGlobalLimitation($articleContentObject);

        unset($articleContentObject);

        eZContentObject::clearCache();
    }
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:21,代码来源:updatevisibility.php

示例5: json_encode

        } else {
            $data['status'] = 'error';
            $data['message'] = "Attribute not found";
            $data['header'] = "HTTP/1.1 404 Not Found";
        }
    } else {
        $data['status'] = 'error';
        $data['message'] = "Current user can not edit object";
        $data['header'] = "HTTP/1.1 403 Forbidden";
    }
} else {
    $data['status'] = 'error';
    $data['message'] = "Object not found";
    $data['header'] = "HTTP/1.1 404 Not Found";
}
if ($data['status'] == 'success') {
    eZContentObject::clearCache(array($objectId));
    $object = eZContentObject::fetch($objectId);
    $attributes = $object->fetchAttributesByIdentifier(array($attributeIdentifier));
    $attribute = array_shift($attributes);
    $tpl = eZTemplate::factory();
    $datatypeString = $attribute->attribute('data_type_string');
    $tpl->setVariable('attribute', $attribute);
    $data['newValue'] = $tpl->fetch('design:content/datatype/view/' . $datatypeString . '.tpl');
    unset($data['message']);
}
header($data['header']);
unset($data['header']);
header('Content-Type: application/json');
echo json_encode($data);
eZExecution::cleanExit();
开发者ID:OpencontentCoop,项目名称:ocoperatorscollection,代码行数:31,代码来源:attribute.php

示例6: createMobileSitemap

 public static function createMobileSitemap()
 {
     eZDebug::writeDebug("Generating mobile sitemap ...", __METHOD__);
     $cli = eZCLI::instance();
     if (!$isQuiet) {
         $cli->output("Generating mobile sitemap for siteaccess " . $GLOBALS['eZCurrentAccess']['name'] . " \n");
     }
     $ini = eZINI::instance('site.ini');
     $xrowsitemapINI = eZINI::instance('xrowsitemap.ini');
     // Get the Sitemap's root node
     $rootNode = self::rootNode();
     // Settings variables
     if ($xrowsitemapINI->hasVariable('MobileSitemapSettings', 'ClassFilterType') and $xrowsitemapINI->hasVariable('MobileSitemapSettings', 'ClassFilterArray')) {
         $params2 = array('ClassFilterType' => $xrowsitemapINI->variable('MobileSitemapSettings', 'ClassFilterType'), 'ClassFilterArray' => $xrowsitemapINI->variable('MobileSitemapSettings', 'ClassFilterArray'));
     }
     $max = self::MAX_PER_FILE;
     $limit = 50;
     // Fetch the content tree
     $params = array('SortBy' => array(array('depth', true), array('published', true)));
     if (isset($params2)) {
         $params = array_merge($params, $params2);
     }
     $subtreeCount = eZContentObjectTreeNode::subTreeCountByNodeID($params, $rootNode->NodeID);
     if ($subtreeCount == 1) {
         $cli->output("No Items found under RootNode {$rootNode->NodeID}.");
     }
     if (!$isQuiet) {
         $amount = $subtreeCount + 1;
         // +1 is root node
         $cli->output("Adding {$amount} nodes to the sitemap for RootNode {$rootNode->NodeID}.");
         $output = new ezcConsoleOutput();
         $bar = new ezcConsoleProgressbar($output, $amount);
     }
     $addPrio = false;
     if ($xrowsitemapINI->hasVariable('Settings', 'AddPriorityToSubtree') and $xrowsitemapINI->variable('Settings', 'AddPriorityToSubtree') == 'true') {
         $addPrio = true;
     }
     $sitemap = new xrowMobileSitemap();
     // Generate Sitemap
     /** START Adding the root node **/
     $object = $rootNode->object();
     $meta = xrowMetaDataFunctions::fetchByObject($object);
     $extensions = array();
     $extensions[] = new xrowSitemapItemModified($rootNode->attribute('modified_subnode'));
     $url = $rootNode->attribute('url_alias');
     eZURI::transformURI($url);
     if ($xrowsitemapINI->hasVariable('SitemapSettings', 'MobileDomainName') && $xrowsitemapINI->hasVariable('SitemapSettings', 'MobileDomainName') != '') {
         $mobileDomain = $xrowsitemapINI->variable('SitemapSettings', 'MobileDomainName');
     } else {
         $mobileDomain = self::domain();
     }
     $url = 'http://' . $mobileDomain . $url;
     if ($meta and $meta->sitemap_use != '0') {
         $extensions[] = new xrowSitemapItemFrequency($meta->change);
         $extensions[] = new xrowSitemapItemPriority($meta->priority);
         $sitemap->add($url, $extensions);
     } elseif ($meta === false and $xrowsitemapINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
         if ($addPrio) {
             $extensions[] = new xrowSitemapItemPriority('1');
         }
         $sitemap->add($url, $extensions);
     }
     if (isset($bar)) {
         $bar->advance();
     }
     /** END Adding the root node **/
     $max = min($max, $subtreeCount);
     $params['Limit'] = min($max, $limit);
     $params['Offset'] = 0;
     while ($params['Offset'] < $max) {
         $nodeArray = eZContentObjectTreeNode::subTreeByNodeID($params, $rootNode->NodeID);
         foreach ($nodeArray as $subTreeNode) {
             eZContentLanguage::expireCache();
             $meta = xrowMetaDataFunctions::fetchByNode($subTreeNode);
             $extensions = array();
             $extensions[] = new xrowSitemapItemModified($subTreeNode->attribute('modified_subnode'));
             $url = $subTreeNode->attribute('url_alias');
             eZURI::transformURI($url);
             $url = 'http://' . $mobileDomain . $url;
             if ($meta and $meta->sitemap_use != '0') {
                 $extensions[] = new xrowSitemapItemFrequency($meta->change);
                 $extensions[] = new xrowSitemapItemPriority($meta->priority);
                 $sitemap->add($url, $extensions);
             } elseif ($meta === false and $xrowsitemapINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
                 if ($addPrio) {
                     $rootDepth = $rootNode->attribute('depth');
                     $prio = 1 - ($subTreeNode->attribute('depth') - $rootDepth) / 10;
                     if ($prio > 0) {
                         $extensions[] = new xrowSitemapItemPriority($prio);
                     }
                 }
                 $sitemap->add($url, $extensions);
             }
             if (isset($bar)) {
                 $bar->advance();
             }
         }
         eZContentObject::clearCache();
         $params['Offset'] += $params['Limit'];
     }
//.........这里部分代码省略.........
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:101,代码来源:xrowsitemaptools.php

示例7: array

         $childResponse['url'] = 'content/view/full/' . $childResponse['node_id'];
     }
     eZURI::transformURI($childResponse['url']);
     $childResponse['modified_subnode'] = $child->ModifiedSubNode;
     $childResponse['languages'] = $childObject->availableLanguages();
     $childResponse['is_hidden'] = $child->IsHidden;
     $childResponse['is_invisible'] = $child->IsInvisible;
     if ($createHereMenu == 'full') {
         $childResponse['class_list'] = array();
         foreach ($child->canCreateClassList() as $class) {
             $childResponse['class_list'][] = $class['id'];
         }
     }
     $response['children'][] = $childResponse;
     unset($object);
     eZContentObject::clearCache();
 }
 $httpCharset = eZTextCodec::httpCharset();
 $jsonText = arrayToJSON($response);
 $codec = eZTextCodec::instance($httpCharset, 'unicode');
 $jsonTextArray = $codec->convertString($jsonText);
 $jsonText = '';
 foreach ($jsonTextArray as $character) {
     if ($character < 128) {
         $jsonText .= chr($character);
     } else {
         $jsonText .= '\\u' . str_pad(dechex($character), 4, '0000', STR_PAD_LEFT);
     }
 }
 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
 header('Cache-Control: cache, max-age=' . MAX_AGE . ', post-check=' . MAX_AGE . ', pre-check=' . MAX_AGE);
开发者ID:stevoland,项目名称:ez_patch,代码行数:31,代码来源:treemenu.php

示例8: installContentObjects

    function installContentObjects( $objectNodes, $topNodeListNode, &$installParameters )
    {
        if ( isset( $installParameters['user_id'] ) )
            $userID = $installParameters['user_id'];
        else
            $userID = eZUser::currentUserID();

        $handlerType = $this->handlerType();
        $firstInstalledID = null;

        foreach( $objectNodes as $objectNode )
        {
            $realObjectNode = $this->getRealObjectNode( $objectNode );

            // Cycle until we reach an element where error has occured.
            // If action has been choosen, try install this item again, else skip it.
            if ( isset( $installParameters['error']['error_code'] ) &&
                 !$this->isErrorElement( $realObjectNode->getAttribute( 'remote_id' ), $installParameters ) )
            {
                continue;
            }

            //we are here, it means we'll try to install some object.
            if ( !$firstInstalledID )
            {
                $firstInstalledID = $realObjectNode->getAttribute( 'remote_id' );
            }

            $newObject = eZContentObject::unserialize( $this->Package, $realObjectNode, $installParameters, $userID, $handlerType );
            if ( !$newObject )
            {
                return false;
            }

            if ( is_object( $newObject ) )
            {
                eZContentObject::clearCache( $newObject->attribute( 'id' ) );
                unset( $newObject );
            }
            unset( $realObjectNode );

            if ( isset( $installParameters['error'] ) && count( $installParameters['error'] ) )
            {
                $installParameters['error'] = array();
            }
        }

        $this->installSuspendedNodeAssignment( $installParameters );
        $this->installSuspendedObjectRelations( $installParameters );

        // Call postUnserialize on all installed objects
        foreach( $objectNodes as $objectNode )
        {
            if ( $objectNode->localName == 'object' )
            {
                $remoteID = $objectNode->getAttribute( 'remote_id' );
            }
            else
            {
                $remoteID = substr( $objectNode->getAttribute( 'filename' ), 7, 32 );
            }

            // Begin from the object that we started from in the previous cycle
            if ( $firstInstalledID && $remoteID != $firstInstalledID )
            {
                continue;
            }
            else
            {
                $firstInstalledID = null;
            }

            $object = eZContentObject::fetchByRemoteID( $remoteID );
            if ( is_object( $object ) )
            {
                $object->postUnserialize( $this->Package );
                eZContentObject::clearCache( $object->attribute( 'id' ) );
            }
            unset( $object );
        }

        return true;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:83,代码来源:ezcontentobjectpackagehandler.php

示例9: removeSubtrees


//.........这里部分代码省略.........
             // to remove the current main node.
             if ($node->attribute('main_node_id') == $nodeID) {
                 if (count($allAssignedNodes) > 1) {
                     foreach ($allAssignedNodes as $assignedNode) {
                         $assignedNodeID = $assignedNode->attribute('node_id');
                         if ($assignedNodeID == $nodeID) {
                             continue;
                         }
                         $newMainNodeID = $assignedNodeID;
                         break;
                     }
                 }
             }
             if ($infoOnly) {
                 // Find the number of items in the subtree we are allowed to remove
                 // if this differs from the total count it means we have items we cannot remove
                 // We do this by fetching the limitation list for content/remove
                 // and passing it to the subtree count function.
                 $currentUser = eZUser::currentUser();
                 $accessResult = $currentUser->hasAccessTo('content', 'remove');
                 if ($accessResult['accessWord'] == 'limited') {
                     $limitationList = $accessResult['policies'];
                     $removeableChildCount = $node->subTreeCount(array('Limitation' => $limitationList, 'IgnoreVisibility' => true));
                     $canRemoveSubtree = $removeableChildCount == $childCount;
                     $canRemove = $canRemoveSubtree;
                 }
                 //check if there is sub object in pending status
                 $limitCount = 100;
                 $offset = 0;
                 while (1) {
                     $children = $node->subTree(array('Limitation' => array(), 'SortBy' => array('path', false), 'Offset' => $offset, 'Limit' => $limitCount, 'IgnoreVisibility' => true, 'AsObject' => false));
                     // fetch pending node assignment(pending object)
                     $idList = array();
                     //add node itself into idList
                     if ($offset === 0) {
                         $idList[] = $nodeID;
                     }
                     foreach ($children as $child) {
                         $idList[] = $child['node_id'];
                     }
                     if (count($idList) === 0) {
                         break;
                     }
                     $pendingChildCount = eZNodeAssignment::fetchChildCountByVersionStatus($idList, eZContentObjectVersion::STATUS_PENDING);
                     if ($pendingChildCount !== 0) {
                         // there is pending object
                         $hasPendingObject = true;
                         break;
                     }
                     $offset += $limitCount;
                 }
             }
             // We will only remove the subtree if are allowed
             // and are told to do so.
             if ($canRemove and !$infoOnly) {
                 $moveToTrashTemp = $moveToTrash;
                 if (!$moveToTrashAllowed) {
                     $moveToTrashTemp = false;
                 }
                 // Remove children, fetching them by 100 to avoid memory overflow.
                 // removeNodeFromTree -> removeThis handles cache clearing
                 while (1) {
                     // We should remove the latest subitems first,
                     // so we should fetch subitems sorted by 'path_string' DESC
                     $children = $node->subTree(array('Limitation' => array(), 'SortBy' => array('path', false), 'Limit' => 100, 'IgnoreVisibility' => true));
                     if (!$children) {
                         break;
                     }
                     foreach ($children as $child) {
                         $child->removeNodeFromTree($moveToTrashTemp);
                         eZContentObject::clearCache();
                     }
                 }
                 $node->removeNodeFromTree($moveToTrashTemp);
             }
         }
         if (!$canRemove) {
             $canRemoveAll = false;
         }
         // Do not create info list if we are removing subtrees
         if (!$infoOnly) {
             continue;
         }
         $soleNodeCount = $node->subtreeSoleNodeCount();
         $totalLoneNodeCount += $soleNodeCount;
         if ($objectNodeCount <= 1) {
             ++$totalLoneNodeCount;
         }
         $item = array("nodeName" => $nodeName, "childCount" => $childCount, "additionalWarning" => '', 'node' => $node, 'object' => $object, 'class' => $class, 'node_name' => $nodeName, 'child_count' => $childCount, 'object_node_count' => $objectNodeCount, 'sole_node_count' => $soleNodeCount, 'can_remove' => $canRemove, 'can_remove_subtree' => $canRemoveSubtree, 'real_child_count' => $readableChildCount, 'new_main_node_id' => $newMainNodeID);
         $deleteResult[] = $item;
     }
     $db->commit();
     if (!$infoOnly) {
         return true;
     }
     if ($moveToTrashAllowed and $totalLoneNodeCount == 0) {
         $moveToTrashAllowed = false;
     }
     return array('move_to_trash' => $moveToTrashAllowed, 'total_child_count' => $totalChildCount, 'can_remove_all' => $canRemoveAll, 'delete_list' => $deleteResult, 'has_pending_object' => $hasPendingObject, 'reverse_related_count' => eZContentObjectTreeNode::reverseRelatedCount($deleteIDArray));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezcontentobjecttreenode.php

示例10: doDeliveries

 function doDeliveries($quiet = false)
 {
     $cli = eZCLI::instance();
     $issueLimit = 5;
     // Number of issues the script will process each time
     $deliveredCount = 0;
     $deliveryLimit = 200;
     // Number of deliveries the script will do each time. Should be multiples of 50
     $newsletterIni = eZINI::instance('jajnewsletter.ini');
     $newsletterIssuesNodeID = $newsletterIni->variable('ContentSettings', 'NewsletterIssuesNode');
     $subscriptionUsersNodeID = $newsletterIni->variable('ContentSettings', 'SubscriptionUsersNode');
     $fromName = $newsletterIni->variable('NewsletterSettings', 'FromName');
     $fromEmail = $newsletterIni->variable('NewsletterSettings', 'FromEmail');
     $replyTo = $newsletterIni->variable('NewsletterSettings', 'ReplyTo');
     // Get list of newsletter issues with status In Progress
     //$newsletterIssues =& eZContentObjectTreeNode::subTreeByNodeID(
     $newsletterIssues =& eZContentObjectTreeNode::subTree(array('ClassFilterType' => 'include', 'ClassFilterArray' => array('newsletter_issue'), 'AttributeFilter' => array(array('newsletter_issue/status', '=', JAJ_NEWSLETTER_ISSUE_STATUS_PENDING)), 'Limit' => $issueLimit), $newsletterIssuesNodeID);
     if (!$quiet) {
         $cli->output('Newsletter issues awating delivery: ' . count($newsletterIssues) . ' (' . $issueLimit . ' max)');
     }
     foreach ($newsletterIssues as $issue) {
         // Get newsletter and prepare
         $issueObject = $issue->object();
         $issueDatamap = $issueObject->dataMap();
         $newsletterSubject = $issueDatamap['subject']->content();
         if (!$quiet) {
             $cli->output();
             $cli->output('Delivering newsletter \'' . $newsletterSubject . '\' (Object id: ' . $issueObject->ID . ')');
         }
         $newsletterBody = JAJNewsletterOperations::prepareNewsletterIssue($issueObject);
         if ($newsletterBody == false) {
             if (!$quiet) {
                 $cli->notice('Failed to generate newsletter \'' . $newsletterSubject . '\' (Object id: ' . $issueObject->ID . ')');
             }
             continue;
         }
         // Go though users in delivery que in batch and deliver newsletter
         $userLimit = 50;
         while (true) {
             // Get users in delivery que for current newsletteer
             // TODO: Should only get items where jajdelivery.tstamp > 1 hour or something
             //$userNodes =& eZContentObjectTreeNode::subTreeByNodeID(
             $userNodes =& eZContentObjectTreeNode::subTree(array('ClassFilterType' => 'include', 'ClassFilterArray' => array('subscription_user'), 'ExtendedAttributeFilter' => array(id => 'jajdeliveryfilter', params => array('newsletter_object_id' => $issueObject->ID, 'status' => array(JAJ_NEWSLETTER_DELIVERY_STATUS_PENDING))), 'Limit' => $userLimit, 'Limitation' => array()), $subscriptionUsersNodeID);
             $userCount = count($userNodes);
             if (!$quiet) {
                 $cli->output('     Users found for batch delivery: ' . $userCount . ' (' . $userLimit . ' max in batch)');
             }
             foreach ($userNodes as $userNode) {
                 $userObject = $userNode->object();
                 $userDatamap = $userObject->dataMap();
                 $userEmail = $userDatamap['email']->content();
                 if (!$quiet) {
                     $cli->output('     Delivereing to: ' . $userEmail, false);
                 }
                 $htmlNewsletter = $newsletterBody['html'];
                 $plainNewsletter = $newsletterBody['plain'];
                 $htmlNewsletter = str_replace("__remote_id", $userObject->remoteID(), $htmlNewsletter);
                 $htmlNewsletter = str_replace("__object_id", $userObject->ID, $htmlNewsletter);
                 $plainNewsletter = str_replace("__remote_id", $userObject->remoteID(), $plainNewsletter);
                 $plainNewsletter = str_replace("__object_id", $userObject->ID, $plainNewsletter);
                 $newsletterDeliveryResult = JAJNewsletterOperations::deliver($newsletterSubject, $htmlNewsletter, $plainNewsletter, $fromName, $fromEmail, $replyTo, $userEmail);
                 $deliveryResult = JAJDelivery::fetchDelivery($issueObject->ID, $userObject->ID);
                 $delivery = $deliveryResult['result'];
                 $delivery->setAttribute('tstamp', time());
                 if ($newsletterDeliveryResult) {
                     if (!$quiet) {
                         $cli->output(' => OK');
                     }
                     $delivery->setAttribute('status', JAJ_NEWSLETTER_DELIVERY_STATUS_SENT);
                 } else {
                     $tries = $delivery->attribute('tries') + 1;
                     $delivery->setAttribute('tries', $tries);
                     if ($tries >= 3) {
                         $delivery->setAttribute('status', JAJ_NEWSLETTER_DELIVERY_STATUS_FAILED);
                     }
                     if (!$quiet) {
                         $cli->output(' => FAILED, tries: ' . $tries);
                     }
                 }
                 $delivery->sync();
                 $deliveredCount++;
             }
             eZContentObject::clearCache();
             if ($userCount < $userLimit || $deliveredCount >= $deliveryLimit) {
                 break;
             }
         }
         if ($deliveredCount >= $deliveryLimit) {
             if (!$quiet) {
                 $cli->output('Reached delivery limit for script (' . $deliveredCount . '/' . $deliveryLimit . ')');
             }
             break;
         }
         // Change status to archived if delivery que for newsletter is empty
         if (JAJDelivery::emptyDeliveryQue($issueObject->ID)) {
             if (!$quiet) {
                 $cli->output('Delivery que for newsletter empty, changing status to archived');
             }
             $status = $issueDatamap["status"];
             $status->setAttribute('data_text', JAJ_NEWSLETTER_ISSUE_STATUS_ARCHIVED);
//.........这里部分代码省略.........
开发者ID:jjohnsen,项目名称:jajnewsletter,代码行数:101,代码来源:jajnewsletteroperations.php

示例11: flush

 /**
  * Will clear current content object cache and reset dataMap.
  * Avoids useless memory consumption and allows to "refresh" content object.
  * Warning ! Further call to object attributes will do new DB queries.
  * @see eZContentObject::clearCache()
  * @see eZContentObject::resetDataMap()
  */
 public function flush()
 {
     if ($this->contentObject instanceof eZContentObject) {
         $objectID = $this->contentObject->attribute('id');
         $this->contentObject->resetDataMap();
         eZContentObject::clearCache(array($objectID));
     }
 }
开发者ID:nicolasaguenot,项目名称:sqliimport,代码行数:15,代码来源:sqlicontent.php

示例12: run

 public function run($remove = false, $useStateHashes = true, $update = true, $create = true)
 {
     $contentClass = $this->config->getContentClass();
     $allOjectsInFeedRemoteIDs = array();
     $dataList = $this->config->getDataList();
     $dataListCount = count($dataList);
     if ($dataListCount > 0) {
         foreach ($dataList as $key => &$objectData) {
             $memoryUsage = number_format(memory_get_usage(true) / (1024 * 1024), 2);
             $this->debug(number_format($key / $dataListCount * 100, 2) . '% (' . ($key + 1) . '/' . $dataListCount . '), Memory usage: ' . $memoryUsage . ' Mb', array('red'));
             $objectData['remoteID'] = $this->config->getObjectRemoteID($objectData);
             $objectData['mainParentNodeID'] = $this->config->getMainParentNodeID($objectData);
             $objectData['adittionalParentNodeIDs'] = (array) $this->config->getAdittionalParentNodeIDs($objectData);
             $objectData['attributes'] = (array) $this->config->transformObjectAttributes($objectData);
             $objectData['language'] = $this->config->getLanguage($objectData);
             $objectData['versionStatus'] = $this->config->getVersionStatus($objectData);
             $objectData['mainNodePriority'] = $this->config->getMainNodePriority($objectData);
             $objectData['visibility'] = $this->config->isVisible($objectData);
             $currentStateHash = $this->config->getStateHash($objectData);
             $allOjectsInFeedRemoteIDs[] = $objectData['remoteID'];
             $object = eZContentObject::fetchByRemoteID($objectData['remoteID']);
             $result = $this->config->preProcessCallback($object, $objectData);
             if ($result === false) {
                 $this->debug('[Skipped by preProcessCallback] Remote ID: "' . $objectData['remoteID'] . '"', array('blue'));
                 $this->skip($object, $objectData);
                 continue;
             }
             $skipped = false;
             if ($object instanceof eZContentObject) {
                 if ($update === false) {
                     $this->debug('[Skipped] "' . $object->attribute('name') . '"', array('blue'));
                     $this->skip($object, $objectData);
                     $skipped = true;
                 } else {
                     $storedStateHash = nxcImportStateHash::get($objectData['remoteID']);
                     if ($currentStateHash == $storedStateHash && $useStateHashes === true) {
                         $this->debug('[Skipped] "' . $object->attribute('name') . '" (Node ID: ' . $object->attribute('main_node_id') . ')', array('blue'));
                         $this->skip($object, $objectData);
                         $skipped = true;
                     } else {
                         $parentNode = false;
                         if ($objectData['mainParentNodeID'] !== false) {
                             $parentNode = eZContentObjectTreeNode::fetch($objectData['mainParentNodeID']);
                         }
                         if ($objectData['mainParentNodeID'] !== false && $parentNode instanceof eZContentObjectTreeNode === false) {
                             $this->remove($object, $objectData);
                             nxcImportStateHash::remove($object->attribute('remote_id'));
                             $this->pcHandler->removeObject($object);
                         } else {
                             $params = array('object' => $object, 'attributes' => $objectData['attributes'], 'additionalParentNodeIDs' => $objectData['adittionalParentNodeIDs'], 'visibility' => (bool) $objectData['visibility']);
                             if ($objectData['mainParentNodeID'] !== false) {
                                 $params['parentNode'] = $parentNode;
                             }
                             $this->pcHandler->updateObject($params);
                             $this->update($object, $objectData);
                             nxcImportStateHash::update($objectData['remoteID'], $currentStateHash);
                             $object->resetDataMap();
                             eZContentObject::clearCache($object->attribute('id'));
                         }
                     }
                 }
             } else {
                 if ($create === false) {
                     $this->debug('[Skipped]', array('blue'));
                     $this->skip($object, $objectData);
                     $skipped = true;
                 } else {
                     $object = $this->pcHandler->createObject(array('class' => $contentClass, 'parentNodeID' => $objectData['mainParentNodeID'], 'attributes' => $objectData['attributes'], 'remoteID' => $objectData['remoteID'], 'additionalParentNodeIDs' => $objectData['adittionalParentNodeIDs'], 'languageLocale' => isset($objectData['language']) ? $objectData['language'] : false, 'visibility' => (bool) $objectData['visibility']));
                     if ($object instanceof eZContentObject) {
                         $this->create($object, $objectData);
                         nxcImportStateHash::update($objectData['remoteID'], $currentStateHash);
                         if ($objectData['mainNodePriority'] !== false) {
                             $mainNode = $object->attribute('main_node');
                             $mainNode->setAttribute('priority', $objectData['mainNodePriority']);
                             $mainNode->store();
                         }
                         $object->resetDataMap();
                         eZContentObject::clearCache($object->attribute('id'));
                     }
                 }
             }
             $this->config->postProcessCallback($object, $objectData, $skipped);
         }
         $allOjectsInFeedRemoteIDs = array_unique($allOjectsInFeedRemoteIDs);
         if ($remove && count($allOjectsInFeedRemoteIDs) > 0) {
             $publishedObjects = $contentClass->objectList();
             foreach ($publishedObjects as $object) {
                 if (in_array($object->attribute('remote_id'), $allOjectsInFeedRemoteIDs) === false) {
                     $this->remove($object, $objectData);
                     nxcImportStateHash::remove($object->attribute('remote_id'));
                     $this->pcHandler->removeObject($object);
                 }
             }
         }
     }
 }
开发者ID:nxc,项目名称:nxc_import,代码行数:96,代码来源:controller.php

示例13: fetchNodeAndAppFromCourseId

    /**
     * @param $courseId
     * @return array
     */
    protected static function fetchNodeAndAppFromCourseId( $courseId )
    {
        $nodeList = eZFunctionHandler::execute( 'content', 'tree', array(
            'parent_node_id' => 2,
            'attribute_filter' => array(
                array(
                    'article/publisher_internal_id',
                    '=',
                    $courseId
                )
            ),
            'class_filter_type' => 'include',
            'class_filter_array' => array(
                'article'
            ),
            'main_node_only' => false,
        ) );

        foreach ( $nodeList as $node )
        {
            $application = NodeTool::getApplicationFromNode($node);

            if ( $application )
            {
                $isCertificate = SolrSafeOperatorHelper::getCustomParameter( $application, 'HasCertificates', 'application' );

                if ( $isCertificate )
                {
                    eZContentObject::clearCache();
                    return array(
                        'application' => $application,
                        'node' => $node,
                    );
                }
            }
        }
        eZContentObject::clearCache();
        return false;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:43,代码来源:mycertificates.php

示例14: viewCacheClear

 /**
  * Clears view cache for imported content objects.
  * ObjectIDs are stored in 'ezpending_actions' table, with {@link SQLIContent::ACTION_CLEAR_CACHE} action
  */
 public static function viewCacheClear()
 {
     $db = eZDB::instance();
     $isCli = isset($_SERVER['argv']);
     $output = null;
     $progressBar = null;
     $i = 0;
     $conds = array('action' => SQLIContent::ACTION_CLEAR_CACHE);
     $limit = array('offset' => 0, 'length' => 50);
     $count = (int) eZPersistentObject::count(eZPendingActions::definition(), $conds);
     if ($isCli && $count > 0) {
         // Progress bar implementation
         $output = new ezcConsoleOutput();
         $output->outputLine('Starting to clear view cache for imported objects...');
         $progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
         $progressBar = new ezcConsoleProgressbar($output, $count, $progressBarOptions);
         $progressBar->start();
     }
     /*
      * To avoid fatal errors due to memory exhaustion, pending actions are fetched by packets
      */
     do {
         $aObjectsToClear = eZPendingActions::fetchObjectList(eZPendingActions::definition(), null, $conds, null, $limit);
         $jMax = count($aObjectsToClear);
         if ($jMax > 0) {
             for ($j = 0; $j < $jMax; ++$j) {
                 if ($isCli) {
                     $progressBar->advance();
                 }
                 $db->begin();
                 eZContentCacheManager::clearContentCacheIfNeeded((int) $aObjectsToClear[$j]->attribute('param'));
                 $aObjectsToClear[$j]->remove();
                 $db->commit();
                 $i++;
             }
         }
         unset($aObjectsToClear);
         eZContentObject::clearCache();
         if (eZINI::instance('site.ini')->variable('ContentSettings', 'StaticCache') == 'enabled') {
             $optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
             $options = new ezpExtensionOptions($optionArray);
             $staticCacheHandler = eZExtension::getHandlerClass($options);
             $staticCacheHandler::executeActions();
         }
     } while ($i < $count);
     if ($isCli && $count > 0) {
         $progressBar->finish();
         $output->outputLine();
     }
 }
开发者ID:lolautruche,项目名称:sqliimport,代码行数:54,代码来源:sqliimportutils.php

示例15: spreadGlobalLimitationChange

    /**
     * @param eZContentObjectTreeNode $parentNode
     * @param $isParentInvisible
     */
    public static function spreadGlobalLimitationChange( $parentNode, $isParentInvisible )
    {
        $db         = eZDB::instance();
        $childQuery = "SELECT contentobject_id FROM ezcontentobject_tree where depth='%s' and path_string='%s%%'";
        $children   = $db->arrayQuery(sprintf(
            $childQuery,
            $parentNode->attribute('depth') + 1,
            $parentNode->attribute('path_string')
        ));

        foreach( $children as $child )
        {
            $childObjectId = $child['contentobject_id'];
            $child         = eZContentObject::fetch($childObjectId);

            if ( $child instanceof eZContentObject )
                self::updateGlobalLimitation($childObjectId, $isParentInvisible);

            unset($child);
            eZContentObject::clearCache(array($childObjectId));
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:26,代码来源:objectVisibilityManager.php


注:本文中的eZContentObject::clearCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。