Create a Component in accordance with the J3.x development tutorial with an sql folder and a simple install.mysql.utf8.sql
but no numbered updates.
The SQL in the install.mysql.utf8.sql
is run and there is no error raised.
A large error is raised, with the error stack ending in line 1085 of Install.php
- which looks like this:
$files = str_replace('.sql', '', \JFolder::files($this->getPath('extension_root') . '/' . $schemapath, '\.sql$')); usort($files, 'version_compare');
My suspicion is that $files
contains no results, so there is nothing to sort.
Also the installer sql is not run in my case, but that may be completely unrelated.
Running on a WAMP stack on Windows, but it seems plausible that this is going to be a reasonably common problem.
I did have the update section in my config xml, which may have been a bad thing when there weren't any files in that folder yet:
<!update> <schemas> <schemapath type="mysql">sql/updates/mysql</schemapath> </schemas> </update -->
Still I would expect this to be handled in a calmer way.
I have worked around it with a little hedging on that usort
call for now, but that is probably not the best solution.
Labels |
Added:
?
|
Title |
|
Labels |
Added:
J3 Issue
|
Status | New | ⇒ | Information Required |
If nothing else, a more informative exception ( or performing some validation on the component xml file ) would make the problem a lot easier to troubleshoot- figuring out how to construct a component is pretty tricky even as an experienced developer and supporting people in doing that is probably a positive for the Joomla ecosystem.
@glenatron it woild be appreciated if you write a pr that make the install process smoother or bring us better error handling
This issue here could be related to an issue which the patchtester component had, see comment here: joomla-extensions/patchtester#186 (comment).
@HLeithner sure, is the best way to raise the message to use application->enqueueMessage($msg, 'error');
or is something else more correct in this circumstance?
Can confirm that failing to run the SQL installer file was me messing up the markup of my config file, so that is not relevant to this message at all.
@infograf768 can the Issue be closed?
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-06-17 11:41:22 |
Closed_By | ⇒ | HLeithner |
@glenatron enqueue a message would be enough so if the developer test his component at least once he should see the problem.
I'm closing this. You can reference this issue in your PR.
Maybe you're right and I don't understand your thoughts but there is already a correct message in the queue as you can see in the red error:
{"success":true,"message":null,"messages":{"warning":["JFolder: :files: Path is not a folder. Path: /administrator/components/com_helloworld/sql/updates/mysql"],"message":["Installation of the component was successful."]},"data":{"redirect":"/administrator/index.php?option=com_installer&view=install"}}
but it's not displayed. From my point of view the whole routine should stop if $files is not an array because the whole following db query is broken then.
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Installer/Installer.php#L1098
2 possible ways, stop the installation or let the installer ignore the missing sql file.
Because I prefer to learn coding "the hard way" I would leave it as ist is. See my "Contra" in #25202 (comment)
Why should Joomla react friendly here? The extension is wrongly configured. The red message contains all necessary informations for developers and more helpful informations than the message queue can provide.
Now I see:
admin\sql\updates\mysql
.Red warning message but no other messages(!)
The extension is installed now.
Reload the page: or navigate to another one:
Pro: Thus it's somehow an issue from my point of view even if the extension package manifest is misconfigured because the redirect/page reload is suppressed.
Their should be at least an additional message for users that the extension has been installed.
Irritating.
Contra: On the other hand I would say it's the job of the developer to avoid such errors before releasing an extension and a developer should be able to understand the red message. Not a Joomla core issue.
Contra would rule for me and I would close the issue.
After installation
After page reload