Compare commits

...

3 Commits

5 changed files with 71 additions and 47 deletions

View File

@ -1,3 +1,7 @@
0.1 - 2023.xx.xx DotclearWatch 0.6 - 2023.08.09
- require dotclear 2.27 ===========================================================
- require php 7.4 * require dotclear 2.27
* require php 7.4
* Use curl first to send report to server
* Move third party repository
* Use Dotclear style for CHANGELOG

View File

@ -1,11 +1,10 @@
# README # README
[![Release](https://img.shields.io/github/v/release/JcDenis/DotclearWatch)](https://github.com/JcDenis/DotclearWatch/releases) [![Release](https://img.shields.io/badge/release-0.6-a2cbe9.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/DotclearWatch)](https://github.com/JcDenis/DotclearWatch/releases) [![Date](https://img.shields.io/badge/date-2023.08.09-c44d58.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/DotclearWatch)](https://github.com/JcDenis/DotclearWatch/issues) [![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/DotclearWatch)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/DotclearWatch) [![License](https://img.shields.io/github/license/JcDenis/DotclearWatch)](https://git.dotclear.watch/dw/DotclearWatch/blob/master/LICENSE)
[![License](https://img.shields.io/github/license/JcDenis/DotclearWatch)](https://github.com/JcDenis/DotclearWatch/blob/master/LICENSE)
## WHAT IS DOTCLEARWATCH ? ## WHAT IS DOTCLEARWATCH ?
@ -13,24 +12,27 @@
web publishing software called Dotclear. web publishing software called Dotclear.
It tracks Dotclear's installation to get stats about it. It tracks Dotclear's installation to get stats about it.
Default statistics server is located at https://dotclear.watch/statistics
What's being track : What's being track :
* Dotclear version, * Dotclear version,
* PHP version, * PHP version,
* Database version, * Database version,
* List of installed modules (only id and version) * Current blog theme,
* Number of blogs. (no name or id or whatever else) * number of blogs on multiblogs
* List of installed modules (only id and version)
* Number of blogs. (no name or id or whatever else)
If you want to hide some modules, just enter their IDs in a comma separeted list If you want to hide some modules, just enter their IDs in a comma separeted list
in aboutConfig global parameters called DotclearWatch->hidden_modules in aboutConfig global parameters called DotclearWatch->hidden_modules
## REQUIREMENTS ## REQUIREMENTS
DotclearWatch requires: DotclearWatch requires:
* super admin permission to intall it * super admin permission to intall it
* Dotclear 2.27 * Dotclear 2.27
* PHP 7.4+ * PHP 7.4+
## USAGE ## USAGE
@ -41,13 +43,13 @@ To disable sending stats, just deactivate or uninstall this plugin.
## LINKS ## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html) * License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contributions : [GitHub Page](https://github.com/JcDenis/DotclearWatch) * Source & contributions : [Gitea Page](https://git.dotclear.watch/dw/DotclearWatch) or [GitHub Page](https://github.com/JcDenis/DotclearWatch)
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/DotclearWatch) * Packages & details : [Gitea Page](https://git.dotclear.watch/dw/DotclearWatch/releases) or[Dotaddict Page](https://plugins.dotaddict.org/dc2/details/DotclearWatch)
* Discussion & Help : [Github issue](https://github.com/JcDenis/DotclearWatch/issues) * Discussion & Help : [Gitea Page](https://github.com/dw/DotclearWatch/issues)
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Christian Denis (author) * Jean-Christian Denis (author)
You are welcome to contribute to this code. You are welcome to contribute to this code.

View File

@ -14,15 +14,15 @@ $this->registerModule(
'Dotclear Watch', 'Dotclear Watch',
'Send report about your Dotclear', 'Send report about your Dotclear',
'Jean-Christian Denis and contributors', 'Jean-Christian Denis and contributors',
'0.5', '0.6',
[ [
'requires' => [ 'requires' => [
['php', '7.4'], ['php', '7.4'],
['core', '2.27'], ['core', '2.27'],
], ],
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/DotclearWatch/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'http://plugins.dotaddict.org/dc2/details/DotclearWatch', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
'repository' => 'https://raw.githubusercontent.com/JcDenis/DotclearWatch/master/dcstore.xml', 'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
] ]
); );

View File

@ -2,12 +2,12 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="DotclearWatch"> <module id="DotclearWatch">
<name>Dotclear Watch</name> <name>Dotclear Watch</name>
<version>0.5</version> <version>0.6</version>
<author>Jean-Christian Denis and contributors</author> <author>Jean-Christian Denis and contributors</author>
<desc>Send report about your Dotclear</desc> <desc>Send report about your Dotclear</desc>
<file>https://github.com/JcDenis/DotclearWatch/releases/download/v0.5/plugin-DotclearWatch.zip</file> <file>https://git.dotclear.watch/dw/DotclearWatch/releases/download/v0.6/plugin-DotclearWatch.zip</file>
<da:dcmin>2.27</da:dcmin> <da:dcmin>2.27</da:dcmin>
<da:details>http://plugins.dotaddict.org/dc2/details/DotclearWatch</da:details> <da:details>http://plugins.dotaddict.org/dc2/details/DotclearWatch</da:details>
<da:support>https://github.com/JcDenis/DotclearWatch/issues</da:support> <da:support>https://git.dotclear.watch/dw/DotclearWatch/issues</da:support>
</module> </module>
</modules> </modules>

View File

@ -48,7 +48,7 @@ class Utils
if (My::settings()->getGlobal('distant_api_url')) { if (My::settings()->getGlobal('distant_api_url')) {
echo sprintf( echo sprintf(
'<ul><li><a href="%s" title="%s" class="outgoing">%s<img src="%s" /></a></ul></li>', '<ul><li><a href="%s" title="%s" class="outgoing">%s<img src="%s" /></a></ul></li>',
'https://dotclear.watch/statistics', 'https://statistics.dotclear.watch',
__('DotclearWatch plugin statistics'), __('DotclearWatch plugin statistics'),
__('Tracked by dotclear.watch'), __('Tracked by dotclear.watch'),
My::fileURL('icon.svg') My::fileURL('icon.svg')
@ -188,28 +188,46 @@ class Utils
self::write($contents); self::write($contents);
$client = false;
$status = 500; $status = 500;
$response = ''; $response = '';
$url = sprintf(self::url(), 'report'); $url = sprintf(self::url(), 'report');
$path = '';
if ($client = HttpClient::initClient($url, $path)) {
try {
$client->setUserAgent('Dotclear.watch ' . My::id() . '/' . self::DISTANT_API_VERSION);
$client->useGzip(false);
$client->setPersistReferers(false);
$client->post($path, ['key' => self::key(), 'report' => $contents]);
$status = $client->getStatus(); try {
$response = $client->getContent(); if (function_exists('curl_init')) {
unset($client); if (false !== ($client = curl_init($url))) {
if ($status != 202) { curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
self::error((string) '(' . $status . ') ' . $response); curl_setopt($client, CURLOPT_POST, true);
curl_setopt($client, CURLOPT_POSTFIELDS, ['key' => self::key(), 'report' => $contents]);
if (false !== ($response = curl_exec($client))) {
$status = (int) curl_getinfo($client, CURLINFO_HTTP_CODE);
}
} }
} else {
$path = '';
if (false !== ($client = HttpClient::initClient($url, $path))) {
$client->setUserAgent('Dotclear.watch ' . My::id() . '/' . self::DISTANT_API_VERSION);
$client->useGzip(false);
$client->setPersistReferers(false);
$client->post($path, ['key' => self::key(), 'report' => $contents]);
return; $status = (int) $client->getStatus();
} catch (Exception $e) { $response = $client->getContent();
unset($client); }
} }
unset($client);
} catch (Exception $e) {
unset($client);
}
if ($status == 202) {
return;
}
if ($status !== false) {
self::error((string) '(' . $status . ') ' . $response);
} }
if ($force) { if ($force) {