コード例 #1
0
 /**
  * Logs a SQL statement to the system logger (DEBUG priority).
  *
  * @param string $sql The SQL to be executed
  * @param array $params The SQL parameters
  * @param array $types The SQL parameter types.
  * @return void
  */
 public function startQuery($sql, array $params = null, array $types = null)
 {
     // this is a safeguard for when no logger might be available...
     if ($this->logger !== null) {
         $this->logger->log($sql, LOG_DEBUG, array('params' => $params, 'types' => $types));
     }
 }
コード例 #2
0
 /**
  * Logs calls
  *
  * @Flow\After("method(PerfectIn\Api\Webservice\WebserviceCall->invoke())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current joinpoint
  */
 public function logFinishServiceCall(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     $callIdentifier = $joinPoint->getProxy()->getClass() . '::' . $joinPoint->getProxy()->getMethod();
     if ($joinPoint->hasException()) {
         $this->logger->log($this->logIdentifier . ' - error - ' . $joinPoint->getException()->getMessage() . '(' . $joinPoint->getException()->getCode() . ')', LOG_ERR);
     } else {
         $this->logger->log($this->logIdentifier . ' - response - ' . $this->getLogMessageForVariable($joinPoint->getResult()), LOG_INFO);
     }
 }
コード例 #3
0
 /**
  * Returns translated label ("target" tag in XLIFF) for the id given.
  * Id is compared with "id" attribute of "trans-unit" tag (see XLIFF
  * specification for details).
  *
  * @param string $transUnitId The "id" attribute of "trans-unit" tag in XLIFF
  * @param integer $pluralFormIndex Index of plural form to use (starts with 0)
  * @return mixed Translated label or FALSE on failure
  */
 public function getTargetByTransUnitId($transUnitId, $pluralFormIndex = 0)
 {
     if (!isset($this->xmlParsedData['translationUnits'][$transUnitId])) {
         $this->i18nLogger->log('No trans-unit element with the id "' . $transUnitId . '" was found in ' . $this->sourcePath . '. Either this translation has been removed or the id in the code or template referring to the translation is wrong.', LOG_DEBUG);
         return false;
     }
     if (!isset($this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex])) {
         $this->i18nLogger->log('The plural form index "' . $pluralFormIndex . '" for the trans-unit element with the id "' . $transUnitId . '" in ' . $this->sourcePath . ' is not available.', LOG_DEBUG);
         return false;
     }
     if ($this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['target']) {
         return $this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['target'];
     } elseif ($this->locale->getLanguage() === $this->xmlParsedData['sourceLocale']->getLanguage()) {
         return $this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['source'] ?: false;
     } else {
         $this->i18nLogger->log('The target translation was empty and the source translation language (' . $this->xmlParsedData['sourceLocale']->getLanguage() . ') does not match the current locale (' . $this->locale->getLanguage() . ') for the trans-unit element with the id "' . $transUnitId . '" in ' . $this->sourcePath, LOG_DEBUG);
         return false;
     }
 }
コード例 #4
0
 /**
  * @param LoggerInterface $logger
  * @param boolean $dryRun
  * @return \Lightwerk\SurfRunner\Domain\Model\Deployment
  * @throws \Lightwerk\SurfRunner\Exception\NoAvailableDeploymentException
  * @throws \Lightwerk\SurfRunner\Factory\Exception
  * @throws \TYPO3\Surf\Exception
  */
 public function deployWaitingFromQueue(LoggerInterface $logger, $dryRun)
 {
     /** @var SurfCaptainDeployment $surfCaptainDeployment */
     $surfCaptainDeployment = $this->deploymentRepository->findOneByStatus(SurfCaptainDeployment::STATUS_WAITING);
     if ($surfCaptainDeployment instanceof SurfCaptainDeployment === FALSE) {
         throw new NoAvailableDeploymentException('no waiting deployments', 1428685492);
     }
     if ($this->deploymentRepository->countByRepositoryUrlAndStatus($surfCaptainDeployment->getRepositoryUrl(), SurfCaptainDeployment::STATUS_RUNNING) > 0) {
         throw new NoAvailableDeploymentException('deployment already running', 1428685490);
     }
     if (!$dryRun) {
         $this->setStatusBeforeDeployment($surfCaptainDeployment);
     }
     $logger->addBackend(new DatabaseBackend(array('deployment' => $surfCaptainDeployment, 'severityThreshold' => LOG_DEBUG)));
     try {
         $deployment = $this->deploymentFactory->getDeploymentByDeploymentRecord($surfCaptainDeployment, $logger);
     } catch (\Lightwerk\SurfRunner\Factory\Exception $e) {
         $this->setStatusAfterDeployment($surfCaptainDeployment, Deployment::STATUS_FAILED);
         throw new NoAvailableDeploymentException('cannot create deployment with DeploymentFactoryException ' . $e->getMessage() . ' - ' . $e->getCode(), 1428769118);
     }
     $deployment->initialize();
     if (!$dryRun) {
         $this->emitDeploymentStarted($deployment, $surfCaptainDeployment);
         try {
             $deployment->deploy();
         } catch (\TYPO3\Surf\Exception\InvalidConfigurationException $e) {
             $this->setStatusAfterDeployment($surfCaptainDeployment, Deployment::STATUS_FAILED);
             throw new NoAvailableDeploymentException('cannot deploy with InvalidConfigurationException' . $e->getMessage() . ' - ' . $e->getCode(), 1428769119);
         }
         $this->setStatusAfterDeployment($surfCaptainDeployment, $deployment->getStatus());
         $this->emitDeploymentFinished($deployment, $surfCaptainDeployment);
     } else {
         $deployment->simulate();
     }
     return $deployment;
 }