Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
3a2818b
Updated COmmand class
bosunski Jul 12, 2018
d3cc35e
Updated Factory.php
bosunski Jul 12, 2018
56a8fe7
Updated commad class: added Registry
bosunski Jul 12, 2018
00df438
Updated command class to include checks
bosunski Jul 14, 2018
f830ea0
Updated runCheck Method
bosunski Jul 14, 2018
2a39145
Updated help message
bosunski Jul 14, 2018
131f669
Removed unnecessary checks
bosunski Jul 15, 2018
f62bebb
Updated command class
bosunski Jul 15, 2018
ecfe7e5
Added command class
bosunski Jul 16, 2018
39bb8a9
Added new command class
bosunski Jul 16, 2018
9703aa6
Edited class
bosunski Jul 16, 2018
96a6836
Edited class
bosunski Jul 16, 2018
62816fd
Added SiteDown and Site Up commands
bosunski Jul 18, 2018
1f91105
Updated command classes
bosunski Jul 19, 2018
237192f
small change
bosunski Jul 22, 2018
59ba1a0
Updated command class
bosunski Jul 22, 2018
01da3ed
Finished multiple configuration setting
bosunski Jul 23, 2018
ade3411
Added multiple settings of options
bosunski Jul 23, 2018
0c0daca
performed some fixes
bosunski Jul 23, 2018
a6810f1
Fixed some issues pointed out in review
bosunski Jul 23, 2018
3f05391
FIxed some issues reported from PR review
bosunski Jul 24, 2018
c628ad2
Updated class: defred writing config file to after database connectio…
bosunski Jul 24, 2018
385563f
Modified database check before writing configuration
bosunski Jul 24, 2018
c29852f
Upated site:down and site:up commands
bosunski Jul 24, 2018
d97b3cb
Updated class: Ensured that all options are available
bosunski Jul 25, 2018
be064f9
Fixed conflicts
bosunski Jul 25, 2018
dce2143
Updated sorting
bosunski Jul 25, 2018
7b5e121
progress bar
alikon Jul 25, 2018
0aeda6d
Exclude optional configurations
bosunski Jul 25, 2018
0716701
Merge pull from origin
bosunski Jul 25, 2018
a0aba35
Added message to installation progress
bosunski Jul 25, 2018
e3029db
Changed to namespaced Text
bosunski Jul 25, 2018
a4e491e
Created constants
bosunski Jul 25, 2018
8beba78
Created constants
bosunski Jul 25, 2018
0da0fc0
Added docs for constants
bosunski Jul 25, 2018
5aec189
Added docs for constants
bosunski Jul 25, 2018
06e9861
Updated class: Modified grouping of options
bosunski Jul 26, 2018
cb50252
Updated class: Modified help message
bosunski Jul 26, 2018
e024804
Started work on codestyle
bosunski Jul 27, 2018
4ef2c6b
Fixed CodeStyle
bosunski Jul 27, 2018
5f2c9b2
Fixed CodeStyle
bosunski Jul 27, 2018
1d7fedc
Fixed CodeStyle
bosunski Jul 27, 2018
42c2700
Fixed CodeStyle
bosunski Jul 27, 2018
f7cce83
Fixed codeStyle
bosunski Jul 28, 2018
36a7f12
Added progress bar
bosunski Jul 30, 2018
0be7d89
Minor Update
bosunski Jul 30, 2018
69aaf77
Updated command class: added progress and constants
bosunski Jul 30, 2018
2a5ab94
Added constants
bosunski Jul 30, 2018
14a0e85
Modified Setconfiguration output, suppressed the output when called e…
bosunski Jul 30, 2018
fa23711
Updated command class
bosunski Aug 1, 2018
c174dc5
Updated class
bosunski Aug 1, 2018
f23fc0c
Updated command class
bosunski Aug 3, 2018
77b3490
Merge Changes form joomla-cms/4.0-dev
bosunski Aug 7, 2018
43ffbfb
Merged m3
bosunski Aug 7, 2018
7ae5010
Merged m4
bosunski Aug 7, 2018
f0a82f0
Merged m5
bosunski Aug 7, 2018
4291c6d
Updated some files: fixed issues raised at review
bosunski Aug 7, 2018
4321b59
Updated some files: fixed issues raised at review
bosunski Aug 7, 2018
a915115
Updated some files: fixed issues raised at review
bosunski Aug 7, 2018
8ff5c17
Merge branch '4.0-dev' into m1_copy
wilsonge Aug 8, 2018
4b98344
Merge branch '4.0-dev' into m1_copy
bosunski Aug 8, 2018
26f70d5
Merge branch '4.0-dev' into m1_copy
rdeutz Aug 8, 2018
c46a316
Merge branch '4.0-dev' into m1_copy
rdeutz Aug 8, 2018
ea8c239
Remove Tests
bosunski Aug 9, 2018
9a41943
Merged Pull
bosunski Aug 9, 2018
4cce91f
Slight changes
bosunski Aug 9, 2018
90d137e
Merge branch '4.0-dev' into m1_copy
bosunski Aug 9, 2018
5bbbf0d
Merge branch '4.0-dev' into m1_copy
bosunski Aug 9, 2018
317ce2d
Merge branch '4.0-dev' into m1_copy
bosunski Aug 9, 2018
1458ca6
Minor changes
bosunski Aug 9, 2018
ee3576c
Merge branch '4.0-dev' into m1_copy
bosunski Aug 9, 2018
4907b06
Merge branch '4.0-dev' into m1_copy
bosunski Aug 10, 2018
d6fefd3
Removed package-lock.json
bosunski Aug 14, 2018
86219cd
Deleted unnecessary files
bosunski Aug 14, 2018
6f8c159
Added session for installation
bosunski Aug 14, 2018
f44d366
FIxed CS
bosunski Aug 15, 2018
1605298
Updated framework.php
bosunski Aug 15, 2018
ad2a45f
Updated PrefixFiield
bosunski Aug 15, 2018
96f344d
Fixed merge conflicts
bosunski Aug 16, 2018
8f15bea
Modified PrefixField.php
bosunski Aug 16, 2018
68d986c
updated framework.php
bosunski Aug 16, 2018
0dc5d17
Added session for installation
bosunski Aug 16, 2018
b2522e2
Fixed merge conflicts
bosunski Aug 16, 2018
e9f0490
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into m…
bosunski Aug 16, 2018
5cdabc6
Added some files
bosunski Aug 16, 2018
3163bf0
Delete template-rtl.css
bosunski Aug 16, 2018
236e19f
Delete template.css
bosunski Aug 16, 2018
2d349e5
Added some files
bosunski Aug 16, 2018
99e6f9f
Reverted files to 4.0-dev version
bosunski Aug 16, 2018
5fa88fd
Removed some files from branch
bosunski Aug 16, 2018
2d6ce67
Deleted files
bosunski Aug 16, 2018
6c7cff6
Deleted files
bosunski Aug 16, 2018
0fda256
Updated files
bosunski Aug 17, 2018
b010394
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into m…
bosunski Aug 17, 2018
b16f652
Minor update
bosunski Aug 17, 2018
77e69c3
Made files identical
bosunski Aug 17, 2018
5fd7922
Meged pull from upstream
bosunski Aug 18, 2018
450a25a
Merge branch '4.0-dev' into m1_copy
bosunski Aug 20, 2018
5b4b6b2
Merge branch '4.0-dev' into m1_copy
bosunski Aug 20, 2018
4aa323e
Moved Namespace register to joomla.php
bosunski Aug 21, 2018
6e8e92b
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Aug 21, 2018
e4b135f
Merge branch '4.0-dev' into m1_copy
bosunski Aug 21, 2018
568dc6d
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Aug 21, 2018
ee254f1
Merge branch '4.0-dev' into m1_copy
bosunski Aug 24, 2018
1306b13
Merge branch '4.0-dev' into m1_copy
bosunski Aug 25, 2018
ddb6be8
Merge branch '4.0-dev' into m1_copy
bosunski Aug 27, 2018
198f02b
Merge branch '4.0-dev' into m1_copy
bosunski Sep 3, 2018
fad7076
Removed unused class
bosunski Sep 3, 2018
8746c78
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Sep 3, 2018
80adb6f
Merge branch '4.0-dev' into m1_copy
bosunski Sep 10, 2018
19f0607
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Sep 10, 2018
0568130
Merge branch '4.0-dev' into m1_copy
bosunski Sep 11, 2018
bcce1e8
Fixed defined constant
bosunski Sep 11, 2018
1e94b70
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Sep 11, 2018
d12ddc3
Updated how the configuration is gotten and options validation
bosunski Sep 11, 2018
b8ac39c
Merge branch '4.0-dev' into m1_copy
bosunski Sep 26, 2018
3fbc8e9
Merge branch '4.0-dev' into m1_copy
bosunski Oct 26, 2018
f67df4e
Merge branch '4.0-dev' into m1_copy
bosunski Oct 31, 2018
3d444b1
Merge branch '4.0-dev' into m1_copy
bosunski Nov 4, 2018
21b0f4d
Fixed error thrown when manifest_cache is false
bosunski Nov 4, 2018
c7a594b
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Nov 4, 2018
afc30d5
Merge branch '4.0-dev' into m1_copy
bosunski Nov 6, 2018
2f80bf0
Added getClientId and clientId to ConsoleApplication
bosunski Nov 6, 2018
d90e459
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Nov 6, 2018
c3eb623
Merge branch '4.0-dev' into m1_copy
bosunski Nov 6, 2018
017f09d
Merge branch '4.0-dev' into m1_copy
bosunski Nov 18, 2018
4e5713e
Changed createMVCFactory to getMVCFactory
bosunski Nov 18, 2018
3810902
Fixed the issue of JNamespacePsr4Map not found by registering the class
bosunski Nov 18, 2018
5945a1f
Fixed createMVCFactory not found issue
bosunski Nov 18, 2018
ae81926
NULL config error
bosunski Nov 19, 2018
c5116ae
Update libraries/src/Console/ExtensionRemoveCommand.php
Nov 19, 2018
adee795
Update libraries/src/Console/ExtensionRemoveCommand.php
Nov 19, 2018
21cc87e
Update libraries/src/Console/ExtensionRemoveCommand.php
Nov 19, 2018
27e6782
Update libraries/src/Console/ExtensionRemoveCommand.php
Nov 19, 2018
ee41ac8
Update libraries/src/Console/ExtensionsListCommand.php
Nov 19, 2018
49aea85
Update libraries/src/Console/ExtensionsListCommand.php
Nov 19, 2018
5751aca
Update libraries/src/Console/ExtensionsListCommand.php
Nov 19, 2018
022c893
Update libraries/src/Console/ExtensionsListCommand.php
Nov 19, 2018
6778df7
Update libraries/src/Console/ExtensionsListCommand.php
Nov 19, 2018
a895d7d
Corrected some coding styles
bosunski Nov 19, 2018
02c39d4
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Nov 19, 2018
f63b3da
Corrected some coding styles
bosunski Nov 19, 2018
f098e2c
Corrected some coding styles
bosunski Nov 19, 2018
b911346
Merge branch '4.0-dev' into m1_copy
bosunski Nov 20, 2018
84c8e27
Merge branch '4.0-dev' into m1_copy
bosunski Nov 28, 2018
b23fdfb
Merge branch '4.0-dev' into m1_copy
infograf768 Dec 2, 2018
8eee306
Merge branch '4.0-dev' into m1_copy
bosunski Dec 3, 2018
b2da127
Merge branch '4.0-dev' into m1_copy
bosunski Dec 6, 2018
7d35c0d
Merge branch '4.0-dev' into m1_copy
bosunski Dec 8, 2018
9ece943
Moved PSR4 regisration after the Application is set
bosunski Dec 8, 2018
9be7e20
Merge branch '4.0-dev' into m1_copy
bosunski Dec 13, 2018
a49b93c
Merge branch '4.0-dev' into m1_copy
bosunski Dec 14, 2018
61ab309
Fixed extension remove not reporting error when name is passed as arg…
bosunski Dec 14, 2018
93e9d0b
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Dec 14, 2018
96775fa
Merge branch '4.0-dev' into m1_copy
bosunski Dec 15, 2018
44d2fd0
Corrected some review feedbacks
bosunski Dec 16, 2018
e03f5cc
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Dec 16, 2018
70dc274
Merge branch '4.0-dev' into m1_copy
bosunski Dec 16, 2018
004392d
Fixed merge conflict
bosunski Feb 20, 2019
a299d35
Update Command classes to follow new update in AbstractCommand
bosunski Feb 20, 2019
298c1b2
Update some code style
bosunski Feb 20, 2019
f2b593e
Update some code style
bosunski Feb 20, 2019
5701c90
Update some code style
bosunski Feb 20, 2019
cb6f264
Correct previous code style issues
bosunski Feb 20, 2019
4a73fd5
Merge branch '4.0-dev' into m1_copy
bosunski Feb 20, 2019
a959f8f
Update Get configuration to format booleans approppriately
bosunski Feb 21, 2019
8a61284
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Feb 21, 2019
5412272
Update Get configuration to format booleans approppriately and Remove…
bosunski Feb 21, 2019
292a3f0
Fix CS
bosunski Feb 21, 2019
dabed3f
Moved Extension loader into Application
bosunski Feb 21, 2019
e2897a6
Refactor some part of ConsoleApplication
bosunski Feb 21, 2019
fb0196b
Refacored command classes to use method params
bosunski Feb 21, 2019
ed9b8b6
Make command classes use property
bosunski Feb 21, 2019
60eef28
fixed CS
bosunski Feb 21, 2019
6bc0cc5
Merge branch '4.0-dev' into m1_copy
bosunski Feb 21, 2019
c8aa176
Merge branch '4.0-dev' into m1_copy
bosunski Feb 23, 2019
6f94953
Merge branch '4.0-dev' into m1_copy
bosunski Feb 24, 2019
4860b9e
Merge branch '4.0-dev' into m1_copy
bosunski Feb 28, 2019
6b61ec7
Merge branch '4.0-dev' into m1_copy
bosunski Mar 8, 2019
fabdf75
Updtae client ID to 4 instead of null
bosunski Mar 27, 2019
1c2f9f7
Move Command classes to be registered through the Service provider
bosunski Mar 27, 2019
0a93ade
Merge branch '4.0-dev' into m1_copy
bosunski Mar 27, 2019
68bbb4c
Fix some DocBlock mistakes
bosunski Mar 27, 2019
5ea1435
Amend retrieving of Application object to be via the injected applica…
bosunski Mar 27, 2019
556702c
Change implementation for writing configuration to Joomla\CMS\Filesystem
bosunski Mar 27, 2019
7f17e79
Update How another CLI is Called
bosunski Mar 27, 2019
31753c7
Update How another CLI is Called
bosunski Mar 27, 2019
e0a6680
Update CLI class to not pull application from the factory but rather …
bosunski Mar 27, 2019
fc827e0
Remove unnecessary unsetting of class property
bosunski Mar 27, 2019
b7e8ab4
Remove Exit from Installation Process
bosunski Mar 27, 2019
fea9214
Rename getDummyOptions to getDefaultOptions
bosunski Mar 27, 2019
eb3103d
Update Core Install
bosunski Mar 27, 2019
631073e
Update Extension Install
bosunski Mar 27, 2019
07c696c
Inject DB Instance into Update Core Command
bosunski Mar 27, 2019
53f913b
Remove unnecessary null check inside Factory for getuser Method
bosunski Mar 27, 2019
8f265d9
Fix merge conflict
bosunski Mar 27, 2019
a071a6b
Merge branch '4.0-dev' into m1_copy
bosunski Mar 27, 2019
ea1b823
Merge branch '4.0-dev' into m1_copy
bosunski Apr 23, 2019
4e455ea
Update libraries/src/Console/CheckJoomlaUpdatesCommand.php
mbabker Apr 23, 2019
960c108
Fix some reviews
bosunski Apr 23, 2019
56d00b0
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Apr 23, 2019
c990bbc
Fix some reviews
bosunski Apr 23, 2019
3ddb19c
Update Factory to 4.0-dev version
bosunski Apr 23, 2019
8bf850c
Fix error
bosunski Apr 23, 2019
3a4254a
Remove from argument from Extension install
bosunski Apr 23, 2019
bda5ffb
Move registration of installation namespace into bootstrap.php
bosunski Apr 23, 2019
9560bf9
Add comment for why the check inside framework.php was made
bosunski Apr 23, 2019
b033cb9
Move getPrefix method into DatabaseHelper
bosunski Apr 23, 2019
097d2a1
Fix error
bosunski Apr 23, 2019
a97eb0d
Update Core Install to use getPrefix from DatabaseHelper
bosunski Apr 23, 2019
08ba64d
Modified GetPrefix to include size as argument
bosunski Apr 23, 2019
a87f70f
Modified GetPrefix to include size as argument
bosunski Apr 23, 2019
683b7fd
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Apr 23, 2019
8e00fce
fix code styling
bosunski Apr 23, 2019
d422c87
Merge branch '4.0-dev' into m1_copy
jeckodevelopment Apr 24, 2019
bdc0a1a
Merge branch '4.0-dev' into m1_copy
bosunski Apr 29, 2019
90aebf7
Merge branch '4.0-dev' into m1_copy
bosunski May 3, 2019
c1267f8
Fix merge conflict
bosunski Jun 7, 2019
ddee242
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Jun 7, 2019
879e108
Fix some code style issue
bosunski Jun 7, 2019
4b46a35
Fix some code style issue
bosunski Jun 7, 2019
dba0069
Merge branch '4.0-dev' into m1_copy
HLeithner Jun 7, 2019
e80940d
Update installation/src/Helper/DatabaseHelper.php
bosunski Jun 9, 2019
256c196
Update installation/src/Helper/DatabaseHelper.php
bosunski Jun 9, 2019
5bfc934
Update includes/framework.php
bosunski Jun 9, 2019
8af02f6
Update includes/framework.php
bosunski Jun 9, 2019
b566179
Change debug mode to false
bosunski Jun 9, 2019
8f89eee
Update Local files
bosunski Jun 9, 2019
e3b964d
Merge branch '4.0-dev' into m1_copy
bosunski Jun 9, 2019
bcc0036
Fix merge conflict and update code
bosunski Oct 2, 2019
b4c8532
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into m…
bosunski Oct 2, 2019
e89d80b
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Oct 2, 2019
07f7d73
Merge branch '4.0-dev' into m1_copy
bosunski Oct 2, 2019
595716a
Update commands
bosunski Oct 2, 2019
f56754b
Merge branch '4.0-dev' into m1_copy
wilsonge Nov 5, 2019
5606ff9
Merge branch '4.0-dev' into m1_copy
infograf768 Nov 30, 2019
502e426
Merge branch '4.0-dev' into m1_copy
bosunski Nov 30, 2019
5753337
Update installation/src/Helper/DatabaseHelper.php
bosunski Dec 2, 2019
2dae8a4
Update installation/src/Helper/DatabaseHelper.php
bosunski Dec 2, 2019
d626612
Merge branch '4.0-dev' into m1_copy
bosunski Dec 2, 2019
767a5ac
Merge branch '4.0-dev' into m1_copy
bosunski Dec 3, 2019
ab9cb42
Update libraries/src/Console/GetConfigurationCommand.php
bosunski Dec 3, 2019
15b3be6
Update libraries/src/Console/SetConfigurationCommand.php
bosunski Dec 3, 2019
535ce86
Update libraries/src/Console/GetConfigurationCommand.php
bosunski Dec 3, 2019
d1e9f0d
Update libraries/src/Console/GetConfigurationCommand.php
bosunski Dec 3, 2019
7e174eb
Merge branch '4.0-dev' into m1_copy
bosunski Dec 8, 2019
dcfc62a
Make some code style fixes
bosunski Dec 8, 2019
ee5066a
Merge branch 'm1_copy' of https://github.com/bosunski/joomla-cms into…
bosunski Dec 8, 2019
f6ec9d9
Merge branch '4.0-dev' into m1_copy
bosunski Dec 9, 2019
3f9ada1
Merge branch '4.0-dev' into m1_copy
wilsonge Jan 18, 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
11 changes: 10 additions & 1 deletion includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
|| (filesize(JPATH_CONFIGURATION . '/configuration.php') < 10)
|| (file_exists(JPATH_INSTALLATION . '/index.php') && (false === (new Version)->isInDevelopmentState())))
{
if (file_exists(JPATH_INSTALLATION . '/index.php'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is still required before registering the namespace and trying to do something. For stable releases, the installation directory is removed from a site after Joomla has been installed. Therefore, altering the behavior based on the active SAPI must still account for the production filesystem structure and issue appropriate warnings if not available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this and also I have this check for the installation directory, I think that is already accounted for, if I'm correct? @mbabker

// Prevents the script from falling back to $_SERVER['REQUEST_URI'] as it will throw an error in CLI mode.
if (php_sapi_name() === 'cli')
{
// This is been defined because some core scripts needs it defined.
define('JDEBUG', false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JDEBUG constant should still be set true/false based on the configuration. It should not be arbitrarily set to false for all CLI scripts.


// We pass control back to the calling script - joomla.php to allow commands like core:install to run
return;
}
elseif (file_exists(JPATH_INSTALLATION . '/index.php'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Style Suggestion: You dont need elseif when your return in the first if block

{
header('Location: ' . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')) . 'installation/index.php');

Expand Down
26 changes: 4 additions & 22 deletions installation/src/Form/Field/Installation/PrefixField.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Installation\Helper\DatabaseHelper;

/**
* Database Prefix field.
Expand Down Expand Up @@ -45,36 +46,17 @@ protected function getInput()
$disabled = (string) $this->element['disabled'] === 'true' ? ' disabled="disabled"' : '';

// Make sure somebody doesn't put in a too large prefix size value.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check needs to be here instead of the getPrefix method - because if the prefix is in the session this check is going to be skipped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilsonge please check this commit, is that what you meant?

if ($size > 10)
if ($size > 15)
{
$size = 10;
$size = 15;
}

// If a prefix is already set, use it instead.
$session = Factory::getSession()->get('setup.options', array());

if (empty($session['db_prefix']))
{
// Create the random prefix.
$prefix = '';
$chars = range('a', 'z');
$numbers = range(0, 9);

// We want the fist character to be a random letter.
shuffle($chars);
$prefix .= $chars[0];

// Next we combine the numbers and characters to get the other characters.
$symbols = array_merge($numbers, $chars);
shuffle($symbols);

for ($i = 0, $j = $size - 1; $i < $j; ++$i)
{
$prefix .= $symbols[$i];
}

// Add in the underscore.
$prefix .= '_';
$prefix = DatabaseHelper::getPrefix();
}
else
{
Expand Down
34 changes: 34 additions & 0 deletions installation/src/Helper/DatabaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,40 @@ public static function getDbo($driver, $host, $user, $password, $database, $pref
}

/**
* Generates random prefix string for DB table
*
* @param int $size Size of the Prefix
*
* @return string
*
* @since 4.0
*/
public static function getPrefix(int $size = 15)
{
// Create the random prefix.
$chars = range('a', 'z');
$numbers = range(0, 9);

// We want the first character to be a random letter.
shuffle($chars);
$prefix = $chars[0];

// Next we combine the numbers and characters to get the other characters.
$symbols = array_merge($numbers, $chars);
shuffle($symbols);

for ($i = 1, $j = $size - 1; $i < $j; ++$i)
{
$prefix .= $symbols[$i];
}

// Add in the underscore.
$prefix .= '_';

return $prefix;
}

/**
* Convert encryption options to array.
*
* @param \stdClass $options The session options
Expand Down
109 changes: 106 additions & 3 deletions installation/src/Model/DatabaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public function createTables($options)
$serverType = $db->getServerType();

// Set the appropriate schema script based on UTF-8 support.
$schema = 'sql/' . $serverType . '/joomla.sql';
$schema = JPATH_INSTALLATION . '/sql/' . $serverType . '/joomla.sql';

// Check if the schema is a valid file
if (!is_file($schema))
Expand Down Expand Up @@ -723,7 +723,7 @@ public function createTables($options)
}

// Load the localise.sql for translating the data in joomla.sql.
$dblocalise = 'sql/' . $serverType . '/localise.sql';
$dblocalise = JPATH_INSTALLATION . '/sql/' . $serverType . '/localise.sql';

if (is_file($dblocalise))
{
Expand All @@ -745,7 +745,7 @@ public function createTables($options)
}

// Handle default backend language setting. This feature is available for localized versions of Joomla.
$languages = Factory::getApplication()->getLocaliseAdmin($db);
$languages = $this->getLocaliseAdmin($db);

if (in_array($options->language, $languages['admin']) || in_array($options->language, $languages['site']))
{
Expand Down Expand Up @@ -790,6 +790,109 @@ public function createTables($options)
return $return;
}

/**
* Returns the installed language in the administrative and frontend area.
*
* @param DatabaseInterface $db Database driver.
*
* @return array Array with installed language packs in admin and site area.
*
* @since 4.0
*/
public function getLocaliseAdmin(DatabaseInterface $db = null)
{
$langfiles = [];

// If db connection, fetch them from the database.
if ($db)
{
foreach (LanguageHelper::getInstalledLanguages() as $clientId => $languages)
{
$clientName = $clientId === 0 ? 'site' : 'admin';

foreach ($languages as $language)
{
$langfiles[$clientName][] = $language->element;
}
}

return $langfiles;
}

// Read the folder names in the site and admin area.
return [
'site' => Folder::folders(LanguageHelper::getLanguagePath(JPATH_SITE)),
'admin' => Folder::folders(LanguageHelper::getLanguagePath(JPATH_ADMINISTRATOR)),
];
}

/**
* Method to install the sample data.
*
* @return boolean True on success.
*
* @since 3.1
*/
public function installSampleData()
{
$db = Factory::getDbo();

// Build the path to the sample data file.
$type = $db->getServerType();

if (Factory::getApplication()->input->get('sample_file', ''))
{
$sample_file = Factory::getApplication()->input->get('sample_file', '');
}
else
{
$sample_file = 'sample_testing.sql';
}

$data = JPATH_INSTALLATION . '/sql/' . $type . '/' . $sample_file;

// Attempt to import the database schema if one is chosen.
if ($sample_file != '')
{
if (!file_exists($data))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('INSTL_DATABASE_FILE_DOES_NOT_EXIST', $data), 'error');

return false;
}
elseif (!$this->populateDatabase($db, $data))
{
return false;
}

$this->postInstallSampleData($db, $sample_file);
}

return true;
}

/**
* Sample data tables and data post install process.
*
* @param \JDatabaseDriver $db Database connector object $db*.
* @param string $sampleFileName The sample dats filename.
*
* @return void
*
* @since 3.1
*/
protected function postInstallSampleData($db, $sampleFileName = '')
{
// Update the sample data user ids.
$this->updateUserIds($db);

// If not joomla sample data for testing, update the sample data dates.
if ($sampleFileName !== 'sample_testing.sql')
{
$this->updateDates($db);
}
}

/**
* Method to install the cms data.
*
Expand Down
6 changes: 6 additions & 0 deletions libraries/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ class_exists('\\Joomla\\CMS\\Autoload\\ClassLoader');

// Register the PasswordHash library.
JLoader::register('PasswordHash', JPATH_PLATFORM . '/phpass/PasswordHash.php');

// Registers the Installation namespace
if (file_exists(JPATH_INSTALLATION . '/index.php'))
{
JLoader::registerNamespace('Joomla\\CMS\\Installation', JPATH_INSTALLATION . '/src', false, false, 'psr4');
}
43 changes: 41 additions & 2 deletions libraries/src/Application/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Extension\ExtensionManagerTrait;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Version;
use Joomla\Console\Application;
use Joomla\DI\Container;
use Joomla\DI\ContainerAwareTrait;
Expand All @@ -22,6 +23,8 @@
use Joomla\Event\DispatcherInterface;
use Joomla\Registry\Registry;
use Joomla\Session\SessionInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
Expand Down Expand Up @@ -57,6 +60,14 @@ class ConsoleApplication extends Application implements DispatcherAwareInterface
*/
private $session;

/**
* The client identifier.
*
* @var integer
* @since 4.0
*/
protected $clientId = 4;

/**
* Class constructor.
*
Expand Down Expand Up @@ -163,8 +174,11 @@ public function execute()
$this->createExtensionNamespaceMap();

// Import CMS plugin groups to be able to subscribe to events
PluginHelper::importPlugin('system');
PluginHelper::importPlugin('console');
if (file_exists(JPATH_CONFIGURATION . '/configuration.php'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment indicating why this check is necessary should be left. And I would suggest this check should not be necessary, the plugin helper should deal with issues stemming from the database connection being unavailable if really necessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment still needs to be addressed.

{
PluginHelper::importPlugin('system');
PluginHelper::importPlugin('console');
}

parent::execute();
}
Expand Down Expand Up @@ -307,6 +321,31 @@ public function setSession(SessionInterface $session): self
return $this;
}


/**
* Flush the media version to refresh versionable assets
*
* @return void
*
* @since 4.0
*/
public function flushAssets()
{
(new Version)->refreshMediaVersion();
}

/**
* Gets the client id of the current running application.
*
* @return integer A client identifier.
*
* @since 4.0
*/
public function getClientId()
{
return $this->clientId;
}

/**
* Returns the application \JMenu object.
*
Expand Down
Loading