@daemonitor/plugins 1.1.37 → 1.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,8 +25,11 @@ function collectDisks() {
|
|
|
25
25
|
try {
|
|
26
26
|
const darwin = platform() === "darwin";
|
|
27
27
|
// Linux: `-T` gives the fstype column; bytes via --block-size=1.
|
|
28
|
-
//
|
|
29
|
-
|
|
28
|
+
// `-l` on both: local filesystems only, which is all this reports, and
|
|
29
|
+
// df skips network mounts without touching them. Without it a dead NFS
|
|
30
|
+
// server hung every call past the timeout, so the Patroni nodes
|
|
31
|
+
// reported no disks at all for seven weeks.
|
|
32
|
+
const cmd = darwin ? "df -kl" : "df -lPT --block-size=1";
|
|
30
33
|
const out = execSync(cmd, { encoding: "utf8", timeout: 5000 });
|
|
31
34
|
const raw = [];
|
|
32
35
|
for (const line of out.split("\n").slice(1)) {
|
|
@@ -193,6 +193,49 @@ async function collectSite(site) {
|
|
|
193
193
|
catch (e) {
|
|
194
194
|
out.cronError = String(e?.stderr || e?.message || e).slice(0, 160);
|
|
195
195
|
}
|
|
196
|
+
// 6. Plugins: how many are active, which sit inactive (code on disk that
|
|
197
|
+
// nobody uses, still reachable by a request), and which have an update
|
|
198
|
+
// waiting. The update flags come from WordPress's own cached check.
|
|
199
|
+
try {
|
|
200
|
+
const raw = await wp(site, ["plugin", "list", "--fields=name,status,update,version", "--format=json"]);
|
|
201
|
+
const list = parseJsonSafe(raw, []).filter((p) => p.status === "active" || p.status === "active-network" || p.status === "inactive");
|
|
202
|
+
out.plugins = {
|
|
203
|
+
active: list.filter((p) => p.status !== "inactive").length,
|
|
204
|
+
inactive: list.filter((p) => p.status === "inactive").map((p) => String(p.name)),
|
|
205
|
+
updates: list.filter((p) => p.update === "available").map((p) => String(p.name)),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
out.pluginsError = String(e?.message || e).slice(0, 160);
|
|
210
|
+
}
|
|
211
|
+
// 7. Themes with an update waiting, from the same cached check.
|
|
212
|
+
try {
|
|
213
|
+
const raw = await wp(site, ["theme", "list", "--fields=name,update", "--format=json"]);
|
|
214
|
+
out.themeUpdates = parseJsonSafe(raw, []).filter((t) => t.update === "available").map((t) => String(t.name));
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
out.themesError = String(e?.message || e).slice(0, 160);
|
|
218
|
+
}
|
|
219
|
+
// 8. A core release newer than the one installed (asks api.wordpress.org;
|
|
220
|
+
// an empty list is up to date).
|
|
221
|
+
try {
|
|
222
|
+
const raw = await wp(site, ["core", "check-update", "--format=json"], 30000);
|
|
223
|
+
const ups = parseJsonSafe(raw, []);
|
|
224
|
+
out.coreUpdate = ups.length ? String(ups[0].version) : null;
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
out.coreUpdateError = String(e?.message || e).slice(0, 160);
|
|
228
|
+
}
|
|
229
|
+
// 9. The PHP that WP-CLI, and so the site, runs on. `wp cli info` doesn't
|
|
230
|
+
// load WordPress.
|
|
231
|
+
try {
|
|
232
|
+
const info = parseJsonSafe(await wp(site, ["cli", "info", "--format=json"]), {});
|
|
233
|
+
if (info.php_version)
|
|
234
|
+
out.phpVersion = String(info.php_version);
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
out.phpVersionError = String(e?.message || e).slice(0, 160);
|
|
238
|
+
}
|
|
196
239
|
return out;
|
|
197
240
|
}
|
|
198
241
|
export function createWordpressPlugin() {
|