-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is_installed routine fails #1543
Comments
@mybb/developers @Destroy666x @JN-Jones |
@mybb/developers As this shouldn't break plugins it's probably best to simply add another if for this. Or do we want to close this as it's been like this for years now? |
I'm not sure if it's worth fixing given how long it's been like this - some people might be used to the current behaviour. |
Anyone else with an opinion? |
I think this is the correct behavior. Whether the plugin is completely uninstalled or just deactivated, it should be in the inactive column. |
As we have the control "Install & Activate" the plugin gets activated along with installation. Afterwards if its Deactivated it goes under "Inactive Plugins". Now we can either make a separate section for installed but not activated plugins or close the issue as the behaviour is normal, it already indicating which one is installed and which one is not somehow. @mybb/developers |
So it looks like if a plugin has been activated and is recorded in the plugins cache as activated then it will appear in the active plugins table. However when deciding which controls to display if the plugin has an mybb/admin/modules/config/plugins.php Lines 649 to 652 in 19e30a0
then the install and activate control is shown: mybb/admin/modules/config/plugins.php Lines 667 to 677 in 19e30a0
Example plugin to recreate the behaviour<?php
$plugins->add_hook('global_start', 'mytestplug_global');
function mytestplug_global()
{
die('Plugin is active');
}
function mytestplug_info()
{
return array(
'name' => 'Test plugin',
'compatibility' => '18*',
'codename' => 'mytestplug'
);
}
function mytestplug_activate(){}
function mytestplug_deactivate(){}
function mytestplug_install(){}
function mytestplug_is_installed(){}
function mytestplug_uninstall(){} This is undesirable in my opinion since the plugin is actually active and plugin hooks execute but the administrator has no control to deactivate the plugin. I think it would be right to ensure that after calling mybb/admin/modules/config/plugins.php Lines 423 to 429 in 19e30a0
My suggestion would be something like: diff --git a/admin/modules/config/plugins.php b/admin/modules/config/plugins.php
index e11875c23..1efeef889 100644
--- a/admin/modules/config/plugins.php
+++ b/admin/modules/config/plugins.php
@@ -424,6 +424,14 @@ if($mybb->input['action'] == "activate" || $mybb->input['action'] == "deactivate
if($installed == false && function_exists("{$codename}_install"))
{
call_user_func("{$codename}_install");
+
+ if($installed_func() != true)
+ {
+ call_user_func("{$codename}_uninstall");
+ flash_message($lang->error_plugin_not_installed_successfully, 'error');
+ admin_redirect("index.php?module=config-plugins");
+ }
+
$message = $lang->success_plugin_installed;
$install_uninstall = true;
} And also show a warning and change the controls for plugins that are active but say are not installed. |
Well, not actually. The sorting of active/deactivated plugins only checks if the plugin is activated and shows it under the proper table. It ignores the returned value of its _is_installed() routine.
Original thread: is_installed routine fails
The text was updated successfully, but these errors were encountered: