PMCORE-3845 Check and made the recommend changes in the Laravel upgrade guide
This commit is contained in:
committed by
Mauricio Veliz
parent
6d1d7d752e
commit
d0c5a23d67
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Cache\Repository as Cache;
|
||||||
use Illuminate\Queue\Console\RestartCommand as BaseRestartCommand;
|
use Illuminate\Queue\Console\RestartCommand as BaseRestartCommand;
|
||||||
|
|
||||||
class RestartCommand extends BaseRestartCommand
|
class RestartCommand extends BaseRestartCommand
|
||||||
@@ -17,4 +18,15 @@ class RestartCommand extends BaseRestartCommand
|
|||||||
* This contains the necessary code to add parameters.
|
* This contains the necessary code to add parameters.
|
||||||
*/
|
*/
|
||||||
use AddParametersTrait;
|
use AddParametersTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new queue restart command.
|
||||||
|
*
|
||||||
|
* @param Cache $cache
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(Cache $cache)
|
||||||
|
{
|
||||||
|
parent::__construct($cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,23 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use Bootstrap;
|
use Bootstrap;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
|
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
|
||||||
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||||
use Maveriks\WebApplication;
|
use Maveriks\WebApplication;
|
||||||
use ProcessMaker\Model\TaskScheduler;
|
use ProcessMaker\Model\TaskScheduler;
|
||||||
|
|
||||||
class ScheduleRunCommand extends BaseCommand
|
class ScheduleRunCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
use AddParametersTrait;
|
use AddParametersTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(\Illuminate\Console\Scheduling\Schedule $schedule)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->startedAt = Carbon::now();
|
$this->startedAt = Carbon::now();
|
||||||
$this->signature = "schedule:run";
|
$this->signature = "schedule:run";
|
||||||
@@ -27,14 +30,18 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
{--processmakerPath=./ : ProcessMaker path.}
|
{--processmakerPath=./ : ProcessMaker path.}
|
||||||
";
|
";
|
||||||
$this->description .= ' (ProcessMaker has extended this command)';
|
$this->description .= ' (ProcessMaker has extended this command)';
|
||||||
parent::__construct($schedule);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
|
* @param Schedule $schedule
|
||||||
|
* @param Dispatcher $dispatcher
|
||||||
|
* @param ExceptionHandler $handler
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(Schedule $schedule, Dispatcher $dispatcher, ExceptionHandler $handler)
|
||||||
{
|
{
|
||||||
$that = $this;
|
$that = $this;
|
||||||
$workspace = $this->option('workspace');
|
$workspace = $this->option('workspace');
|
||||||
@@ -116,6 +123,6 @@ class ScheduleRunCommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
parent::handle();
|
parent::handle($schedule, $dispatcher, $handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Cache\Repository as Cache;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\Queue\Console\WorkCommand as BaseWorkCommand;
|
use Illuminate\Queue\Console\WorkCommand as BaseWorkCommand;
|
||||||
use Illuminate\Queue\Events\JobProcessing;
|
use Illuminate\Queue\Events\JobProcessing;
|
||||||
@@ -9,7 +10,6 @@ use Illuminate\Queue\Worker;
|
|||||||
|
|
||||||
class WorkCommand extends BaseWorkCommand
|
class WorkCommand extends BaseWorkCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
use AddParametersTrait;
|
use AddParametersTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +19,7 @@ class WorkCommand extends BaseWorkCommand
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(Worker $worker)
|
public function __construct(Worker $worker, Cache $cache)
|
||||||
{
|
{
|
||||||
$this->signature .= '
|
$this->signature .= '
|
||||||
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
|
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
|
||||||
@@ -28,7 +28,7 @@ class WorkCommand extends BaseWorkCommand
|
|||||||
|
|
||||||
$this->description .= ' (ProcessMaker has extended this command)';
|
$this->description .= ' (ProcessMaker has extended this command)';
|
||||||
|
|
||||||
parent::__construct($worker);
|
parent::__construct($worker, $cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Helpers\Workspace;
|
use App\Console\Commands\WorkCommand;
|
||||||
use App\Log\LogManager;
|
use App\Log\LogManager;
|
||||||
|
use Illuminate\Queue\Worker;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
@@ -17,8 +18,11 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
App::bind('workspace', function() {
|
$this->app->bind(WorkCommand::class, function ($app) {
|
||||||
return new Workspace();
|
$isDownForMaintenance = function () {
|
||||||
|
return $this->app->isDownForMaintenance();
|
||||||
|
};
|
||||||
|
return new WorkCommand(App::make(Worker::class, ['isDownForMaintenance' => $isDownForMaintenance]), $app['cache.store']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->app->singleton('log', function ($app) {
|
$this->app->singleton('log', function ($app) {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ return [
|
|||||||
],
|
],
|
||||||
'aliases' => [
|
'aliases' => [
|
||||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||||
'ScriptVariables' => Eusebiu\JavaScript\Facades\ScriptVariables::class,
|
|
||||||
'View' => Illuminate\Support\Facades\View::class
|
'View' => Illuminate\Support\Facades\View::class
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -5616,23 +5616,28 @@ class G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pathSep = getConstant('PATH_SEP');
|
||||||
|
$pathSkinEngine = getConstant('PATH_SKIN_ENGINE');
|
||||||
|
$pathSkins = getConstant('PATH_SKINS');
|
||||||
|
$pathCustomSkins = getConstant('PATH_CUSTOM_SKINS');
|
||||||
|
|
||||||
$arrayAux = explode("?", $strAux);
|
$arrayAux = explode("?", $strAux);
|
||||||
$fileTemplate = $arrayAux[0];
|
$fileTemplate = $arrayAux[0];
|
||||||
|
|
||||||
if (file_exists(PATH_SKIN_ENGINE . "base" . PATH_SEP . $fileTemplate)) {
|
if (file_exists($pathSkinEngine . "base" . $pathSep . $fileTemplate)) {
|
||||||
$path = PATH_SKIN_ENGINE . "base" . PATH_SEP;
|
$path = $pathSkinEngine . "base" . $pathSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(PATH_SKIN_ENGINE . $skin . PATH_SEP . $fileTemplate)) {
|
if (file_exists($pathSkinEngine . $skin . $pathSep . $fileTemplate)) {
|
||||||
$path = PATH_SKIN_ENGINE . $skin . PATH_SEP;
|
$path = $pathSkinEngine . $skin . $pathSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(PATH_SKINS . $skin . PATH_SEP . $fileTemplate)) {
|
if (file_exists($pathSkins . $skin . $pathSep . $fileTemplate)) {
|
||||||
$path = PATH_SKINS . $skin . PATH_SEP;
|
$path = $pathSkins . $skin . $pathSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(PATH_CUSTOM_SKINS . $skin . PATH_SEP . $fileTemplate)) {
|
if (file_exists($pathCustomSkins . $skin . $pathSep . $fileTemplate)) {
|
||||||
$path = PATH_CUSTOM_SKINS . $skin . PATH_SEP;
|
$path = $pathCustomSkins . $skin . $pathSep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
thirdparty/pake/pakeException.class.php
vendored
28
thirdparty/pake/pakeException.class.php
vendored
@@ -29,8 +29,7 @@ class pakeException extends Exception
|
|||||||
$title = ' [' . get_class($e) . '] ';
|
$title = ' [' . get_class($e) . '] ';
|
||||||
$len = self::strlen($title);
|
$len = self::strlen($title);
|
||||||
$lines = array();
|
$lines = array();
|
||||||
foreach (explode("\n", $e->getMessage()) as $line)
|
foreach (explode("\n", $e->getMessage()) as $line) {
|
||||||
{
|
|
||||||
$lines[] = ' ' . $line . ' ';
|
$lines[] = ' ' . $line . ' ';
|
||||||
$len = max(self::strlen($line) + 4, $len);
|
$len = max(self::strlen($line) + 4, $len);
|
||||||
}
|
}
|
||||||
@@ -39,40 +38,37 @@ class pakeException extends Exception
|
|||||||
$title . str_repeat(' ', $len - self::strlen($title)),
|
$title . str_repeat(' ', $len - self::strlen($title)),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($lines as $line)
|
foreach ($lines as $line) {
|
||||||
{
|
|
||||||
$messages[] = $line . str_repeat(' ', $len - self::strlen($line));
|
$messages[] = $line . str_repeat(' ', $len - self::strlen($line));
|
||||||
}
|
}
|
||||||
|
|
||||||
$messages[] = str_repeat(' ', $len);
|
$messages[] = str_repeat(' ', $len);
|
||||||
|
|
||||||
fwrite(STDERR, "\n");
|
$stderr = getConstant('STDERR', fopen('php://stderr', 'wb'));
|
||||||
foreach ($messages as $message)
|
fwrite($stderr, "\n");
|
||||||
{
|
foreach ($messages as $message) {
|
||||||
fwrite(STDERR, pakeColor::colorize($message, 'ERROR', STDERR)."\n");
|
fwrite($stderr, pakeColor::colorize($message, 'ERROR', $stderr) . "\n");
|
||||||
}
|
}
|
||||||
fwrite(STDERR, "\n");
|
fwrite($stderr, "\n");
|
||||||
|
|
||||||
$pake = pakeApp::get_instance();
|
$pake = pakeApp::get_instance();
|
||||||
|
|
||||||
if ($pake->get_trace())
|
if ($pake->get_trace()) {
|
||||||
{
|
fwrite($stderr, "exception trace:\n");
|
||||||
fwrite(STDERR, "exception trace:\n");
|
|
||||||
|
|
||||||
$trace = $this->trace($e);
|
$trace = $this->trace($e);
|
||||||
for ($i = 0, $count = count($trace); $i < $count; $i++)
|
for ($i = 0, $count = count($trace); $i < $count; $i++) {
|
||||||
{
|
|
||||||
$class = (isset($trace[$i]['class']) ? $trace[$i]['class'] : '');
|
$class = (isset($trace[$i]['class']) ? $trace[$i]['class'] : '');
|
||||||
$type = (isset($trace[$i]['type']) ? $trace[$i]['type'] : '');
|
$type = (isset($trace[$i]['type']) ? $trace[$i]['type'] : '');
|
||||||
$function = $trace[$i]['function'];
|
$function = $trace[$i]['function'];
|
||||||
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
||||||
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
||||||
|
|
||||||
fwrite(STDERR, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO', STDERR), pakeColor::colorize($line, 'INFO', STDERR)));
|
fwrite($stderr, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO', $stderr), pakeColor::colorize($line, 'INFO', $stderr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(STDERR, "\n");
|
fwrite($stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function trace($exception)
|
function trace($exception)
|
||||||
|
|||||||
@@ -1073,6 +1073,9 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($aFields['PROCESS']['DISABLED'])) {
|
||||||
|
$aFields['PROCESS']['DISABLED'] = '';
|
||||||
|
}
|
||||||
$G_PUBLISH->AddContent('smarty', $tplFile, '', '', $aFields);
|
$G_PUBLISH->AddContent('smarty', $tplFile, '', '', $aFields);
|
||||||
break;
|
break;
|
||||||
case 'EXTERNAL':
|
case 'EXTERNAL':
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php if (function_exists("http_response_code")) {
|
<?php
|
||||||
|
|
||||||
|
if (function_exists("http_response_code")) {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +23,8 @@ if (isset($_GET["url"]) && $_GET["url"] != "") {
|
|||||||
$sysSys = $match[1];
|
$sysSys = $match[1];
|
||||||
|
|
||||||
// Check if sys path exists
|
// Check if sys path exists
|
||||||
$checkDir = PATH_DATA."sites/".$sysSys;
|
$pathData = getConstant('PATH_DATA');
|
||||||
|
$checkDir = $pathData . "sites/" . $sysSys;
|
||||||
if (!is_dir($checkDir)) {
|
if (!is_dir($checkDir)) {
|
||||||
$sysSys = '';
|
$sysSys = '';
|
||||||
}
|
}
|
||||||
@@ -36,10 +39,12 @@ if (isset($_GET["url"]) && $_GET["url"] != "") {
|
|||||||
$sysSkin = $url[3];
|
$sysSkin = $url[3];
|
||||||
|
|
||||||
// Check if sys path exists
|
// Check if sys path exists
|
||||||
$checkDir = PATH_SKIN_ENGINE.$sysSkin;
|
$pathSkinEngine = getConstant('PATH_SKIN_ENGINE');
|
||||||
|
$checkDir = $pathSkinEngine . $sysSkin;
|
||||||
if (!is_dir($checkDir)) {
|
if (!is_dir($checkDir)) {
|
||||||
// Try this again
|
// Try this again
|
||||||
$checkDir = PATH_CUSTOM_SKINS.$sysSkin;
|
$pathCustomSkins = getConstant('PATH_CUSTOM_SKINS');
|
||||||
|
$checkDir = $pathCustomSkins . $sysSkin;
|
||||||
if (!is_dir($checkDir)) {
|
if (!is_dir($checkDir)) {
|
||||||
$sysSkin = '';
|
$sysSkin = '';
|
||||||
}
|
}
|
||||||
@@ -51,7 +56,6 @@ if (isset($_GET["url"]) && $_GET["url"] != "") {
|
|||||||
$urlHome = $http . "://" . $host . "/sys" . $sysSys . "/" . $sysLang . "/" . $sysSkin . "/cases/main";
|
$urlHome = $http . "://" . $host . "/sys" . $sysSys . "/" . $sysLang . "/" . $sysSkin . "/cases/main";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@@ -727,3 +727,14 @@ function calculateDate($iniDate, $timeUnit, $time)
|
|||||||
|
|
||||||
return $datetime->format('Y-m-d H:i:s');
|
return $datetime->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the constant value.
|
||||||
|
* @param string $name
|
||||||
|
* @param mixed $default
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getConstant(string $name, $default = '')
|
||||||
|
{
|
||||||
|
return defined($name) === true ? constant($name) : $default;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user