public static function photos($objectType, $objectSelect, $MLSNumber)
 {
     $config = new \PHRETS\Configuration();
     $config->setLoginUrl(env('RETS_LOGIN_URL'))->setUsername(env('RETS_USERNAME'))->setPassword(env('RETS_PASSWORD'))->setRetsVersion(env('RETS_VERSION'));
     $rets = new \PHRETS\Session($config);
     $connect = $rets->Login();
     try {
         $photos = $rets->GetObject($objectType, $objectSelect, $MLSNumber);
     } catch (Exception $e) {
         Bugsnag::notifyException($e);
     } catch (PHRETS\Exceptions\CapabilityUnavailable $e) {
         Bugsnag::notifyException($e);
     }
     $rets->Disconnect();
     return $photos;
 }
 public function renderException($e, $output)
 {
     // Send exception to Bugsnag
     \Bugsnag::notifyException($e);
     // Call parent function
     parent::renderException($e, $output);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public static function errorHandler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = array())
 {
     parent::errorHandler($errno, $errstr, $errfile, $errline, $errcontext);
     if (Kohana::$errors === true) {
         Kohana::error_handler($errno, $errstr, $errfile, $errline);
     }
 }
 public static function handleException(Exception $exception)
 {
     // Call Bugsnag
     Bugsnag::exceptionHandler($exception);
     // Fall back to Cake..
     return parent::handleException($exception);
 }
Example #5
0
 /**
  * Authenticates the current user for the upcoming API calls.
  */
 private function authenticate()
 {
     try {
         $this->client->authenticate($this->user->token, GitHubClient::AUTH_HTTP_TOKEN);
     } catch (\Exception $e) {
         \Bugsnag::notifyError('Exception', 'GitHub Authentication failed: ' . $e->getMessage());
     }
 }
 public function removeFromElasticSearch($mlsNumber)
 {
     $client = \Elasticsearch\ClientBuilder::create()->build();
     $params['index'] = 'properties';
     $params['type'] = 'property';
     $params['body']['query']['match']['MLSNumber'] = $mlsNumber;
     try {
         $response = $client->search($params);
     } catch (Elasticsearch\Common\Exceptions\Missing404Exception $e) {
         Bugsnag::notifyException($e);
     }
     if (!empty($response['hits']['hits'])) {
         $paramsDelete['index'] = 'properties';
         $paramsDelete['type'] = 'property';
         $paramsDelete['id'] = $response['hits']['hits'][0]['_id'];
         $response = $client->delete($paramsDelete);
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $days = 100;
     $time = date('H:i:s');
     $startDate = date('Y-m-d', strtotime('-40 days'));
     $date = date('Y-m-d', strtotime('-0days'));
     while ($startDate <= $date) {
         try {
             $results = \App\Libraries\RetsQuery::properties('Property', 'Listing', '(Area=101,102,103,201,202,203,204,301,302,303,401,402,403,404,405,501,502,503,504,505,601,602,603,604,605,606) AND (ListPrice=100000+) AND (PropertyType=RES) AND NOT (PropertySubType=CON) AND (Status=A) AND (OriginalEntryTimestamp=' . $startDate . 'T' . $time . '-' . date('Y-m-d', strtotime('-' . $days . 'days')) . ')');
         } catch (Exception $e) {
             Bugsnag::notifyException($e);
         } catch (PHRETS\Exceptions\CapabilityUnavailable $e) {
             Bugsnag::notifyException($e);
         }
         $days = $days - 20;
         $startDate = date('Y-m-d', strtotime("+20 days", strtotime($startDate)));
         $results = $this->appendDescription($results->toArray());
         foreach ($results as $property) {
             dispatch((new MakeProperty($property))->onQueue('createProperty'));
         }
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $images = [];
     try {
         $createdProperty = \App\Property::where('MLSNumber', '=', $this->property['MLSNumber'])->with('propertyImages')->first();
     } catch (Exception $e) {
         Bugsnag::notifyException($e);
     }
     switch (true) {
         case !is_null($createdProperty):
             $createProperty = $createdProperty->update($this->property);
             break;
         default:
             $createProperty = \App\Property::create($this->property);
             $listingAgent = dispatch((new CreateListingAgent($createProperty, $this->property))->onQueue('additionalInformation'));
             $community = dispatch((new CreateListingCommunity($createProperty, $this->property))->onQueue('additionalInformation'));
             if ($this->property['PhotoCount'] > 0) {
                 $images = dispatch((new GetPropertyImages($createProperty, $this->property['Matrix_Unique_ID']))->onQueue('images'));
             }
             $createdAt = $this->setCreatedAt($createProperty->toArray());
             dispatch((new IndexProperty($this->property, $createdAt))->onQueue('indexProperty'));
             break;
     }
 }
Example #9
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     \Bugsnag::setReleaseStage(app()->environment());
 }
Example #10
0
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenace mode is in effect for this application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
/*
|--------------------------------------------------------------------------
| Bugsnag
|--------------------------------------------------------------------------
*/
// If a user is logged in, we'll set him as the
// target user for which the errors will occur.
if (Auth::check()) {
    Bugsnag::setUser(['name' => Auth::user()->name, 'email' => Auth::user()->email]);
}
Example #11
0
<?php

use lithium\core\Libraries;
use lithium\core\Environment;
use lithium\security\Auth;
$_config = Libraries::get('li3_bugsnag');
if (isset($_config['apiKey']) && !empty($_config['apiKey'])) {
    \Bugsnag::register($_config['apiKey']);
    \Bugsnag::setReleaseStage(Environment::get());
    \Bugsnag::setProjectRoot(LITHIUM_APP_PATH);
    set_error_handler('Bugsnag::errorHandler');
    /**
     * This placeholder is used only to retrieve last defined handler
     * @var callable
     */
    $placeholder = set_exception_handler(null);
    set_exception_handler(function ($exception) use($placeholder) {
        if ($exception->getCode() !== 404) {
            \Bugsnag::exceptionHandler($exception);
        }
        if ($placeholder) {
            call_user_func($placeholder, $exception);
        }
    });
}
unset($_config);
Example #12
0
    if (Config::get('app.debug')) {
        Session::flash('alert', sprintf("%s (Line %d): %s", $e->getFile(), $e->getLine(), $e->getMessage()));
    } else {
        Session::flash('alert', $e->getMessage());
    }
    return View::make('index');
});
App::error(function (DestinyException $e) {
    Bugsnag::notifyException($e);
    return View::make('error', ['error' => $e->getMessage(), 'bungie' => true]);
});
App::missing(function (Exception $e) {
    return Response::view('404', [], 404);
});
App::error(function (UnknownPlayerException $e) {
    Bugsnag::notifyException($e);
    return View::make('error', ['error' => $e->getMessage()]);
});
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //
});
 public function testManualNotification()
 {
     $this->markTestSkipped('Uncomment this skip call if you want to demo Bugsnag');
     Bugsnag::notifyException(new Exception("Bugsnag test: uhm, something bad happened"));
 }