Changeset 3255044
- Timestamp:
- 03/12/2025 10:16:07 PM (13 months ago)
- Location:
- prompress
- Files:
-
- 6 edited
- 20 copied
-
tags/1.2.1 (copied) (copied from prompress/trunk)
-
tags/1.2.1/LICENSE (copied) (copied from prompress/trunk/LICENSE)
-
tags/1.2.1/README.md (copied) (copied from prompress/trunk/README.md)
-
tags/1.2.1/README.txt (copied) (copied from prompress/trunk/README.txt) (2 diffs)
-
tags/1.2.1/build (copied) (copied from prompress/trunk/build)
-
tags/1.2.1/build/index-rtl.css (copied) (copied from prompress/trunk/build/index-rtl.css)
-
tags/1.2.1/build/index.asset.php (copied) (copied from prompress/trunk/build/index.asset.php) (1 diff)
-
tags/1.2.1/build/index.css (copied) (copied from prompress/trunk/build/index.css)
-
tags/1.2.1/build/index.js (copied) (copied from prompress/trunk/build/index.js) (1 diff)
-
tags/1.2.1/composer.json (copied) (copied from prompress/trunk/composer.json)
-
tags/1.2.1/inc (copied) (copied from prompress/trunk/inc)
-
tags/1.2.1/inc/class-monitor.php (copied) (copied from prompress/trunk/inc/class-monitor.php) (2 diffs)
-
tags/1.2.1/inc/rest.php (copied) (copied from prompress/trunk/inc/rest.php)
-
tags/1.2.1/inc/settings.php (copied) (copied from prompress/trunk/inc/settings.php)
-
tags/1.2.1/package.json (copied) (copied from prompress/trunk/package.json) (2 diffs)
-
tags/1.2.1/prompress.php (copied) (copied from prompress/trunk/prompress.php) (2 diffs)
-
tags/1.2.1/uninstall.php (copied) (copied from prompress/trunk/uninstall.php)
-
tags/1.2.1/vendor (copied) (copied from prompress/trunk/vendor)
-
tags/1.2.1/vendor/composer/installed.php (copied) (copied from prompress/trunk/vendor/composer/installed.php)
-
tags/1.2.1/vendor/promphp (copied) (copied from prompress/trunk/vendor/promphp)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/inc/class-monitor.php (modified) (2 diffs)
-
trunk/package.json (modified) (2 diffs)
-
trunk/prompress.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
prompress/tags/1.2.1/README.txt
r3252918 r3255044 4 4 Requires at least: 6.4 5 5 Tested up to: 6.7.2 6 Stable tag: 1.2. 06 Stable tag: 1.2.1 7 7 Requires PHP: 8.1 8 8 License: GPLv3 or later … … 57 57 == Changelog == 58 58 59 = 1.2.1 = 60 61 * Bugfix- Properly sets the Redis prefix. 62 * Bugfix- Adds a filter for the Redis prefix. 63 59 64 = 1.2.0 = 60 65 -
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 127 127 } 128 128 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() . ':' ); 132 132 133 133 $options = \apply_filters( … … 140 140 'read_timeout' => \WP_REDIS_READ_TIMEOUT, 141 141 'persistent_connections' => \WP_REDIS_PERSISTENT, 142 'prefix' => 'wp_site_' . $sitePrefix . ':',143 142 ] 144 143 ); 145 144 146 145 Redis::setDefaultOptions( $options ); 146 Redis::setPrefix( $sitePrefix ); 147 147 } 148 148 -
prompress/tags/1.2.1/package.json
r3161698 r3255044 5 5 "author": "Peter Booker <mail@peterbooker.com>", 6 6 "engines": { 7 "node": ">=2 0.0.0",7 "node": ">=22.0.0", 8 8 "npm": ">=10.0.0", 9 9 "yarn": "Please use npm" … … 22 22 "@types/wordpress__notices": "~3.27.6", 23 23 "@wordpress/eslint-plugin": "~17.9.0", 24 "@wordpress/scripts": "~ 30.0.2",24 "@wordpress/scripts": "~27.2.6", 25 25 "resolve-url-loader": "~5.0.0", 26 26 "webpack-remove-empty-scripts": "~1.0.4" -
prompress/tags/1.2.1/prompress.php
r3252918 r3255044 4 4 * Plugin URI: https://github.com/PeterBooker/prompress 5 5 * Description: Monitor your WordPress website with Prometheus. 6 * Version: 1.2. 06 * Version: 1.2.1 7 7 * Author: Peter Booker 8 8 * Author URI: https://peterbooker.com … … 27 27 } 28 28 29 \define( 'PROMPRESS_VERSION', '1.2. 0' );29 \define( 'PROMPRESS_VERSION', '1.2.1' ); 30 30 \define( 'PROMPRESS_DIR', \plugin_dir_path( __FILE__ ) ); 31 31 \define( 'PROMPRESS_URL', \plugin_dir_url( __FILE__ ) ); -
prompress/trunk/README.txt
r3252918 r3255044 4 4 Requires at least: 6.4 5 5 Tested up to: 6.7.2 6 Stable tag: 1.2. 06 Stable tag: 1.2.1 7 7 Requires PHP: 8.1 8 8 License: GPLv3 or later … … 57 57 == Changelog == 58 58 59 = 1.2.1 = 60 61 * Bugfix- Properly sets the Redis prefix. 62 * Bugfix- Adds a filter for the Redis prefix. 63 59 64 = 1.2.0 = 60 65 -
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 127 127 } 128 128 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() . ':' ); 132 132 133 133 $options = \apply_filters( … … 140 140 'read_timeout' => \WP_REDIS_READ_TIMEOUT, 141 141 'persistent_connections' => \WP_REDIS_PERSISTENT, 142 'prefix' => 'wp_site_' . $sitePrefix . ':',143 142 ] 144 143 ); 145 144 146 145 Redis::setDefaultOptions( $options ); 146 Redis::setPrefix( $sitePrefix ); 147 147 } 148 148 -
prompress/trunk/package.json
r3161698 r3255044 5 5 "author": "Peter Booker <mail@peterbooker.com>", 6 6 "engines": { 7 "node": ">=2 0.0.0",7 "node": ">=22.0.0", 8 8 "npm": ">=10.0.0", 9 9 "yarn": "Please use npm" … … 22 22 "@types/wordpress__notices": "~3.27.6", 23 23 "@wordpress/eslint-plugin": "~17.9.0", 24 "@wordpress/scripts": "~ 30.0.2",24 "@wordpress/scripts": "~27.2.6", 25 25 "resolve-url-loader": "~5.0.0", 26 26 "webpack-remove-empty-scripts": "~1.0.4" -
prompress/trunk/prompress.php
r3252918 r3255044 4 4 * Plugin URI: https://github.com/PeterBooker/prompress 5 5 * Description: Monitor your WordPress website with Prometheus. 6 * Version: 1.2. 06 * Version: 1.2.1 7 7 * Author: Peter Booker 8 8 * Author URI: https://peterbooker.com … … 27 27 } 28 28 29 \define( 'PROMPRESS_VERSION', '1.2. 0' );29 \define( 'PROMPRESS_VERSION', '1.2.1' ); 30 30 \define( 'PROMPRESS_DIR', \plugin_dir_path( __FILE__ ) ); 31 31 \define( 'PROMPRESS_URL', \plugin_dir_url( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.