Changeset 2925069
- Timestamp:
- 06/13/2023 05:22:31 AM (3 years ago)
- Location:
- use-memcached/trunk
- Files:
-
- 10 added
- 5 edited
-
classes/AdminNotices.php (modified) (1 diff)
-
classes/Tools.php (modified) (3 diffs)
-
includes (added)
-
includes/assets (added)
-
includes/assets/css (added)
-
includes/assets/css/settings-page.css (added)
-
includes/assets/images (added)
-
includes/assets/images/icon-128x128.jpg (added)
-
includes/assets/images/memcached.svg (added)
-
includes/use_memcached_info_page.php (added)
-
includes/use_memcached_main_page.php (added)
-
includes/use_memcached_warmer_page.php (added)
-
plugin.php (modified) (3 diffs)
-
readme.txt (modified) (4 diffs)
-
templates/object-cache.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
use-memcached/trunk/classes/AdminNotices.php
r2225295 r2925069 98 98 ) { 99 99 $this->enqueue( 100 __( "Some memcache servers are not reachable. Please check memcached service and connection settings.", DOMAIN )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 ) 101 101 ); 102 102 } else if( -
use-memcached/trunk/classes/Tools.php
r2259565 r2925069 15 15 public function __construct(Plugin $plugin) { 16 16 $this->plugin = $plugin; 17 add_action( 'admin_menu', array( $this, 'admin_menu' ) );18 17 add_action( 'admin_init', array($this, 'save_settings') ); 19 18 } … … 24 23 */ 25 24 public function getUrl(){ 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 ); 25 return admin_url("admin.php?page=use-memcached"); 37 26 } 38 27 … … 54 43 } 55 44 } 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 }140 45 } -
use-memcached/trunk/plugin.php
r2924652 r2925069 5 5 * Plugin URI: https://github.com/palasthotel/use-memcached 6 6 * Description: Adds memcached support for WP_Object_Cache. 7 * Version: 1.0. 47 * Version: 1.0.5 8 8 * Text Domain: use-memcached 9 9 * Domain Path: /languages 10 * Author: Edward Bock11 * Author URI: http s://profiles.wordpress.org/edwardbock/10 * Author: Palasthotel <[email protected]> (in person: Edward Bock) 11 * Author URI: http://www.palasthotel.de 12 12 * Requires at least: 5.0 13 * Tested up to: 5.3.213 * Tested up to: 6.2 14 14 * License: http://www.gnu.org/licenses/gpl-2.0.html GPLv2 15 15 * … … 24 24 // ------------------------------------------------------------------------ 25 25 const DOMAIN = "use-memcached"; 26 27 28 29 30 26 31 27 32 //------------------------------------------------------------------------ … … 124 129 125 130 require_once dirname( __FILE__ ) . "/cli/wp-cli.php"; 131 132 133 // Include plugin Settings pages 134 require_once plugin_dir_path( __FILE__ ) . 'includes/use_memcached_main_page.php'; 135 require_once plugin_dir_path( __FILE__ ) . 'includes/use_memcached_info_page.php'; 136 require_once plugin_dir_path( __FILE__ ) . 'includes/use_memcached_warmer_page.php'; -
use-memcached/trunk/readme.txt
r2924652 r2925069 1 1 === Use Memcached === 2 2 Contributors: edwardbock, stefanpejcic 3 Authors: 3 Donate link: http://palasthotel.de/ 4 4 Tags: cache, performance 5 5 Requires at least: 5.0 6 Tested up to: 5.3.27 Stable tag: 1.0. 46 Tested up to: 6.2 7 Stable tag: 1.0.5 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl … … 13 13 == Description == 14 14 15 This plugin is no longer actively maintained. 15 Use this to optimize your website performance with Memcached instances. 16 16 17 17 18 == Installation == … … 29 30 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. 30 31 31 With other hosters or service settings you need to configure some php variables in wp-config.php file.32 With other hosters or service settings you need to set the server and port in the plugin settings page. 32 33 33 34 … … 37 38 38 39 == Changelog == 40 41 = 1.0.5 = 42 43 * Added a settings page where user can set memcached server and port 44 * Added a settings page that allows user to view cached information 39 45 40 46 = 1.0.4 = -
use-memcached/trunk/templates/object-cache.php
r2259573 r2925069 327 327 328 328 } else { 329 $buckets = array( '127.0.0.1:11211' ); 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 330 348 } 331 349 }
Note: See TracChangeset
for help on using the changeset viewer.