first commit

This commit is contained in:
2024-12-17 13:43:22 +01:00
commit 8e6cd8b410
21292 changed files with 3514826 additions and 0 deletions

115
modules/ps_metrics/vendor/bin/analytics vendored Normal file
View File

@@ -0,0 +1,115 @@
#!/usr/bin/env php
<?php
require_once(__DIR__ . '/../lib/Segment.php');
if (in_array('--help', $argv)) {
print(usage());
exit;
}
if (empty($_ENV['SEGMENT_WRITE_KEY'])) {
error('$SEGMENT_WRITE_KEY environment variable required');
}
date_default_timezone_set('UTC');
Segment::init($_ENV['SEGMENT_WRITE_KEY']);
$options = getopt('', [
'method:', // T I P G A
'event::', // x
'userId::', // x x x x x
'groupId::', // x
'previousId::', // x
'anonymousId::', // x x x x x
'properties::', // x x
'name::', // x
'traits::', // x x
'context::', // x x x x x
'timestamp::' // x x x x x
]);
switch ($options['method']) {
case 'track':
Segment::track(array(
'userId' => $options['userId'],
'anonymousId' => $options['anonymousId'],
'event' => $options['event'],
'properties' => parse_json($options['properties']),
'timestamp' => parse_timestamp($options['timestamp']),
'context' => parse_json($options['context'])
));
break;
case 'identify':
Segment::identify(array(
'userId' => $options['userId'],
'anonymousId' => $options['anonymousId'],
'traits' => parse_json($options['traits']),
'timestamp' => parse_timestamp($options['timestamp']),
'context' => parse_json($options['context'])
));
break;
case 'page':
Segment::page(array(
'userId' => $options['userId'],
'anonymousId' => $options['anonymousId'],
'name' => $options['name'],
'category' => $options['category'],
'properties' => parse_json($options['properties']),
'timestamp' => parse_timestamp($options['timestamp']),
'context' => parse_json($options['context'])
));
break;
case 'group':
Segment::identify(array(
'userId' => $options['userId'],
'anonymousId' => $options['anonymousId'],
'groupId' => $options['groupId'],
'traits' => parse_json($options['traits']),
'timestamp' => parse_timestamp($options['timestamp']),
'context' => parse_json($options['context'])
));
break;
case 'alias':
Segment::alias(array(
'userId' => $options['userId'],
'previousId' => $options['previousId']
));
break;
default:
error(usage());
break;
}
Segment::flush();
function usage() {
return "\n Usage: analytics --method <track|identify|page|group|alias> [options]\n\n";
}
function error($message) {
print("$message\n\n");
exit(1);
}
function parse_json($input) {
if (empty($input)) {
return null;
}
return json_decode($input);
}
function parse_timestamp($input) {
if (empty($input)) {
return null;
}
return strtotime($input);
}

11
modules/ps_metrics/vendor/bin/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

92
modules/ps_metrics/vendor/bin/sentry vendored Normal file
View File

@@ -0,0 +1,92 @@
#!/usr/bin/env php
<?php
// Maximize error reporting
error_reporting(E_ALL | E_STRICT);
// TODO: if we could get rid of this and have composer figure things out it'd make it
// a bit more sane
require(dirname(__file__) . '/../lib/Raven/Autoloader.php');
Raven_Autoloader::register();
function raven_cli_test($command, $args)
{
// Do something silly
try {
throw new Exception('This is a test exception sent from the Raven CLI.');
} catch (Exception $ex) {
return $ex;
}
}
function cmd_test($dsn)
{
// Parse DSN as a test
try {
if (empty(Raven_Client::parseDSN($dsn))) {
exit('ERROR: Missing DSN value');
}
} catch (InvalidArgumentException $ex) {
exit("ERROR: There was an error parsing your DSN:\n " . $ex->getMessage());
}
$client = new Raven_Client($dsn, array(
'trace' => true,
'curl_method' => 'sync',
'app_path' => realpath(__DIR__ . '/..'),
'base_path' => realpath(__DIR__ . '/..'),
));
$config = get_object_vars($client);
$required_keys = array('server', 'project', 'public_key');
echo "Client configuration:\n";
foreach ($required_keys as $key) {
if (empty($config[$key])) {
exit("ERROR: Missing configuration for $key");
}
if (is_array($config[$key])) {
echo "-> $key: [".implode(", ", $config[$key])."]\n";
} else {
echo "-> $key: $config[$key]\n";
}
}
echo "\n";
echo "Sending a test event:\n";
$ex = raven_cli_test("command name", array("foo" => "bar"));
$event_id = $client->captureException($ex);
echo "-> event ID: $event_id\n";
$last_error = $client->getLastError();
if (!empty($last_error)) {
exit("ERROR: There was an error sending the test event:\n " . $last_error);
}
echo "\n";
echo "Done!";
}
function main() {
global $argv;
if (!isset($argv[1])) {
exit('Usage: sentry test <dsn>');
}
$cmd = $argv[1];
switch ($cmd) {
case 'test':
cmd_test(@$argv[2]);
break;
default:
exit('Usage: sentry test <dsn>');
}
}
main();