[wp-trac] [WordPress Trac] #27196: More informative message when plugin installs fail
WordPress Trac
noreply at wordpress.org
Sat May 19 20:50:33 UTC 2018
#27196: More informative message when plugin installs fail
---------------------------+-----------------------------------
Reporter: DavidAnderson | Owner: (none)
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Text Changes | Version: 3.8
Severity: normal | Resolution: maybelater
Keywords: needs-patch | Focuses: docs, administration
---------------------------+-----------------------------------
Comment (by DavidAnderson):
Greetings, past self! 4 more years of people baffled by WordPress's tech-
speak in this message passed before I realised I could help them without a
fix in core.... in case anybody else finds this useful, here's how to do
it (change the slug and message for your case, of course)...
{{{#!php
<?php
add_filter('upgrader_source_selection', 'my_upgrader_source_selection',
10, 4);
function my_upgrader_source_selection($source, $remote_source,
$upgrader_object, $hook_extra) {
if (!is_array($hook_extra) || empty($hook_extra['type']) ||
'plugin' !== $hook_extra['type'] || empty($hook_extra['action']) ||
'install' !== $hook_extra['action'] || empty($source) || 'updraftplus' !==
basename(untrailingslashit($source)) || !class_exists('ReflectionObject'))
return $source;
$reflect = new ReflectionObject($upgrader_object);
$properties = $reflect->getProperty('strings');
if (!$properties::IS_PUBLIC ||
!is_array($upgrader_object->strings) ||
empty($upgrader_object->strings['folder_exists'])) return $source;
$upgrader_object->strings['folder_exists'] .= ' '.__('A version of
UpdraftPlus is already installed. WordPress will only allow you to install
your new version after first de-installing the existing one. That is safe
- all your settings and backups will be retained. So, go to the "Plugins"
page, de-activate and de-install UpdraftPlus, and then try again.',
'updraftplus');
return $source;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27196#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list