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

View File

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

View File

@@ -1,4 +1,5 @@
<?php
return [
/*
|--------------------------------------------------------------------------

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
<?php
namespace Tests;
namespace tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase

View File

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

View File

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

View File

@@ -2,10 +2,9 @@
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.
require_once __DIR__.'/../../gulliver/system/class.g.php';
require_once __DIR__.'/../../bootstrap/autoload.php';
require_once __DIR__.'/../../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
require_once __DIR__ . '/../../gulliver/system/class.g.php';
require_once __DIR__ . '/../../bootstrap/autoload.php';
require_once __DIR__ . '/../../bootstrap/app.php';
register_shutdown_function(

View File

@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use Illuminate\Foundation\Http\Kernel;
/**
* bootstrap - ProcessMaker Bootstrap
* 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();
}
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
Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );