HEX
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: u103727277 (3416564)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /homepages/oneclick/joomla/3.5.1/2/scripts/joomla-upgrade.php
<?php

function upgrade_joomla($psa_modify_hash)
{
	//First delete old joomla files (Plesk bug)
	// TODO Use Joomla! Installation to remove all files correctly - not only hard coded ones!
	deleteOldJoomlaFiles($psa_modify_hash['@@ROOT_DIR@@']);

	// Joomla! Core Fix functionality for the database update
	JLoad::loadFramework($psa_modify_hash['@@ROOT_DIR@@']);
	JFixDatabase::fixIt();
}

use Joomla\Registry\Registry;

Class JLoad
{
	public static function loadFramework($root_dir)
	{
		// Load the framework only once
		static $loaded = false;

		if(empty($loaded))
		{
			if(!defined('_JEXEC'))
			{
				define('_JEXEC', 1);
			}

			if(!defined('JPATH_BASE'))
			{
				define('JPATH_BASE', $root_dir);
			}

			// Deactivate error reporting to suppress possible warnings
			ini_set('error_reporting', 0);

			require_once JPATH_BASE.'/includes/defines.php';
			require_once JPATH_BASE.'/includes/framework.php';

			$jregistry = new Registry();
			$jregistry->def('session', false);

			// Instantiate the application.
			$app = new JApplicationAdministrator(null, $jregistry);
			JFactory::$application = $app;


			$app->initialise(false);

			$loaded = true;
		}
	}
}

Class JFixDatabase
{
	public static function fixIt()
	{
		// Load the correct model from the component
		JLoader::import('database', JPATH_ADMINISTRATOR.'/components/com_installer/models');
		$model = JModelLegacy::getInstance('database', 'InstallerModel');
		$model->fix();

		// Purge updates
		JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_joomlaupdate/models', 'JoomlaupdateModel');
		$updateModel = JModelLegacy::getInstance('default', 'JoomlaupdateModel');
		$updateModel->purge();

		// Refresh versionable assets cache
		JFactory::getApplication()->flushAssets();
	}
}

Class JSetDefaultLanguage
{
	public static function setLanguage($language_id)
	{
		// We need to set the default language for the front- and backend
		$obj = new stdClass;
		$obj->id = 0;
		$obj->name = 'site';
		$obj->path = JPATH_SITE;

		JSetDefaultLanguage::publish($language_id, $obj);

		$obj = new stdClass;
		$obj->id = 1;
		$obj->name = 'administrator';
		$obj->path = JPATH_ADMINISTRATOR;

		JSetDefaultLanguage::publish($language_id, $obj);
	}

	private static function publish($cid, $client)
	{
		$params = JComponentHelper::getParams('com_languages');
		$params->set($client->name, $cid);

		$table = JTable::getInstance('extension');
		$id = $table->find(array('element' => 'com_languages'));

		$table->load($id);
		$table->params = (string)$params;

		// pre-save checks
		$table->check();

		// save the changes
		$table->store();
	}
}