I've done merge conflicts on the latest PreUpdate checker changes in 60260bb - largely I've done all the conversion from jQuery to native JS. I've also fixed a bunch of errors where if reinstall mode was selected then everything went kaboom (@zero-24 not sure if this is an issue in 3.10 or not - maybe jQuery hides it).
I think this works - but with the nightly custom install pack Joomla considers things a reinstall rather than an update. I also didn't have any custom extensions installed when I did this so needs some testing around that.
There's definitely invalid html in the default_update.php view where I've kinda tried to leave things largely untouched (other than removing some of the table elements) - someone needs to review the styling 60260bb?w=1
JS Code style fails - I'm very nervous to strict type that line as in the past we've had integer + strings differences on PDO vs MySQLi - and for merge conflicts I need a clean install with no extensions (so had no data sources anyhow)
Generally it needs testing + html fixing
Labels |
Added:
?
?
|
Ah and yes, there is invalid html in the default_update.php, a closing td added in an else part for which before was no opening td. But this error seems to exist also in 3.10:
Update: Silly me. It's not an orphan closing tag, it's a single <td/>
. So that's ok.
@wilsonge what is the type of extensionId
?
if (PreUpdateChecker.nonCoreCriticalPlugins[cpi].package_id == extensionId
|| PreUpdateChecker.nonCoreCriticalPlugins[cpi].extension_id == extensionId)
if it's a number you can rewrite this to something, like:
parseInt(extensionId, 10)
and make the comparison strict.
@dgrammatiko See #33487 . I can re-open if preferred by George.
@richard67 please reopen it, the solution looks solid
extensionId
is a attribute value, so I think it is string. I think we can use
PreUpdateChecker.nonCoreCriticalPlugins[cpi].package_id.toString() === extensionId
Will that work?
Will that work?
It will work either way, just ensure that both sides are the same type
I think toString() is shorter (we do not need to cast both side to int. However, there are more problem than just that:
If we can be 100.00% sure that extensionData.element.getAttribute('data-extension-id')
always results in a string, then I'd say we go the @joomdonation way.
This line
Factory::getDocument()->addScriptDeclaration("var nonCoreCriticalPlugins = '" . json_encode($this->nonCoreCriticalPlugins) . "';");
is totally unacceptable, Just use $doc->addScriptOptions()
Grrrrr
@dgrammatiko Yes, that's right. We should use addScriptOptions() instead. The original code could cause eror in case plugins have special character as I said.
If we can be 100.00% sure that
extensionData.element.getAttribute('data-extension-id')
always results in a string
It always returns string, also the correct version of this line is: extensionData.element.dataset.extensionId
Mind the capital i
I wanted to ask for performance comparison between getAttribute
and dataset
(just for education purpose :)).
I wanted to ask for performance comparison between getAttribute and dataset
For modern browsers, the performance should be the same (or in favour of dataset), but you can try it yourself:
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-05-06 23:23:24 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
Removed: ? |
I think this is good enough for now. We can create specific issues going forward
Labels |
Removed:
?
|
Some codestyle stuff already has been fixed with #33478 and #33479 . What remains is the strict comparisons in JS which @wilsonge mentioned and which need to be tested on PDO and MySQLi, see here: https://ci.joomla.org/joomla/joomla-cms/42900/1/21