Exemplo n.º 1
0
 /**
  * @param $domainId
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute($domainId, DomainListener $listener)
 {
     $domain = $this->repository->getDomainById($domainId);
     $sshKey = $this->getPublicKey();
     $this->log->info('Show Domain id ' . $domainId, $domain->toArray());
     return $listener->view('domains.show', compact('domain', 'sshKey'));
 }
Exemplo n.º 2
0
 /**
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute(DomainListener $listener)
 {
     $user = $this->auth->user();
     $domains = $this->repository->listOfDomains($user->id);
     $this->log->info('Show Domains');
     return $listener->view('domains.index', compact('domains'));
 }
 /**
  * Execute the required command against the command handler.
  *
  * @param Command $command
  * @return mixed
  */
 public function execute(Command $command)
 {
     $handler = $this->commandTranslator->getCommandHandler($command);
     $commandName = $this->getCommandName($command);
     $this->log->info("New command [{$commandName}]", get_object_vars($command));
     return $this->app->make($handler)->handle($command);
 }
Exemplo n.º 4
0
 /**
  * Stores The SupervisorD configuration
  *
  * @param $worker
  */
 private function storeSupervisordConfig($worker)
 {
     $domain = Domain::findOrFail($worker->domain_id);
     $file = view('configuration.supervisord', compact('worker', 'domain'))->render();
     File::put(Config::get('settings.supervisord_location') . '/worker-' . $worker->id . '.log', $file);
     $this->log->info('Supervisord Config created');
 }
 /**
  * @return mixed
  */
 public function api()
 {
     $args = func_get_args();
     if (self::$laravelDebug === true) {
         $this->laravelLog->info('Facebook Api Call: ' . print_r($args, 1));
     }
     return call_user_func_array("parent::api", $args);
 }
Exemplo n.º 6
0
 /**
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired.");
     }
 }
 /**
  * Dispatches the array of events, firing off the appropriate event name for each and logging the event fired.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->log->info("New event [{$eventName}]", get_object_vars($event));
         $this->event->fire($eventName, $event);
     }
 }
Exemplo n.º 8
0
 public function execute($domainId, $envData, EnvironmentsListener $listener)
 {
     if (empty($envData['environment'])) {
         $envData['environment'] = 'production';
     }
     $environment = $this->repository->addEnvironment($domainId, $envData);
     $this->log->info('Environment variable added', $environment->toArray());
     return $listener->environmentRedirect($environment);
 }
Exemplo n.º 9
0
 /**
  * Release the events on the event stack.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     // For every Event's on the event array
     // It will get the event name from the object Namespace the fire that event
     // Also will write that in the log file as an information log
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired");
     }
 }
Exemplo n.º 10
0
 /**
  * Dispatch the events
  *
  * @param array $events
  * @param bool  $log
  */
 public function dispatch(array $events, $log = false)
 {
     foreach ($events as $event) {
         // Get the name of the event
         $eventName = $this->getEventName($event);
         // Fire the event
         $this->event->fire($eventName, [$event]);
         if ($log) {
             // Log that the event was fired
             $this->logger->info("Event [{$eventName}] was fired.");
         }
     }
 }
Exemplo n.º 11
0
 /**
  * Handles authenticating that a user/character is still valid.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function postAuthorized()
 {
     // Get the neccessary headers from the request.
     $service = $this->request->header('service', false);
     $username = $this->request->header('username', '');
     $character = $this->request->header('character', '');
     $this->log->info('A service is attempting to validate a user.', ['username' => $username, 'character' => $character, 'service' => $service]);
     // Verify that the external service exists in the configuration.
     if (!$service || !$this->config->get("addon.auth.{$service}")) {
         $this->log->info(self::ERROR_INVALID_EXTERNAL_SERVICE, ['service' => $service]);
         return $this->failure(self::ERRNO_INVALID_EXTERNAL_SERVICE, self::ERROR_INVALID_EXTERNAL_SERVICE);
     }
     // Check the cache first so the api isn't hammered too badly.
     $key = 'auth:session:' . sha1("{$service}:{$username}");
     if ($this->cache->has($key)) {
         $this->log->info('Returning the cached authorization result.');
         return $this->cache->get($key);
     }
     // Attempt to find the requested user.
     $identifier = filter_var($username, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
     $user = $this->users->where($identifier, $username)->first() ?: false;
     if (!$user) {
         $this->log->info(self::ERROR_USER_NOT_FOUND);
         return $this->failure(self::ERRNO_USER_NOT_FOUND, self::ERROR_USER_NOT_FOUND);
     }
     // Get and cache the response for 15 minutes.
     $response = $this->getLoginResult($user, $service, $character);
     $this->cache->put($key, $response, $this->carbon->now()->addMinutes(15));
     return $response;
 }
Exemplo n.º 12
0
 public function sysmessage(Request $request, Crypt $crypt)
 {
     $logger = new Writer(new Logger("output"));
     $logger->useFiles('php://stdout');
     $raw = $GLOBALS['HTTP_RAW_POST_DATA'];
     $logger->info('raw post:');
     $logger->info(var_export($raw, true));
     $data = $this->process($raw);
     $logger->info(var_export($data, true));
     // $errCode = $crypt->decryptMsg($raw->ComponentVerifyTicket, $raw->CreateTime, $nonce, $from_xml, $msg);
     echo 'success';
     return;
     /*
     	if ($errCode == 0) {
     		$logger->info('after decrypt:');
     		$logger->info(var_export($msg, true));
     	} else {
     		$logger->info('Err: '.$errCode);
     	}
     */
     echo 'success';
 }
Exemplo n.º 13
0
 /**
  * Logs that a message was sent.
  *
  * @param $message
  */
 protected function logMessage($message)
 {
     $numbers = implode(" , ", $message->getTo());
     $message = $message->getText();
     //dump($message);
     $mode = "fake";
     $delivered = $this->delivered();
     if (!$this->isPretending()) {
         $mode = 'actual';
         $delivered = $this->driver->delivered();
         //dump($delivered);
     }
     $delivered = $delivered ? 'SUCCESS' : 'FAILED';
     $this->logger->info("#MODE: {$mode}   #DELIVERED: {$delivered}  #MESSAGE: {$message}  #NUMBER: {$numbers} ");
 }
Exemplo n.º 14
0
 public function execute($appId, $appData, AppListener $listener)
 {
     $app = $this->repository->updateRepository($appId, $appData);
     $this->log->info('Branch Updated', $app->toArray());
     return $listener->appRedirect($app);
 }
Exemplo n.º 15
0
 /**
  * Removes the file from storage
  *
  * @param $worker
  */
 private function destroyConfiguration($worker)
 {
     $this->log->info('Worker File removed');
     File::delete(Config::get('settings.supervisord_location') . '/worker-' . $worker->id . '.log');
 }
Exemplo n.º 16
0
 protected function findProfile()
 {
     $adapter_profile = $this->getAdapterProfile();
     $ProfileModel = $this->config['db']['profilemodel'];
     $UserModel = $this->config['db']['usermodel'];
     $user = NULL;
     // Have they logged in with this provider before?
     $profile_builder = call_user_func_array("{$ProfileModel}::where", array('provider', $this->provider));
     $profile = $profile_builder->where('identifier', $adapter_profile->identifier)->first();
     if ($profile) {
         // ok, we found an existing user
         $user = $profile->user()->first();
         $this->logger->debug('Anvard: found a profile, id=' . $profile->id);
     } elseif ($adapter_profile->email) {
         $this->logger->debug('Anvard: could not find profile, looking for email');
         // ok it's a new profile ... can we find the user by email?
         $user_builder = call_user_func_array("{$UserModel}::where", array('email', $adapter_profile->email));
         $user = $user_builder->first();
     }
     // If we haven't found a user, we need to create a new one
     if (!$user) {
         $this->logger->debug('Anvard: did not find user, creating');
         $user = new $UserModel();
         // map in anything from the profile that we want in the User
         $map = $this->config['db']['profiletousermap'];
         foreach ($map as $apkey => $ukey) {
             $user->{$ukey} = $adapter_profile->{$apkey};
         }
         $values = $this->config['db']['uservalues'];
         foreach ($values as $key => $value) {
             if (is_callable($value)) {
                 $user->{$key} = $value($user, $adapter_profile);
             } else {
                 $user->{$key} = $value;
             }
         }
         // @todo this is all very custom ... how to fix?
         $user->username = $adapter_profile->email;
         $user->displayname = $adapter_profile->firstName . " " . $adapter_profile->lastName;
         $user->email = $adapter_profile->email;
         $user->password = uniqid();
         $user->password_confirmation = $user->password;
         $rules = $this->config['db']['userrules'];
         $result = $user->save($rules);
         // will bowman
         $user->saveRoles(array(\Setting::get('users.default_role_id')));
         if (!$result) {
             $this->logger->error('Anvard: FAILED TO SAVE USER');
             return NULL;
         }
     }
     if (!$profile) {
         // If we didn't find the profile, we need to create a new one
         $profile = $this->createProfileFromAdapterProfile($adapter_profile, $user);
     } else {
         // If we did find a profile, make sure we update any changes to the source
         $profile = $this->applyAdapterProfileToExistingProfile($adapter_profile, $profile);
     }
     $result = $profile->save();
     if (!$result) {
         $this->logger->error('Anvard: FAILED TO SAVE PROFILE');
         return NULL;
     }
     $this->logger->info('Anvard: succesful login!');
     return $profile;
 }
 /**
  * Log that a message was sent.
  *
  * @param  \Swift_Message  $message
  * @return void
  */
 protected function logMessage($message)
 {
     $emails = implode(', ', array_keys((array) $message->getTo()));
     $this->logger->info("Pretending to mail message to: {$emails}");
 }
Exemplo n.º 18
0
 /**
  * Logs that a message was sent.
  *
  * @param $message
  */
 protected function logMessage($message)
 {
     $numbers = implode(" , ", $message->getTo());
     $this->logger->info("Pretending to send SMS message to: {$numbers}");
 }
Exemplo n.º 19
0
 /**
  * @param $domainId
  * @param DomainListener $listener
  * @return Redirect
  */
 public function execute($domainId, DomainListener $listener)
 {
     $domain = $this->repository->newToken($domainId);
     $this->log->info('New Token Generated', $domain->toArray());
     return $listener->domainRedirect($domain);
 }
Exemplo n.º 20
0
 /**
  * @param $domain
  */
 private function storeNginxConfig($domain)
 {
     $file = view('configuration.nginx-plain', compact('domain'))->render();
     File::put(Config::get('settings.nginx_location') . '/' . $domain->name, $file);
     $this->log->info('Nginx Config created');
 }
Exemplo n.º 21
0
 function loger($level, $file, $line, $string, $ar = NULL)
 {
     // если системный level ниже notice, то при включеном KINT_DUMP, ставим уровень notice
     if ($GLOBALS['KINT_DUMP'] && $this->agiconfig['verbosity_level'] < 2) {
         $this->agiconfig['verbosity_level'] = 2;
     }
     if ($this->agiconfig['verbosity_level'] < $level) {
         return;
     }
     if ($GLOBALS['KINT_DUMP']) {
         ~d("{$level} | {$file} | {$line}");
         if (!is_null($string)) {
             d($string);
         }
         if (!is_null($ar)) {
             d($ar);
         }
         return;
     }
     if (!is_null($string)) {
         $this->agi->verbose($string);
     }
     if (!is_null($ar)) {
         $this->agi->verbose($ar);
     }
     if ((int) $this->agiconfig['logging_write_file'] === 1) {
         $logger = new Writer(new Logger('local'));
         $logger->useFiles($this->config['logs_patch']);
         if (!is_null($ar)) {
             $string .= "\n";
             $string .= var_export($string, true);
         }
         switch ($level) {
             case 'error':
                 $logger->error("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'warning':
                 $logger->warning("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'notice':
                 $logger->notice("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'info':
                 $logger->info("[" . $this->uniqueid . "] [{$file}] [{$line}]:  {$string}");
                 break;
             default:
                 $logger->debug("[" . $this->uniqueid . "] [{$file}] [{$line}]: {$string}");
                 break;
         }
     }
 }
Exemplo n.º 22
0
 public function execute($domainId, $repositoryData, AppListener $listener)
 {
     $repository = $this->repository->addNewRepository($domainId, $repositoryData);
     $this->log->info('Repository created for DomainID: ' . $domainId, $repository->toArray());
     return $listener->appRedirect($repository);
 }
Exemplo n.º 23
0
 /**
  * @param $environmentId
  * @param EnvironmentsListener $listener
  * @return mixed
  */
 public function execute($environmentId, EnvironmentsListener $listener)
 {
     $environment = $this->repository->removeEnvironment($environmentId);
     $this->log->info('Environment variable removed', $environment->toArray());
     return $listener->environmentRedirect($environment);
 }
Exemplo n.º 24
0
 public function execute($appId, AppListener $listener)
 {
     $repository = $this->repository->unInstallRepository($appId);
     $this->log->info('App UnInstalled', $repository->toArray());
     return $listener->appRedirect($repository);
 }
Exemplo n.º 25
0
 /**
  * @param $domainId
  * @param DomainListener $listener
  * @return Redirect
  */
 public function execute($domainId, DomainListener $listener)
 {
     $domain = $this->repository->deleteDomain($domainId);
     $this->log->info('Domain Id: ' . $domainId . ' is deleted successfully');
     return $listener->domainRedirect($domain);
 }
Exemplo n.º 26
0
 /**
  * Log an event within the Application.
  *
  * @param $message
  * @return mixed
  */
 public function logEvent($message)
 {
     return $this->log->info($message);
 }