Skip to content

Commit 5eeb9fb

Browse files
dgrammatikovoronkovich
authored andcommitted
[6.0] Move jquery-noconflict script (#45020)
Thank you @dgrammatiko and the testers @brianteeman and @Fedik Much appreciated
1 parent 95be2c1 commit 5eeb9fb

File tree

14 files changed

+392
-30
lines changed

14 files changed

+392
-30
lines changed

administrator/includes/framework.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use Joomla\CMS\Version;
1313
use Joomla\Utilities\IpHelper;
14+
use Symfony\Component\Dotenv\Dotenv;
1415

1516
// System includes
1617
require_once JPATH_LIBRARIES . '/bootstrap.php';
@@ -38,13 +39,30 @@
3839
exit;
3940
}
4041

42+
// Load .env files
43+
if (file_exists(JPATH_ROOT . '/.env.local.php') || file_exists(JPATH_ROOT . '/.env')) {
44+
(new Dotenv('JOOMLA_ENV', 'JOOMLA_DEBUG'))->bootEnv(JPATH_ROOT . '/.env', 'prod');
45+
}
46+
4147
// Pre-Load configuration. Don't remove the Output Buffering due to BOM issues, see JCode 26026
4248
ob_start();
4349
require_once JPATH_CONFIGURATION . '/configuration.php';
4450
ob_end_clean();
4551

52+
// getenv() is not thread-safe and it can cause segmentaion fault, so we should try $_SERVER first
53+
$envs = !empty($_SERVER) ? $_SERVER : getenv();
54+
4655
// System configuration.
47-
$config = new JConfig();
56+
$config = new JConfig();
57+
$config->error_reporting = $envs['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting;
58+
$config->debug = (bool) ($envs['JOOMLA_DEBUG'] ?? $config->debug);
59+
if (isset($envs['JOOMLA_LOG_DEPRECATED'])) {
60+
$config->log_deprecated = (int) $envs['JOOMLA_LOG_DEPRECATED'];
61+
}
62+
if (isset($envs['JOOMLA_BEHIND_LOADBALANCER'])) {
63+
$config->behind_loadbalancer = (bool) $envs['JOOMLA_BEHIND_LOADBALANCER'];
64+
}
65+
unset($envs);
4866

4967
// Set the error_reporting, and adjust a global Error Handler
5068
switch ($config->error_reporting) {

api/includes/framework.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use Joomla\CMS\Version;
1313
use Joomla\Utilities\IpHelper;
14+
use Symfony\Component\Dotenv\Dotenv;
1415

1516
// System includes
1617
require_once JPATH_LIBRARIES . '/bootstrap.php';
@@ -38,13 +39,30 @@
3839
exit;
3940
}
4041

42+
// Load .env files
43+
if (file_exists(JPATH_ROOT . '/.env.local.php') || file_exists(JPATH_ROOT . '/.env')) {
44+
(new Dotenv('JOOMLA_ENV', 'JOOMLA_DEBUG'))->bootEnv(JPATH_ROOT . '/.env', 'prod');
45+
}
46+
4147
// Pre-Load configuration. Don't remove the Output Buffering due to BOM issues, see JCode 26026
4248
ob_start();
4349
require_once JPATH_CONFIGURATION . '/configuration.php';
4450
ob_end_clean();
4551

52+
// getenv() is not thread-safe and it can cause segmentaion fault, so we should try $_SERVER first
53+
$envs = !empty($_SERVER) ? $_SERVER : getenv();
54+
4655
// System configuration.
47-
$config = new JConfig();
56+
$config = new JConfig();
57+
$config->error_reporting = $envs['JOOMLA_ERROR_REPORTING'] ?? $config->error_reporting;
58+
$config->debug = (bool) ($envs['JOOMLA_DEBUG'] ?? $config->debug);
59+
if (isset($envs['JOOMLA_LOG_DEPRECATED'])) {
60+
$config->log_deprecated = (int) $envs['JOOMLA_LOG_DEPRECATED'];
61+
}
62+
if (isset($envs['JOOMLA_BEHIND_LOADBALANCER'])) {
63+
$config->behind_loadbalancer = (bool) $envs['JOOMLA_BEHIND_LOADBALANCER'];
64+
}
65+
unset($envs);
4866

4967
// Set the error_reporting
5068
switch ($config->error_reporting) {

build/build-modules-js/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,11 @@
432432
"name": "jquery",
433433
"type": "script",
434434
"uri": "jquery.min.js"
435+
},
436+
{
437+
"name": "jquery-noconflict",
438+
"type": "script",
439+
"uri": "jquery-noconflict.min.js"
435440
}
436441
],
437442
"dependencies": [],

build/media_source/legacy/joomla.asset.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

build/media_source/legacy/js/jquery-noconflict.es5.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line no-undef
2+
window.$ = jQuery.noConflict();

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"php": "8.1.0"
1515
},
1616
"vendor-dir": "libraries/vendor",
17-
"github-protocols": ["https"]
17+
"github-protocols": [
18+
"https"
19+
]
1820
},
1921
"support": {
2022
"issues": "https://issues.joomla.org/",
@@ -26,7 +28,7 @@
2628
{
2729
"type": "vcs",
2830
"url": "https://github.com/joomla-backports/json-api-php.git",
29-
"no-api": true
31+
"no-api": true
3032
},
3133
{
3234
"type": "vcs",
@@ -109,7 +111,8 @@
109111
"jfcherng/php-diff": "^6.16.2",
110112
"voku/portable-utf8": "dev-joomla-5.3 as 6.0.13",
111113
"php-tuf/php-tuf": "^1.0.2",
112-
"php-debugbar/php-debugbar": "^2.1"
114+
"php-debugbar/php-debugbar": "^2.1",
115+
"symfony/dotenv": "^6.4"
113116
},
114117
"require-dev": {
115118
"phpunit/phpunit": "^9.6.22",
@@ -135,7 +138,7 @@
135138
},
136139
"scripts": {
137140
"post-install-cmd": [
138-
"php build/update_fido_cache.php"
141+
"php build/update_fido_cache.php"
139142
]
140143
}
141144
}

composer.lock

Lines changed: 75 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

env.dev.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
JOOMLA_DEBUG=1
2+
JOOMLA_DEBUG_LANG=0
3+
JOOMLA_DEBUG_LANG_CONST=0
4+
JOOMLA_ERROR_REPORTING='maximum'
5+
JOOMLA_LOG_DEPRECATED=1
6+
JOOMLA_LOG_EVERYTHING=1

env.dist

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$JOOMLA_ENV committed environment-specific defaults
7+
# * .env.$JOOMLA_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
#
13+
# To set a configuration value use format JOOMLA_$KEY:
14+
#
15+
# JOOMLA_OFFLINE=1
16+
# JOOMLA_SITENAME='Joomla!'
17+
#
18+
# All available configuration values are listed in installation/configuration.php-dist.
19+
20+
JOOMLA_ENV=dev
21+
22+
# Database configuration
23+
#
24+
# JOOMLA_DBTYPE='mysqli'
25+
# JOOMLA_DBHOST='localhost'
26+
# JOOMLA_DBNAME='db'
27+
# JOOMLA_DBUSER='db'
28+
# JOOMLA_DBPASSWORD='db'
29+
# JOOMLA_DBPREFIX='jos_'

0 commit comments

Comments
 (0)