Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
27e88ad
public folder
dgrammatiko Apr 30, 2023
06f338d
Dual mode
dgrammatiko Apr 30, 2023
c6f4c35
nope
dgrammatiko Apr 30, 2023
36e0f69
CS
dgrammatiko Apr 30, 2023
c64f7ca
fixes
dgrammatiko Apr 30, 2023
d007b2d
Update .gitignore
dgrammatiko Apr 30, 2023
04e2daa
fixit
dgrammatiko Apr 30, 2023
dd83bd6
nope
dgrammatiko Apr 30, 2023
a26269a
well
dgrammatiko Apr 30, 2023
ad7c4ff
absolute path fix
dgrammatiko Apr 30, 2023
084d20e
Cs
dgrammatiko Apr 30, 2023
9332586
Don’t hardcode the name of the public folder
dgrammatiko Apr 30, 2023
161cd83
missed one
dgrammatiko Apr 30, 2023
2b20df0
nope
dgrammatiko Apr 30, 2023
d981eaa
Introduce constants globally
dgrammatiko Apr 30, 2023
3b89c0b
also
dgrammatiko Apr 30, 2023
cc3223b
tests
dgrammatiko Apr 30, 2023
7879081
almost
dgrammatiko Apr 30, 2023
3066e8d
Add a fallback just to be sure we won’t break anything
dgrammatiko Apr 30, 2023
604bbb1
also the CLI
dgrammatiko Apr 30, 2023
72c1bbd
minor
dgrammatiko Apr 30, 2023
f2430e5
this might help
dgrammatiko Apr 30, 2023
12a7bb1
If you copy paste it correctly
dgrammatiko Apr 30, 2023
59870aa
Discard the constant JPATH_PUBLICNAME
dgrammatiko Apr 30, 2023
b996bb5
Update app.php
dgrammatiko Apr 30, 2023
065a27c
Update defines.php
dgrammatiko Apr 30, 2023
1d89f22
Update joomla.php
dgrammatiko Apr 30, 2023
bfc3d6c
cs
dgrammatiko Apr 30, 2023
ff5345e
remove the public folder
dgrammatiko Apr 30, 2023
6109aac
Update .gitignore
dgrammatiko Apr 30, 2023
a11ccc0
Refactor
dgrammatiko May 1, 2023
83f7086
cs
dgrammatiko May 1, 2023
9a8ac42
Actually public folder is not required here
dgrammatiko May 1, 2023
78526ba
Only for the web clients
dgrammatiko May 2, 2023
f329750
Revert to JPATH_ROOT
dgrammatiko May 2, 2023
306d001
CS
dgrammatiko May 2, 2023
c297d38
revert
dgrammatiko May 2, 2023
5277eca
revert
dgrammatiko May 2, 2023
5368856
Nope
dgrammatiko May 2, 2023
6222f08
Reduce the changes needed by
dgrammatiko May 5, 2023
b1b2530
Merge branch '5.0-dev' into 5.0-dev-rfc-public
dgrammatiko May 5, 2023
978c562
cc
dgrammatiko May 5, 2023
c98e3e4
that was a bad idea
dgrammatiko May 6, 2023
2685779
nope
dgrammatiko May 6, 2023
0bde122
CS
dgrammatiko May 6, 2023
15801a7
oops
dgrammatiko May 6, 2023
fa86749
Merge branch '5.0-dev' into 5.0-dev-rfc-public
dgrammatiko May 21, 2023
a17aeb5
Merge branch '5.0-dev' into 5.0-dev-rfc-public
HLeithner Jun 12, 2023
34e8fbf
Merge branch '5.0-dev' into 5.0-dev-rfc-public
dgrammatiko Jun 16, 2023
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
8 changes: 6 additions & 2 deletions administrator/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
require_once JPATH_BASE . '/includes/defines.php';
}

if (!defined('JPATH_PUBLIC')) {
define('JPATH_PUBLIC', JPATH_ROOT);
}

// Check for presence of vendor dependencies not included in the git repository
if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_ROOT . '/media/vendor')) {
echo file_get_contents(JPATH_ROOT . '/templates/system/build_incomplete.html');
if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_PUBLIC . '/media/vendor')) {
echo file_get_contents(JPATH_BASE . '/templates/system/build_incomplete.html');

exit;
}
Expand Down
1 change: 1 addition & 0 deletions administrator/includes/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// Defines
define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_PUBLIC', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator');
define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries');
Expand Down
6 changes: 5 additions & 1 deletion administrator/includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
|| (file_exists(JPATH_INSTALLATION . '/index.php') && (false === (new Version())->isInDevelopmentState()))
) {
if (file_exists(JPATH_INSTALLATION . '/index.php')) {
header('Location: ../installation/index.php');
if (JPATH_ROOT === JPATH_PUBLIC) {
header('Location: ../installation/index.php');
} else {
echo 'Installation from a public folder is not supported, revert your Server configuration to point at the Joomla\'s root folder to continue.';
}

exit();
} else {
Expand Down
2 changes: 1 addition & 1 deletion administrator/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
str_replace(
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/../templates/system/incompatible.html')
file_get_contents(dirname(dirname(__FILE__)) . '/includes/incompatible.html')
)
);
}
Expand Down
4 changes: 4 additions & 0 deletions api/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
require_once JPATH_BASE . '/includes/defines.php';
}

if (!defined('JPATH_PUBLIC')) {
define('JPATH_PUBLIC', JPATH_ROOT);
}

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

// Set profiler start time and memory usage and mark afterLoad in the profiler.
Expand Down
1 change: 1 addition & 0 deletions api/includes/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// Defines.
define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_PUBLIC', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator');
define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries');
Expand Down
12 changes: 5 additions & 7 deletions build/build-modules-js/error-pages.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,12 @@ module.exports.createErrorPages = async (options) => {
await mkdir(dirname(`${RootPath}${options.settings.errorPages[name].destFile}`), { recursive: true, mode: 0o755 });
}

await writeFile(
`${RootPath}${options.settings.errorPages[name].destFile}`,
template,
{ encoding: 'utf8', mode: 0o644 },
);
options.settings.errorPages[name].destFile.forEach(async (folder) => {
await writeFile(`${RootPath}${folder}`, template, { encoding: 'utf8', mode: 0o644 });

// eslint-disable-next-line no-console
console.error(`✅ Created the file: ${options.settings.errorPages[name].destFile}`);
// eslint-disable-next-line no-console
console.error(`✅ Created the file: ${folder}`);
});
};

Object.keys(options.settings.errorPages).forEach((name) => processPages.push(processPage(name)));
Expand Down
8 changes: 4 additions & 4 deletions build/build-modules-js/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -788,31 +788,31 @@
"text": "It looks like you are trying to run Joomla! from our git repository. To do so requires you complete a couple of extra steps first.",
"link": "J4.x:Setting_Up_Your_Local_Environment",
"linkText": "More Details",
"destFile": "/templates/system/build_incomplete.html"
"destFile": ["/templates/system/build_incomplete.html"]
},
"unsupported": {
"title": "Joomla: unsupported PHP version",
"header": "Sorry, your PHP version is not supported",
"text": "Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla!",
"link": "J4.x:Unsupported_PHP_Version",
"linkText": "Help me resolve this",
"destFile": "/templates/system/incompatible.html"
"destFile": ["/templates/system/incompatible.html", "/includes/incompatible.html"]
},
"noxml": {
"title": "Joomla: Missing PHP-XML library",
"header": "Sorry, your PHP is missing a vital library",
"text": "Your host needs to use PHP with support for the XML library to run this version of Joomla!",
"link": "J4.x:Missing_XML_Library",
"linkText": "Help me resolve this",
"destFile": "/media/system/html/noxml.html"
"destFile": ["/media/system/html/noxml.html"]
},
"fatal": {
"title": "An Error Occurred: {{statusText}}",
"header": "Sorry, there was a problem we could not recover from.",
"text": "The server returned a \"{{statusCode_statusText}}\"",
"link": "J4.x:FatalError",
"linkText": "Help me resolve this",
"destFile": "/templates/system/fatal-error.html"
"destFile": ["/templates/system/fatal-error.html"]
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions cli/joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
exit;
}

if (!defined('JPATH_PUBLIC')) {
define('JPATH_PUBLIC', JPATH_ROOT);
}

// Check if installed
if (
!file_exists(JPATH_CONFIGURATION . '/configuration.php')
Expand Down
8 changes: 6 additions & 2 deletions includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
require_once JPATH_BASE . '/includes/defines.php';
}

if (!defined('JPATH_PUBLIC')) {
define('JPATH_PUBLIC', JPATH_ROOT);
}

// Check for presence of vendor dependencies not included in the git repository
if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_ROOT . '/media/vendor')) {
echo file_get_contents(JPATH_ROOT . '/templates/system/build_incomplete.html');
if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_PUBLIC . '/media/vendor')) {
echo file_get_contents(JPATH_BASE . '/templates/system/build_incomplete.html');

exit;
}
Expand Down
1 change: 1 addition & 0 deletions includes/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_PUBLIC', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator');
define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries');
define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins');
Expand Down
6 changes: 5 additions & 1 deletion includes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
|| (file_exists(JPATH_INSTALLATION . '/index.php') && (false === (new Version())->isInDevelopmentState()))
) {
if (file_exists(JPATH_INSTALLATION . '/index.php')) {
header('Location: ' . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')) . 'installation/index.php');
if (JPATH_ROOT === JPATH_PUBLIC) {
header('Location: ' . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')) . 'installation/index.php');
} else {
echo 'Installation from a public folder is not supported, revert your Server configuration to point at the Joomla\'s root folder to continue.';
}

exit;
} else {
Expand Down
38 changes: 38 additions & 0 deletions includes/incompatible.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
str_replace(
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/templates/system/incompatible.html')
file_get_contents(dirname(__FILE__) . '/includes/incompatible.html')
Copy link
Member

Choose a reason for hiding this comment

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

hmm wouldn't it make more sense to move this to the media folder?

Copy link
Member

Choose a reason for hiding this comment

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

having this file now 2 times looks a bit silly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's fine because the file is generated by the tools, so the source is 1 file

)
);
}
Expand Down
1 change: 1 addition & 0 deletions installation/includes/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Defines
define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_PUBLIC', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator');
define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries');
Expand Down
18 changes: 9 additions & 9 deletions libraries/src/HTML/HTMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec

if ($template->inheritable || !empty($template->parent)) {
$client = $app->isClient('administrator') === true ? 'administrator' : 'site';
$templaPath = JPATH_ROOT . "/media/templates/$client";
$templaPath = JPATH_PUBLIC . "/media/templates/$client";
}

// For each potential files
Expand Down Expand Up @@ -441,7 +441,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
list($element, $file) = explode('/', $file, 2);

// Try to deal with plugins group in the media folder
$found = static::addFileToBuffer(JPATH_ROOT . "/media/$extension/$element/$folder/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/$extension/$element/$folder/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand All @@ -450,7 +450,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
}

// Try to deal with classical file in a media subfolder called element
$found = static::addFileToBuffer(JPATH_ROOT . "/media/$extension/$folder/$element/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/$extension/$folder/$element/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand All @@ -477,7 +477,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
}
} else {
// Try to deal with system files in the media folder
$found = static::addFileToBuffer(JPATH_ROOT . "/media/system/$folder/$element/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/system/$folder/$element/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand All @@ -487,7 +487,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
}
} else {
// Try to deal with files in the extension's media folder
$found = static::addFileToBuffer(JPATH_ROOT . "/media/$extension/$folder/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/$extension/$folder/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand Down Expand Up @@ -524,7 +524,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
}

// Try to deal with system files in the media folder
$found = static::addFileToBuffer(JPATH_ROOT . "/media/system/$folder/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/system/$folder/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand All @@ -534,7 +534,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
}
} else {
// Try to deal with system files in the media folder
$found = static::addFileToBuffer(JPATH_ROOT . "/media/system/$folder/$file", $ext, $debugMode);
$found = static::addFileToBuffer(JPATH_PUBLIC . "/media/system/$folder/$file", $ext, $debugMode);

if (!empty($found)) {
$includes[] = $found;
Expand All @@ -558,7 +558,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
* This MD5SUM file must represent the signature of the folder content
*/
foreach ($files as $file) {
$path = JPATH_ROOT . "/$file";
$path = JPATH_PUBLIC . '/' . $file;

$found = static::addFileToBuffer($path, $ext, $debugMode);

Expand Down Expand Up @@ -1209,7 +1209,7 @@ protected static function addFileToBuffer($path = '', $ext = '', $debugMode = fa
*/
protected static function convertToRelativePath($path)
{
$relativeFilePath = Uri::root(true) . str_replace(JPATH_ROOT, '', $path);
$relativeFilePath = Uri::root(true) . str_replace(JPATH_PUBLIC, '', $path);

// On windows devices we need to replace "\" with "/" otherwise some browsers will not load the asset
return str_replace(DIRECTORY_SEPARATOR, '/', $relativeFilePath);
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
define('JPATH_ROOT', JPATH_BASE);
}

if (!defined('JPATH_PUBLIC')) {
define('JPATH_PUBLIC', JPATH_ROOT);
}

/**
* @deprecated 4.4.0 will be removed in 6.0
**/
Expand Down