User tests: Successful: Unsuccessful:
As long as at least one post-install message associated to Joomla exists, the control panel displays a warning and leads to com_postinstall.
There, all messages as shown, regardless of they are associated to Joomla or 3rd party extensions.
However, as soon as all the Joomla related messages are marked as read, the control panel no longer indicates that other post-installation messages are present.
Messages associated to 3rd party extension will not be notified in the control panel until at least one message associated to Joomla will added again.
Labels |
Added:
?
|
I don't think that extension postinstall messages should show in the Joomla Backend for things that are not specific to Joomla. If you have a postinstall message, use the same functionality to show it within your own component and use a link to your extension's id
@wilsonge
I respect your point of view. I don't want to appear rude, but here we are not discussing about the design of the post-install extension.
Its technical specifications has already been officially communicated to the community.
Note that the Joomla Magazine article linked, shows a workaround to the bug we are discussing here in order to get the message displayed in the control panel anyway.
In the example provided there, the extension pretends to be a Joomla core extension by forcing its extension_id to '700'.
This has important implications on your theory about showing only Joomla related messages, and proves that your goal to show only Joomla related messages, can not be achieved even theoretically, because 3rd party extensions will continue acting as described above.
However, for completeness of information, as you explained your point of view about Post-Installation behaviour, I'll do the same.
It's a matter of consistency. Not only "Post-Installation" (com_postinstall) should handle both Joomla core and 3rd party extensions exactly as "Extension manager" (com_installer) does,
but even the "Control Panel" (com_cpanel) should point out post-installation messages originating from both Joomla core and 3rd party extensions, exactly as it currently points out updates related to both Joomla and 3rd party extensions.
(In the bottom-left corner of Joomla Administration entry page)
MAINTENANCE
Checking Joomla!... Joomla! is up-to-date
Checking extensions... Updates are available
@zero-24
Actually, there is no need to install any extension. The problem regards the message, therefore generating a message is sufficient.
The example above generates a post-installation message related to extension_id 25, which is "com_users".
INSERT INTO #__postinstall_messages
(extension_id, title_key, description_key, action_key, language_extension, type, action_file, action, version_introduced) VALUES
(25, 'Message title', 'Message description.', 'See the documentation', 'com_users', 'link', '', '', '3.4.0');
As already explained in #6058, I agree with @wilsonge.
As for the article you linked. It's not an official documentation. It's an article someone wrote for the magazine. It wasn't even the original developer (which would be @nikosdion). I think back at that time, postinstall messages had still a few issues when you used an extension ID instead of 700. Those are fixed by now and we can actually start using them reliably for extensions.
Thus that's no argument and design can and should indeed discussed in this PR.
@demis-palma Each extension needs to cater for its own messages. Please take a look at Akeeba Backup Core or Admin Tools Core where we use post-installation messages and show notifications for them inside our own components.
When I wrote the post-installation messages component the specification was to allow Joomla! display notifications after installation which would disappear once acknowledged, just like I was doing in my own components. Actually, I was asked to write this component by Elin. I was basically "volunteered" into it with about 10 days before a beta freeze. At the eleventh hour I just added one more table field for the extension ID to allow 3PDs to use the same component for their own extensions' messages. Indeed the 3PD support it was buggy and fixed just recently (also the reason why I couldn't use it for my own extensions).
But the essence of the story is that each extension should take care of displaying a notification for its own messages. Joomla! shouldn't bother you with post-install messages of 3PD extensions on peril of users eventually ignoring the post-installation message notifications altogether, missing potentially critical information in future Joomla! versions.
Thanks @nikosdion
I'm closing this PR based on that information and two PLT members already disagreeing with it.
@demis-palma Thanks anyway for the time you put into this.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-02-14 20:11:56 |
Thanks @nikosdion to clarify.
It was clear that the behaviour was buggy, but it seems that I completely misunderstood the nature of the bug.
@Bakual I appreciate your call to discuss the design of this component in this PR but I seldom put into question the specification after a piece of software has been wrote and released to the public.
I've only seen a behaviour that seems a bug I and just tried to fix it. Nothing more, nothing less.
Despite all the acceptable argumentations that @wilsonge @nikosdion and you adduced, I have seen that the trend is to use the component in a dirty way, pretending to be a Joomla related message.
And this is too bad for both the extension developers, who get their hands dirty, and for Joomla developers who want 3rd party extensions to get out of the Control Panel.
Can you give an example?
On 15 February 2015 at 00:20, Demis Palma notifications@github.com wrote:
Thanks @nikosdion https://github.com/nikosdion to clarify.
It was clear that the behaviour was buggy, but it seems that I completely
misunderstood the nature of the bug.@Bakual https://github.com/Bakual I appreciate your call to discuss the
design of this component in this PR but I seldom put into question the
specification after a piece of software has been wrote and released to the
public. [image: ]
I've only seen a behaviour that seems a bug I and just tried to fix it.
Nothing more, nothing less.Despite all the acceptable argumentation that @wilsonge
https://github.com/wilsonge @nikosdion https://github.com/nikosdion
and you adduced, I have seen that the trend is to use the component in
a dirty way, pretending to be a Joomla related message.
And this is too bad for both the extension developers, who get their hands
dirty, and for Joomla developers who want 3rd party extensions to get out
of the Control Panel. [image: ]—
Reply to this email directly or view it on GitHub
#6087 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
With pleasure. An example of what?
Of extension developers who "use the component in a dirty way, pretending
to be a Joomla related message."
On 15 February 2015 at 00:22, Demis Palma notifications@github.com wrote:
With pleasure. An example of what?
—
Reply to this email directly or view it on GitHub
#6087 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Oh, of course. As I mentioned above, an article on Joomla Magazine.
Bakual said that it is not an official communication by Joomla Team. Well, call me stupid, but I've always thought that magazine.joomla.org it is an official magazine, or at least its content is approved.
To me the question is: is it really important that the Control Panel does not display post-installation message related to 3rd party extensions?
If yes, what can we do exactly to prevent or at least discourage extensions to create messages as they were Joomla?
Sorry I am confused - you stated
I have seen that the trend is to use the component in a dirty way,
pretending to be a Joomla related message.
So I am just asking for an example of that so we can see - if nothing else
we would need to see that to ensure that any change would be B/C
On 15 February 2015 at 00:35, Demis Palma notifications@github.com wrote:
Oh, of course. As I mentioned above, an article on Joomla Magazine
http://magazine.joomla.org/issues/issue-december-2013/item/1649-joomla-3-2-new-features-postinstall-messages
.
Bakual said that it is not an official communication by Joomla Team. Well,
call me stupid, [image: ] but I've always thought that
magazine.joomla.org it is an official magazine, or at least its content
is approved.To me the question is: is it really important that the Control Panel does
not display post-installation message related to 3rd party extensions?
If yes, what can we do exactly to prevent or at least discourage
extensions to create messages as they were Joomla?—
Reply to this email directly or view it on GitHub
#6087 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
You can't prevent developers from "playing dirty" with the messages so long as a developer has database access.
Please do not misunderstand. I don't want to accuse the author. Nicola explained how to use the feature in the only way it can currently work.
So there are no examples of developers doing this then
On 15 February 2015 at 00:42, Demis Palma notifications@github.com wrote:
Please do not misunderstand. I don't want to accuse the author. Nicola
explained how to use the feature in the only way it can currently work.—
Reply to this email directly or view it on GitHub
#6087 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
@brianteeman Sorry, I don't know the meaning of B/C, therefore I did not understand your last sentence.
It is possible that I did not explain well. The article mentioned, tells us to create a message using 700 as extension_id, which means "create a message as originated by Joomla".
This is what I call a trend.
I don't know any extension which is doing it right now, but based on amount of readers that the magazine has, I suppose that we will see a lot them in the next months, I guess.
You are seriously confused.
As I already said, you MUST NOT play dirty. Read my code. It cannot get any more official than reading the code which uses the feature written by the same person who wrote that feature to begin with!
You MUST NOT create a message with extension ID 700. It is wrong. If I was asked to read that article before publishing it would have never been published. If someone knows who to contact in JCM please ask them to take it down, its content is not just wrong, it is downright dangerous!
Also, the magazine IS NOT official documentation. It is a magazine. It does not necessarily represent the views of the Joomla! project. This is what allows article authors to discuss commercial components, for example. If it were official documentation it could never have op-eds, articles on 3PD extensions, articles in events etc. Think about it.
@nikosdion
i will be happy to make a "code washing" & article review with your support
i like code
Please do. The reason I put the extension_id column in was to prevent 3PDs from abusing the system. The article completely goes around that provision. Argh!
if i remember well i've used that "hack" for manage plugin/module postinstall messages
someone from the marketing can sell like a new feature so don't tell
so what to do with that article now ?
IMHO the article should be taken down.
@nikosdion of course I am confused, otherwise I would not have proposed this PR. Please be patient.
I appreciate @alikon for series of long time reasons. The article proposes a hack, nevertheless, under Joomla 3.3 which is still the current release, this is the only reasonable thing to do, due to the bug explained at the top of this page that is "under some circumstances (but not always) post-installation messages ignores records associated to 3rd party extensions".
The hack simply works around the bug. By pretending to be a Joomla message it is shown in all circumstances.
I didn't said that this is the right way in general, for that reason I mentioned the article here.
I am terrible sorry to have raised this discussion.
I wish I had gone fishing that day, instead of writing a PR.
@denis-palma LOL! Indeed :)
As for your comment regarding Joomla! 3.3: nope. PLEASE look at my code. You CAN pass the extension ID in the URL to display them.
And since people might come to this thread and wonder, here's the short tutorial.
Put this code in your main view's view.html.php
file, inside the display()
method:
$this->extensionName = 'com_example'; // Change this to your component's name
$this->hasPostInstallationMessages = $this->hasPostInstallMessages();
Also add the following method to your view.html.php file:
public function hasPostInstallMessages()
{
// Get the extension ID for our component
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('extension_id')
->from('#__extensions')
->where($db->qn('element') . ' = ' . $db->q($this->extensionName));
$db->setQuery($query);
try
{
$ids = $db->loadColumn();
}
catch (Exception $exc)
{
return false;
}
if (empty($ids))
{
return false;
}
$extension_id = array_shift($ids);
$this->extension_id = $extension_id; // This will be used by the view template
$this->setState('extension_id', $extension_id);
if ( !defined('FOF_INCLUDED'))
{
include_once JPATH_SITE . '/libraries/fof/include.php';
}
if ( !defined('FOF_INCLUDED'))
{
return false;
}
// Do I have messages?
try
{
$pimModel = FOFModel::getTmpInstance('Messages', 'PostinstallModel');
$pimModel->savestate(false);
$pimModel->setState('eid', $extension_id);
$list = $pimModel->getList();
$result = count($list) >= 1;
}
catch (\Exception $e)
{
$result = null;
}
return ($result);
}
In your view template (e.g. default.php
) add something like the following:
<?php if($this->hasPostInstallationMessages): ?>
<div class="alert alert-info">
<h3>
<?php echo JText::_('COM_EXAMPLE_HAVEMESSAGES_TITLE'); ?>
</h3>
<p>
<?php echo JText::_('COM_EXAMPLE_HAVEMESSAGES_DESC'); ?>
</p>
<a href="index.php?option=com_postinstall&eid=<?php echo $this->extension_id?>"
class="btn btn-primary btn-large">
<?php echo JText::_('COM_EXAMPLE_HAVEMESSAGES_BUTTON'); ?>
</a>
</div>
?>
If hasPostInstallationMessages() returns null the user has screwed up the FOF installation in Joomla!. This can only be accomplished by following ridiculously wrong instructions. I've written a very detailed troubleshooter and explanation as a public service to the Joomla! community. Feel free to link to it if hasPostInstallationMessages() returns null.
You can create an onAfterInitialise event handler which checks if you are in the site's back-end, control panel page. Then you can just do a simple JFactory::getApplication()->enqueueMessage($message, 'info')
to render an info message that there are post-installation messages, providing the direct URL to see them. If you want to be a good person also add a configuration switch to ALWAYS HIDE this info message. Site integrators will thank you for your consideration.
Create a custom JFormField to do the same check and display a link to the post-installation messages page. Then add a field using this custom JFormField in your module's configuration. Therefore, when the administrator accesses the module's configuration they'll get the notification.
Same as modules or components, depending on whether you're using a template framework which renders itself through a component.
These package types were considered outside the scope of the Post-Installation Messages when the feature was written. The reason was simply that under Joomla! 3.2 you did not have installation script support for these extension types so there was no way to add PIMs when installing extensions of these types.
This did change in Joomla! 3.3, but the PIM feature wasn't updated to support them. In Joomla! 3.4 you'll be able to add PIMs for these extension types and Joomla! will be able to display them. This is an enhancement over the original feature implementation added in Joomla! 3.4.
Take a look at the FOFUtilsInstallscript class included in Joomla! 3.4, addPostInstallationMessage()
and uninstallPostInstallationMessages()
methods. You can fork these methods and include them in your extension's installation script.
Since adding/removing PIMs requires doing a direct database operation, yes you can. Just select all entries of the #__postinstall_messages
with your extension's extension_id which have specific title_key
values and delete them. It's that simple.
@demis-palma you should be happy to have raised this discussion cause we love constructive "criticism"
and this indeed it is. Just look at @nikosdion post "How to use Post-Installation Messages in third party extensions, THE RIGHT WAY"
Regarding the magazine article i'm going to update it a little bit (since decembre 2013 something is changed after all)
instead of use of hardcoded ID =700 in the extension_id postinstall_message INSERT
ID= foreign key to the extension table id (now work as per 3.4.0 rc-dev)
and maybe instead of official way (even if never claimed to be official) an ALTERNATIVE WAY
this is an example of how work the alternative way (with an extension module)
so despite it is not considered the right way IMO for module/plugin can be consdered at least an alternative one
@demis-palma Did you have a example extension for testing? Thanks.