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.4] update does nothing #42034

Closed
brianteeman opened this issue Oct 3, 2023 · 39 comments
Closed

[4.4] update does nothing #42034

brianteeman opened this issue Oct 3, 2023 · 39 comments

Comments

@brianteeman
Copy link
Contributor

brianteeman commented Oct 3, 2023

Steps to reproduce the issue

with a php version LESS than 8.1
install and configure joomla 4.4
set the update url to https://update.joomla.org/core/nightlies/next_major_list.xml
check for updates

Expected result

something happens. Probably an error message about not having the required php version. OR more helpfully the preinstall check shows exactly what the problem is. Otherwise it does make the very first check redundant as you can only see that if you are already compliant

image

Actual result

Generic we can not find an update url message. No mention at all that its because the site doesnt match the requirements for 5.0. Especially confusing because the dashboard says a new version is available.

System information (as much as possible)

Additional comments

@richard67
Copy link
Member

@brianteeman In section „Actual result“ you wrote:

Generic we can find an update url message.

I assume you meant „we can’t find”.

@brianteeman brianteeman changed the title [5.0] update does nothing [4.4] update does nothing Oct 4, 2023
@richard67
Copy link
Member

richard67 commented Oct 4, 2023

There was an attempt to fix it but it was given up: #38799 .

The issue was reported in past with #38694 , which was closed when the PR mentioned above was created, but it was not reopened when that PR was closed.

As far as I can see, that PR would not have solved the issue when the current installation meets the requirements but the updated site would not, and it checked the requirements of the database driver, which are lower than those of the CMS.

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

Also DB version check would be good,
I was able to run update on MySQL 5.6 that should not be possible :)
(it is half failed but the site still works)

@richard67
Copy link
Member

@Fedik Problem with DB version check is that currently we have the information about the DB requirement of the CMS only in the installation folder in the DatabaseHelper and in the XML files of the update server, but nowhere in a regular installation locally. The check with the minimum version required by the framework's database driver results in a lower requirement.

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

We probably can hardcode it somewhere, in update script/model/view or controller,
Not sure currently how it should be displayed and processed

@richard67
Copy link
Member

For the PHP version it is hardcoded in the index.php files in the root, in administrator and in installation.

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

Maybe something what you made in #41757 or to what we did with log:

// Make sure logging is working before continue
try {
Log::add('Test logging', Log::INFO, 'Update');
} catch (\Throwable $e) {
$message = Text::sprintf('COM_JOOMLAUPDATE_UPDATE_LOGGING_TEST_FAIL', $e->getMessage());
$this->setRedirect('index.php?option=com_joomlaupdate', $message, 'error');
return;
}

Having something like

if($updateToMajorVersion) { 
$this->checkMinRequirement(); 
}

Hmhm, but can be tricky

@richard67
Copy link
Member

$this->checkMinRequirement(); uses the database driver's requirement, as far as I remember, and that's not the same as the CMS requirement.

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

Ah no, I mean a new method $this->blablaCheckMinRequirement(), nothing from existing.
Where we can hardcode everything 😉

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

Hm, but we already have it https://update.joomla.org/core/test/extension_test.xml

<supported_databases mysql="8.0.13" mariadb="10.4.0" postgresql="12.0"/>

It just not processed/validated, only check for type

public function isDatabaseTypeSupported()

Okay, so it seems just need one more method and option for the overview list :)

@Fedik
Copy link
Member

Fedik commented Oct 6, 2023

something happens. Probably an error message about not having the required php version.

@brianteeman I not sure now, where the issue is, when I example modify the requirement to php 9, then it shows me failed "check".
That what I would expect, maybe I missing something?

Screenshot 2023-10-06_15-40-02

@richard67
Copy link
Member

richard67 commented Oct 6, 2023

Hm, but we already have it https://update.joomla.org/core/test/extension_test.xml

<supported_databases mysql="8.0.13" mariadb="10.4.0" postgresql="12.0"/>

It just not processed/validated, only check for type

This helps only if the update site is reachable and an update would be found.

@richard67
Copy link
Member

Hmm I think @Fedik is right and we can do something here. I was confused by my daily work. And now I am tired, was a hard day for me. Will check tomorrow what we can do, if Fedir is not faster.

@Fedik
Copy link
Member

Fedik commented Oct 7, 2023

@richard67 here is for DB version check:

@brianteeman
Copy link
Contributor Author

@Fedik there are checks taking place at different times in the process.

If your site is running php 7.x and you try to update it reads the xml it looks for an entry on the update server for that php version. If it doesnt find one then it reports no url found

@Fedik
Copy link
Member

Fedik commented Oct 7, 2023

Ah, I understood now, the issue that it does not show anything usefull, and user may think that there is no update.

@Fedik Fedik added the bug label Oct 7, 2023
@Fedik
Copy link
Member

Fedik commented Oct 7, 2023

The issue that Joomla\CMS\Updater\Update

$update = new Update();
$update->loadFromXml($updateObject->detailsurl, $minimumStability);

return empty result when PHP or DB is incompatible, so we cannot even get the information whether there any incompatibility.

$phpMatch = false;
// Check if PHP version supported via <php_minimum> tag, assume true if tag isn't present
if (!isset($this->currentUpdate->php_minimum) || version_compare(PHP_VERSION, $this->currentUpdate->php_minimum->_data, '>=')) {
$phpMatch = true;
}
$dbMatch = false;
// Check if DB & version is supported via <supported_databases> tag, assume supported if tag isn't present
if (isset($this->currentUpdate->supported_databases)) {
$db = Factory::getDbo();
$dbType = strtolower($db->getServerType());
$dbVersion = $db->getVersion();
$supportedDbs = $this->currentUpdate->supported_databases;
// MySQL and MariaDB use the same database driver but not the same version numbers
if ($dbType === 'mysql') {
// Check whether we have a MariaDB version string and extract the proper version from it
if (stripos($dbVersion, 'mariadb') !== false) {
// MariaDB: Strip off any leading '5.5.5-', if present
$dbVersion = preg_replace('/^5\.5\.5-/', '', $dbVersion);
$dbType = 'mariadb';
}
}
// Do we have an entry for the database?
if (isset($supportedDbs->$dbType)) {
$minimumVersion = $supportedDbs->$dbType;
$dbMatch = version_compare($dbVersion, $minimumVersion, '>=');
}
} else {
// Set to true if the <supported_databases> tag is not set
$dbMatch = true;
}
// Check minimum stability
$stabilityMatch = true;
if (isset($this->currentUpdate->stability) && ($this->currentUpdate->stability < $this->minimum_stability)) {
$stabilityMatch = false;
}
if ($phpMatch && $stabilityMatch && $dbMatch) {
if (!empty($this->currentUpdate->downloadurl) && !empty($this->currentUpdate->downloadurl->_data)) {
$this->compatibleVersions[] = $this->currentUpdate->version->_data;
}
if (
!isset($this->latest)
|| version_compare($this->currentUpdate->version->_data, $this->latest->version->_data, '>')
) {
$this->latest = $this->currentUpdate;
}
}
}

@brianteeman
Copy link
Contributor Author

Ah, I understood now, the issue that it does not show anything usefull, and user may think that there is no update.

exactly

@brianteeman
Copy link
Contributor Author

I have done what I can to raise this important issue and request that it is a release blocker. I can only do so much.

@richard67
Copy link
Member

As far as I remember there was once in 4.x made an optimization for the Joomla Updates Quick Icon. Maybe that's the reason that it shows an available update when the Joomla Update component doesn't find one? The PHP and database requirements are in the details XML file of the update site. If the quickicon doesn't check the details xml but only the list XML (where we also have the targetplatformversion but not the PHP and DB requirements), it will explain that behaviour.

There are 2 possible ways out without having to rewrite the complete updater library for that case:

  1. We let the quick icon also check the details XML so it doesn't show the update when the PHP and DB requirements are not met. So we are consistent between quick icon and Joomla Update component, but it might have a performance impact on the quickicon, maybe need to check and if necessary improve caching for that.
  2. We let the Joomla Update component run both checks, the check from the quickicon and the check for updastes with the updater library. That is silly but maybe easier than changing code of the updater library. When the results (number of updates found) is the same, we do nothing, but when the check from the quick icon shows something larger than zero, and the check for updates results in zero found, we could show an alert that there might be updates available but they require higher PHP or database versions than the current site has.

So or so it is an old problem not introduced with 4.4 or 5.0 so I wouldn't say it's a release blocker.

@brianteeman
Copy link
Contributor Author

We let the quick icon also check the details XML so it doesn't show the update when the PHP and DB requirements are not met.

That just moves the problem - user hears about a new version but their site makes no mention of the update and they dont know why

So or so it is an old problem not introduced with 4.4 or 5.0 so I wouldn't say it's a release blocker.

Of course its a new problem. We didnt have a higher version of php or joomla as a requirement before.

But it seems everyone thinks it is acceptable to hide the availability of an update without explaining why.

@Fedik
Copy link
Member

Fedik commented Oct 9, 2023

I think Quickicon should do the same as Component do. At current point: "show nothing" when compatible update did not found.

$hasUpdate = !empty($this->updateInfo['hasUpdate']);
$hasDownload = isset($this->updateInfo['object']->downloadurl->_data);

Then we should look how to improve it.
Maybe need some new mechanism (or changes to existing) to load update information, separately.

What Joomla\CMS\Updater\Update is doing is extarcting download url for compatible update. (technicaly we can have diferent packges: only for Mysql, or only for PHP 5 etc)
It is not very usable for retrieve Update information.

Currently I have no idea how it can be done.

Of course its a new problem.

If I right remember, it was the same for 3 to 4 update.

@richard67
Copy link
Member

If I right remember, it was the same for 3 to 4 update.

I remember the same.

@brianteeman
Copy link
Contributor Author

I dont' I am sure it came in when the emptystate code was added in j4

@brianteeman
Copy link
Contributor Author

but whichever is the case it doesnt resolve the problem

@brianteeman
Copy link
Contributor Author

Is this an acceptable quick fix ??

chrome_2023-10-09_14-03-39.mp4

@richard67
Copy link
Member

I would think yes, but to be sure I'd like to see the code.

@brianteeman
Copy link
Contributor Author

No code - just a string edit

- COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_TITLE="We can't find a download URL"
+ COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_TITLE="This site can not be updated to Joomla %1$s as this web server does not meet the minimum requirements."

@Fedik
Copy link
Member

Fedik commented Oct 9, 2023

Looks not bad.

We can't find a download URL

We can't find a download URL for your server environment
People not always read the description ;)

@richard67
Copy link
Member

No code - just a string edit

I see. So it's shown always when no update found.

@Fedik
Copy link
Member

Fedik commented Oct 9, 2023

Not realy, it will be shown when Update available, but download URL is empty:

if ($hasUpdate) {
$this->messagePrefix = '_NODOWNLOAD';
}

@richard67
Copy link
Member

Ah.

@richard67
Copy link
Member

Maybe the message could refer to the documentation? We could e.g. add to the end:

<br>Check <a class=\"alert-link\" href=\"https://downloads.joomla.org/technical-requirements\" target=\"_blank\" rel=\"noopener noreferrer\">the technical requirements</a> and switch to a suitable server, or check <a class=\"alert-link\" href=\"https://downloads.joomla.org/latest\" target=\"_blank\" rel=\"noopener noreferrer\">the official Joomla download page</a> for a Joomla <em><strong>Upgrade Package</strong></em> which works with your server.

@brianteeman
Copy link
Contributor Author

agreed - it was just as poc

of course it needs to be a link to a page with actual content ;)

@brianteeman
Copy link
Contributor Author

I will wait for a release lead approval before making a pr

@richard67
Copy link
Member

of course it needs to be a link to a page with actual content ;)

@brianteeman Currently the page for which I suggested the link is empty, but it says it will be updated soon and it links to the developer docs with the right info, so I think we still can use that and not the developer docs link which we later might have to change back.

@brianteeman
Copy link
Contributor Author

please test #42103

@richard67
Copy link
Member

Can this issue be closed as we have a PR? OR is something remaining to be done?

@brianteeman
Copy link
Contributor Author

i just hadnt pressed the button yet - you were too fast

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