/** * Invokes the plugin specific code. * * @return string * @throws Stagehand_LegacyError_PEARErrorStack_Exception */ public function invoke() { $this->_prepareContinuation(); Piece_Unity_Service_Continuation::setFlowExecutionTicketKey($this->flowExecutionTicketKey); self::$_flowID = $this->context->getOriginalScriptName(); Piece_Flow_Action_Factory::setActionDirectory($this->actionDirectory); $viewElement = $this->context->viewElement; $viewElement->setElement('__flowExecutionTicketKey', Piece_Unity_Service_Continuation::getFlowExecutionTicketKey()); try { $flowExecutionTicket = $this->_continuationServer->invoke($this->context, $this->bindActionsWithFlowExecution); $viewString = $this->_continuationServer->getView(); } catch (Stagehand_LegacyError_PEARErrorStack_Exception $e) { if ($e->getCode() == PIECE_FLOW_ERROR_FLOW_EXECUTION_EXPIRED) { if ($this->useGCFallback) { $session = $this->context->getSession(); $session->setAttribute('_flowExecutionExpired', true); $this->context->sendHTTPStatus(302); return $this->gcFallbackURI; } } throw $e; } $this->context->viewElement->setElement('__flowExecutionTicket', $flowExecutionTicket); $session = $this->context->getSession(); $session->setPreloadCallback('_Dispatcher_Continuation_ActionLoader', array(__CLASS__, 'loadAction')); foreach (array_keys(Piece_Flow_Action_Factory::getInstances()) as $actionClass) { $session->addPreloadClass('_Dispatcher_Continuation_ActionLoader', $actionClass, $this->_continuationServer->getActiveFlowID()); } return $this->_prefixFlowNameToViewString($viewString); }
/** * Defines and initializes extension points and configuration points. * * @since Method available since Release 0.6.0 */ function _initialize() { $this->_addConfigurationPoint('actionDirectory'); $this->_addConfigurationPoint('enableSingleFlowMode', false); // deprecated $this->_addConfigurationPoint('cacheDirectory'); $this->_addConfigurationPoint('flowDefinitions', array()); // deprecated $this->_addConfigurationPoint('flowExecutionTicketKey', '_flowExecutionTicket'); $this->_addConfigurationPoint('flowNameKey', '_flow'); // deprecated $this->_addConfigurationPoint('flowName'); // deprecated $this->_addConfigurationPoint('bindActionsWithFlowExecution', true); $this->_addConfigurationPoint('enableGC', false); $this->_addConfigurationPoint('gcExpirationTime', 1440); $this->_addConfigurationPoint('useGCFallback', false); $this->_addConfigurationPoint('gcFallbackURL'); // deprecated $this->_addConfigurationPoint('useFlowMappings', false); $this->_addConfigurationPoint('flowMappings', array()); $this->_addConfigurationPoint('configDirectory'); $this->_addConfigurationPoint('configExtension', '.flow'); $this->_addConfigurationPoint('useFullFlowNameAsViewPrefix', true); $this->_addConfigurationPoint('gcFallbackURI', $this->_getConfiguration('gcFallbackURL')); Piece_Unity_Service_Continuation::setFlowExecutionTicketKey($this->_getConfiguration('flowExecutionTicketKey')); $GLOBALS['PIECE_UNITY_Continuation_FlowIDKey'] = $this->_getConfiguration('flowNameKey'); if ($this->_getConfiguration('useFlowMappings')) { $GLOBALS['PIECE_UNITY_Continuation_FlowID'] = $this->_context->getOriginalScriptName(); } else { $GLOBALS['PIECE_UNITY_Continuation_FlowID'] = $this->_getConfiguration('flowName'); } Piece_Flow_Action_Factory::setActionDirectory($this->_getConfiguration('actionDirectory')); $viewElement =& $this->_context->getViewElement(); $viewElement->setElement('__flowExecutionTicketKey', Piece_Unity_Service_Continuation::getFlowExecutionTicketKey()); $viewElement->setElement('__flowNameKey', $GLOBALS['PIECE_UNITY_Continuation_FlowIDKey']); }