Skip to content

Conversation

@PhilETaylor
Copy link
Contributor

As requested in #33150

Summary of Changes

When we have finished with sample data, unpublish its module and plugins - therefore gaining a tiny bit of performance.

Testing Instructions

Install Joomla 4
Install any of the sample data
refresh the Home Dashboard - note the module is no longer there
visit the Plugins and see they are unpublished
No side effects.

Actual result BEFORE applying this Pull Request

After using the sample data plugins, the module and plugins remain published, which is more db calls, more code running on each page load

Expected result AFTER applying this Pull Request

module and plugins are uninstalled for the life of a live site - gaining a tiny bit of performance as code is not run.

Documentation Changes Required

none

@PhilETaylor

This comment was marked as abuse.

@richard67
Copy link
Member

This will make it harder to install Blog sample data multiple times when having a multilanguage site, one time for each backend language. It will need to enable the plugin again each time.

Currently we can change language in backend and install blog sample data for each language, and when we later install another backend language, we can do that again for that language.

This will not be possible anymore in this way.

Ping @infograf768 .

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko
Copy link
Contributor

Currently we can change language in backend and install blog sample data for each language

This is a flaw in the current architecture of the sampledata plugin/modules. The CMS has all the data (installed languages and content languages) to decide (or even ask the user) if the data should be installed in one or more languages. AFAIK there's already an open issue about sampledata: #32878

@richard67
Copy link
Member

AFAIK there's already an open issue about sampledata: #32878

That issue doesn't cover the multilanguage aspect.

Regarding this PR here it's not on me to decide if it's ok or not, I just wanted to mention that aspect here so it is not forgotten.

@infograf768
Copy link
Member

I agree with @richard67
We absolutely need to be able to install multingual sample data and thereafter blog sample data for each content language.

@PhilETaylor

This comment was marked as abuse.

@brianteeman
Copy link
Contributor

As I have stated before ad nauseum there is zero need to have the multilingual sample data plugin enabled if the site is not multilingual

@dgrammatiko
Copy link
Contributor

We absolutely need to be able to install multingual sample data and thereafter blog sample data for each content language.

If the only way to do that is by doing it manually we should pack it here and start farming...

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko
Copy link
Contributor

tell me a check I can make to find this out

Count the languages in __extensions select * where 'type' = 'language'and the content languages in __languages

@infograf768
Copy link
Member

It is very simple, once one has tested the feature at will, to start from scratch as was always done and then unpublish the module.

but, as usual, do whatever you like.

@brianteeman
Copy link
Contributor

Nothing in that sentence makes any sense at all

@PhilETaylor

This comment was marked as abuse.

@richard67
Copy link
Member

In Blog Sample Data we use this to check if we have multilanguage on:

https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Language/Multilanguage.php#L43

@dgrammatiko
Copy link
Contributor

I bet 10-99% of Joomla admins will never unpublish this module manually ;-)

Anything less than 98% would be a surprise for me

@brianteeman
Copy link
Contributor

@PhilETaylor see #20749

@PhilETaylor

This comment was marked as abuse.

@brianteeman
Copy link
Contributor

It is simple but one person objects to it as they believe no one will know you can do it unless you shove it in front of their face until they get so annoyed with it they uninstall joomla

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

The module itself should not be unpublished. Keep in mind that the module isn't exclusively used for core sample data. Each 3rd party extension can provide its own sample data as well. And I know for example DP Calendar does that.

I'm not a big fan of extensions who publish/unpublish themself. I would offer a button to directly unpublish the plugin instead. So it can be hidden with a single click.

@brianteeman
Copy link
Contributor

We already have that button ;)

Disable the plugin automatically THEN
If there are no plugins to display the module is empty and as there is no point in having an empty module just hide the module. That way if an extension is installed later that has a sample data plugin it will still be displayed

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko
Copy link
Contributor

I bet you cannot name another 5 extensions that use sample data like this ;-) ;-) ;-)

I can't name 5 but I can point you at https://github.com/dgrammatiko/sloth-pkg/tree/main/plg_sampledata which is way different from the core monstrosity plugins... ;)

@PhilETaylor

This comment was marked as abuse.

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

Each 3rd party extension can provide its own sample data as well. And I know for example DP Calendar does that.

I bet you cannot name another 5 extensions that use sample data like this ;-) ;-) ;-)

I dunno, but that was one of the initial ideas of using this approach. So instead that the extensions put their sample data hardcoded into their SQLs (like core did before), they can offer a plugin as well (like core does now).

Obviously, the module could return empty if no sample data plugin is active (don't know if it does that today already).

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

I would offer a button to directly unpublish the plugin instead. So it can be hidden with a single click.

We already have that button ;)

@brianteeman I meant for the plugins. I know that the modules all have such a button, that's where the idea came from 😄

@infograf768
Copy link
Member

#20749 (comment)

@PhilETaylor

This comment was marked as abuse.

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

Imho, it would be nice to be in that position if there are sample data available. Otherwise people don't see them.

But it would also nice to be able to unpublish the plugins directly from the module, as it is not very intuitive to know where they can be hidden. So a button either on each sample data set or on the module ("Manage Sample Data" for the lack of better wording) would be great.

It would also be nice if the module hides completely if no plugin is active.
Currently it shows like this:
image

I certainly wouldn't automatically unpublish anything.

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

I've created a simple PR to hide the module if no sample data plugin is published. See #33168

@Bakual
Copy link
Contributor

Bakual commented Apr 16, 2021

Button to go directly to the pluginmanager to disable plugins:
#33169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants