GithubHelp home page GithubHelp logo

wp-cli / wp-super-cache-cli Goto Github PK

View Code? Open in Web Editor NEW
58.0 12.0 18.0 96 KB

A CLI interface for the WP Super Cache plugin

Home Page: http://wordpress.org/support/topic/patch-for-wp-cli-command-1

PHP 95.31% Gherkin 4.69%
wp-cli wp-cli-package wp-super-cache wordpress cli cache hacktoberfest

wp-super-cache-cli's Introduction

CLI interface for the WP Super Cache

This repository contains a WP-CLI plugin for the WP Super Cache Wordpress plugin. After installing this plugin, a Wordpress administrator will have access to a wp super-cache command

$ wp super-cache
usage: wp super-cache disable 
   or: wp super-cache enable 
   or: wp super-cache flush [--post_id=<post-id>] [--permalink=<permalink>]
   or: wp super-cache preload [--status] [--cancel]
   or: wp super-cache status 

See 'wp help super-cache <command>' for more information on a specific command.

Installing

For instructions on installing this, and other, WP-CLI community packages, read the Community Packages section of the WP-CLI Wiki.

wp-super-cache-cli's People

Contributors

astorm avatar danielbachhuber avatar dereckson avatar iandunn avatar mackensen avatar mondalaci avatar schlessera avatar scribu avatar stephandesouza avatar stodorovic avatar swissspidy avatar wojsmol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-super-cache-cli's Issues

Should super-cache enable / disable modify $cache_enabled?

Hi all,

I did some tests using this package on my wordpress installations and because I don't know much how works wordpress cache, I was wondering some questions.

As I can see, if run this

$ wp --path='/var/www/wordpress' super-cache enable

The only thing that changes is in wp-cache-config.php - $super_cache_enabled = 'true';

But in wordpress frontend, cache still remains disabled:

image

The same thing happens with

$ wp --path='/var/www/wordpress' super-cache disable

variable $super_cache_enabled changes to false but in frontend, cache remains enabled.

So, I did some research and I see that in frontend if you enable or disable cache, two variables of wp-cache-config.php changes: $cache_enabled and $super_cache_enabled

My workaround to solve this was in enable / disable functions of super-cache package adding wp_cache_disable(); and wp_cache_enable();.

super-cache.txt

But my concern is if maybe super-cache enable / disable should affect only to super-cache plugin (as it is now). In the other side, in wordpress frontend, if you check / uncheck enabling cache, you are modifying the two values.

What do you think guys?

Thank you.

Support cdn_export

Feature Request

It will be good to have ability to execute cdn_export from cli.

Flushing doesn't work in multisite

The flush command doesn't do anything in multisite. Given this syntax:

wp super-cache flush --url=your.sample.domain

I'd expect the files within cache/supercache/your.sample.domain to be removed. Although the command reports "Success: Cache cleared", no files are actually removed. WP Super Cache works correctly from the public interface.

The index page doesn't get flushed

flush clears the whole cache except our main page which is https://ultimatehackingkeyboard.com

In the settings page the WordPress Address is https://ultimatehackingkeyboard.com/wordpress and the Site Address is https://ultimatehackingkeyboard.com/wordpress

The relevant nginx configuration which might also affect the situation is:

    location / {
        # Redirect from the front page to the blog.
        rewrite "^/$" /wordpress/index.php last;

        # Use WordPress search when encountering with any non-existing files.
        if (!-e $request_filename) {
            rewrite ^(.+)$ /wordpress/index.php?q=$1 last;
        }
    }

Commands not working (for me)

I installed the plugin on the server and tried to execute the commands. But besides from wp super-cache status none of the them seems to work. I can't enable, disable, flush nor preload. When I enable or disable WP Super Cache by hand the status is always off.

terminal_ ssh_dahoam _240x58

Move command over to new v2 structure

The following changes need to be made to move the command over to the v2 structure:

  • Make sure the correct framework is required:
    composer require wp-cli/wp-cli:^2
    
  • Require the testing framework as a dev dependency:
    composer require --dev wp-cli/wp-cli-tests:^2
    
  • Use the .travis.yml file from wp-cli/wp-cli:
    wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/.travis.yml
    
  • Add the default script configuration to Composer file:
      "scripts": {
          "lint": "run-linter-tests",
          "phpcs": "run-phpcs-tests",
          "phpunit": "run-php-unit-tests",
          "behat": "run-behat-tests",
          "prepare-tests": "install-package-tests",
          "test": [
              "@lint",
              "@phpcs",
              "@phpunit",
              "@behat"
          ]
      },
    
  • Remove scaffolded binary files:
    git rm bin/install-package-tests.sh
    git rm bin/test.sh
    
  • Remove scaffolded Behat setup:
    git rm features/bootstrap/*
    git rm features/extra/*
    git rm features/steps/*
    
  • Remove scaffolded Behat tags util script:
    git rm utils/behat-tags.php
    
  • Add command packages that are needed for Behat tests as --dev dependencies.
    The following commands are already available, anything else needs to be explicitly required:
    • cli *
    • config *
    • core *
    • eval
    • eval-file
    • help
  • Update all dependencies:
    composer update
    
  • Optional - Add PHPCS rule set to enable CS & compatibility sniffing:
    wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/phpcs.xml.dist
    
  • Run and adapt tests to make sure they all pass:
    composer test
    

--post_id gets disrespected

When I invoke wp-cli super-cache flush --post_id=123 the post id gets disrespected. It doesn't matter what I specify, the whole cache gets flushed.

Incorrect status reported

I'm attempting to use wp-super-cache-cli in a WordPress 4.5.1 subdomain multisite environment with PHP 5.5. WP Super Cache is installed, configured, and preloading. No matter what I do with the plugin, it reports the following: Error: The WP Super Cache is not enabled.. My limited troubleshooting so far suggests that the values from wp-cache-config.php aren't available to it. I haven't gotten further than that.

Warning: Content-Lenth mismatch trying to install

It's possible this is an issue with my environment or composer on this host, i haven't tried to install wp-cli packages before or used composer on the server... Is the package installer working with this project for others? thanks!

here's a bit of output that may show my environment details...

root@myhost:~# wp --allow-root package install https://github.com/wp-cli/wp-super-cache-cli.git
Installing package wp-cli/wp-super-cache-cli (dev-master)
Updating /home/tmuka/.wp-cli/packages/composer.json to require the package...
Registering https://github.com/wp-cli/wp-super-cache-cli.git as a VCS repository...
Using Composer to install the package...
Loading composer repositories with package information
Updating dependencies
Warning: Content-Length mismatch
Error: Package installation failed (Composer return code ). Reverted composer.json
root@webhost6:~# wps cli version
WP-CLI 1.1.0
root@webhost6:~# php --version
PHP 5.5.9-1ubuntu4.21 (cli) (built: Feb  9 2017 20:54:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.6.0, Copyright (c) 2002-2014, by ionCube Ltd., and
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

Add a clear all setting

WP Super Cache has a clear all capability in the plugin.

When doing code pushes having the ability to clear all the cache would be extremely helpful.

Super cache configuration export/ import

The question is how to save WP Super Cache plugin configuration while deploy a new version of the web.

We have two domains:
example.com (deploy) - with caching on
dev.example.com (dev version) - with WPSC plugin turned off

While new deploy we use the bash script so the full process gets ~2 minutes

Problem is that after deployment we have to restore WPSC settings manually and its a bit terrible.
We can not use saved wp-cache-config.php file because $cache_page_secret constant is unique.

Is there any way to save and restore the configuration?

Wp-cli has no option to do it for now.
Could be:

wp super-cache export-settings >file

wp super-cache import-settings <file

So during deploy could be the sequence:

wp plugin activate wp-super-cache
wp super-cache enable
wp super-cache flush
wp super-cache import-settings <file

It would be really great!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.