Example #1
0
 private function evalPlatform($value)
 {
     $args = func_get_args();
     // remove the first argument: $value ..
     array_shift($args);
     // .. append to last position
     $args[] = $value;
     $process = $this->platform->exec('/usr/bin/sudo /sbin/e-smith/validate ${@}', $args);
     if ($process->getExitCode() !== 0 && $this->platform instanceof \Nethgui\Log\LogConsumerInterface) {
         NETHGUI_DEBUG && $this->platform->getLog()->notice(sprintf('platformValidator (%s): %s', implode(', ', $args), strtr($process->getOutput(), "\n", " ")));
         $outputArray = $process->getOutputArray();
         $reason = array_pop($outputArray);
         // inject reason message in failure template arguments. Refs #1058
         $args['${reason}'] = substr(implode("\n", $outputArray), 0, 64);
         $this->addFailureInfo('valid_platform,' . $reason, $args);
     }
     return $process->getExitCode() === 0;
 }
Example #2
0
 /**
  * Gets PDOStatement of query to fetch all data from a table.
  * @param      string $tableName
  * @param      PlatformInterface $platform
  * @return     PDOStatement
  */
 private function getTableDataStmt($tableName, PlatformInterface $platform)
 {
     return $this->conn->query("SELECT * FROM " . $platform->quoteIdentifier($tableName));
 }