Skip to content
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

[4.0] Autoloader broken when not fetched in libraries? #21009

Closed
infograf768 opened this issue Jul 7, 2018 · 9 comments
Closed

[4.0] Autoloader broken when not fetched in libraries? #21009

infograf768 opened this issue Jul 7, 2018 · 9 comments

Comments

@infograf768
Copy link
Member

infograf768 commented Jul 7, 2018

Steps to reproduce the issue

Create a multilingual site.

Expected result

The multilingual status module displays in the status position.

Actual result

the icon does not display
var_dump gives

Error: Class 'Joomla\Module\Multilangstatus\Administrator\Helper\MultilangstatusAdminHelper' not found: Class 'Joomla\Module\Multilangstatus\Administrator\Helper\MultilangstatusAdminHelper' not found

@brianteeman
Copy link
Contributor

Same.as #20823 ?

@infograf768
Copy link
Member Author

maybe similar but not the same afaik. this one concerns modules

@infograf768
Copy link
Member Author

@wilsonge @laoneo

@mbabker
Copy link
Contributor

mbabker commented Jul 7, 2018

#20902

@brianteeman
Copy link
Contributor

Delete the namespace map and let the plugin recreate it as explained in 20902 and see if that fixes it. If it did then it's not an error in joomla and is caused by an old branch

@infograf768
Copy link
Member Author

OK, found the issue and will solve it.

Background

This happens on a clean install, not an old branch at all
Deleting autoload_psr4.php and letting the plugin recreate it has no effect.
Deleting the namespacemap.php file makes no sense and, if done, kills the site with "Error".

Real tests saves a lot of time: It takes 10 minutes to create such a site.

The call to MultilangstatusAdminHelper is done in the mod_status module
https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/modules/mod_status/tmpl/default.php#L20
and used further down multiple times

Just var_dump(MultilangstatusAdminHelper::isEnabled()); line 21 to get the class not found.

The issue is solved if I manually modify /libraries/autoload_psr4.php

by adding
'Joomla\\Module\\Multilangstatus\\Administrator\\' => [JPATH_ROOT . "/administrator/modules/mod_multilangstatus",],

Therefore
/libraries/namespacemap.php is unable to add that line.
I trace this to the _extensions table namespace column for the module:
It is empty and therefore protected function getNamespacedExtensions() does not return the extension.
Looked at our sql: it does not include the namespace for that module.
Also not in the update sql.

Will make a patch to add Joomla\Module\Multilangstatus in the namespace column for that module in joomla.sql as well as in the sql update.

@infograf768
Copy link
Member Author

I prepared a patch but my results are weird for anew install.

diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-07-08.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-07-08.sql
new file mode 100644
index 0000000..5ff17f1
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-07-08.sql
@@ -0,0 +1 @@
+UPDATE `#__extensions` SET `namespace` = 'Joomla\\Module\\Multilangstatus' WHERE `name` = 'mod_multilangstatus';
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-07-08.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-07-08.sql
new file mode 100644
index 0000000..5ff17f1
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-07-08.sql
@@ -0,0 +1 @@
+UPDATE `#__extensions` SET `namespace` = 'Joomla\\Module\\Multilangstatus' WHERE `name` = 'mod_multilangstatus';
diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql
index ef95d53..661b221 100644
--- a/installation/sql/mysql/joomla.sql
+++ b/installation/sql/mysql/joomla.sql
@@ -572,5 +572,5 @@
 (311, 0, 'mod_title', 'module', 'mod_title', '', 1, 1, 1, 0, '', '', 0, '0000-00-00 00:00:00', 0, 0, ''),
 (312, 0, 'mod_toolbar', 'module', 'mod_toolbar', '', 1, 1, 1, 1, '', '', 0, '0000-00-00 00:00:00', 0, 0, ''),
-(313, 0, 'mod_multilangstatus', 'module', 'mod_multilangstatus', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '0000-00-00 00:00:00', 0, 0, ''),
+(313, 0, 'mod_multilangstatus', 'module', 'mod_multilangstatus', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Module\\Multilangstatus'),
 (314, 0, 'mod_version', 'module', 'mod_version', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Module\\Version'),
 (315, 0, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '{"serverinfo":"0","siteinfo":"0","counter":"0","increase":"0","cache":"1","cache_time":"900","cachemode":"static"}', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Module\\StatsAdmin'),
diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql
index 49c687a..e0c4fd6 100644
--- a/installation/sql/postgresql/joomla.sql
+++ b/installation/sql/postgresql/joomla.sql
@@ -585,5 +585,5 @@
 (311, 0, 'mod_title', 'module', 'mod_title', '', 1, 1, 1, 0, '', '', 0, '1970-01-01 00:00:00', 0, 0, ''),
 (312, 0, 'mod_toolbar', 'module', 'mod_toolbar', '', 1, 1, 1, 1, '', '', 0, '1970-01-01 00:00:00', 0, 0, ''),
-(313, 0, 'mod_multilangstatus', 'module', 'mod_multilangstatus', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '1970-01-01 00:00:00', 0, 0, ''),
+(313, 0, 'mod_multilangstatus', 'module', 'mod_multilangstatus', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '1970-01-01 00:00:00', 0, 0, 'Joomla\\Module\\Multilangstatus'),
 (314, 0, 'mod_version', 'module', 'mod_version', '', 1, 1, 1, 0, '', '{"cache":"0"}', 0, '1970-01-01 00:00:00', 0, 0, ''),
 (315, 0, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '{"serverinfo":"0","siteinfo":"0","counter":"0","increase":"0","cache":"1","cache_time":"900","cachemode":"static"}', 0, '1970-01-01 00:00:00', 0, 0, ''),

When I do a clean install, the namespace is still NOT added in the column.
If I update with the specific query, it works fine.

Any idea?

brianteeman added a commit to brianteeman/joomla-cms that referenced this issue Jul 8, 2018
@infograf768 Please test this PR for your issue with joomla#21009
@joomla-cms-bot
Copy link

Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/21009

@ghost
Copy link

ghost commented Jul 9, 2018

closed as having Pull Request #21020

laoneo pushed a commit that referenced this issue Jul 9, 2018
* [4.0]Namespace mod multilangstatus

@infograf768 Please test this PR for your issue with #21009

* update and codestyle

* save before push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants