3

I have a Joomla installation, version 3.5+, but I cannot update, no matter what I tried. I tried to use the Joomla Update component, tried to upload the package, it just doesn't work.

I then tried to extract the package on the root directory, and it broke my site.

How can I manually update it?

3

Many posts around say that you shouldn't manually update Joomla 3.5+. And there are various reasons that this is good advice.

However, you can manually update Joomla 3.5+ to the latest version (currently 3.8.8).

1. Backup first

First, you need to have a good, working backup of your current site. Things may go wrong.

2. Login to administrator

It's important to have an active session in the site's administrator, while it is still working, or step 4 may not work.

3. Extract the files

You can download the latest Joomla upgrade package, either from your Joomla Update component (Components > Joomla Update), or from downloads.joomla.org.

Rename your libraries directory to libraries-old.

Place the package you downloaded in the root directory of your site. Extract.

If you open your front-end, and get an error, or a blank page, you can try to rename the libraries directory again, to libraries-broken and copy a libraries directory directly from the latest version full package.

4. Fix Database

If you have done well so far, your administrator should be broken. If not, hurray! Go to Extensions > Manage > Database and click the Fix button.

If your administrator is broken, copy the following link after your site's administrator URL:

[your site]/administrator/index.php?option=com_installer&view=database&task=database.fix

If you click that link, the database should be automatically fixed, and your administrator will be usable again. Click Fix one more time.

Your site should now have the latest Joomla version. If you still have problems with it, you may need to update third-party extensions, or similar.

  • You can often install the update packages through the installer too. Which is not manually, but if the auto updater is not working that might still be a solution for you. – Eoin May 26 '18 at 11:35
  • 1
    I thought that it would work that way too, but when I tried it and also got the Ajax loading error, I decided to write what I found here. – mavrosxristoforos May 26 '18 at 15:24
3

Michael Babker has provided a Post-Manual Update Script at https://gist.github.com/mbabker/d7bfb4e1e2fbc6b7815a733607f89281 which runs the steps normally performed after the filesystem updates.

This script is designed to be run after you have manually extracted the update package over your site.

As always, you should run a backup of your website before attempting any major update like this one.

Below is the current copy of the code, but as the linked page may be updated in future, be sure to check that you are using the latest version.


postupdate.php file as of 15 Sep 2019:

<?php
/**
 * @package    Joomla.Administrator
 *
 * @copyright  Copyright (C) 2016 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
/**
 * Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
 */
define('JOOMLA_MINIMUM_PHP', '5.3.10');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
    die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');
}
/**
 * Constant that is checked in included files to prevent direct access.
 * define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
 */
define('_JEXEC', 1);
// Load the administrator application's path constants
if (file_exists(__DIR__ . '/defines.php'))
{
    include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
    define('JPATH_BASE', __DIR__);
    require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
require_once JPATH_BASE . '/includes/helper.php';
// Account for moved JToolbarHelper class in 3.9
if (file_exists(JPATH_BASE . '/includes/toolbar.php'))
{
    require_once JPATH_BASE . '/includes/toolbar.php';
}
else
{
    require_once JPATH_BASE . '/includes/subtoolbar.php';
}
// Boot JApplicationAdministrator so the application references in the factory resolve correctly.
JFactory::getApplication('administrator');
// Set the component path (un)constants
define('JPATH_COMPONENT', JPATH_ADMINISTRATOR . '/components/com_joomlaupdate');
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_joomlaupdate');
define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/com_joomlaupdate');
// Load the update component's model to run the cleanup methods
JModelLegacy::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/models', 'JoomlaupdateModel');
/** @var JoomlaupdateModelDefault $model */
$model = JModelLegacy::getInstance('default', 'JoomlaupdateModel');
// Make sure we got the model
if (!($model instanceof JoomlaupdateModelDefault))
{
    echo 'Could not load update component model, please check the logs for additional details.' . PHP_EOL;
    exit(1);
}
// Load up the logger
JLog::addLogger(
    array(
        'format'    => '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}',
        'text_file' => 'joomla_update.php',
    ),
    JLog::INFO,
    array('Update', 'databasequery', 'jerror')
);
JLog::add('Starting manual update using postupdate', JLog::INFO, 'Update');
// Load the Joomla library and update component language files
JFactory::getLanguage()->load('lib_joomla');
JFactory::getLanguage()->load('com_joomlaupdate');
JLog::add(JText::_('COM_JOOMLAUPDATE_UPDATE_LOG_FINALISE'), JLog::INFO, 'Update');
// Finalize the update
if ($model->finaliseUpgrade() === false)
{
    echo 'Failed to finalize the upgrade, please check the logs for additional details.' . PHP_EOL;
    exit(1);
}
JLog::add(JText::_('COM_JOOMLAUPDATE_UPDATE_LOG_CLEANUP'), JLog::INFO, 'Update');
// Cleanup after the update
$model->cleanUp();
JLog::add(JText::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_COMPLETE', JVERSION), JLog::INFO, 'Update');
JLog::add('Finished manual update using postupdate', JLog::INFO, 'Update');
echo 'Update to ' . JVERSION . ' completed successfully.' . PHP_EOL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.