Plugin Directory

Changeset 2932273


Ignore:
Timestamp:
06/29/2023 12:44:46 PM (3 years ago)
Author:
stefanpejcic
Message:

rollback to 1.0.3

Location:
use-memcached/trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • use-memcached/trunk/classes/AdminNotices.php

    r2925069 r2932273  
    9898        ) {
    9999            $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 )
    101101            );
    102102        } else if(
  • use-memcached/trunk/classes/Tools.php

    r2925069 r2932273  
    1515    public function __construct(Plugin $plugin) {
    1616        $this->plugin = $plugin;
     17        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
    1718        add_action( 'admin_init', array($this, 'save_settings') );
    1819    }
     
    2324     */
    2425    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        );
    2637    }
    2738
     
    4354        }
    4455    }
     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    }
    45140}
  • use-memcached/trunk/plugin.php

    r2932095 r2932273  
    33/**
    44 * Plugin Name: Use Memcached
     5 * Plugin URI: https://github.com/palasthotel/use-memcached
    56 * Description: Adds memcached support for WP_Object_Cache.
    67 * Version: 1.0.5
    78 * Text Domain: use-memcached
    89 * Domain Path: /languages
     10 * Author: Palasthotel <[email protected]> (in person: Edward Bock)
     11 * Author URI: http://www.palasthotel.de
    912 * Requires at least: 5.0
    1013 * Tested up to: 6.2
  • use-memcached/trunk/readme.txt

    r2932095 r2932273  
    11=== Use Memcached ===
    2 Contributors: edwardbock, stefanpejcic
    3 Tags: cache, performance, memcache, memcached, caching, object cache
     2Contributors: edwardbock
     3Tags: cache, performance
    44Requires at least: 5.0
    5 Tested up to: 6.2
    6 Stable tag: 1.0.5
     5Tested up to: 5.3.2
     6Stable tag: 1.0.6
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl
     
    1212== Description ==
    1313
    14 Use this to optimize your website performance with Memcached instances.
     14This plugin is no longer actively maintained.
    1515
     16<<<<<<< .mine
     17||||||| .r2925082
    1618Simply 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.
    1719
    1820
     21
     22
     23For more free WordPress plugins please visit [♣️ plugins.club](https://plugins.club/).
     24
     25=======
     26Simply 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
    1930== Installation ==
    2031
    21321. Upload `use-memcached.zip` to the `/wp-content/plugins/` directory
    22 2. Extract the Plugin to a `use-memcached` Folder
    23 3. Activate the plugin through the 'Plugins' menu in WordPress
    24 4. The plugin will copy a object-cache.php file to /wp-content/ folder
    25 5. You can provide custom memcached server and port in plugin settings page
     331. Extract the Plugin to a `use-memcached` Folder
     341. Activate the plugin through the 'Plugins' menu in WordPress
     351. The plugin will copy a object-cache.php file to /wp-content/ folder
     361. You can provide custom memcached server settings in the wp-config.php file
    2637
    2738== Frequently Asked Questions ==
     
    3142If 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.
    3243
    33 With other hosters or service settings you need to set the server and port in the plugin settings page.
     44With other hosters or service settings you need to configure some php variables in wp-config.php file.
    3445
    35 = How to purge cache? =
    36 
    37 Click on the "Purge Cache" link in the topbar or using WP-CLI:
    38 `
    39 wp memcache flush
    40 `
    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 `
    5246
    5347== Screenshots ==
    5448
    55 1. Add Memcached server hostname and port
    56 2. Preview cached data and monitor resource usage
    57 3. Cache warmup using sitemap file
    5849
    5950
    6051== Changelog ==
    61 
    62 = 1.0.5 =
    63 
    64 * Added a settings page where user can set memcached server and port
    65 * Added a settings page that allows user to view cached information
    66 
    67 = 1.0.4 =
    68 * process logs will only be written on WP_DEBUG = true or USE_MEMCACHED_PROCESS_LOG = true sessions
    6952
    7053= 1.0.3 =
     
    8467
    8568
    86 == CREDITS ==
     69== Arbitrary section ==
    8770
     71<<<<<<< .mine
     72There’s a documentation at https://github.com/palasthotel/use-memcached
     73
     74
     75||||||| .r2925082
     76Originally developed by [Palasthotel (in person: Edward Bock)](https://palasthotel.de/)
     77=======
    8878Maintenance by Stefan Pejcic
    8979
    9080Originally developed by [Palasthotel (in person: Edward Bock)](https://palasthotel.de/)
     81>>>>>>> .r2932270
  • use-memcached/trunk/templates/object-cache.php

    r2925069 r2932273  
    44
    55// always count up if file changed
    6 define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_VERSION', 24 );
     6define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_VERSION', 23 );
    77// this file needs to exist. otherwise we will fall back to core WP_Object_Cache
    88define( 'USE_MEMCACHED_OBJECT_CACHE_SCRIPT_ENABLED_FILE', WP_CONTENT_DIR . "/uploads/use-memcached.enabled" );
     
    327327
    328328                } 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' );
    348330                }
    349331            }
     
    757739
    758740        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')){
    768742                try {
    769743                    process_log_write( function ( $log ) use ( $value, $key ) {
     
    784758            }
    785759        }
     760
    786761    }
    787762
Note: See TracChangeset for help on using the changeset viewer.