Skip to content

Commit

Permalink
edit js compiled
Browse files Browse the repository at this point in the history
removed index_dev.php reference from composer and add some lines in mautic-setup.sh to change configurations of environment file

fix mautic-setup.sh

remove part url with index_dev.php

remove index_dev.php from scafford folder

remove dev comments
remove reference in htaccess root and scaffold folder
copy index.php from root to scaffold folder

It was created  parameter environment handler in Core Bundle

Remove dump and add comments

fix reference array type

coping index.php in root folder to index.php in scaffold folder

refactor index
add boostrap.php
copy index to scaffold
  • Loading branch information
lenonleite committed Apr 15, 2023
1 parent f877c23 commit b05db41
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
13 changes: 3 additions & 10 deletions app/assets/scaffold/files/index.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<?php

define('MAUTIC_ROOT_DIR', __DIR__);

// Fix for hosts that do not have date.timezone set, it will be reset based on users settings
date_default_timezone_set('UTC');

require_once 'autoload.php';
require 'config/bootstrap.php';

use Mautic\CoreBundle\ErrorHandler\ErrorHandler;
use Mautic\CoreBundle\Loader\EnvironmentHandler;
use Mautic\Middleware\MiddlewareBuilder;
use Symfony\Component\HttpFoundation\Request;

$config = (new EnvironmentHandler())->getEnvParameters();
ErrorHandler::register($config['ENV']);
ErrorHandler::register($_SERVER['APP_ENV']);

$kernel = (new MiddlewareBuilder(new AppKernel($config['ENV'], $config['DEBUG'])))->resolve();
$kernel = (new MiddlewareBuilder(new AppKernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG'])))->resolve();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
Expand Down
32 changes: 32 additions & 0 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'/autoload.php';

if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}

// Fix for hosts that do not have date.timezone set, it will be reset based on users settings
date_default_timezone_set('UTC');
define('MAUTIC_ROOT_DIR', __DIR__);

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_DEBUG'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$_SERVER['IPS_ALLOWED'] = $_ENV['IPS_ALLOWED'] = ($_SERVER['IPS_ALLOWED'] ?? $_ENV['IPS_ALLOWED'] ?? null) ?: '127.0.0.1,::1,172.17.0.1';

if ('dev' === strtolower($_SERVER['APP_ENV']) && extension_loaded('apcu') && in_array(@$_SERVER['REMOTE_ADDR'], explode(',', $_SERVER['IPS_ALLOWED']))) {
@apcu_clear_cache();
}
13 changes: 3 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<?php

define('MAUTIC_ROOT_DIR', __DIR__);

// Fix for hosts that do not have date.timezone set, it will be reset based on users settings
date_default_timezone_set('UTC');

require_once 'autoload.php';
require 'config/bootstrap.php';

use Mautic\CoreBundle\ErrorHandler\ErrorHandler;
use Mautic\CoreBundle\Loader\EnvironmentHandler;
use Mautic\Middleware\MiddlewareBuilder;
use Symfony\Component\HttpFoundation\Request;

$config = (new EnvironmentHandler())->getEnvParameters();
ErrorHandler::register($config['ENV']);
ErrorHandler::register($_SERVER['APP_ENV']);

$kernel = (new MiddlewareBuilder(new AppKernel($config['ENV'], $config['DEBUG'])))->resolve();
$kernel = (new MiddlewareBuilder(new AppKernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG'])))->resolve();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
Expand Down

0 comments on commit b05db41

Please # to comment.