Skip to:
Content

bbPress.org

Opened 18 years ago

Closed 18 years ago

Last modified 2 years ago

#810 closed defect (bug) (fixed)

You can't activate plugins

Reported by: da3rx's profile da3rX 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)

#1 follow-ups: @mdawaffe
18 years ago

This works for me using either trunk/ code or branches/0.8/ code.

Additionally, the message I see is Plugin "Akismet" activated not Plugin "akismet.php" activated.

Are you using up to date code?

#2 in reply to: ↑ 1 @da3rX
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 @da3rX
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 @da3rX
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 @da3rX
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 @da3rX
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 @da3rX
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';
}

#8 @mdawaffe
18 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#9 @sambauers
18 years ago

(In [1277]) Making transformation that was rightly removed from bb_basename() in [1263] specifically applied in bb_theme_basename(). See #810

#10 @sambauers
18 years ago

(In [1278]) Making transformation that was rightly removed from bb_basename() in [1263] specifically applied in bb_theme_basename() in branches/0.8. See #810

Note: See TracTickets for help on using tickets.