TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.76k stars 429 forks source link

Plugin with upper case characters fails to activate: 'Plugin file does not exist' #548

Closed csears closed 8 years ago

csears commented 8 years ago

Greetings,

I started using a theme called Strata, which included a plugin called LayerSlider, which included TGM-Plugin-Activation version 2.4.1, which I realize is not the current version.

TLDR: That version seemed to assume the plugin directory would be all lower case. Renaming the plugin to all lower case fixed the issue.

If this is no longer an issue, please close this. I just wanted to document it for others who might be using the old version.

Further detail...

When I tried activating it, I got the message: Plugin file does not exist

I turned on debugging and tried activating again: Undefined offset: 0 in /var/www/html/wp-content/themes/strata/includes/plugins/class-tgm-plugin-activation.php

Looking at that code:

// Populate $plugin array with necessary information.
$plugin['name']   = $_GET['plugin_name']; // @todo needs sanitizing, figure out how
$plugin['slug']   = sanitize_title( $_GET['plugin'] );
$plugin['source'] = $_GET['plugin_source']; // @todo needs sanitizing, figure out how

$plugin_data = get_plugins( '/' . $plugin['slug'] ); // Retrieve all plugins.

It seemed odd that it would build the file path from the slug (which was lowercased somewhere), so I tried renaming the folder to be all lowercase: mv LayerSlider layerslider

Tried reactivating, and it worked.

Hope it's useful to someone. Have a great day!

GaryJones commented 8 years ago

Thanks for taking the time to let us know.

This issue was reported in #401 and #407, and fixed in #403. Released in 2.5.0.

If you wanted to feed this back to the Strata author so they can update their release, that would be great!