protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $con = $databaseManager->getDatabase($options['connection'])->getConnection();
     $this->log("[INFO] " . date("d/m/y : H:i:s", time()));
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', 'dev', true));
     $response = diagnostic::getAgentFiles('diagnostic');
     $this->log("[INFO] " . date("d/m/y : H:i:s", time()));
     return;
 }
예제 #2
0
 public function executeJsonDiagnostic(sfWebRequest $request)
 {
     $method = $request->getParameter('method');
     if ($method == 'diagnostic') {
         $this->updateSetting(EtvaSettingPeer::_SMTP_SERVER_, $request->getParameter('smtpserver'));
         $this->updateSetting(EtvaSettingPeer::_SMTP_PORT_, $request->getParameter('port'));
         $this->updateSetting(EtvaSettingPeer::_SMTP_USE_AUTH_, $request->getParameter('useauth'));
         $this->updateSetting(EtvaSettingPeer::_SMTP_USERNAME_, $request->getParameter('username'));
         $this->updateSetting(EtvaSettingPeer::_SMTP_KEY_, $request->getParameter('key'));
         $this->updateSetting(EtvaSettingPeer::_SMTP_SECURITY_, $request->getParameter('security_type'));
     }
     error_log("[METHOD] {$method}");
     $result = diagnostic::getAgentFiles($method);
     if (!$result['success']) {
         $error = $this->setJsonError($result);
         return $this->renderText($error);
     }
     $json_encoded = json_encode($result);
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     return $this->renderText($json_encoded);
 }