Moved laravel boot after ProcessMaker loads its evironment constants. (PATH_DATA for shared folder)
This commit is contained in:
davidcallizaya
2017-08-07 13:02:26 -04:00
parent cd0bd1d25b
commit 21a0b9508e
13 changed files with 52 additions and 28 deletions

View File

@@ -12,12 +12,9 @@
*/ */
$app = new Illuminate\Foundation\Application( $app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../') realpath(__DIR__ . '/../')
); );
// Change storage path
$app->useStoragePath(realpath(__DIR__.'/../shared/'));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Bind Important Interfaces | Bind Important Interfaces
@@ -44,11 +41,11 @@ $app->singleton(
Illuminate\Foundation\Exceptions\Handler::class Illuminate\Foundation\Exceptions\Handler::class
); );
$app->configureMonologUsing(function($monolog) use ($app) { $app->configureMonologUsing(function ($monolog) use ($app) {
$monolog->pushHandler( $monolog->pushHandler(
(new Monolog\Handler\RotatingFileHandler( (new Monolog\Handler\RotatingFileHandler(
// Set the log path // Set the log path
$app->storagePath().'/logs/processmaker.log', $app->storagePath() . '/logs/processmaker.log',
// Set the number of daily files you want to keep // Set the number of daily files you want to keep
$app->make('config')->get('app.log_max_files', 5) $app->make('config')->get('app.log_max_files', 5)
))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true)) ))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true))
@@ -66,4 +63,4 @@ $app->configureMonologUsing(function($monolog) use ($app) {
| |
*/ */
return $app; return $app;

View File

@@ -16,4 +16,4 @@ return [
'aliases' => [ 'aliases' => [
], ],
]; ];

View File

@@ -56,8 +56,13 @@ return [
env('MEMCACHED_USERNAME'), env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'), env('MEMCACHED_PASSWORD'),
], ],
/**
* Memcached options, example:
* Memcached::OPT_CONNECT_TIMEOUT => 2000,
*
* @link http://php.net/manual/en/memcached.constants.php
*/
'options' => [ 'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
], ],
'servers' => [ 'servers' => [
[ [
@@ -88,4 +93,4 @@ return [
'prefix' => 'processmaker', 'prefix' => 'processmaker',
]; ];

View File

@@ -65,4 +65,4 @@ return [
], ],
]; ];

View File

@@ -1,4 +1,5 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -24,4 +25,4 @@ return [
| |
*/ */
'compiled' => realpath(storage_path('framework/views')), 'compiled' => realpath(storage_path('framework/views')),
]; ];

View File

@@ -5,6 +5,7 @@ use Maveriks\Util;
use ProcessMaker\Services; use ProcessMaker\Services;
use ProcessMaker\Services\Api; use ProcessMaker\Services\Api;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
use Illuminate\Foundation\Http\Kernel;
/** /**
* Web application bootstrap * Web application bootstrap
@@ -476,6 +477,10 @@ class WebApplication
define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_TEMPORAL", PATH_C . "dynEditor/");
define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); define("PATH_DB", PATH_DATA . "sites" . PATH_SEP);
// Change storage path
app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap();
\Bootstrap::setLanguage(); \Bootstrap::setLanguage();
\Bootstrap::LoadTranslationObject((defined("SYS_LANG"))? SYS_LANG : "en"); \Bootstrap::LoadTranslationObject((defined("SYS_LANG"))? SYS_LANG : "en");

View File

@@ -1,6 +1,8 @@
<?php <?php
namespace Tests; namespace tests;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication trait CreatesApplication
{ {
/** /**
@@ -10,8 +12,8 @@ trait CreatesApplication
*/ */
public function createApplication() public function createApplication()
{ {
$app = require __DIR__.'/../bootstrap/app.php'; $app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap(); $app->make(Kernel::class)->bootstrap();
return $app; return $app;
} }
} }

View File

@@ -1,8 +1,9 @@
<?php <?php
namespace Tests; namespace tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase abstract class TestCase extends BaseTestCase
{ {
use CreatesApplication; use CreatesApplication;
} }

View File

@@ -202,7 +202,7 @@ class workspaceTools
$start = microtime(true); $start = microtime(true);
CLI::logging("> Update framework paths...\n"); CLI::logging("> Update framework paths...\n");
$this->updatingFrameworkPaths($workSpace); $this->updateFrameworkPaths($workSpace);
$stop = microtime(true); $stop = microtime(true);
CLI::logging("<*> Update framework paths took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Update framework paths took " . ($stop - $start) . " seconds.\n");
} }
@@ -3909,17 +3909,17 @@ class workspaceTools
* Updating framework directory structure * Updating framework directory structure
* *
*/ */
private function updatingFrameworkPaths($workSpace = SYS_SYS) private function updateFrameworkPaths($workSpace = SYS_SYS)
{ {
$paths = [ $paths = [
PATH_DATA.'framework' => 0770, PATH_DATA.'framework' => 0770,
PATH_DATA.'framework'.DIRECTORY_SEPARATOR.'cache' => 0770, PATH_DATA.'framework' . DIRECTORY_SEPARATOR.'cache' => 0770,
]; ];
foreach ($paths as $path => $permission) { foreach ($paths as $path => $permission) {
if (!file_exists($path)) { if (!file_exists($path)) {
G::mk_dir($path, $permission); G::mk_dir($path, $permission);
} }
CLI::logging(" $path [".(file_exists($path) ? 'OK' : 'MISSING')."]\n"); CLI::logging(" $path [" . (file_exists($path) ? 'OK' : 'MISSING') . "]\n");
} }
} }
} }

View File

@@ -285,7 +285,7 @@ class Translation extends BaseTranslation
/* Load strings from plugin translation.php. /* Load strings from plugin translation.php.
* @parameter $languageId (es|en|...). * @parameter $languageId (es|en|...).
*/ */
public function generateFileTranslationPlugin ($plugin, $languageId = '') public static function generateFileTranslationPlugin ($plugin, $languageId = '')
{ {
if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) { if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) {
return; return;

View File

@@ -1749,8 +1749,8 @@ class Installer extends Controller
private function verifySharedFrameworkPaths($sharedPath) private function verifySharedFrameworkPaths($sharedPath)
{ {
$paths = [ $paths = [
$sharedPath.'framework' => 0770, $sharedPath . 'framework' => 0770,
$sharedPath.'framework'.DIRECTORY_SEPARATOR.'cache' => 0770, $sharedPath . 'framework' . DIRECTORY_SEPARATOR . 'cache' => 0770,
]; ];
foreach ($paths as $path => $permission) { foreach ($paths as $path => $permission) {
if (!file_exists($path)) { if (!file_exists($path)) {

View File

@@ -2,10 +2,9 @@
use Illuminate\Foundation\Http\Kernel; use Illuminate\Foundation\Http\Kernel;
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used. // Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
require_once __DIR__.'/../../gulliver/system/class.g.php'; require_once __DIR__ . '/../../gulliver/system/class.g.php';
require_once __DIR__.'/../../bootstrap/autoload.php'; require_once __DIR__ . '/../../bootstrap/autoload.php';
require_once __DIR__.'/../../bootstrap/app.php'; require_once __DIR__ . '/../../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
register_shutdown_function( register_shutdown_function(

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
use Illuminate\Foundation\Http\Kernel;
/** /**
* bootstrap - ProcessMaker Bootstrap * bootstrap - ProcessMaker Bootstrap
* this file is used initialize main variables, redirect and dispatch all requests * this file is used initialize main variables, redirect and dispatch all requests
@@ -546,6 +548,18 @@ if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
die(); die();
} }
app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap();
//Overwrite with the Processmaker env.ini configuration used in production environments
//@todo: move env.ini configuration to .env
ini_set( 'display_errors', $config['display_errors']);
ini_set( 'error_reporting', $config['error_reporting']);
ini_set( 'short_open_tag', 'On' );
ini_set( 'default_charset', "UTF-8" );
ini_set( 'memory_limit', $config['memory_limit'] );
ini_set( 'soap.wsdl_cache_enabled', $config['wsdl_cache'] );
ini_set('date.timezone', $config['time_zone']); //Set Time Zone
// Load Language Translation // Load Language Translation
Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" ); Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );