Fix wromg server detecting / improved Pleroma version numbers
This commit is contained in:
parent
34a0e71485
commit
de0ddfa0d8
2 changed files with 28 additions and 0 deletions
|
@ -651,6 +651,29 @@ function admin_page_federation(App $a)
|
||||||
$v[$key] = ['total' => $v[$key]['total'], 'version' => L10n::t('unknown')];
|
$v[$key] = ['total' => $v[$key]['total'], 'version' => L10n::t('unknown')];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reformat and compact version numbers
|
||||||
|
if ($p == 'Pleroma') {
|
||||||
|
$compacted = [];
|
||||||
|
|
||||||
|
foreach ($v as $key => $value) {
|
||||||
|
$version = $v[$key]['version'];
|
||||||
|
$parts = explode(' ', trim($version));
|
||||||
|
do {
|
||||||
|
$part = array_pop($parts);
|
||||||
|
} while (!empty($parts) && ((strlen($part) >= 40) || (strlen($part) <= 3)));
|
||||||
|
|
||||||
|
if (!empty($part)) {
|
||||||
|
$compacted[$part] += $v[$key]['total'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$v = [];
|
||||||
|
foreach ($compacted as $version => $total) {
|
||||||
|
$v[] = ['version' => $version, 'total' => $total];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// in the DB the Diaspora versions have the format x.x.x.x-xx the last
|
// in the DB the Diaspora versions have the format x.x.x.x-xx the last
|
||||||
// part (-xx) should be removed to clean up the versions from the "head
|
// part (-xx) should be removed to clean up the versions from the "head
|
||||||
// commit" information and combined into a single entry for x.x.x.x
|
// commit" information and combined into a single entry for x.x.x.x
|
||||||
|
|
|
@ -133,6 +133,11 @@ class CurlResult
|
||||||
{
|
{
|
||||||
$this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0;
|
$this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0;
|
||||||
|
|
||||||
|
// Everything higher than 299 is not an success
|
||||||
|
if ($this->returnCode > 299) {
|
||||||
|
$this->isSuccess = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->isSuccess) {
|
if (!$this->isSuccess) {
|
||||||
Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, Logger::INFO);
|
Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, Logger::INFO);
|
||||||
Logger::log('debug: ' . print_r($this->info, true), Logger::DATA);
|
Logger::log('debug: ' . print_r($this->info, true), Logger::DATA);
|
||||||
|
|
Loading…
Reference in a new issue