Plugin Directory

Changeset 3255044


Ignore:
Timestamp:
03/12/2025 10:16:07 PM (13 months ago)
Author:
PeterBooker
Message:

Release 1.2.1

Location:
prompress
Files:
6 edited
20 copied

Legend:

Unmodified
Added
Removed
  • prompress/tags/1.2.1/README.txt

    r3252918 r3255044  
    44Requires at least: 6.4
    55Tested up to: 6.7.2
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77Requires PHP: 8.1
    88License: GPLv3 or later
     
    5757== Changelog ==
    5858
     59= 1.2.1 =
     60
     61* Bugfix- Properly sets the Redis prefix.
     62* Bugfix- Adds a filter for the Redis prefix.
     63
    5964= 1.2.0 =
    6065
  • prompress/tags/1.2.1/build/index.asset.php

    r3162357 r3255044  
    1 <?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '92eefcffe11c2a056f0e');
     1<?php return array('dependencies' => array('react', 'wp-api', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '61c8e9c73bb43afde274');
  • prompress/tags/1.2.1/build/index.js

    r3162357 r3255044  
    1 (()=>{"use strict";var e={n:s=>{var t=s&&s.__esModule?()=>s.default:()=>s;return e.d(t,{a:t}),t},d:(s,t)=>{for(var o in t)e.o(t,o)&&!e.o(s,o)&&Object.defineProperty(s,o,{enumerable:!0,get:t[o]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s)};const s=window.React,t=window.wp.i18n,o=window.wp.components,r=window.wp.element,n=window.wp.data,a=window.wp.api;var i=e.n(a);const p=window.wp.apiFetch;var c=e.n(p);const l=window.wp.notices,m=window.ReactJSXRuntime,d=()=>{const e=(0,n.useSelect)((e=>e(l.store).getNotices().filter((e=>"snackbar"===e.type))),[]),{removeNotice:s}=(0,n.useDispatch)(l.store);return(0,m.jsx)(o.SnackbarList,{className:"edit-site-notices",notices:e,onRemove:s})};function h(){const[e,a]=(0,s.useReducer)(((e,s)=>({...e,...s})),{isLoaded:!1,settings:{active:!0,authentication:!1,token:"",storage:"apc",features:{emails:!0,errors:!0,options:!0,posts:!0,queries:!0,requests:!0,remote_requests:!0,updates:!0,users:!0}}}),{isLoaded:p,settings:l}=e,{active:h,authentication:u,token:_,features:g}=l;return(0,s.useEffect)((()=>{i().loadPromise.then((()=>{const e=new(i().models.Settings);!1===p&&e.fetch().then((e=>{null!==e.prompress_settings&&a({isLoaded:!0,settings:{active:e.prompress_settings.active,authentication:e.prompress_settings.authentication,token:e.prompress_settings.token,features:e.prompress_settings.features}}),a({isLoaded:!0})})).catch((e=>{e.log(e)}))}))}),[]),(0,s.useEffect)((()=>{c()({method:"GET",path:"/prompress/v1/storage/compatibility"}).then((e=>{a({isStorageCompatLoaded:!0,storageCompat:e})})).catch((e=>{e.log(e)}))}),[]),p?(0,m.jsxs)(r.Fragment,{children:[(0,m.jsx)("div",{className:"prompress__header",children:(0,m.jsx)("div",{className:"prompress__container",children:(0,m.jsx)("div",{className:"prompress__title",children:(0,m.jsxs)("h1",{children:[(0,t.__)("PromPress Settings","prompress")," ",(0,m.jsx)(o.Icon,{icon:"admin-plugins"})]})})})}),(0,m.jsxs)("div",{className:"prompress__main",children:[(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("General","prompress")}),(0,m.jsx)("p",{children:"You can control whether monitoring is active or inactive globally."}),(0,m.jsx)(o.ToggleControl,{label:"Active",help:h?"Monitoring is active.":"Monitoring is not active.",checked:h,onChange:()=>{a({settings:{...l,active:!h}})}}),(0,m.jsx)(o.Button,{variant:"secondary",onClick:()=>{c()({method:"GET",path:"/prompress/v1/storage/wipe"}).then((()=>{(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Storage wiped","prompress"),{type:"snackbar",isDismissible:!0})})).catch((e=>{(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Failed to wipe storage","prompress"),{type:"snackbar",isDismissible:!0})}))},children:(0,t.__)("Wipe Storage","prompress")})]})}),(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("REST API","prompress")}),(0,m.jsx)("p",{children:"Enable authentication for the metrics endpoint."}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Require Authentication","prompress"),help:u?"Authentication is required.":"Authentication is not required.",checked:u,onChange:()=>{a({settings:{...l,authentication:!u}})}}),u&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(o.TextControl,{label:(0,t.__)("Bearer Token","prompress"),value:_,onChange:e=>{a({settings:{...l,token:e}})},help:(0,t.__)("Set a bearer token which must be sent by Prometheus to access the metrics endpoint.","prompress")})})]})}),(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("Features","prompress")}),(0,m.jsx)("p",{children:"Toggle the following features on/off to control what is being monitored."}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Emails","prompress"),help:(0,t.__)("Track the number of emails sent.","prompress"),checked:g.emails,onChange:()=>{a({settings:{...l,features:{...g,emails:!g.emails}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Errors","prompress"),help:(0,t.__)("Track the number of errors thrown.","prompress"),checked:g.errors,onChange:()=>{a({settings:{...l,features:{...g,errors:!g.errors}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Options","prompress"),help:(0,t.__)("Track the number of options.","prompress"),checked:g.options,onChange:()=>{a({settings:{...l,features:{...g,options:!g.options}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Posts","prompress"),help:(0,t.__)("Track the number of posts (with post type).","prompress"),checked:g.posts,onChange:()=>{a({settings:{...l,features:{...g,posts:!g.posts}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Queries","prompress"),help:(0,t.__)("Track the number and length of database queries. Note: The `SAVEQUERIES` constant must be set and true.","prompress"),checked:g.queries,onChange:()=>{a({settings:{...l,features:{...g,queries:!g.queries}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Requests","prompress"),help:(0,t.__)("Track the number and length of requests.","prompress"),checked:g.requests,onChange:()=>{a({settings:{...l,features:{...g,requests:!g.requests}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Remote Requests","prompress"),help:(0,t.__)("Track the number and length of remote requests.","prompress"),checked:g.remote_requests,onChange:()=>{a({settings:{...l,features:{...g,remote_requests:!g.remote_requests}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Updates","prompress"),help:(0,t.__)("Track the number of plugin and theme updates available.","prompress"),checked:g.updates,onChange:()=>{a({settings:{...l,features:{...g,updates:!g.updates}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Users","prompress"),help:(0,t.__)("Track the number of users (with role).","prompress"),checked:g.users,onChange:()=>{a({settings:{...l,features:{...g,users:!g.users}}})}})]})})]}),(0,m.jsx)("div",{className:"prompress__save",children:(0,m.jsx)(o.Button,{variant:"primary",onClick:()=>{new(i().models.Settings)({prompress_settings:l}).save(),(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Settings Saved","prompress"),{type:"snackbar",isDismissible:!0})},children:(0,t.__)("Save","prompress")})}),(0,m.jsx)("div",{className:"prompress__notices",children:(0,m.jsx)(d,{})})]}):(0,m.jsx)(o.Placeholder,{children:(0,m.jsx)(o.Spinner,{})})}document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("prompress-plugin-settings");e&&(0,r.render)((0,m.jsx)(h,{}),e)}))})();
     1(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.i18n,r=window.wp.components,n=window.wp.element,o=window.wp.data,a=window.wp.api;var l=e.n(a);const c=window.wp.apiFetch;var i=e.n(c);const p=window.wp.notices,m=()=>{const e=(0,o.useSelect)((e=>e(p.store).getNotices().filter((e=>"snackbar"===e.type))),[]),{removeNotice:s}=(0,o.useDispatch)(p.store);return(0,t.createElement)(r.SnackbarList,{className:"edit-site-notices",notices:e,onRemove:s})};function u(){const[e,a]=(0,t.useReducer)(((e,t)=>({...e,...t})),{isLoaded:!1,settings:{active:!0,authentication:!1,token:"",storage:"apc",features:{emails:!0,errors:!0,options:!0,posts:!0,queries:!0,requests:!0,remote_requests:!0,updates:!0,users:!0}}}),{isLoaded:c,settings:p}=e,{active:u,authentication:d,token:_,features:h}=p;return(0,t.useEffect)((()=>{l().loadPromise.then((()=>{const e=new(l().models.Settings);!1===c&&e.fetch().then((e=>{null!==e.prompress_settings&&a({isLoaded:!0,settings:{active:e.prompress_settings.active,authentication:e.prompress_settings.authentication,token:e.prompress_settings.token,features:e.prompress_settings.features}}),a({isLoaded:!0})})).catch((e=>{e.log(e)}))}))}),[]),(0,t.useEffect)((()=>{i()({method:"GET",path:"/prompress/v1/storage/compatibility"}).then((e=>{a({isStorageCompatLoaded:!0,storageCompat:e})})).catch((e=>{e.log(e)}))}),[]),c?(0,t.createElement)(n.Fragment,null,(0,t.createElement)("div",{className:"prompress__header"},(0,t.createElement)("div",{className:"prompress__container"},(0,t.createElement)("div",{className:"prompress__title"},(0,t.createElement)("h1",null,(0,s.__)("PromPress Settings","prompress")," ",(0,t.createElement)(r.Icon,{icon:"admin-plugins"}))))),(0,t.createElement)("div",{className:"prompress__main"},(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("General","prompress")),(0,t.createElement)("p",null,"You can control whether monitoring is active or inactive globally."),(0,t.createElement)(r.ToggleControl,{label:"Active",help:u?"Monitoring is active.":"Monitoring is not active.",checked:u,onChange:()=>{a({settings:{...p,active:!u}})}}),(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>{i()({method:"GET",path:"/prompress/v1/storage/wipe"}).then((()=>{(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Storage wiped","prompress"),{type:"snackbar",isDismissible:!0})})).catch((e=>{(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Failed to wipe storage","prompress"),{type:"snackbar",isDismissible:!0})}))}},(0,s.__)("Wipe Storage","prompress")))),(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("REST API","prompress")),(0,t.createElement)("p",null,"Enable authentication for the metrics endpoint."),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Require Authentication","prompress"),help:d?"Authentication is required.":"Authentication is not required.",checked:d,onChange:()=>{a({settings:{...p,authentication:!d}})}}),d&&(0,t.createElement)(n.Fragment,null,(0,t.createElement)(r.TextControl,{label:(0,s.__)("Bearer Token","prompress"),value:_,onChange:e=>{a({settings:{...p,token:e}})},help:(0,s.__)("Set a bearer token which must be sent by Prometheus to access the metrics endpoint.","prompress")})))),(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("Features","prompress")),(0,t.createElement)("p",null,"Toggle the following features on/off to control what is being monitored."),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Emails","prompress"),help:(0,s.__)("Track the number of emails sent.","prompress"),checked:h.emails,onChange:()=>{a({settings:{...p,features:{...h,emails:!h.emails}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Errors","prompress"),help:(0,s.__)("Track the number of errors thrown.","prompress"),checked:h.errors,onChange:()=>{a({settings:{...p,features:{...h,errors:!h.errors}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Options","prompress"),help:(0,s.__)("Track the number of options.","prompress"),checked:h.options,onChange:()=>{a({settings:{...p,features:{...h,options:!h.options}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Posts","prompress"),help:(0,s.__)("Track the number of posts (with post type).","prompress"),checked:h.posts,onChange:()=>{a({settings:{...p,features:{...h,posts:!h.posts}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Queries","prompress"),help:(0,s.__)("Track the number and length of database queries. Note: The `SAVEQUERIES` constant must be set and true.","prompress"),checked:h.queries,onChange:()=>{a({settings:{...p,features:{...h,queries:!h.queries}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Requests","prompress"),help:(0,s.__)("Track the number and length of requests.","prompress"),checked:h.requests,onChange:()=>{a({settings:{...p,features:{...h,requests:!h.requests}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Remote Requests","prompress"),help:(0,s.__)("Track the number and length of remote requests.","prompress"),checked:h.remote_requests,onChange:()=>{a({settings:{...p,features:{...h,remote_requests:!h.remote_requests}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Updates","prompress"),help:(0,s.__)("Track the number of plugin and theme updates available.","prompress"),checked:h.updates,onChange:()=>{a({settings:{...p,features:{...h,updates:!h.updates}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Users","prompress"),help:(0,s.__)("Track the number of users (with role).","prompress"),checked:h.users,onChange:()=>{a({settings:{...p,features:{...h,users:!h.users}}})}})))),(0,t.createElement)("div",{className:"prompress__save"},(0,t.createElement)(r.Button,{variant:"primary",onClick:()=>{new(l().models.Settings)({prompress_settings:p}).save(),(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Settings Saved","prompress"),{type:"snackbar",isDismissible:!0})}},(0,s.__)("Save","prompress"))),(0,t.createElement)("div",{className:"prompress__notices"},(0,t.createElement)(m,null))):(0,t.createElement)(r.Placeholder,null,(0,t.createElement)(r.Spinner,null))}document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("prompress-plugin-settings");e&&(0,n.render)((0,t.createElement)(u,null),e)}))})();
  • prompress/tags/1.2.1/inc/class-monitor.php

    r3252918 r3255044  
    127127        }
    128128
    129         $site_url = \parse_url(\get_site_url());
    130         $path = !empty($site_url['path']) ? \sanitize_key(trim($site_url['path'], '/')) : '';
    131         $sitePrefix = \sanitize_key($site_url['host']) . ($path ? "_{$path}" : '') . '_' . \get_current_blog_id();
     129        $site_url   = \parse_url(\get_site_url());
     130        $path       = !empty($site_url['path']) ? \sanitize_key(\trim($site_url['path'], '/')) : '';
     131        $sitePrefix = \apply_filters('prompress_redis_prefix', 'wp_site_' . \sanitize_key($site_url['host']) . ($path ? "_{$path}" : '') . '_' . \get_current_blog_id() . ':' );
    132132
    133133        $options = \apply_filters(
     
    140140                'read_timeout'           => \WP_REDIS_READ_TIMEOUT,
    141141                'persistent_connections' => \WP_REDIS_PERSISTENT,
    142                 'prefix'                 => 'wp_site_' . $sitePrefix . ':',
    143142            ]
    144143        );
    145144
    146145        Redis::setDefaultOptions( $options );
     146        Redis::setPrefix( $sitePrefix );
    147147    }
    148148
  • prompress/tags/1.2.1/package.json

    r3161698 r3255044  
    55    "author": "Peter Booker <mail@peterbooker.com>",
    66    "engines": {
    7         "node": ">=20.0.0",
     7        "node": ">=22.0.0",
    88        "npm": ">=10.0.0",
    99        "yarn": "Please use npm"
     
    2222        "@types/wordpress__notices": "~3.27.6",
    2323        "@wordpress/eslint-plugin": "~17.9.0",
    24         "@wordpress/scripts": "~30.0.2",
     24        "@wordpress/scripts": "~27.2.6",
    2525        "resolve-url-loader": "~5.0.0",
    2626        "webpack-remove-empty-scripts": "~1.0.4"
  • prompress/tags/1.2.1/prompress.php

    r3252918 r3255044  
    44 * Plugin URI:        https://github.com/PeterBooker/prompress
    55 * Description:       Monitor your WordPress website with Prometheus.
    6  * Version:           1.2.0
     6 * Version:           1.2.1
    77 * Author:            Peter Booker
    88 * Author URI:        https://peterbooker.com
     
    2727}
    2828
    29 \define( 'PROMPRESS_VERSION', '1.2.0' );
     29\define( 'PROMPRESS_VERSION', '1.2.1' );
    3030\define( 'PROMPRESS_DIR', \plugin_dir_path( __FILE__ ) );
    3131\define( 'PROMPRESS_URL', \plugin_dir_url( __FILE__ ) );
  • prompress/trunk/README.txt

    r3252918 r3255044  
    44Requires at least: 6.4
    55Tested up to: 6.7.2
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77Requires PHP: 8.1
    88License: GPLv3 or later
     
    5757== Changelog ==
    5858
     59= 1.2.1 =
     60
     61* Bugfix- Properly sets the Redis prefix.
     62* Bugfix- Adds a filter for the Redis prefix.
     63
    5964= 1.2.0 =
    6065
  • prompress/trunk/build/index.asset.php

    r3162357 r3255044  
    1 <?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '92eefcffe11c2a056f0e');
     1<?php return array('dependencies' => array('react', 'wp-api', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '61c8e9c73bb43afde274');
  • prompress/trunk/build/index.js

    r3162357 r3255044  
    1 (()=>{"use strict";var e={n:s=>{var t=s&&s.__esModule?()=>s.default:()=>s;return e.d(t,{a:t}),t},d:(s,t)=>{for(var o in t)e.o(t,o)&&!e.o(s,o)&&Object.defineProperty(s,o,{enumerable:!0,get:t[o]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s)};const s=window.React,t=window.wp.i18n,o=window.wp.components,r=window.wp.element,n=window.wp.data,a=window.wp.api;var i=e.n(a);const p=window.wp.apiFetch;var c=e.n(p);const l=window.wp.notices,m=window.ReactJSXRuntime,d=()=>{const e=(0,n.useSelect)((e=>e(l.store).getNotices().filter((e=>"snackbar"===e.type))),[]),{removeNotice:s}=(0,n.useDispatch)(l.store);return(0,m.jsx)(o.SnackbarList,{className:"edit-site-notices",notices:e,onRemove:s})};function h(){const[e,a]=(0,s.useReducer)(((e,s)=>({...e,...s})),{isLoaded:!1,settings:{active:!0,authentication:!1,token:"",storage:"apc",features:{emails:!0,errors:!0,options:!0,posts:!0,queries:!0,requests:!0,remote_requests:!0,updates:!0,users:!0}}}),{isLoaded:p,settings:l}=e,{active:h,authentication:u,token:_,features:g}=l;return(0,s.useEffect)((()=>{i().loadPromise.then((()=>{const e=new(i().models.Settings);!1===p&&e.fetch().then((e=>{null!==e.prompress_settings&&a({isLoaded:!0,settings:{active:e.prompress_settings.active,authentication:e.prompress_settings.authentication,token:e.prompress_settings.token,features:e.prompress_settings.features}}),a({isLoaded:!0})})).catch((e=>{e.log(e)}))}))}),[]),(0,s.useEffect)((()=>{c()({method:"GET",path:"/prompress/v1/storage/compatibility"}).then((e=>{a({isStorageCompatLoaded:!0,storageCompat:e})})).catch((e=>{e.log(e)}))}),[]),p?(0,m.jsxs)(r.Fragment,{children:[(0,m.jsx)("div",{className:"prompress__header",children:(0,m.jsx)("div",{className:"prompress__container",children:(0,m.jsx)("div",{className:"prompress__title",children:(0,m.jsxs)("h1",{children:[(0,t.__)("PromPress Settings","prompress")," ",(0,m.jsx)(o.Icon,{icon:"admin-plugins"})]})})})}),(0,m.jsxs)("div",{className:"prompress__main",children:[(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("General","prompress")}),(0,m.jsx)("p",{children:"You can control whether monitoring is active or inactive globally."}),(0,m.jsx)(o.ToggleControl,{label:"Active",help:h?"Monitoring is active.":"Monitoring is not active.",checked:h,onChange:()=>{a({settings:{...l,active:!h}})}}),(0,m.jsx)(o.Button,{variant:"secondary",onClick:()=>{c()({method:"GET",path:"/prompress/v1/storage/wipe"}).then((()=>{(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Storage wiped","prompress"),{type:"snackbar",isDismissible:!0})})).catch((e=>{(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Failed to wipe storage","prompress"),{type:"snackbar",isDismissible:!0})}))},children:(0,t.__)("Wipe Storage","prompress")})]})}),(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("REST API","prompress")}),(0,m.jsx)("p",{children:"Enable authentication for the metrics endpoint."}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Require Authentication","prompress"),help:u?"Authentication is required.":"Authentication is not required.",checked:u,onChange:()=>{a({settings:{...l,authentication:!u}})}}),u&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(o.TextControl,{label:(0,t.__)("Bearer Token","prompress"),value:_,onChange:e=>{a({settings:{...l,token:e}})},help:(0,t.__)("Set a bearer token which must be sent by Prometheus to access the metrics endpoint.","prompress")})})]})}),(0,m.jsx)("div",{className:"components-panel",children:(0,m.jsxs)("div",{className:"components-panel__body is-opened",children:[(0,m.jsx)("h2",{className:"components-panel__body-title",children:(0,t.__)("Features","prompress")}),(0,m.jsx)("p",{children:"Toggle the following features on/off to control what is being monitored."}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Emails","prompress"),help:(0,t.__)("Track the number of emails sent.","prompress"),checked:g.emails,onChange:()=>{a({settings:{...l,features:{...g,emails:!g.emails}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Errors","prompress"),help:(0,t.__)("Track the number of errors thrown.","prompress"),checked:g.errors,onChange:()=>{a({settings:{...l,features:{...g,errors:!g.errors}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Options","prompress"),help:(0,t.__)("Track the number of options.","prompress"),checked:g.options,onChange:()=>{a({settings:{...l,features:{...g,options:!g.options}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Posts","prompress"),help:(0,t.__)("Track the number of posts (with post type).","prompress"),checked:g.posts,onChange:()=>{a({settings:{...l,features:{...g,posts:!g.posts}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Queries","prompress"),help:(0,t.__)("Track the number and length of database queries. Note: The `SAVEQUERIES` constant must be set and true.","prompress"),checked:g.queries,onChange:()=>{a({settings:{...l,features:{...g,queries:!g.queries}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Requests","prompress"),help:(0,t.__)("Track the number and length of requests.","prompress"),checked:g.requests,onChange:()=>{a({settings:{...l,features:{...g,requests:!g.requests}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Remote Requests","prompress"),help:(0,t.__)("Track the number and length of remote requests.","prompress"),checked:g.remote_requests,onChange:()=>{a({settings:{...l,features:{...g,remote_requests:!g.remote_requests}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Updates","prompress"),help:(0,t.__)("Track the number of plugin and theme updates available.","prompress"),checked:g.updates,onChange:()=>{a({settings:{...l,features:{...g,updates:!g.updates}}})}}),(0,m.jsx)(o.ToggleControl,{label:(0,t.__)("Users","prompress"),help:(0,t.__)("Track the number of users (with role).","prompress"),checked:g.users,onChange:()=>{a({settings:{...l,features:{...g,users:!g.users}}})}})]})})]}),(0,m.jsx)("div",{className:"prompress__save",children:(0,m.jsx)(o.Button,{variant:"primary",onClick:()=>{new(i().models.Settings)({prompress_settings:l}).save(),(0,n.dispatch)("core/notices").createNotice("success",(0,t.__)("Settings Saved","prompress"),{type:"snackbar",isDismissible:!0})},children:(0,t.__)("Save","prompress")})}),(0,m.jsx)("div",{className:"prompress__notices",children:(0,m.jsx)(d,{})})]}):(0,m.jsx)(o.Placeholder,{children:(0,m.jsx)(o.Spinner,{})})}document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("prompress-plugin-settings");e&&(0,r.render)((0,m.jsx)(h,{}),e)}))})();
     1(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.i18n,r=window.wp.components,n=window.wp.element,o=window.wp.data,a=window.wp.api;var l=e.n(a);const c=window.wp.apiFetch;var i=e.n(c);const p=window.wp.notices,m=()=>{const e=(0,o.useSelect)((e=>e(p.store).getNotices().filter((e=>"snackbar"===e.type))),[]),{removeNotice:s}=(0,o.useDispatch)(p.store);return(0,t.createElement)(r.SnackbarList,{className:"edit-site-notices",notices:e,onRemove:s})};function u(){const[e,a]=(0,t.useReducer)(((e,t)=>({...e,...t})),{isLoaded:!1,settings:{active:!0,authentication:!1,token:"",storage:"apc",features:{emails:!0,errors:!0,options:!0,posts:!0,queries:!0,requests:!0,remote_requests:!0,updates:!0,users:!0}}}),{isLoaded:c,settings:p}=e,{active:u,authentication:d,token:_,features:h}=p;return(0,t.useEffect)((()=>{l().loadPromise.then((()=>{const e=new(l().models.Settings);!1===c&&e.fetch().then((e=>{null!==e.prompress_settings&&a({isLoaded:!0,settings:{active:e.prompress_settings.active,authentication:e.prompress_settings.authentication,token:e.prompress_settings.token,features:e.prompress_settings.features}}),a({isLoaded:!0})})).catch((e=>{e.log(e)}))}))}),[]),(0,t.useEffect)((()=>{i()({method:"GET",path:"/prompress/v1/storage/compatibility"}).then((e=>{a({isStorageCompatLoaded:!0,storageCompat:e})})).catch((e=>{e.log(e)}))}),[]),c?(0,t.createElement)(n.Fragment,null,(0,t.createElement)("div",{className:"prompress__header"},(0,t.createElement)("div",{className:"prompress__container"},(0,t.createElement)("div",{className:"prompress__title"},(0,t.createElement)("h1",null,(0,s.__)("PromPress Settings","prompress")," ",(0,t.createElement)(r.Icon,{icon:"admin-plugins"}))))),(0,t.createElement)("div",{className:"prompress__main"},(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("General","prompress")),(0,t.createElement)("p",null,"You can control whether monitoring is active or inactive globally."),(0,t.createElement)(r.ToggleControl,{label:"Active",help:u?"Monitoring is active.":"Monitoring is not active.",checked:u,onChange:()=>{a({settings:{...p,active:!u}})}}),(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>{i()({method:"GET",path:"/prompress/v1/storage/wipe"}).then((()=>{(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Storage wiped","prompress"),{type:"snackbar",isDismissible:!0})})).catch((e=>{(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Failed to wipe storage","prompress"),{type:"snackbar",isDismissible:!0})}))}},(0,s.__)("Wipe Storage","prompress")))),(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("REST API","prompress")),(0,t.createElement)("p",null,"Enable authentication for the metrics endpoint."),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Require Authentication","prompress"),help:d?"Authentication is required.":"Authentication is not required.",checked:d,onChange:()=>{a({settings:{...p,authentication:!d}})}}),d&&(0,t.createElement)(n.Fragment,null,(0,t.createElement)(r.TextControl,{label:(0,s.__)("Bearer Token","prompress"),value:_,onChange:e=>{a({settings:{...p,token:e}})},help:(0,s.__)("Set a bearer token which must be sent by Prometheus to access the metrics endpoint.","prompress")})))),(0,t.createElement)("div",{className:"components-panel"},(0,t.createElement)("div",{className:"components-panel__body is-opened"},(0,t.createElement)("h2",{className:"components-panel__body-title"},(0,s.__)("Features","prompress")),(0,t.createElement)("p",null,"Toggle the following features on/off to control what is being monitored."),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Emails","prompress"),help:(0,s.__)("Track the number of emails sent.","prompress"),checked:h.emails,onChange:()=>{a({settings:{...p,features:{...h,emails:!h.emails}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Errors","prompress"),help:(0,s.__)("Track the number of errors thrown.","prompress"),checked:h.errors,onChange:()=>{a({settings:{...p,features:{...h,errors:!h.errors}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Options","prompress"),help:(0,s.__)("Track the number of options.","prompress"),checked:h.options,onChange:()=>{a({settings:{...p,features:{...h,options:!h.options}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Posts","prompress"),help:(0,s.__)("Track the number of posts (with post type).","prompress"),checked:h.posts,onChange:()=>{a({settings:{...p,features:{...h,posts:!h.posts}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Queries","prompress"),help:(0,s.__)("Track the number and length of database queries. Note: The `SAVEQUERIES` constant must be set and true.","prompress"),checked:h.queries,onChange:()=>{a({settings:{...p,features:{...h,queries:!h.queries}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Requests","prompress"),help:(0,s.__)("Track the number and length of requests.","prompress"),checked:h.requests,onChange:()=>{a({settings:{...p,features:{...h,requests:!h.requests}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Remote Requests","prompress"),help:(0,s.__)("Track the number and length of remote requests.","prompress"),checked:h.remote_requests,onChange:()=>{a({settings:{...p,features:{...h,remote_requests:!h.remote_requests}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Updates","prompress"),help:(0,s.__)("Track the number of plugin and theme updates available.","prompress"),checked:h.updates,onChange:()=>{a({settings:{...p,features:{...h,updates:!h.updates}}})}}),(0,t.createElement)(r.ToggleControl,{label:(0,s.__)("Users","prompress"),help:(0,s.__)("Track the number of users (with role).","prompress"),checked:h.users,onChange:()=>{a({settings:{...p,features:{...h,users:!h.users}}})}})))),(0,t.createElement)("div",{className:"prompress__save"},(0,t.createElement)(r.Button,{variant:"primary",onClick:()=>{new(l().models.Settings)({prompress_settings:p}).save(),(0,o.dispatch)("core/notices").createNotice("success",(0,s.__)("Settings Saved","prompress"),{type:"snackbar",isDismissible:!0})}},(0,s.__)("Save","prompress"))),(0,t.createElement)("div",{className:"prompress__notices"},(0,t.createElement)(m,null))):(0,t.createElement)(r.Placeholder,null,(0,t.createElement)(r.Spinner,null))}document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("prompress-plugin-settings");e&&(0,n.render)((0,t.createElement)(u,null),e)}))})();
  • prompress/trunk/inc/class-monitor.php

    r3252918 r3255044  
    127127        }
    128128
    129         $site_url = \parse_url(\get_site_url());
    130         $path = !empty($site_url['path']) ? \sanitize_key(trim($site_url['path'], '/')) : '';
    131         $sitePrefix = \sanitize_key($site_url['host']) . ($path ? "_{$path}" : '') . '_' . \get_current_blog_id();
     129        $site_url   = \parse_url(\get_site_url());
     130        $path       = !empty($site_url['path']) ? \sanitize_key(\trim($site_url['path'], '/')) : '';
     131        $sitePrefix = \apply_filters('prompress_redis_prefix', 'wp_site_' . \sanitize_key($site_url['host']) . ($path ? "_{$path}" : '') . '_' . \get_current_blog_id() . ':' );
    132132
    133133        $options = \apply_filters(
     
    140140                'read_timeout'           => \WP_REDIS_READ_TIMEOUT,
    141141                'persistent_connections' => \WP_REDIS_PERSISTENT,
    142                 'prefix'                 => 'wp_site_' . $sitePrefix . ':',
    143142            ]
    144143        );
    145144
    146145        Redis::setDefaultOptions( $options );
     146        Redis::setPrefix( $sitePrefix );
    147147    }
    148148
  • prompress/trunk/package.json

    r3161698 r3255044  
    55    "author": "Peter Booker <mail@peterbooker.com>",
    66    "engines": {
    7         "node": ">=20.0.0",
     7        "node": ">=22.0.0",
    88        "npm": ">=10.0.0",
    99        "yarn": "Please use npm"
     
    2222        "@types/wordpress__notices": "~3.27.6",
    2323        "@wordpress/eslint-plugin": "~17.9.0",
    24         "@wordpress/scripts": "~30.0.2",
     24        "@wordpress/scripts": "~27.2.6",
    2525        "resolve-url-loader": "~5.0.0",
    2626        "webpack-remove-empty-scripts": "~1.0.4"
  • prompress/trunk/prompress.php

    r3252918 r3255044  
    44 * Plugin URI:        https://github.com/PeterBooker/prompress
    55 * Description:       Monitor your WordPress website with Prometheus.
    6  * Version:           1.2.0
     6 * Version:           1.2.1
    77 * Author:            Peter Booker
    88 * Author URI:        https://peterbooker.com
     
    2727}
    2828
    29 \define( 'PROMPRESS_VERSION', '1.2.0' );
     29\define( 'PROMPRESS_VERSION', '1.2.1' );
    3030\define( 'PROMPRESS_DIR', \plugin_dir_path( __FILE__ ) );
    3131\define( 'PROMPRESS_URL', \plugin_dir_url( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.