Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracking codes for kibana #112

Merged
merged 1 commit into from
Feb 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions php/Terminus/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function send($url, $method, $data = array()) {
}
// create a new Guzzle\Http\Client
$browser = new Browser;
$browser->setUserAgent(self::userAgent());
$options = array();
$options['allow_redirects'] = @$data['allow_redirects'] ?: false;
$options['json'] = @$data['json'] ?: false;
Expand Down Expand Up @@ -58,6 +59,8 @@ public static function send($url, $method, $data = array()) {
$debug = "#### REQUEST ####".PHP_EOL;
$debug .= $request->getRawHeaders();
\Terminus\Loggers\Regular::debug($debug);
if (isset($data['body']))
\Terminus\Loggers\Regular::debug($data['body']);
}

if ( getenv("BUILD_FIXTURES") ) {
Expand All @@ -73,6 +76,11 @@ public static function send($url, $method, $data = array()) {
return $response;
}

static function userAgent() {
$agent = sprintf("Terminus/%s (php_version=%s&script=%s)", constant('TERMINUS_VERSION'), phpversion(), constant('TERMINUS_SCRIPT'));
return $agent;
}

public static function download($url,$target) {
// @todo use Guzzle in the future, but for now this will do
$ch = curl_init($url);
Expand Down
7 changes: 6 additions & 1 deletion php/terminus.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
// Can be used by plugins/themes to check if Terminus is running or not
define( 'Terminus', true );
define( 'TERMINUS_VERSION', '0.4-beta');
$source = 'unknown';
if ('cli' === PHP_SAPI && isset($argv)) {
$source = explode('/',$argv[0]);
$source = end($source);
}
define('TERMINUS_SCRIPT',$source);
date_default_timezone_set('UTC');

include TERMINUS_ROOT . '/php/utils.php';
include TERMINUS_ROOT . '/php/login.php';
include TERMINUS_ROOT . '/php/FileCache.php';
Expand Down