Skip to content

Commit 65db7fb

Browse files
committed
updates adding statistics logging of sendy subscribe
1 parent c037dc1 commit 65db7fb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Plugin.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Detain\MyAdminSendy;
44

5+
require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
6+
57
use Symfony\Component\EventDispatcher\GenericEvent;
68

79
/**
@@ -105,10 +107,14 @@ public static function doEmailSetup($email, $params = false)
105107
'content' => $postdata
106108
]
107109
];
110+
\StatisticClient::tick('Sendy', 'subscribe');
108111
$context = stream_context_create($opts);
109112
$result = trim(file_get_contents(SENDY_APIURL.'/subscribe', false, $context));
110113
if ($result != '1') {
114+
\StatisticClient::report('Sendy', 'subscribe', false, 100, $result, STATISTICS_SERVER);
111115
myadmin_log('accounts', 'info', "Sendy Response: {$result}", __LINE__, __FILE__);
112-
}
116+
} else {
117+
\StatisticClient::report('Sendy', 'subscribe', true, 0, '', STATISTICS_SERVER);
118+
}
113119
}
114120
}

0 commit comments

Comments
 (0)