Changeset 2932273
- Timestamp:
- 06/29/2023 12:44:46 PM (3 years ago)
- Location:
- use-memcached/trunk
- Files:
-
- 1 deleted
- 5 edited
-
classes/AdminNotices.php (modified) (1 diff)
-
classes/Tools.php (modified) (3 diffs)
-
includes (deleted)
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
templates/object-cache.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
use-memcached/trunk/classes/AdminNotices.php
r2925069 r2932273 98 98 ) { 99 99 $this->enqueue( 100 __( "Some memcache servers are not reachable. Please check <a href='/wp-admin/admin.php?page=use-memcached'>memcached service and connection settings</a>.", DOMAIN )100 __( "Some memcache servers are not reachable. Please check memcached service and connection settings.", DOMAIN ) 101 101 ); 102 102 } else if( -
use-memcached/trunk/classes/Tools.php
r2925069 r2932273 15 15 public function __construct(Plugin $plugin) { 16 16 $this->plugin = $plugin; 17 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 17 18 add_action( 'admin_init', array($this, 'save_settings') ); 18 19 } … … 23 24 */ 24 25 public function getUrl(){ 25 return admin_url("admin.php?page=use-memcached"); 26 return admin_url("tools.php?page=use_memcached"); 27 } 28 29 public function admin_menu() { 30 add_management_page( 31 __("Tools › Use Memcached", DOMAIN), 32 __("Use Memcached", DOMAIN), 33 "manage_options", 34 self::SLUG, 35 array( $this, 'render' ) 36 ); 26 37 } 27 38 … … 43 54 } 44 55 } 56 57 public function render(){ 58 59 echo "<div class='wrap'>"; 60 echo sprintf("<h2>%s</h2>", __("Use Memcached", DOMAIN)); 61 62 if(!function_exists("use_memcached_get_configuration")){ 63 printf("<p>%s</p>", __("Cannot find use_memcached_get_configuration function.", DOMAIN)); 64 return; 65 } 66 67 $config = use_memcached_get_configuration(); 68 69 $buttonText = (!$config->isEnabled())? 70 __("Memcached is disabled. Enable memcached!", DOMAIN) 71 : 72 __("Memcache is enabled. Disable memcached!", DOMAIN); 73 74 $primaryClass = (!$config->isEnabled())? 75 "": "button-primary"; 76 77 echo "<form method='post'>"; 78 echo "<input type='hidden' name='use_memcached_disable_toggle' value='yes' />"; 79 echo "<p style='text-align: center;'>"; 80 echo "<button class='button $primaryClass button-hero'>$buttonText</button>"; 81 echo "</p>"; 82 echo "</form>"; 83 84 if($config->isEnabled()){ 85 $this->renderStats(); 86 } else { 87 printf( 88 "<p style='text-align: center;' class='description'>%s</p>", 89 __("No info available because Memcached is disabled.", DOMAIN) 90 ); 91 } 92 93 echo "</div>"; 94 } 95 96 private function renderStats(){ 97 98 $config = use_memcached_get_configuration(); 99 if($config->isFreistil()){ 100 echo "<p>We have Freistil infrastructure</p>"; 101 } else { 102 echo "<p>We do not have Freistil infrastructure</p>"; 103 } 104 105 106 $this->renderRow( 107 __("Freistil prefix", DOMAIN), 108 $this->plugin->memcache->getFreistilPrefix() 109 ); 110 $this->renderRow( 111 __("Global prefix", DOMAIN), 112 $this->plugin->memcache->getGlobalPrefix() 113 ); 114 $this->renderRow( 115 __("Blog prefix", DOMAIN), 116 $this->plugin->memcache->getBlogPrefix() 117 ); 118 119 $stats = $this->plugin->memcache->stats(true); 120 if(is_array($stats)){ 121 122 foreach ($stats as $buckets){ 123 foreach ($buckets as $ip => $server){ 124 echo "<h3>$ip</h3>"; 125 foreach ($server as $key => $value){ 126 $this->renderRow($key, $value); 127 } 128 129 } 130 } 131 } else { 132 sprintf("<p>%s</p>",__("No stats available", DOMAIN)); 133 } 134 135 } 136 137 private function renderRow($key, $value){ 138 echo "<div><p><strong>$key:</strong> $value</p></div>"; 139 } 45 140 } -
use-memcached/trunk/plugin.php
r2932095 r2932273 3 3 /** 4 4 * Plugin Name: Use Memcached 5 * Plugin URI: https://github.com/palasthotel/use-memcached 5 6 * Description: Adds memcached support for WP_Object_Cache. 6 7 * Version: 1.0.5 7 8 * Text Domain: use-memcached 8 9 * Domain Path: /languages 10 * Author: Palasthotel <[email protected]> (in person: Edward Bock) 11 * Author URI: http://www.palasthotel.de 9 12 * Requires at least: 5.0 10 13 * Tested up to: 6.2 -
use-memcached/trunk/readme.txt
r2932095 r2932273 1 1 === Use Memcached === 2 Contributors: edwardbock , stefanpejcic3 Tags: cache, performance , memcache, memcached, caching, object cache2 Contributors: edwardbock 3 Tags: cache, performance 4 4 Requires at least: 5.0 5 Tested up to: 6.26 Stable tag: 1.0. 55 Tested up to: 5.3.2 6 Stable tag: 1.0.6 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl … … 12 12 == Description == 13 13 14 Use this to optimize your website performance with Memcached instances.14 This plugin is no longer actively maintained. 15 15 16 <<<<<<< .mine 17 ||||||| .r2925082 16 18 Simply install the plugin, add your Memcached server and port in the plugin settings *(default are **127.0.0.1:11211**) and click on the **Enable memcached!** button. 17 19 18 20 21 22 23 For more free WordPress plugins please visit [♣️ plugins.club](https://plugins.club/). 24 25 ======= 26 Simply install the plugin, add your Memcached server and port in the plugin settings *(default are **127.0.0.1:11211**) and click on the **Enable memcached!** button. 27 28 29 >>>>>>> .r2932270 19 30 == Installation == 20 31 21 32 1. Upload `use-memcached.zip` to the `/wp-content/plugins/` directory 22 2. Extract the Plugin to a `use-memcached` Folder23 3. Activate the plugin through the 'Plugins' menu in WordPress24 4. The plugin will copy a object-cache.php file to /wp-content/ folder25 5. You can provide custom memcached server and port in plugin settings page33 1. Extract the Plugin to a `use-memcached` Folder 34 1. Activate the plugin through the 'Plugins' menu in WordPress 35 1. The plugin will copy a object-cache.php file to /wp-content/ folder 36 1. You can provide custom memcached server settings in the wp-config.php file 26 37 27 38 == Frequently Asked Questions == … … 31 42 If you are using a Memcached service with default values host 127.0.0.1 (localhost) and port 11211 or you are hosting with freistil.it than you don't need to configure anything. 32 43 33 With other hosters or service settings you need to set the server and port in the plugin settings page.44 With other hosters or service settings you need to configure some php variables in wp-config.php file. 34 45 35 = How to purge cache? =36 37 Click on the "Purge Cache" link in the topbar or using WP-CLI:38 `39 wp memcache flush40 `41 42 = How to use multiple Memcached servers? =43 44 Currently the only way to use more than one Memcached server requires to edit the object-cache.php file:45 46 `47 $memcached_servers = array(48 '10.10.10.20:11211',49 '10.10.10.30:11217'50 );51 `52 46 53 47 == Screenshots == 54 48 55 1. Add Memcached server hostname and port56 2. Preview cached data and monitor resource usage57 3. Cache warmup using sitemap file58 49 59 50 60 51 == Changelog == 61 62 = 1.0.5 =63 64 * Added a settings page where user can set memcached server and port65 * Added a settings page that allows user to view cached information66 67 = 1.0.4 =68 * process logs will only be written on WP_DEBUG = true or USE_MEMCACHED_PROCESS_LOG = true sessions69 52 70 53 = 1.0.3 = … … 84 67 85 68 86 == CREDITS==69 == Arbitrary section == 87 70 71 <<<<<<< .mine 72 There’s a documentation at https://github.com/palasthotel/use-memcached 73 74 75 ||||||| .r2925082 76 Originally developed by [Palasthotel (in person: Edward Bock)](https://palasthotel.de/) 77 ======= 88 78 Maintenance by Stefan Pejcic 89 79 90 80 Originally developed by [Palasthotel (in person: Edward Bock)](https://palasthotel.de/) 81 >>>>>>> .r2932270 -
use-memcached/trunk/templates/object-cache.php
r2925069 r2932273 4 4 5 5 // always count up if file changed 6 define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_VERSION', 2 4);6 define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_VERSION', 23 ); 7 7 // this file needs to exist. otherwise we will fall back to core WP_Object_Cache 8 8 define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_ENABLED_FILE', WP_CONTENT_DIR . "/uploads/use-memcached.enabled" ); … … 327 327 328 328 } else { 329 // Load the wp-config.php file 330 require_once('../wp-config.php'); 331 332 // Check if the constants are defined and not empty 333 if (defined('USE_MEMCACHED_SERVER') && !empty(USE_MEMCACHED_SERVER)) { 334 $server = USE_MEMCACHED_SERVER; 335 } else { 336 $server = '127.0.0.1'; 337 } 338 339 if (defined('USE_MEMCACHED_PORT') && !empty(USE_MEMCACHED_PORT)) { 340 $port = USE_MEMCACHED_PORT; 341 } else { 342 $port = '11211'; 343 } 344 345 // Create the array with the server and port 346 $buckets = array($server . ':' . $port); 347 329 $buckets = array( '127.0.0.1:11211' ); 348 330 } 349 331 } … … 757 739 758 740 function log($key, $value = null){ 759 if( 760 ( 761 (defined('WP_DEBUG') && WP_DEBUG == true) 762 || 763 (defined('USE_MEMCACHED_PROCESS_LOG') && USE_MEMCACHED_PROCESS_LOG == true) 764 ) 765 && 766 function_exists('process_log_write') 767 ){ 741 if(function_exists('process_log_write')){ 768 742 try { 769 743 process_log_write( function ( $log ) use ( $value, $key ) { … … 784 758 } 785 759 } 760 786 761 } 787 762
Note: See TracChangeset
for help on using the changeset viewer.