inpsyde / menu-cache Goto Github PK
View Code? Open in Web Editor NEWEasily cache rendered menus using the Transients API.
Home Page: https://packagist.org/packages/inpsyde/menu-cache
License: GNU General Public License v2.0
Easily cache rendered menus using the Transients API.
Home Page: https://packagist.org/packages/inpsyde/menu-cache
License: GNU General Public License v2.0
Documentation is a bit unclear on how or why would you actually use MenuCache::FILTER_KEY_ARGUMENT
?
On surface, it seems like working with MenuCache::FILTER_KEY
is always better.
Anything I'm missing?
I created a composer.json in my wordpress directory (/var/www/mysite.com):
{
"require": {
"inpsyde/menu-cache": "^1.3"
}
}
When I run composer install, the plugin is installed in /var/www/mysite.com/vendor instead of /var/www/mysite.com/wp-content/plugins.
What is the correct way to install this plugin?
With time-based caching, dynamics like .current-menu-item
get lost for all cached hits.
Are there any well known strategies for making it work again via AJAX / REST API?
A functioning sub-site
The site is switched to the menu origin's site, so content and permalinks and loads of other stuff is broken
Multisite Shared Menu hooks into pre_wp_nav_menu
, just like Menu Cache. It uses this hook to switch_to_blog()
and restores the current blog in wp_nav_menu_items
The problem is that it never gets there if Menu Cache returned the cached HTML, so we end up with a rogue site-switch.
I'm not blaming this on Menu Cache, mind you. But since wp_nav_menu
is not implemented in a way that would allow us to hook into it safely, stuff like this is bound to happen.
If Menu Cache was more aggressive about dealing with its hooke, this particular incompatibility could be avoided, however. I will post a PR for you to review
Deployment to Mittwald through Envoyer to go through without issue
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 106 installs, 0 updates, 0 removals
- Installing composer/installers (v1.4.0) Loading from cache
- Installing johnpbloch/wordpress-core-installer (1.0.0) Loading from cache
[...]
- Installing squizlabs/php_codesniffer (3.1.1) Loading from cache
- Installing wp-coding-standards/wpcs (0.13.1) Loading from cache
- Installing wimg/php-compatibility (8.0.1) Loading from cache
- Installing dealerdirect/phpcodesniffer-composer-installer (v0.4.3) Loading from cache
Plugin installation failed, rolling back
- Removing dealerdirect/phpcodesniffer-composer-installer (v0.4.3)
[Symfony\Component\Process\Exception\ProcessFailedException]
The command "'/files/deployments/releases/20171024101214/public/wp-content/vendor/bin/phpcs' '--config-show' 'installed_paths'" failed.
Exit Code: 3(Unknown error)
Working directory: /files/deployments/releases/20171024101214
Output:
================
Content-type: text/html; charset=UTF-8
ERROR: You must supply at least one file or directory to process.
Run "phpcs --help" for usage information
Error Output:
================
It appears that during the installation, phpcs --config-set installed_paths
is unset, resulting in phpcs throwing an error.
It it a requirement to use phpcs in production? Could this stuff be a dev-dependency? Maybe you should try to set the path as a post-install-cmd. Anyway, I am not sufficiently aware of the workflows surrounding the usage of the phpcs/wpcs packages within the development of menu-cache, so you probably know better.
<?php
add_filter( \Inpsyde\MenuCache\MenuCache::FILTER_EXPIRATION, function () {
return 3600;
} );
?>
Custom plugin would activate and filter would modify menu caching period.
Custom plugin fails to activate:
[27-Sep-2017 05:14:53 UTC] PHP Fatal error: Uncaught Error: Class 'Inpsyde\MenuCache\MenuCache' not found in /var/www/mysite.com/wp-content/plugins/customplugin-menu-cache/customplugin-menu-cache.php:14
Stack trace:
#0 /var/www/mysite.com/wp-admin/includes/plugin.php(560): include_once()
#1 /var/www/mysite.com/wp-admin/plugins.php(42): activate_plugin('customplugin-menu-...', 'https://www.mysite.com...', true)
#2 /var/www/mysite.com/wp-admin/network/plugins.php(13): require('/var/www/www.mysite.com...')
#3 {main}
thrown in /var/www/mysite.com/wp-content/plugins/customplugin-menu-cache/customplugin-menu-cache.php on line 14
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.