#810 closed defect (bug) (fixed)
You can't activate plugins
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 0.9 | Priority: | normal |
| Severity: | normal | Version: | 1.0-rc-2 |
| Component: | General - Administration | Keywords: | |
| Cc: |
Description
When you click Activate on some plugin the message Plugin "akismet.php" activated shows up, but the plugin really doesn't get activated. It still shows Activate as the action for the plugin.
Change History (10)
#2
in reply to:
↑ 1
@
18 years ago
If i copied akismet.php and bozo.php from bb-plugins/ to my-plugins/, then it started working.
#3
in reply to:
↑ 1
@
18 years ago
It looks like it doesn't let me activate the plugins that are located in bb-plugins/.
(And yes, I'm using the latest 1262 revision)
#4
@
18 years ago
I uploaded bbPress onto my server and guess what? It works fine over there.
My home comp, which it doesn't work on has:
Windows, Apache 2.2.6, PHP 5.2.5, MySQL 5.0.45
My server, which it works on has:
Linux, Apache 2.0.61, PHP 5.2.3, MySQL 5.0.24
#5
@
18 years ago
It for some reason shows
plugins.php?action=activate&plugin=user#akismet.php
as the activation link on my home computer (it should show core#akismet.php, because Akismet is a core plugin, not an user plugin).
#6
@
18 years ago
There seems to be a bug in admin-functions.php bb_get_plugin_data function.
if (substr($plugin_file, 0, strlen(BB_CORE_PLUGIN_DIR)) == BB_CORE_PLUGIN_DIR) {
$location = 'core';
} else {
$location = 'user';
}
I added this debug code:
echo '$plugin_file = "' . $plugin_file . '"<br />'; echo 'substr($plugin_file, 0, strlen(BB_CORE_PLUGIN_DIR)) = "' . substr($plugin_file, 0, strlen(BB_CORE_PLUGIN_DIR)) . '"<br />'; echo 'BB_CORE_PLUGIN_DIR = "' . BB_CORE_PLUGIN_DIR . '"<br />';
...and it outputs:
$plugin_file = "E:\da3rX\Servers\Root\bbpress-svn/bb-plugins\akismet.php" substr($plugin_file, 0, strlen(BB_CORE_PLUGIN_DIR)) = "E:\da3rX\Servers\Root\bbpress-svn/bb-plugins\" BB_CORE_PLUGIN_DIR = "E:\da3rX\Servers\Root\bbpress-svn/bb-plugins/"
There seems to be a conflict between the Linux forward slashes and Windows backslashes. As you can see the last slash is different and that makes the comparison to fail, so it thinks the plugin is located in the user folder. I'm not sure how to fix this in PHP, but i know that Java has a predefined system property called file.separator.
A quick and dirty fix for this would be just to strip the last character from both of the strings before comparing them:
if (substr($plugin_file, 0, strlen(BB_CORE_PLUGIN_DIR) - 1) == substr(BB_CORE_PLUGIN_DIR, 0, strlen(BB_CORE_PLUGIN_DIR) - 1)) {
$location = 'core';
} else {
$location = 'user';
}
Probably not the best one, but hey, it works. :)
#7
@
18 years ago
Probably a better fix. Replaces all the backslashes with forward slashes in both strings before comparing them.
if (substr(str_replace('\\', '/', $plugin_file), 0, strlen(BB_CORE_PLUGIN_DIR)) == str_replace('\\', '/', BB_CORE_PLUGIN_DIR)) {
$location = 'core';
} else {
$location = 'user';
}
This works for me using either trunk/ code or branches/0.8/ code.
Additionally, the message I see is
Plugin "Akismet" activatednotPlugin "akismet.php" activated.Are you using up to date code?