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


PHP Setup::GetLogger方法代码示例

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


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

示例1: RunWorkflow

 public function RunWorkflow($key)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Constructing the PreProcessor]", \PEAR_LOG_DEBUG);
     $preProcessor = new \Swiftriver\Core\PreProcessing\PreProcessor();
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Constructing the PreProcessor]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Listing all preprocessors]", \PEAR_LOG_DEBUG);
     $steps = $preProcessor->ListAllAvailablePreProcessingSteps();
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Listing all preprocessors]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Finding out which are active]", \PEAR_LOG_DEBUG);
     //Get the currently configured steps
     $config = \Swiftriver\Core\Setup::PreProcessingStepsConfiguration();
     $activeSteps = $config->PreProcessingSteps;
     if ($activeSteps != null && is_array($activeSteps) && $steps != null && is_array($steps)) {
         foreach ($activeSteps as $activeStep) {
             foreach ($steps as $step) {
                 if ($step->Name() == $activeStep->name) {
                     $step->active = true;
                 }
             }
         }
     }
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Finding out which are active]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Encoding results to JSON]", \PEAR_LOG_DEBUG);
     $json = parent::ParseStepsToJson($steps);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Encoding results to JSON]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
     return parent::FormatReturn($json);
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:30,代码来源:ListAllPreProcessingSteps.php

示例2: RunQuery

 /**
  * Function that when called with appropriate json will
  * initiate an Analytics call that may return data that
  * can be used by the calling class.
  *
  * @param string $json
  * @param string $key
  * @return string
  */
 public function RunQuery($json, $key)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [Method invoked]", \PEAR_LOG_INFO);
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [START: Parsing input JSON]", \PEAR_LOG_DEBUG);
     try {
         $requestType = parent::ParseJSONToRequestType($json);
         $parameters = parent::ParseJSONToRequestParameters($json);
         $request = new \Swiftriver\Core\Analytics\AnalyticsRequest();
         $request->RequestType = $requestType;
         $request->Parameters = $parameters;
     } catch (\Exception $e) {
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [An Exception was thrown]", \PEAR_LOG_ERR);
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [{$e}]", \PEAR_LOG_ERR);
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [Method finished]", \PEAR_LOG_INFO);
         return parent::FormatErrorMessage("An exception was thrown: " . $e->getMessage());
     }
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [END: Parsing input JSON]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [START: Running Analytics Query]", \PEAR_LOG_DEBUG);
     try {
         $analyticsEngine = new \Swiftriver\Core\Analytics\AnalyticsEngine();
         $response = $analyticsEngine->RunAnalyticsRequest($request);
         $return = \json_encode($response->Result);
     } catch (\Exception $e) {
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [An Exception was thrown]", \PEAR_LOG_ERR);
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [{$e}]", \PEAR_LOG_ERR);
         $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [Method finished]", \PEAR_LOG_INFO);
         return parent::FormatErrorMessage("An exception was thrown: " . $e->getMessage());
     }
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [END: Running Analytics Query]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::Analaytics::RunAnalyticsQuery::RunQuery [Method finished]", \PEAR_LOG_INFO);
     return parent::FormatReturn($return);
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:42,代码来源:RunAnalyticsQuery.php

示例3: ReturnAllAvailableParsers

 public static function ReturnAllAvailableParsers()
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [Method invoked]", \PEAR_LOG_DEBUG);
     $parsers = array();
     $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [START: Directory Itteration]", \PEAR_LOG_DEBUG);
     $dirItterator = new \RecursiveDirectoryIterator(dirname(__FILE__) . "/Parsers/");
     $iterator = new \RecursiveIteratorIterator($dirItterator, \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $file) {
         if ($file->isFile()) {
             $filePath = $file->getPathname();
             if (strpos($filePath, ".php") && !strpos($filePath, "IParser")) {
                 try {
                     $typeString = "\\Swiftriver\\Core\\Modules\\SiSPS\\Parsers\\" . $file->getFilename();
                     $type = str_replace(".php", "", $typeString);
                     $object = new $type();
                     if ($object instanceof Parsers\IParser) {
                         $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [Adding type {$type}]", \PEAR_LOG_DEBUG);
                         $parsers[] = $object;
                     }
                 } catch (\Exception $e) {
                     $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [error adding type {$type}]", \PEAR_LOG_DEBUG);
                     $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [{$e}]", \PEAR_LOG_ERR);
                     continue;
                 }
             }
         }
     }
     $logger->log("Core::Modules::SiSPS::ParserFactory::ReturnAllAvailableParsers [END: Directory Itteration]", \PEAR_LOG_DEBUG);
     return $parsers;
 }
开发者ID:katembu,项目名称:Swiftriver,代码行数:31,代码来源:ParserFactory.php

示例4: RunService

 /**
  * Activates the channel processing job
  *
  * @param string $json
  * @return string $json
  */
 public function RunService($json)
 {
     //Setup the logger
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [Method invoked]", \PEAR_LOG_INFO);
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Parsing the JSON input]", \PEAR_LOG_DEBUG);
     //Parse the JSON input
     $channel = parent::ParseJSONToChannel($json);
     if (!isset($channel)) {
         $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [ERROR: Method ParseIncommingJSON returned null]", \PEAR_LOG_DEBUG);
         $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [ERROR: Registering new processing job with Core]", \PEAR_LOG_INFO);
         return parent::FormatErrorMessage("There were errors in you JSON. Please review the API documentation and try again.");
     }
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Parsing the JSON input]", \PEAR_LOG_DEBUG);
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Constructing Repository]", \PEAR_LOG_DEBUG);
     //Construct a new repository
     $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository();
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Constructing Repository]", \PEAR_LOG_DEBUG);
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Activatin Processing Job]", \PEAR_LOG_DEBUG);
     //Activate the channel processing job
     $repository->ActivateChannelProcessingJob($channel);
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Activating Processing Job]", \PEAR_LOG_DEBUG);
     $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [Method finished]", \PEAR_LOG_INFO);
     //return an OK messagae
     return parent::FormatMessage("OK");
 }
开发者ID:surflightroy,项目名称:SwiftriverCore,代码行数:32,代码来源:ActivateChannelProcessingJob.php

示例5: ListAllAvailablePreProcessingSteps

 /**
  * Returns all the classes that implment the IPreProcessor interface
  * @return IPreProcessingStep[]
  */
 public function ListAllAvailablePreProcessingSteps()
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::PreProcessing::PreProcessor::ListAllAvailablePreProcessingSteps [Method invoked]", \PEAR_LOG_DEBUG);
     $steps = array();
     $modulesDirectory = \Swiftriver\Core\Setup::Configuration()->ModulesDirectory;
     $dirItterator = new \RecursiveDirectoryIterator($modulesDirectory);
     $iterator = new \RecursiveIteratorIterator($dirItterator, \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $file) {
         if ($file->isFile()) {
             $filePath = $file->getPathname();
             if (strpos($filePath, "PreProcessingStep.php")) {
                 try {
                     include_once $filePath;
                     $typeString = "\\Swiftriver\\PreProcessingSteps\\" . $file->getFilename();
                     $type = str_replace(".php", "", $typeString);
                     $object = new $type();
                     if ($object instanceof IPreProcessingStep) {
                         $logger->log("Core::PreProcessing::PreProcessor::ListAllAvailablePreProcessingSteps [Adding type {$type}]", \PEAR_LOG_DEBUG);
                         $object->filePath = str_replace($modulesDirectory, "", $filePath);
                         $object->type = $type;
                         $steps[] = $object;
                     }
                 } catch (\Exception $e) {
                     $logger->log("Core::PreProcessing::PreProcessor::ListAllAvailablePreProcessingSteps [error adding type {$type}]", \PEAR_LOG_DEBUG);
                     $logger->log("Core::PreProcessing::PreProcessor::ListAllAvailablePreProcessingSteps [{$e}]", \PEAR_LOG_ERR);
                     continue;
                 }
             }
         }
     }
     $logger->log("Core::PreProcessing::PreProcessor::ListAllAvailablePreProcessingSteps [Method finished]", \PEAR_LOG_DEBUG);
     return $steps;
 }
开发者ID:katembu,项目名称:Swiftriver,代码行数:38,代码来源:PreProcessor.php

示例6: GetAndParse

 /**
  * Implementation of IParser::GetAndParse
  * @param \Swiftriver\Core\ObjectModel\Channel $channel
  * @return Swiftriver\Core\ObjectModel\Content[] contentItems
  */
 public function GetAndParse($channel)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [Method invoked]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [END: Extracting required parameters]", \PEAR_LOG_DEBUG);
     //Create the Content array
     $contentItems = array();
     switch ($channel->subType) {
         case "Remote":
             $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [START: Parsing SMS items from Remote API]", \PEAR_LOG_DEBUG);
             $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [START: Extracting required parameters]", \PEAR_LOG_DEBUG);
             //Extract the Server URL
             $serverURL = $channel->parameters["ServerURL"];
             if (!isset($serverURL)) {
                 $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [the parameter 'ServerURL' was not supplied. Returning null]", \PEAR_LOG_DEBUG);
                 $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [Method finished]", \PEAR_LOG_DEBUG);
                 return null;
             }
             $contentItems = $this->getRemoteContentItems($channel, $logger, $serverURL);
             $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [END: Parsing SMS items from Remote API]", \PEAR_LOG_DEBUG);
             break;
         case "Local":
             $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [START: Parsing SMS items from Local DB]", \PEAR_LOG_DEBUG);
             $contentItems = $this->getLocalContentItems($channel, $logger);
             $logger->log("Core::Modules::SiSPS::Parsers::FrontlineSMSParser::GetAndParse [END: Parsing SMS items from Local DB]", \PEAR_LOG_DEBUG);
             break;
     }
     //return the content array
     return $contentItems;
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:35,代码来源:FrontlineSMSParser.php

示例7: RunWorkflow

 public function RunWorkflow($key)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Constructing the Event Distributor]", \PEAR_LOG_DEBUG);
     $eventDistributer = new \Swiftriver\Core\EventDistribution\EventDistributor();
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Constructing the Event Distributor]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Getting a full list of Event Handlers from the event distributor]", \PEAR_LOG_DEBUG);
     $handlers = $eventDistributer->ListAllAvailableEventHandlers();
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Getting a full list of Event Handlers from the event distributor]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Finding out which event handlers are active]", \PEAR_LOG_DEBUG);
     $config = \Swiftriver\Core\Setup::EventDistributionConfiguration();
     $activeHandlers = $config->EventHandlers;
     if ($activeHandlers != null && is_array($activeHandlers) && $handlers != null && is_array($handlers)) {
         foreach ($activeHandlers as $activeHandler) {
             foreach ($handlers as $handler) {
                 if ($handler->Name() == $activeHandler->name) {
                     $handler->active = true;
                 }
             }
         }
     }
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Finding out which event handlers are active]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Parsing the handlers to JSON]", \PEAR_LOG_DEBUG);
     $json = parent::ParseHandlersToJson($handlers);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Parsing the handlers to JSON]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
     return parent::FormatReturn($json);
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:29,代码来源:ListAllEventHandlers.php

示例8: GetAndParse

 /**
  * Implementation of IParser::GetAndParse
  * @param \Swiftriver\Core\ObjectModel\Channel $channel
  * @param datetime $lassucess
  */
 public function GetAndParse($channel)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [Method invoked]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [START: Extracting required parameters]", \PEAR_LOG_DEBUG);
     //Extract the IMAP parameters
     $imapHostName = $channel->parameters["IMAPHostName"];
     $imapUserName = $channel->parameters["IMAPUserName"];
     $imapPassword = $channel->parameters["IMAPPassword"];
     if (!isset($imapHostName) || $imapHostName == "") {
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [the parameter 'IMAPHostName' was not supplied. Returning null]", \PEAR_LOG_DEBUG);
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [Method finished]", \PEAR_LOG_DEBUG);
         return null;
     }
     if (!isset($imapUserName) || $imapUserName == "") {
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [the parameter 'IMAPUserName' was not supplied. Returning null]", \PEAR_LOG_DEBUG);
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [Method finished]", \PEAR_LOG_DEBUG);
         return null;
     }
     if (!isset($imapPassword) || $imapPassword == "") {
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [the parameter 'IMAPPassword' was not supplied. Returning null]", \PEAR_LOG_DEBUG);
         $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [Method finished]", \PEAR_LOG_DEBUG);
         return null;
     }
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [END: Extracting required parameters]", \PEAR_LOG_DEBUG);
     //Create the Content array
     $contentItems = array();
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [START: Parsing IMAP items]", \PEAR_LOG_DEBUG);
     //Get information regarding the source
     $contentItems = $this->GetIMAPContent($imapHostName, $imapUserName, $imapPassword, $channel);
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [END: Parsing IMAP items]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Modules::SiSPS::Parsers::IMAPParser::GetAndParse [Method finished]", \PEAR_LOG_DEBUG);
     //return the content array
     return $contentItems;
 }
开发者ID:Bridgeborn,项目名称:Swiftriver,代码行数:40,代码来源:IMAPParser.php

示例9: CreateChannel

 public static function CreateChannel($json)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Method invoked]", \PEAR_LOG_DEBUG);
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Calling json_decode]", \PEAR_LOG_DEBUG);
     $data = json_decode($json);
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Extracting data from the JSON objects]", \PEAR_LOG_DEBUG);
     if (!isset($data) || !$data) {
         throw new \InvalidArgumentException("There was an error in the JSON. No Channel can be constructed.");
     }
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Extracting values from the data]", \PEAR_LOG_DEBUG);
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Constructing Channel object]", \PEAR_LOG_DEBUG);
     $channel = new \Swiftriver\Core\ObjectModel\Channel();
     $channel->id = isset($data->id) ? $data->id : null;
     $channel->type = $data->type;
     $channel->updatePeriod = $data->updatePeriod;
     $channel->active = isset($data->active) ? $data->active : true;
     $channel->lastSucess = isset($data->lastSucess) ? $data->lastSucess : null;
     $channel->inprocess = isset($data->inprocess) ? $data->inprocess : false;
     $params = array();
     foreach ($data->parameters as $key => $value) {
         $params[$key] = $value;
     }
     $channel->parameters = $params;
     //set key values if they have not been set
     $channel = ChannelFactory::SetValuesIfNotSet($channel, array("id" => md5(uniqid(rand(), true)), "active" => true, "nextrun" => time() + $channel->updatePeriod * 60));
     $logger->log("Core::ObjectModel::ObjectFactories::ChannelFactory::CreateChannel [Method finished]", \PEAR_LOG_DEBUG);
     return $channel;
 }
开发者ID:jgosier,项目名称:ushahidi_swift,代码行数:29,代码来源:ChannelFactory.php

示例10: RunWorkflow

 public function RunWorkflow($json, $key)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Parsing the JSON input]", \PEAR_LOG_DEBUG);
     try {
         $name = parent::ParseJsonToEventHandlerName($json);
     } catch (\Exception $e) {
         $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG);
         $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [{$e}]", \PEAR_LOG_ERR);
         return parent::FormatErrorMessage($e);
     }
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Parsing the JSON input]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Instanciating the event distributor]", \PEAR_LOG_DEBUG);
     $eventDistributor = new \Swiftriver\Core\EventDistribution\EventDistributor();
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Instanciating the event distributor]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Getting all the availabel event handlers]", \PEAR_LOG_DEBUG);
     $handlers = $eventDistributor->ListAllAvailableEventHandlers();
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Getting all the availabel event handlers]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Looking for a handler with the matching name]", \PEAR_LOG_DEBUG);
     foreach ($handlers as $handler) {
         if ($handler->Name() == $name) {
             $thisHandler = $handler;
         }
     }
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Looking for a handler with the matching name]", \PEAR_LOG_DEBUG);
     if (!isset($thisHandler) || $thisHandler == null) {
         return parent::FormatErrorMessage("No event handler found matching the name {$name}");
     }
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Constructing the configuration entry]", \PEAR_LOG_DEBUG);
     $className = $thisHandler->type;
     $filePath = $thisHandler->filePath;
     $configEntry = new \Swiftriver\Core\ObjectModel\EventHandlerEntry($name, $className, $filePath);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Constructing the configuration entry]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Extracting the configured event handlers from the config system]", \PEAR_LOG_DEBUG);
     $config = \Swiftriver\Core\Setup::EventDistributionConfiguration();
     $configuredEventHandlers = $config->EventHandlers;
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Extracting the configured event handlers from the config system]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Looking for an existing config entry for this handler]", \PEAR_LOG_DEBUG);
     for ($i = 0; $i < count($configuredEventHandlers); $i++) {
         if ($configuredEventHandlers[$i]->name == $name) {
             $index = $i;
         }
     }
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Looking for an existing config entry for this handler]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Adding a configuration entry for this event handler]", \PEAR_LOG_DEBUG);
     if (isset($index)) {
         $configuredEventHandlers[$index] = $configEntry;
     } else {
         $configuredEventHandlers[] = $configEntry;
     }
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Adding a configuration entry for this event handler]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Saving the configuration]", \PEAR_LOG_DEBUG);
     $config->EventHandlers = $configuredEventHandlers;
     $config->Save();
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Saving the configuration]", \PEAR_LOG_DEBUG);
     $logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
     return parent::FormatMessage("OK");
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:59,代码来源:ActivateEventHandler.php

示例11: mongo_analytics

 function mongo_analytics($request)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $parameters = $request->Parameters;
     $yearDay = (int) \date('z');
     $timeLimit = 5;
     if (\is_array($parameters)) {
         if (\key_exists("TimeLimit", $parameters)) {
             $timeLimit = (int) $parameters["TimeLimit"];
         }
     }
     $date = \strtotime("-{$timeLimit} days");
     $channel_array = array();
     $request->Result = null;
     try {
         $db_content = parent::PDOConnection($request);
         $db_sources = parent::PDOConnection($request);
         $db_channels = parent::PDOConnection($request);
         $db_content->where(array("date" => array('$gte' => $date)));
         $content_items = $db_content->get("content");
         $logger->log("Swiftriver::AnalyticsProviders::TotalContentByChannelAnalyticsProvider::ProvideAnalytics [Selected date: {$date}]", \PEAR_LOG_INFO);
         $logger->log("Swiftriver::AnalyticsProviders::TotalContentByChannelAnalyticsProvider::ProvideAnalytics [" . \count($content_items) . " number of content items retrieved]", \PEAR_LOG_INFO);
         $channel_array = array();
         foreach ($content_items as $content_item) {
             $source_id = $content_item["source"]["id"];
             $source_items = $db_sources->get_where("sources", array("id" => $source_id));
             $logger->log("Swiftriver::AnalyticsProviders::TotalContentByChannelAnalyticsProvider::ProvideAnalytics [" . \count($source_items) . " number of source items retrieved]", \PEAR_LOG_INFO);
             foreach ($source_items as $source_item) {
                 $channel_id = $source_item["channelId"];
                 if (!\in_array($channel_id, $channel_array)) {
                     $channel_array[$channel_id] = array();
                 }
                 $channels = $db_channels->get_where("channels", array("id" => $channel_id));
                 $logger->log("Swiftriver::AnalyticsProviders::TotalContentByChannelAnalyticsProvider::ProvideAnalytics [" . \count($channels) . " number of channels retrieved]", \PEAR_LOG_INFO);
                 foreach ($channels as $channel) {
                     $channel_array[$channel_id]["channelId"] = $channel_id;
                     $channel_array[$channel_id]["channelName"] = $channel["name"];
                     if (!\in_array($channel_id, $channel_array[$channel_id]["numberOfContentItems"])) {
                         $channel_array[$channel_id]["numberOfContentItems"] = 1;
                     } else {
                         $channel_array[$channel_id]["numberOfContentItems"] += 1;
                     }
                     $channel_array[$channel_id]["channelType"] = $content_item["source"]["type"];
                     $channel_array[$channel_id]["channelSubType"] = $content_item["source"]["subType"];
                 }
             }
         }
     } catch (\MongoException $e) {
         $logger->log("Swiftriver::AnalyticsProviders::ContentByChannelOverTimeAnalyticsProvider::ProvideAnalytics [An exception was thrown]", \PEAR_LOG_ERR);
         $logger->log("Swiftriver::AnalyticsProviders::ContentByChannelOverTimeAnalyticsProvider::ProvideAnalytics [{$e}]", \PEAR_LOG_ERR);
     }
     foreach ($channel_array as $channel_array_item) {
         if ($request->Result == null) {
             $request->Result = array();
         }
         $request->Result[] = $channel_array_item;
     }
     return $request;
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:59,代码来源:TotalContentByChannelAnalyticsProvider.php

示例12: RecordSourceScoreChange

 /**
  * This method redords the fact that a marker (sweeper) has changed the score
  * of a source by marking a content items as either 'acurate', 'chatter' or
  * 'inacurate'
  *
  * @param string $sourceId
  * @param string $markerId
  * @param int $change
  */
 public function RecordSourceScoreChange($sourceId, $markerId, $change, $reason = null)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::DAL::Repositories::TrustLogRepository::RecordSourceScoreChange [Method invoked]", \PEAR_LOG_DEBUG);
     $dc = new $this->dataContext();
     $dc::RecordSourceScoreChange($sourceId, $markerId, $change, $reason);
     $logger->log("Core::DAL::Repositories::TrustLogRepository::RecordSourceScoreChange [Method Finished]", \PEAR_LOG_DEBUG);
 }
开发者ID:ushahidi,项目名称:Swiftriver-2011,代码行数:17,代码来源:TrustLogRepository.php

示例13: RemoveRegisteredAPIKey

 /**
  * Removes a registered API key
  * Returns true on sucess
  *
  * @param string $key
  * @return bool
  */
 public function RemoveRegisteredAPIKey($key)
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::DAL::Repositories::APIKeyRepository::RemoveRegisteredAPIKey [Method invoked]", \PEAR_LOG_DEBUG);
     $dc = $this->dataContext;
     $dc::RemoveRegisteredCoreAPIKey($key);
     $logger->log("Core::DAL::Repositories::APIKeyRepository::RemoveRegisteredAPIKey [Method finished]", \PEAR_LOG_DEBUG);
 }
开发者ID:jgosier,项目名称:ushahidi_swift,代码行数:15,代码来源:APIKeyRepository.php

示例14: ListAllSources

 /**
  * Lists all the current Source in the core
  * @return \Swiftriver\Core\ObjectModel\Source[]
  */
 public function ListAllSources()
 {
     $logger = \Swiftriver\Core\Setup::GetLogger();
     $logger->log("Core::DAL::Repositories::SourceRepository::ListAllSources [Method invoked]", \PEAR_LOG_DEBUG);
     $dc = $this->dataContext;
     $sources = $dc::ListAllSources();
     $logger->log("Core::DAL::Repositories::SourceRepository::ListAllSources [Method Finished]", \PEAR_LOG_DEBUG);
     return $sources;
 }
开发者ID:Bridgeborn,项目名称:Swiftriver,代码行数:13,代码来源:SourceRepository.php

示例15: test

 public function test()
 {
     include_once dirname(__FILE__) . "/../../../Setup.php";
     include_once dirname(__FILE__) . "/../../../Modules/UshahidiAPIInterface/UshahidiAPIEventHandler.php";
     $event->arguments = new \Swiftriver\Core\ObjectModel\Content();
     $configuration->ModulesDirectory = dirname(__FILE__) . "/../../../Modules/";
     $handler = new \Swiftriver\EventHandlers\UshahidiAPIEventHandler();
     $handler->HandleEvent($event, $configuration, \Swiftriver\Core\Setup::GetLogger());
 }
开发者ID:Bridgeborn,项目名称:Swiftriver,代码行数:9,代码来源:UshahidiAPIEventHandlerTests.php


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