Compare commits
No commits in common. "c3adc7123b6cbda44c6f5aa245d0d1c8bfcb468c" and "4750d43c55985630f762459c6c6244cfd2dc49a2" have entirely different histories.
c3adc7123b
...
4750d43c55
|
@ -1,10 +1,3 @@
|
||||||
DotclearWatch 0.7 - 2023.08.12
|
|
||||||
===========================================================
|
|
||||||
* require dotclear 2.27
|
|
||||||
* require php 7.4
|
|
||||||
* Use asynchronous report sending
|
|
||||||
* Use HttpClient first to send report
|
|
||||||
|
|
||||||
DotclearWatch 0.6 - 2023.08.09
|
DotclearWatch 0.6 - 2023.08.09
|
||||||
===========================================================
|
===========================================================
|
||||||
* require dotclear 2.27
|
* require dotclear 2.27
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-0.7-a2cbe9.svg)](https://git.dotclear.watch/dw/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/badge/date-2023.08.12-c44d58.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
|
[![Date](https://img.shields.io/badge/date-2023.08.09-c44d58.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
|
||||||
[![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-137bbb.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-9ac123.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://git.dotclear.watch/dw/DotclearWatch/blob/master/LICENSE)
|
||||||
|
|
|
@ -14,7 +14,7 @@ $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.7',
|
'0.6',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [
|
||||||
['php', '7.4'],
|
['php', '7.4'],
|
||||||
|
|
|
@ -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.7</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://git.dotclear.watch/dw/DotclearWatch/releases/download/v0.7/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>https://git.dotclear.watch/dw/DotclearWatch/src/branch/master/README.md</da:details>
|
<da:details>http://plugins.dotaddict.org/dc2/details/DotclearWatch</da:details>
|
||||||
<da:support>https://git.dotclear.watch/dw/DotclearWatch/issues</da:support>
|
<da:support>https://git.dotclear.watch/dw/DotclearWatch/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*global $, dotclear */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
dotclear.adminDotclearWatchSendReport = () => {
|
|
||||||
dotclear.services(
|
|
||||||
'adminDotclearWatchSendReport',
|
|
||||||
(data) => {
|
|
||||||
try {
|
|
||||||
const response = JSON.parse(data);
|
|
||||||
if (response?.success) {
|
|
||||||
} else {
|
|
||||||
console.log(dotclear.debug && response?.message ? response.message : 'Dotclear REST server error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
console.log(error);
|
|
||||||
},
|
|
||||||
true, // Use GET method
|
|
||||||
{ json: 1 },
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
$(() => {
|
|
||||||
dotclear.adminDotclearWatchSendReport();
|
|
||||||
});
|
|
|
@ -30,25 +30,13 @@ class Backend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//My::addBackendMenuItem();
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
dcCore::app()->addBehaviors([
|
||||||
'adminDashboardHeaders' => function (): string {
|
'adminDashboardHeaders' => [Utils::class, 'sendReport'],
|
||||||
return My::jsLoad('service', dcCore::app()->getVersion(My::id()));
|
|
||||||
},
|
|
||||||
'adminPageFooterV2' => [Utils::class, 'addMark'],
|
'adminPageFooterV2' => [Utils::class, 'addMark'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
dcCore::app()->rest->addFunction(
|
|
||||||
'adminDotclearWatchSendReport',
|
|
||||||
function (): array {
|
|
||||||
Utils::sendReport();
|
|
||||||
|
|
||||||
return [
|
|
||||||
'ret' => true,
|
|
||||||
'msg' => 'report sent',
|
|
||||||
];
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,18 +192,9 @@ class Utils
|
||||||
$status = 500;
|
$status = 500;
|
||||||
$response = '';
|
$response = '';
|
||||||
$url = sprintf(self::url(), 'report');
|
$url = sprintf(self::url(), 'report');
|
||||||
$path = '';
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (false !== ($client = HttpClient::initClient($url, $path))) {
|
if (function_exists('curl_init')) {
|
||||||
$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 = (int) $client->getStatus();
|
|
||||||
$response = $client->getContent();
|
|
||||||
} elseif (function_exists('curl_init')) {
|
|
||||||
if (false !== ($client = curl_init($url))) {
|
if (false !== ($client = curl_init($url))) {
|
||||||
curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($client, CURLOPT_POST, true);
|
curl_setopt($client, CURLOPT_POST, true);
|
||||||
|
@ -213,6 +204,17 @@ class Utils
|
||||||
$status = (int) curl_getinfo($client, CURLINFO_HTTP_CODE);
|
$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]);
|
||||||
|
|
||||||
|
$status = (int) $client->getStatus();
|
||||||
|
$response = $client->getContent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($client);
|
unset($client);
|
||||||
|
|
Loading…
Reference in New Issue