Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5dacaec
Restructuring Installation, splitting up SQL
Hackwar Mar 15, 2020
7ae41b9
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
Hackwar Mar 15, 2020
18a1bb5
Codestyle and some cleanup
Hackwar Mar 15, 2020
3e196dd
Codestyle
Hackwar Mar 15, 2020
dca5098
Fixing Postgres SQL
Hackwar Mar 15, 2020
dd53fcf
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-hannes-j…
richard67 Mar 18, 2020
df63d36
Fix conflict in mysql/base.sql
richard67 Mar 18, 2020
ed3824c
Fix merge conflict in configuration model
richard67 Mar 18, 2020
5c9f443
Fix misleading variable name
richard67 Mar 18, 2020
dbca1d3
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-hannes-j…
richard67 Mar 19, 2020
ea44de2
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-hannes-j…
richard67 Mar 21, 2020
179228b
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-hannes-j…
richard67 Mar 26, 2020
bf8c065
Update mysql to latest 4.0-dev
richard67 Mar 26, 2020
d43cc7f
Update postgresql to latest 4.0-dev
richard67 Mar 26, 2020
70dd0f4
Merge pull request #37 from richard67/4.0-dev-hannes-j4install-mod-1
Hackwar Mar 26, 2020
f670b6e
Move update of utf8 conversion table back do database model
richard67 Mar 29, 2020
7f78c56
Merge pull request #38 from richard67/4.0-dev-hannes-j4install-mod-3
Hackwar Mar 29, 2020
70f1f45
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-hannes-j…
richard67 Mar 31, 2020
5feaae1
Merge pull request #39 from richard67/4.0-dev-hannes-j4install-mod-4
Hackwar Mar 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,318 changes: 11 additions & 1,307 deletions installation/sql/mysql/joomla.sql → installation/sql/mysql/base.sql

Large diffs are not rendered by default.

883 changes: 883 additions & 0 deletions installation/sql/mysql/extensions.sql

Large diffs are not rendered by default.

430 changes: 430 additions & 0 deletions installation/sql/mysql/supports.sql

Large diffs are not rendered by default.

Large diffs are not rendered by default.

908 changes: 908 additions & 0 deletions installation/sql/postgresql/extensions.sql

Large diffs are not rendered by default.

423 changes: 423 additions & 0 deletions installation/sql/postgresql/supports.sql

Large diffs are not rendered by default.

102 changes: 67 additions & 35 deletions installation/src/Controller/InstallationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Utilities\ArrayHelper;
Expand Down Expand Up @@ -39,7 +40,11 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
{
parent::__construct($config, $factory, $app, $input);

$this->registerTask('remove', 'backup');
$this->registerTask('populate1', 'populate');
$this->registerTask('populate2', 'populate');
$this->registerTask('populate3', 'populate');
$this->registerTask('custom1', 'populate');
$this->registerTask('custom2', 'populate');
$this->registerTask('removeFolder', 'delete');
}

Expand Down Expand Up @@ -77,98 +82,125 @@ public function dbcheck()
}

/**
* Config task.
* Create DB task.
*
* @return void
*
* @since 4.0.0
*/
public function config()
public function create()
{
$this->checkValidToken();

/** @var \Joomla\CMS\Installation\Model\SetupModel $setUpModel */
$setUpModel = $this->getModel('Setup');

// Get the options from the session
$options = $setUpModel->getOptions();

$r = new \stdClass;
$r->view = 'remove';

/** @var \Joomla\CMS\Installation\Model\ConfigurationModel $configurationModel */
$configurationModel = $this->getModel('Configuration');
/** @var \Joomla\CMS\Installation\Model\DatabaseModel $databaseModel */
$databaseModel = $this->getModel('Database');

// Attempt to setup the configuration.
// Create Db
try
{
$setupDone = $configurationModel->setup($options);
$dbCreated = $databaseModel->createDatabase();
}
catch (\RuntimeException $e)
{
$this->app->enqueueMessage($e->getMessage(), 'error');

$setupDone = false;
$dbCreated = false;
}

if (!$setupDone)
if (!$dbCreated)
{
$r->view = 'setup';
}
else
{
if (!$databaseModel->handleOldDatabase())
{
$r->view = 'setup';
}
}

$this->sendJsonResponse($r);
}

/**
* Database task.
* Populate the database.
*
* @return void
*
* @since 4.0.0
*/
public function database()
public function populate()
{
$this->checkValidToken();

/** @var \Joomla\CMS\Installation\Model\SetupModel $model */
$model = $this->getModel('Setup');
$model->checkForm('setup');
$step = $this->getTask();
/** @var \Joomla\CMS\Installation\Model\DatabaseModel $model */
$model = $this->getModel('Database');

$r = new \stdClass;
$db = $model->initialise();
$files = [
'populate1' => 'base',
'populate2' => 'supports',
'populate3' => 'extensions',
'custom1' => 'localise',
'custom2' => 'custom'
];

$schema = $files[$step];
$serverType = $db->getServerType();

if (in_array($step, ['custom1', 'custom2']) && !is_file('sql/' . $serverType . '/' . $schema . '.sql'))
{
$this->sendJsonResponse($r);

// Attempt to create the database tables
/** @var \Joomla\CMS\Installation\Model\DatabaseModel $dbModel */
$dbModel = $this->getModel('Database');
return;
}

if (!$dbModel->initialise() || !$dbModel->installCmsData())
if (!isset($files[$step]))
{
$r->view = 'database';
$r->view = 'setup';
Factory::getApplication()->enqueueMessage(Text::_('INSTL_SAMPLE_DATA_NOT_FOUND'), 'error');
$this->sendJsonResponse($r);
}

// Attempt to populate the database with the given file.
if (!$model->createTables($schema))
{
$r->view = 'setup';
}

$this->sendJsonResponse($r);
}

/**
* Backup task.
* Config task.
*
* @return void
*
* @since 4.0.0
*/
public function backup()
public function config()
{
$this->checkValidToken();

/** @var \Joomla\CMS\Installation\Model\SetupModel $setUpModel */
$setUpModel = $this->getModel('Setup');

// Get the options from the session
$options = $setUpModel->getOptions();

$r = new \stdClass;
$r->view = 'install';
$r->view = 'remove';

/** @var \Joomla\CMS\Installation\Model\DatabaseModel $model */
$model = $this->getModel('Database');
/** @var \Joomla\CMS\Installation\Model\ConfigurationModel $configurationModel */
$configurationModel = $this->getModel('Configuration');

// Attempt to handle the old database.
if (!$model->handleOldDatabase())
// Attempt to setup the configuration.
if (!$configurationModel->setup($options))
{
$r->view = 'database';
$r->view = 'setup';
}

$this->sendJsonResponse($r);
Expand Down
Loading