From: Diogo Cordeiro Date: Mon, 3 Jun 2019 01:39:39 +0000 (+0100) Subject: Nodeinfo has a special rule for upgrades X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df84ccd916ec6a0458fbe7432d388438e967af98;p=quix0rs-gnu-social.git Nodeinfo has a special rule for upgrades --- diff --git a/plugins/Nodeinfo/NodeinfoPlugin.php b/plugins/Nodeinfo/NodeinfoPlugin.php index 8fe6a7999a..79defe39fd 100644 --- a/plugins/Nodeinfo/NodeinfoPlugin.php +++ b/plugins/Nodeinfo/NodeinfoPlugin.php @@ -176,4 +176,13 @@ class NodeinfoPlugin extends Plugin 'description' => _m('Plugin that presents basic instance information using the NodeInfo standard.')]; return true; } + + public function onEndUpgrade() + { + $users = new Usage_stats(); + if ($users->getUserCount() == 0) { + define('NODEINFO_UPGRADE', true); + require_once __DIR__ . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'fix_stats.php'; + } + } } diff --git a/plugins/Nodeinfo/scripts/fix_stats.php b/plugins/Nodeinfo/scripts/fix_stats.php index e94c2bee50..a34e24f827 100755 --- a/plugins/Nodeinfo/scripts/fix_stats.php +++ b/plugins/Nodeinfo/scripts/fix_stats.php @@ -25,9 +25,11 @@ define('INSTALLDIR', realpath(__DIR__ . '/../../..')); -$longoptions = ['type=']; +if (!defined('NODEINFO_UPGRADE')) { -$helptext = <<