From 9b03120dfc18ad2a97f30b0af2102fe1e28c576d Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 7 Oct 2021 11:52:55 +0100
Subject: [PATCH] Show shard in "noblogs info", not host

---
 bin/noblogs.in   |  2 +-
 debian/changelog |  6 ++++++
 debian/rules     |  7 -------
 lib/blogs.php    | 10 ++++++----
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/bin/noblogs.in b/bin/noblogs.in
index c0138d2..d4637d4 100755
--- a/bin/noblogs.in
+++ b/bin/noblogs.in
@@ -115,7 +115,7 @@ function do_info($args) {
 
     echo "ID:          {$blog->blog_id}\n";
     echo "Name:        {$blog->domain}\n";
-    echo "Host:        {$dbinfo['host']}\n";
+    echo "Shard:       {$dbinfo['shard']}\n";
     echo "Status:      {$status}\n";
     echo "Registered:  {$blog->registered}\n";
     echo "Last Update: {$blog->last_updated}\n";
diff --git a/debian/changelog b/debian/changelog
index abbb663..8d8dfac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+noblogs-cli (0.2) unstable; urgency=medium
+
+  * Bump version.
+
+ -- Autistici/Inventati <debian@autistici.org>  Thu, 07 Oct 2021 11:51:35 +0100
+
 noblogs-cli (0.1) unstable; urgency=low
 
   * Initial Release.
diff --git a/debian/rules b/debian/rules
index cc81dde..2b07bd8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,11 +1,4 @@
 #!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#DH_VERBOSE = 1
-
-# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/default.mk
 
 %:
 	dh $@  --with autotools-dev
diff --git a/lib/blogs.php b/lib/blogs.php
index cf18bd3..3055e22 100644
--- a/lib/blogs.php
+++ b/lib/blogs.php
@@ -42,16 +42,18 @@ function noblogs_get_backend_for_blog($blog_id) {
   $backend = $wpdb_reverse_backend_map[$lookup];
 
   // Be nice and split the database host into 'host' and 'port' elements.
-  $result = array();
+  $result = array(
+                  "shard" => $lookup,
+                  "user" => $backend['user'],
+                  "password" => $backend['password'],
+                  "db" => $backend['name']
+                  );
   if (preg_match('/^(.*):([0-9]*)$/', $backend['host'], $matches)) {
     $result['host'] = $matches[1];
     $result['port'] = $matches[2];
   } else {
     $result['host'] = $backend['host'];
   }
-  $result['user'] = $backend['user'];
-  $result['password'] = $backend['password'];
-  $result['db'] = $backend['name'];
   return $result;
 }
 
-- 
GitLab