Exemplo n.º 1
0
 /** End element */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'SITE') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $this->Build->StartTime = $start_time;
         $this->Build->EndTime = $end_time;
         $this->Build->SubmitTime = gmdate(FMT_DATETIME);
         $this->Build->SetSubProject($this->SubProjectName);
         $this->Build->GetIdFromName($this->SubProjectName);
         $this->Build->RemoveIfDone();
         // If the build doesn't exist we add it
         if ($this->Build->Id == 0) {
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
         } else {
             // Otherwise make sure that it's up-to-date.
             $this->Build->UpdateBuild($this->Build->Id, -1, -1);
         }
         $GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
         $this->CoverageSummary->BuildId = $this->Build->Id;
         // Insert coverage summary
         $this->CoverageSummary->Insert(true);
         $this->CoverageSummary->ComputeDifference();
     } elseif ($name == 'FILE') {
         $this->CoverageSummary->AddCoverage($this->Coverage);
     } elseif ($name == 'LABEL') {
         if (isset($this->Coverage)) {
             $this->Coverage->AddLabel($this->Label);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @throws \RuntimeException
  * @internal param array $options Optional parameters
  *
  * @since    2.0
  */
 public function __construct($options)
 {
     if (!static::isSupported()) {
         throw new \RuntimeException('APC Extension is not available', 500);
     }
     parent::__construct($options);
 }
Exemplo n.º 3
0
 /** endElement function */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'NOTE') {
         $this->Build->ProjectId = $this->projectid;
         $this->Build->GetIdFromName($this->SubProjectName);
         $this->Build->RemoveIfDone();
         // If the build doesn't exist we add it.
         if ($this->Build->Id == 0) {
             $this->Build->SetSubProject($this->SubProjectName);
             // Since we only have precision in minutes (not seconds) here,
             // set the start time at the end of the minute so it can be overridden
             // by any more precise XML file received later.
             $start_time = gmdate(FMT_DATETIME, strtotime($this->Note->Time) + 59);
             $this->Build->StartTime = $start_time;
             $this->Build->EndTime = $this->Note->Time;
             $this->Build->SubmitTime = gmdate(FMT_DATETIME);
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
         }
         if ($this->Build->Id > 0) {
             // Insert the note
             $this->Note->BuildId = $this->Build->Id;
             $this->Note->Insert();
         } else {
             add_log('Trying to add a note to a nonexistent build', 'note_handler.php', LOG_ERR);
         }
     }
 }
Exemplo n.º 4
0
 /** End Element */
 public function endElement($parser, $name)
 {
     $parent = $this->getParent();
     // should be before endElement
     parent::endElement($parser, $name);
     if ($name == "STARTDATETIME" && $parent == 'COVERAGELOG') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $this->BuildId = $this->Build->GetIdFromName($this->SubProjectName);
         if ($this->BuildId == 0) {
             $t = 'Cannot add a coverage log to a build that does not exist';
             $f = 'CoverageLogHandler::endElement';
             add_log($t, $f, LOG_ERR, $this->projectid);
         }
     } else {
         if ($name == 'LINE') {
             $this->CoverageFile->File .= '<br>';
             // cannot be <br/> for backward compatibility
         } else {
             if ($name == 'FILE') {
                 if ($this->BuildId != 0) {
                     $this->CoverageFile->Update($this->BuildId);
                     $this->CoverageFileLog->BuildId = $this->BuildId;
                     $this->CoverageFileLog->FileId = $this->CoverageFile->Id;
                     $this->CoverageFileLog->Insert();
                 }
                 unset($this->CoverageFile);
                 unset($this->CoverageFileLog);
             }
         }
     }
 }
Exemplo n.º 5
0
 /** End element */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'SITE') {
         $this->Site->Insert();
     } elseif ($name == 'UPDATE') {
         $this->Build->SiteId = $this->Site->Id;
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $submit_time = gmdate(FMT_DATETIME);
         $this->Build->StartTime = $start_time;
         $this->Build->EndTime = $end_time;
         $this->Build->SubmitTime = $submit_time;
         $this->Build->ProjectId = $this->projectid;
         $this->Build->GetIdFromName($this->SubProjectName);
         // Update.xml doesn't include SubProject information.
         // Check if GetIdFromName returned a child build, and
         // if so, change our buildid to point at the parent instead.
         $parentid = $this->Build->LookupParentBuildId();
         if ($parentid > 0) {
             $this->Build->Id = $parentid;
         }
         $this->Build->RemoveIfDone();
         // If the build doesn't exist we add it
         if ($this->Build->Id == 0) {
             $this->Build->SetSubProject($this->SubProjectName);
             $this->Build->Append = $this->Append;
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
         } else {
             // Otherwise make sure that it's up-to-date.
             $this->Build->UpdateBuild($this->Build->Id, -1, -1);
         }
         $GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
         $this->Update->BuildId = $this->Build->Id;
         $this->Update->StartTime = $start_time;
         $this->Update->EndTime = $end_time;
         // Insert the update
         $this->Update->Insert();
         global $CDASH_ENABLE_FEED;
         if ($CDASH_ENABLE_FEED) {
             // We need to work the magic here to have a good description
             $this->Feed->InsertUpdate($this->projectid, $this->Build->Id);
         }
         if ($this->Update->Command === '') {
             // If the UpdateCommand was not set, then this was a
             // "version only" update.  This means that CTest only told us
             // what version of the code is being built, not what changed
             // since last time.  In this case we need to query the remote
             // repository to figure out what changed.
             perform_version_only_diff($this->Update, $this->projectid);
         }
         // Compute the update statistics
         $this->Build->ComputeUpdateStatistics();
     } elseif ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
         $this->Update->AddFile($this->UpdateFile);
         unset($this->UpdateFile);
     }
 }
Exemplo n.º 6
0
 /**
  * Constructor
  *
  * @param   \Memcache $memcache A Memcache instance
  * @param   array     $options  Optional parameters.
  *
  * @throws \RuntimeException
  * @since   2.0
  */
 public function __construct(\Memcache $memcache = null, $options = array())
 {
     if (!self::isSupported()) {
         throw new \RuntimeException('Memcache Extension is not available', 500);
     }
     $this->memcache = $memcache ?: new \Memcache();
     $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
     parent::__construct($options);
 }
Exemplo n.º 7
0
 /**
  *
  * @param callable|HandlerInterface $handler
  *        	Handler or factory callable($record, $fingersCrossedHandler).
  * @param int $factor
  *        	Sample factor
  */
 public function __construct($handler, $factor)
 {
     parent::__construct();
     $this->handler = $handler;
     $this->factor = $factor;
     if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
         throw new \RuntimeException("The given handler (" . json_encode($this->handler) . ") is not a callable nor a Monolog\\Handler\\HandlerInterface object");
     }
 }
 /**
  *  Constructs a new NestedElement handler and sets up everything.
  *
  *  @param  object  the ExpatParser object
  *  @param  object  the parent handler that invoked this handler
  *  @param  object  the ProjectConfigurator object
  *  @param  object  the parent object this element is contained in
  *  @param  object  the parent wrapper object
  *  @param  object  the target object this task is contained in
  *  @access public
  */
 function __construct($parser, $parentHandler, $configurator, $parent, $parentWrapper, $target) {
     parent::__construct($parser, $parentHandler);
     $this->configurator = $configurator;
     if ($parent instanceof TaskAdapter) {
         $this->parent = $parent->getProxy();
     } else {
         $this->parent = $parent;
     }
     $this->parentWrapper = $parentWrapper;
     $this->target = $target;
 }
Exemplo n.º 9
0
 /**
  *  Constructs a new NestedElement handler and sets up everything.
  *
  * @param  object  the ExpatParser object
  * @param  object  the parent handler that invoked this handler
  * @param  object  the ProjectConfigurator object
  * @param  object  the parent object this element is contained in
  * @param  object  the parent wrapper object
  * @param  object  the target object this task is contained in
  */
 public function __construct($parser, $parentHandler, $configurator, $parent = null, $parentWrapper = null, $target = null)
 {
     parent::__construct($parser, $parentHandler);
     $this->configurator = $configurator;
     if ($parentWrapper != null) {
         $this->parent = $parentWrapper->getProxy();
     } else {
         $this->parent = $parent;
     }
     $this->parentWrapper = $parentWrapper;
     $this->target = $target;
 }
Exemplo n.º 10
0
 /** endElement function */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'NOTE') {
         if ($this->BuildId > 0) {
             // Insert the note
             $this->Note->BuildId = $this->BuildId;
             $this->Note->Insert();
         } else {
             add_log("note_handler.php", "Trying to add a note to an unexisting build");
         }
     }
 }
Exemplo n.º 11
0
 /** End element */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'SITE') {
         $this->Site->Insert();
     } else {
         if ($name == 'UPDATE') {
             $this->Build->SiteId = $this->Site->Id;
             $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
             $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
             $submit_time = gmdate(FMT_DATETIME);
             $this->Build->ProjectId = $this->projectid;
             $buildid = $this->Build->GetIdFromName($this->SubProjectName);
             // If the build doesn't exist we add it
             if ($buildid == 0) {
                 $this->Build->ProjectId = $this->projectid;
                 $this->Build->StartTime = $start_time;
                 $this->Build->EndTime = $end_time;
                 $this->Build->SubmitTime = $submit_time;
                 $this->Build->InsertErrors = false;
                 add_build($this->Build, $this->scheduleid);
                 $buildid = $this->Build->Id;
             } else {
                 $this->Build->Id = $buildid;
                 $this->Build->ProjectId = $this->projectid;
                 $this->Build->StartTime = $start_time;
                 $this->Build->EndTime = $end_time;
                 $this->Build->SubmitTime = $submit_time;
             }
             $GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
             $this->Update->BuildId = $buildid;
             $this->Update->StartTime = $start_time;
             $this->Update->EndTime = $end_time;
             // Insert the update
             $this->Update->Insert();
             global $CDASH_ENABLE_FEED;
             if ($CDASH_ENABLE_FEED) {
                 // We need to work the magic here to have a good description
                 $this->Feed->InsertUpdate($this->projectid, $buildid);
             }
             // Compute the update statistics
             $this->Build->ComputeUpdateStatistics();
         } else {
             if ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
                 $this->Update->AddFile($this->UpdateFile);
                 unset($this->UpdateFile);
             }
         }
     }
 }
Exemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 public function permissions($object, $context)
 {
     $permissions = parent::permissions($object, $context);
     /** Initialize permissions */
     $permissions['deals']['view'] = false;
     $permissions['payments']['view'] = false;
     $permissions['activities']['view'] = false;
     $permissions['phones']['view'] = false;
     /** Deal permissions */
     if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_ALL')) {
         $permissions['deals']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['deals']['view'] = true;
     }
     $permissions['deals']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_EDIT');
     $permissions['deals']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_REMOVE');
     $permissions['deals']['add'] = $this->securityContext->isGranted('ROLE_DEAL_ADD');
     /** Payment permissions */
     if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_ALL')) {
         $permissions['payments']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['payments']['view'] = true;
     }
     $permissions['payments']['edit'] = $this->securityContext->isGranted('ROLE_PAYMENT_EDIT');
     $permissions['payments']['remove'] = $this->securityContext->isGranted('ROLE_PAYMENT_REMOVE');
     $permissions['payments']['add'] = $this->securityContext->isGranted('ROLE_PAYMENT_ADD');
     /** Activity permissions */
     if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_ALL')) {
         $permissions['activities']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['activities']['view'] = true;
     }
     $permissions['activities']['add'] = $this->securityContext->isGranted('ROLE_ACTIVITY_ADD');
     $permissions['activities']['edit'] = $this->securityContext->isGranted('ROLE_ACTIVITY_EDIT');
     $permissions['activities']['remove'] = $this->securityContext->isGranted('ROLE_ACTIVITY_REMOVE');
     /** Phone permissions */
     if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_ALL')) {
         $permissions['phones']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['phones']['view'] = true;
     }
     $permissions['phones']['add'] = $this->securityContext->isGranted('ROLE_PHONE_ADD');
     $permissions['phones']['edit'] = $this->securityContext->isGranted('ROLE_PHONE_EDIT');
     $permissions['phones']['remove'] = $this->securityContext->isGranted('ROLE_PHONE_REMOVE');
     return $permissions;
 }
Exemplo n.º 13
0
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'CONFIGURE') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $this->Build->ProjectId = $this->projectid;
         $this->Build->StartTime = $start_time;
         $this->Build->EndTime = $end_time;
         $this->Build->SubmitTime = gmdate(FMT_DATETIME);
         $this->Build->SetSubProject($this->SubProjectName);
         $this->Build->InsertErrors = false;
         $this->Build->GetIdFromName($this->SubProjectName);
         $this->Build->RemoveIfDone();
         if ($this->Build->Id == 0) {
             // If the build doesn't exist we add it
             add_build($this->Build, $this->scheduleid);
         } else {
             // Otherwise we make sure that it's up-to-date.
             $this->Build->UpdateBuild($this->Build->Id, -1, -1);
         }
         $GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
         $this->Configure->BuildId = $this->Build->Id;
         $this->Configure->StartTime = $start_time;
         $this->Configure->EndTime = $end_time;
         // Insert the configure
         if ($this->Configure->Exists()) {
             $this->Configure->Delete();
         }
         $this->Configure->Insert();
         // Insert errors from the log file
         $this->Configure->ComputeWarnings();
         $this->Configure->ComputeErrors();
         $this->Build->ComputeConfigureDifferences();
         // Record the number of warnings & errors with the build.
         $this->Build->SetNumberOfConfigureWarnings($this->Configure->NumberOfWarnings);
         $this->Build->SetNumberOfConfigureErrors($this->Configure->NumberOfErrors);
         // Record configure duration with the build.
         $this->Build->SetConfigureDuration($this->EndTimeStamp - $this->StartTimeStamp);
         // Update the tally of warnings & errors in the parent build,
         // if applicable.
         $this->Build->UpdateParentConfigureNumbers($this->Configure->NumberOfWarnings, $this->Configure->NumberOfErrors);
     } elseif ($name == 'LABEL') {
         if (isset($this->Configure)) {
             $this->Configure->AddLabel($this->Label);
         }
     }
 }
Exemplo n.º 14
0
 /** End Element */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name === 'SITE') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $this->Build->StartTime = $start_time;
         $this->Build->EndTime = $end_time;
         $this->Build->SubmitTime = gmdate(FMT_DATETIME);
         $this->Build->SetSubProject($this->SubProjectName);
         $this->Build->GetIdFromName($this->SubProjectName);
         $this->Build->RemoveIfDone();
         if ($this->Build->Id == 0) {
             // If the build doesn't exist we add it.
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
         } else {
             // Otherwise make sure that it's up-to-date.
             $this->Build->UpdateBuild($this->Build->Id, -1, -1);
         }
         // Record the coverage data that we parsed from this file.
         foreach ($this->CoverageFiles as $coverageInfo) {
             $coverageFile = $coverageInfo[0];
             $coverageFileLog = $coverageInfo[1];
             $coverageFile->TrimLastNewline();
             $coverageFile->Update($this->Build->Id);
             $coverageFileLog->BuildId = $this->Build->Id;
             $coverageFileLog->FileId = $coverageFile->Id;
             $coverageFileLog->Insert(true);
         }
     } elseif ($name == 'LINE') {
         $this->CurrentCoverageFile->File .= rtrim($this->CurrentLine);
         // Cannot be <br/> for backward compatibility.
         $this->CurrentCoverageFile->File .= '<br>';
     } elseif ($name == 'FILE') {
         // Store these objects to be inserted after we're guaranteed
         // to have a valid buildid.
         $this->CoverageFiles[] = array($this->CurrentCoverageFile, $this->CurrentCoverageFileLog);
     } elseif ($name == 'COVERAGELOG') {
         if (empty($this->CoverageFiles)) {
             // Store these objects to be inserted after we're guaranteed
             // to have a valid buildid.
             $this->CoverageFiles[] = array(new CoverageFile(), new CoverageFileLog());
         }
     }
 }
Exemplo n.º 15
0
 /**
  * Constructs a new TaskHandler and sets up everything.
  *
  * @param AbstractSAXParser The ExpatParser object
  * @param object $parentHandler The parent handler that invoked this handler
  * @param ProjectConfigurator $configurator
  * @param TaskContainer $container The container object this task is contained in (null for top-level tasks).
  * @param RuntimeConfigurable $parentWrapper  Wrapper for the parent element, if any.
  * @param Target $target The target object this task is contained in (null for top-level tasks).
  */
 function __construct(AbstractSAXParser $parser, $parentHandler, ProjectConfigurator $configurator, $container = null, $parentWrapper = null, $target = null)
 {
     parent::__construct($parser, $parentHandler);
     if ($container !== null && !$container instanceof TaskContainer) {
         throw new Exception("Argument expected to be a TaskContainer, got something else");
     }
     if ($parentWrapper !== null && !$parentWrapper instanceof RuntimeConfigurable) {
         throw new Exception("Argument expected to be a RuntimeConfigurable, got something else.");
     }
     if ($target !== null && !$target instanceof Target) {
         throw new Exception("Argument expected to be a Target, got something else");
     }
     $this->configurator = $configurator;
     $this->container = $container;
     $this->parentWrapper = $parentWrapper;
     $this->target = $target;
 }
Exemplo n.º 16
0
 /** End element */
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'SITE') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $buildid = $this->Build->GetIdFromName($this->SubProjectName);
         // If the build doesn't exist we add it
         if ($buildid == 0) {
             $this->Build->ProjectId = $this->projectid;
             $this->Build->StartTime = $start_time;
             $this->Build->EndTime = $end_time;
             $this->Build->SubmitTime = gmdate(FMT_DATETIME);
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
             $buildid = $this->Build->Id;
         }
         // Remove any previous coverage information
         $GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
         $this->CoverageSummary->BuildId = $buildid;
         $this->CoverageSummary->RemoveAll();
         // Insert coverage summary
         $this->CoverageSummary->Insert();
         $this->CoverageSummary->ComputeDifference();
     } else {
         if ($name == 'FILE') {
             $this->CoverageSummary->AddCoverage($this->Coverage);
         } else {
             if ($name == 'LABEL') {
                 if (isset($this->Coverage)) {
                     $this->Coverage->AddLabel($this->Label);
                 }
             }
         }
     }
 }
Exemplo n.º 17
0
 /**
  * Constructs a new ProjectHandler
  *
  * @param  object  the ExpatParser object
  * @param  object  the parent handler that invoked this handler
  * @param  object  the ProjectConfigurator object
  * @access public
  */
 function __construct($parser, $parentHandler, $configurator)
 {
     $this->configurator = $configurator;
     parent::__construct($parser, $parentHandler);
 }
Exemplo n.º 18
0
 /**
  * Constructs a new RootHandler
  *
  * The root filter is required so the parser knows what to do. It's
  * called by the ExpatParser that is instatiated in ProjectConfigurator.
  *
  * It recieves the expat parse object ref and a reference to the
  * configurator
  *
  * @param AbstractSAXParser $parser The ExpatParser object.
  * @param ProjectConfigurator $configurator The ProjectConfigurator object.
  */
 function __construct(AbstractSAXParser $parser, ProjectConfigurator $configurator)
 {
     $this->configurator = $configurator;
     parent::__construct($parser, $this);
 }
Exemplo n.º 19
0
 /**
  * Constructs a new TargetHandler
  *
  * @param  object  the ExpatParser object
  * @param  object  the parent handler that invoked this handler
  * @param  object  the ProjectConfigurator object
  */
 function __construct(AbstractSAXParser $parser, AbstractHandler $parentHandler, ProjectConfigurator $configurator)
 {
     parent::__construct($parser, $parentHandler);
     $this->configurator = $configurator;
 }
Exemplo n.º 20
0
 public function endElement($parser, $name)
 {
     parent::endElement($parser, $name);
     if ($name == 'BUILD') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $submit_time = gmdate(FMT_DATETIME);
         $this->Build->ProjectId = $this->projectid;
         $this->Build->StartTime = $start_time;
         $this->Build->EndTime = $end_time;
         $this->Build->SubmitTime = $submit_time;
         $this->Build->SetSubProject($this->SubProjectName);
         $this->Build->Append = $this->Append;
         add_build($this->Build, $this->scheduleid);
         $this->Build->ComputeDifferences();
         global $CDASH_ENABLE_FEED;
         if ($CDASH_ENABLE_FEED) {
             // Insert the build into the feed
             $this->Feed->InsertBuild($this->projectid, $this->Build->Id);
         }
     } else {
         if ($name == 'WARNING' || $name == 'ERROR' || $name == 'FAILURE') {
             global $CDASH_LARGE_TEXT_LIMIT;
             $threshold = $CDASH_LARGE_TEXT_LIMIT;
             if ($threshold > 0 && isset($this->Error->StdOutput)) {
                 $outlen = strlen($this->Error->StdOutput);
                 if ($outlen > $threshold) {
                     $tmp = substr($this->Error->StdOutput, 0, $threshold);
                     unset($this->Error->StdOutput);
                     $this->Error->StdOutput = $tmp . "\n...\nCDash truncated output because it exceeded {$threshold} characters.\n";
                     $outlen = strlen($this->Error->StdOutput);
                     //add_log("truncated long out text", "build_handler", LOG_INFO);
                 }
                 $errlen = strlen($this->Error->StdError);
                 if ($errlen > $threshold) {
                     $tmp = substr($this->Error->StdError, 0, $threshold);
                     unset($this->Error->StdError);
                     $this->Error->StdError = $tmp . "\n...\nCDash truncated output because it exceeded {$threshold} characters.\n";
                     $errlen = strlen($this->Error->StdError);
                     //add_log("truncated long err text", "build_handler", LOG_INFO);
                 }
             }
             $this->Build->AddError($this->Error);
             unset($this->Error);
         } else {
             if ($name == 'LABEL') {
                 if (isset($this->Error)) {
                     $this->Error->AddLabel($this->Label);
                 } else {
                     if (isset($this->Build)) {
                         $this->Build->AddLabel($this->Label);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 21
0
 /**
  * Overrides endElement for data types. Tells the type
  * handler that processing the element had been finished so
  * handlers know they can perform actions that need to be
  * based on the data contained within the element.
  *
  * @param  string  the name of the XML element
  * @return void
  */
 function endElement($name)
 {
     $this->element->parsingComplete();
     parent::endElement($name);
 }
Exemplo n.º 22
0
 /**
  * Constructor
  *
  * @param array $params
  */
 public function __construct(array $params)
 {
     parent::__construct($params[0], $params[1]);
 }
Exemplo n.º 23
0
 /**
  * Constructs a new TargetHandler
  *
  * @param AbstractSAXParser $parser
  * @param AbstractHandler $parentHandler
  * @param ProjectConfigurator $configurator
  * @param PhingXMLContext $context
  * @internal param the $object ExpatParser object
  * @internal param the $object parent handler that invoked this handler
  * @internal param the $object ProjectConfigurator object
  */
 public function __construct(AbstractSAXParser $parser, AbstractHandler $parentHandler, ProjectConfigurator $configurator, PhingXMLContext $context)
 {
     parent::__construct($parser, $parentHandler);
     $this->configurator = $configurator;
     $this->context = $context;
 }
Exemplo n.º 24
0
 /** End Element */
 public function endElement($parser, $name)
 {
     $parent = $this->getParent();
     // should be before endElement
     parent::endElement($parser, $name);
     if ($name == 'TEST' && $parent == 'TESTING') {
         $this->Test->Insert();
         if ($this->Test->Id > 0) {
             $this->BuildTest->TestId = $this->Test->Id;
             $this->BuildTest->BuildId = $this->Build->Id;
             $this->BuildTest->Insert();
             $this->Test->InsertLabelAssociations($this->Build->Id);
         } else {
             add_log('Cannot insert test', 'Test XML parser', LOG_ERR, $this->projectid, $this->Build->Id);
         }
     } elseif ($name == 'LABEL' && $parent == 'LABELS') {
         if (isset($this->Test)) {
             $this->Test->AddLabel($this->Label);
         }
     } elseif ($name == 'NAMEDMEASUREMENT') {
         if ($this->TestMeasurement->Name == 'Execution Time') {
             $this->BuildTest->Time = $this->TestMeasurement->Value;
         } elseif ($this->TestMeasurement->Name == 'Exit Code') {
             if (strlen($this->Test->Details) > 0) {
                 $this->Test->Details .= ' (' . $this->TestMeasurement->Value . ')';
             } else {
                 $this->Test->Details = $this->TestMeasurement->Value;
             }
         } elseif ($this->TestMeasurement->Name == 'Completion Status') {
             if (strlen($this->Test->Details) > 0) {
                 $this->Test->Details = $this->TestMeasurement->Value . ' (' . $this->Test->Details . ')';
             } else {
                 $this->Test->Details = $this->TestMeasurement->Value;
             }
         } elseif ($this->TestMeasurement->Name == 'Command Line') {
             // don't do anything since it should already be in the FullCommandLine
         } else {
             // explicit measurement
             // If it's an image we add it as an image
             if (strpos($this->TestMeasurement->Type, 'image') !== false) {
                 $image = new Image();
                 $image->Extension = $this->TestMeasurement->Type;
                 $image->Data = $this->TestMeasurement->Value;
                 $image->Name = $this->TestMeasurement->Name;
                 $this->Test->AddImage($image);
             } else {
                 $this->TestMeasurement->Value = trim($this->TestMeasurement->Value);
                 $this->Test->AddMeasurement($this->TestMeasurement);
             }
         }
     } elseif ($name == 'SITE') {
         // Update the number of tests in the Build table
         $this->Build->UpdateTestNumbers($this->NumberTestsPassed, $this->NumberTestsFailed, $this->NumberTestsNotRun);
         $this->Build->ComputeTestTiming();
         if ($this->StartTimeStamp > 0 && $this->EndTimeStamp > 0) {
             // Update test duration in the Build table.
             $this->Build->SaveTotalTestsTime($this->EndTimeStamp - $this->StartTimeStamp);
         }
         // Update the build's end time to extend through testing.
         $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
         $this->Build->EndTime = $end_time;
         $this->Build->UpdateBuild($this->Build->Id, -1, -1);
         global $CDASH_ENABLE_FEED;
         if ($CDASH_ENABLE_FEED) {
             // Insert the build into the feed
             $this->Feed->InsertTest($this->projectid, $this->Build->Id);
         }
     }
 }
Exemplo n.º 25
0
 /**
  * Prepares the handlers, having the code built.
  * @return $this Implementing fluent interface.
  */
 public function prepare()
 {
     parent::prepare();
     $this->addGlobalCode($this->buildInternalCode(), 0);
     return $this;
 }
Exemplo n.º 26
0
 function __construct()
 {
     parent::__construct();
     $this->basePath = realpath(dirname(__FILE__) . '/../../') . '/';
 }
Exemplo n.º 27
0
 /**
  * StreamHandler saves the log messages to a stream
  *
  * $path can be a php stream (e.g. php://stdout)
  * or a filename (e.g. /var/logs/fabyscore.logs)
  *
  * write() will create the log directory if it does not exist
  *
  * @param string $path
  * @param string $format
  * @param string $name
  */
 public function __construct(string $path, string $format = "[%datetime%] [%name%] [%level%] %message% %context%", string $name = "PHP-LOG")
 {
     $this->path = $path;
     parent::__construct($format, $name);
 }
Exemplo n.º 28
0
 /**
  * {@inheritdoc}
  */
 public function permissions($object, $context)
 {
     $permissions = parent::permissions($object, $context);
     $permissions['activities']['view'] = false;
     $permissions['channels']['view'] = false;
     $permissions['clients']['view'] = false;
     $permissions['companies']['view'] = false;
     $permissions['customFields']['view'] = false;
     $permissions['deals']['view'] = false;
     $permissions['dealStates']['view'] = false;
     $permissions['groups']['view'] = false;
     $permissions['payments']['view'] = false;
     $permissions['phones']['view'] = false;
     $permissions['products']['view'] = false;
     $permissions['tags']['view'] = false;
     /** Activity permissions */
     if ($this->securityContext->isGranted(['ROLE_ACTIVITY_VIEW_ALL', 'ROLE_ACTIVITY_VIEW_OWN'])) {
         $permissions['activities']['view'] = true;
     }
     $permissions['activities']['edit'] = $this->securityContext->isGranted('ROLE_ACTIVITY_EDIT');
     $permissions['activities']['remove'] = $this->securityContext->isGranted('ROLE_ACTIVITY_REMOVE');
     $permissions['activities']['add'] = $this->securityContext->isGranted('ROLE_ACTIVITY_ADD');
     /** Channel permissions */
     if ($this->securityContext->isGranted('ROLE_CHANNEL_VIEW_ALL')) {
         $permissions['channels']['view'] = true;
     }
     $permissions['channels']['edit'] = $this->securityContext->isGranted('ROLE_CHANNEL_EDIT');
     $permissions['channels']['remove'] = $this->securityContext->isGranted('ROLE_CHANNEL_REMOVE');
     $permissions['channels']['add'] = $this->securityContext->isGranted('ROLE_CHANNEL_ADD');
     /** Client permissions */
     if ($this->securityContext->isGranted(['ROLE_CLIENT_VIEW_ALL', 'ROLE_CLIENT_VIEW_OWN'])) {
         $permissions['clients']['view'] = true;
     }
     $permissions['clients']['edit'] = $this->securityContext->isGranted('ROLE_CLIENT_EDIT');
     $permissions['clients']['remove'] = $this->securityContext->isGranted('ROLE_CLIENT_REMOVE');
     $permissions['clients']['add'] = $this->securityContext->isGranted('ROLE_CLIENT_ADD');
     /** Company permissions */
     if ($this->securityContext->isGranted('ROLE_COMPANY_VIEW_ALL')) {
         $permissions['companies']['view'] = true;
     }
     $permissions['companies']['edit'] = $this->securityContext->isGranted('ROLE_COMPANY_EDIT');
     $permissions['companies']['remove'] = $this->securityContext->isGranted('ROLE_COMPANY_REMOVE');
     $permissions['companies']['add'] = $this->securityContext->isGranted('ROLE_COMPANY_ADD');
     /** Custom field permissions */
     if ($this->securityContext->isGranted('ROLE_CUSTOM_FIELD_VIEW_ALL')) {
         $permissions['customFields']['view'] = true;
     }
     $permissions['customFields']['edit'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_EDIT');
     $permissions['customFields']['remove'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_REMOVE');
     $permissions['customFields']['add'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_ADD');
     /** Deal permissions */
     if ($this->securityContext->isGranted(['ROLE_DEAL_VIEW_ALL', 'ROLE_DEAL_VIEW_OWN'])) {
         $permissions['deals']['view'] = true;
     }
     $permissions['deals']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_EDIT');
     $permissions['deals']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_REMOVE');
     $permissions['deals']['add'] = $this->securityContext->isGranted('ROLE_DEAL_ADD');
     /** Deal state permissions */
     if ($this->securityContext->isGranted(['ROLE_DEAL_STATE_VIEW_ALL', 'ROLE_DEAL_STATE_VIEW_OWN'])) {
         $permissions['dealStates']['view'] = true;
     }
     $permissions['dealStates']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_EDIT');
     $permissions['dealStates']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_REMOVE');
     $permissions['dealStates']['add'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_ADD');
     /** Group permissions */
     if ($this->securityContext->isGranted('ROLE_GROUP_VIEW_ALL')) {
         $permissions['groups']['view'] = true;
     }
     $permissions['groups']['edit'] = $this->securityContext->isGranted('ROLE_GROUP_EDIT');
     $permissions['groups']['remove'] = $this->securityContext->isGranted('ROLE_GROUP_REMOVE');
     $permissions['groups']['add'] = $this->securityContext->isGranted('ROLE_GROUP_ADD');
     /** Payment permissions */
     if ($this->securityContext->isGranted(['ROLE_PAYMENT_VIEW_ALL', 'ROLE_PAYMENT_VIEW_OWN'])) {
         $permissions['payments']['view'] = true;
     }
     $permissions['payments']['edit'] = $this->securityContext->isGranted('ROLE_PAYMENT_EDIT');
     $permissions['payments']['remove'] = $this->securityContext->isGranted('ROLE_PAYMENT_REMOVE');
     $permissions['payments']['add'] = $this->securityContext->isGranted('ROLE_PAYMENT_ADD');
     /** Phone permissions */
     if ($this->securityContext->isGranted(['ROLE_PHONE_VIEW_ALL', 'ROLE_PHONE_VIEW_OWN'])) {
         $permissions['phones']['view'] = true;
     }
     $permissions['phones']['edit'] = $this->securityContext->isGranted('ROLE_PHONE_EDIT');
     $permissions['phones']['remove'] = $this->securityContext->isGranted('ROLE_PHONE_REMOVE');
     $permissions['phones']['add'] = $this->securityContext->isGranted('ROLE_PHONE_ADD');
     /** Product permissions */
     if ($this->securityContext->isGranted('ROLE_PRODUCT_VIEW_ALL')) {
         $permissions['products']['view'] = true;
     }
     $permissions['products']['edit'] = $this->securityContext->isGranted('ROLE_PRODUCT_EDIT');
     $permissions['products']['remove'] = $this->securityContext->isGranted('ROLE_PRODUCT_REMOVE');
     $permissions['products']['add'] = $this->securityContext->isGranted('ROLE_PRODUCT_ADD');
     /** Tag permissions */
     if ($this->securityContext->isGranted(['ROLE_TAG_VIEW_ALL', 'ROLE_TAG_VIEW_OWN'])) {
         $permissions['tags']['view'] = true;
     }
     $permissions['tags']['edit'] = $this->securityContext->isGranted('ROLE_TAG_EDIT');
     $permissions['tags']['remove'] = $this->securityContext->isGranted('ROLE_TAG_REMOVE');
     $permissions['tags']['add'] = $this->securityContext->isGranted('ROLE_TAG_ADD');
     /** Contact permissions */
     if ($this->securityContext->isGranted('ROLE_CONTACT_VIEW_ALL', 'ROLE_CONTACT_VIEW_ONW')) {
         $permissions['contacts']['view'] = true;
     }
     $permissions['contacts']['edit'] = $this->securityContext->isGranted('ROLE_CONTACT_EDIT');
     $permissions['contacts']['remove'] = $this->securityContext->isGranted('ROLE_CONTACT_REMOVE');
     $permissions['contacts']['add'] = $this->securityContext->isGranted('ROLE_CONTACT_ADD');
     return $permissions;
 }
Exemplo n.º 29
0
 /**
  * 存储或更新模型对象
  * @param  object $p_model 新建或改动后的模型
  * @returnFilterModel         返回更新后的模型对象
  */
 public static function saveModel($p_model)
 {
     return parent::saveModel($p_model);
 }
Exemplo n.º 30
0
 /** End Element */
 public function endElement($parser, $name)
 {
     //$parent = $this->getParent(); // should be before endElement
     parent::endElement($parser, $name);
     if ($name == "TEST-CASE") {
         $this->Test->Insert();
         if ($this->Test->Id > 0) {
             $this->BuildTest->TestId = $this->Test->Id;
             $this->BuildTest->BuildId = $this->BuildId;
             $this->BuildTest->Insert();
             $this->Test->InsertLabelAssociations($this->BuildId);
         } else {
             add_log("Cannot insert test", "Test XML parser", LOG_ERR, $this->projectid, $this->BuildId);
         }
     } else {
         if ($name == "SITE" || $this->HasSiteTag == false && $name == "TEST-RESULTS") {
             if (strlen($this->EndTimeStamp) > 0 && $this->UpdateEndTime) {
                 $end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
                 // The EndTimeStamp
                 $this->Build->UpdateEndTime($end_time);
             }
             // Update the number of tests in the Build table
             $this->Build->UpdateTestNumbers($this->NumberTestsPassed, $this->NumberTestsFailed, $this->NumberTestsNotRun);
             $this->Build->ComputeTestTiming();
         }
     }
 }