Closed alanbrent closed 7 years ago
FYI, if anybody comes here looking for a simple solution, you can force-add files to git repo in such cases:
git add -f wp-content/plugins/google-analytics-for-wordpress/vendor/yoast/api-libs/google/cache
Thanks @andypotanin. This works as a temporary workaround, but of course it's not a fix. Is there anyone watching these tickets? We shouldn't be having to track a folder explicitly named "cache" in our content repos.
You should really rename the folder. Excluding "cache" folders with gitignore is quite normal practice and e.g. WPEngine backups do not include the folders so my backups are incomplete.
In my personal opinion it is overly wide assumption that nothing out there should contain folder named "cache". If your configs are broadly ignoring something (as opposed to specific blacklisted locations), you are creating and taking on risk of it breaking things.
Just in my opinion though, I'll get second one.
Hi Rarst,
I do agree with you. Assuming that "cache"-folders should not be included in Git or Backups is bad, even more when we get namespaces and/or when WordPress developers move towards PSR-standards in having a folder structure that reflects their namespace/class structure. "Cache" as a class or namespace is quite common.
However, using cache folders for this purpose in WP plugins is quite common practice for now, and to me this is just a practical question. If your choice is to keep the folder structure and change the industry a little, I can understand that.
I do not see this as some kind of industry grandstanding. :) Just as a non–issue for vendor, which they (well, us) shouldn't worry about.
OK. =) Well, my original point stands, from practical point of view using a different folder name will cause less issues.
Keep in mind the reason there is a general cache/
exclusion via .gitignore for developers using git in WordPress environments is because the typical use case for a "cache" folder in WordPress core WP plugins and/or themes is to contain cached (usually site-specific) data. So the effective (albeit lazy) approach is to exclude any cache folder in git and/or backup strategies.
The outfit I work with ran into the same issue with Yoast Google Analytics with our git deploy strategies as well recently and while we realize we can work around this issue for your plugin, it lowers the value of a plugin to us when things break like this. So granted, we know the problem and can adjust, but it would make practical sense (as apkopenen pointed out) for you guys to consider changing the name of your folder/namespace if you value the users implementing your plugin in WordPress environments.
Let me put it like this. Let's say we rename the folder. Then next week you encounter another plugin with folder named cache
. You go to another development team and convince them to rename the folder. Next week...
How many times are you willing to do this? Three? Five? Ten?
Let's say you nagged out every last existing WordPress plugin to never name a folder cache
. Alas. some of them start to use more generic PHP libraries which do. Are you going to start convincing every PHP library out there too? Justifying it by “WordPress environments”?
Or you could fix your ignore rules once. Why not just that?.. :)
like I said we can work around it, your point is valid. But its based on the assumption other plugins we use will have a folder named cache in them that's not used for cached data (in which case yeah we can just "fix" our ignore rules". Just like we are basing our rules on the assumption that (so far ;) ) cached folders implemented by WP, WP themes, and WP plugins have contained cached data, not classes related to caching. Either way, assumptions. You're perfectly able to do what you want to do with your plugin and... if we want to continue working with it in our environment, you bet we have to adjust, no worries.
At any rate, with this particular issue I totally get your reluctance to do anything about it. That's fine.
Adding a +1 to rename the folder. We were just bitten by this when our website host restored a backup of the site. I don't know if this folder actually contains cache files but at the very least, the php files
Google_Cache.php Google_WPCache.php
should be moved! I would think it's a best practice for a cache folder to only contain cache files. :)
This Yoast GA is going bye bye but hope this helps PHP Error Log 2Class 'Yoast_Google_WPCache' not foundwp-content/plugins/google-analytics-for-wordpress/vendor/yoast/api-libs/google/Google_Client.php:90a few seconds ago CALL STACK
1 Backtrace too big to show. -:-
We move our sites in and out of dev/stage/production via git strategies. As such, our .gitignore ignores all base Wordpress files and cache files. An issue has cropped up now that we're piloting the Yoast GA plugin (error pasted below), where the site completely stops loading and no source is generated. This is on the backend and frontend of the site. I'm thinking it's probably fairly straightforward for you guys to address this by doing appropriate work when
Yoast_Google_WPCache
is not found.BTW, a quick Google search on this error pulls up plenty of people having this problem.