?
avatar wilsonge
wilsonge
1 May 2021

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

avatar wilsonge wilsonge - open - 1 May 2021
avatar joomla-cms-bot joomla-cms-bot - change - 1 May 2021
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 May 2021
avatar wilsonge wilsonge - change - 1 May 2021
The description was changed
avatar wilsonge wilsonge - edited - 1 May 2021
avatar wilsonge wilsonge - change - 1 May 2021
The description was changed
avatar wilsonge wilsonge - edited - 1 May 2021
avatar wilsonge wilsonge - change - 2 May 2021
The description was changed
avatar wilsonge wilsonge - edited - 2 May 2021
avatar richard67
richard67 - comment - 2 May 2021

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

avatar richard67
richard67 - comment - 2 May 2021

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.

https://github.com/joomla/joomla-cms/blob/3.10-dev/administrator/components/com_joomlaupdate/views/default/tmpl/default_update.php#L185-L187

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

@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.

avatar richard67
richard67 - comment - 2 May 2021

@dgrammatiko See #33487 . I can re-open if preferred by George.

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

@richard67 please reopen it, the solution looks solid

avatar joomdonation
joomdonation - comment - 2 May 2021

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?

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

Will that work?

It will work either way, just ensure that both sides are the same type ?

avatar joomdonation
joomdonation - comment - 2 May 2021

I think toString() is shorter (we do not need to cast both side to int. However, there are more problem than just that:

avatar richard67
richard67 - comment - 2 May 2021

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.

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

This line

Factory::getDocument()->addScriptDeclaration("var nonCoreCriticalPlugins = '" . json_encode($this->nonCoreCriticalPlugins) . "';"); 

is totally unacceptable, Just use $doc->addScriptOptions() Grrrrr

avatar joomdonation
joomdonation - comment - 2 May 2021

@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.

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

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

avatar joomdonation
joomdonation - comment - 2 May 2021

I wanted to ask for performance comparison between getAttribute and dataset (just for education purpose :)).

avatar dgrammatiko
dgrammatiko - comment - 2 May 2021

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:

https://www.measurethat.net/Benchmarks/Show/9389/0/modern-dataset-vs-old-getattribute-vs-jquery-data-vs-jq

avatar richard67
richard67 - comment - 3 May 2021

One issue I am working on: The new database schema check added to the Pre-Update Check with PR #33080 shows false error because the new function has to be adapted to J4.

Update: George already preparing a fix.

avatar richard67
richard67 - comment - 3 May 2021

See also #33497 . Sorry, not related.

avatar wilsonge wilsonge - change - 6 May 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-05-06 23:23:24
Closed_By wilsonge
Labels Added: ?
Removed: ?
avatar wilsonge wilsonge - close - 6 May 2021
avatar wilsonge
wilsonge - comment - 6 May 2021

I think this is good enough for now. We can create specific issues going forward

avatar wilsonge wilsonge - change - 6 May 2021
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 6 May 2021

Add a Comment

Login with GitHub to post a comment