Skip to content

Commit

Permalink
3.5.7-community
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolimo committed Feb 6, 2024
1 parent af77d68 commit a1ce59a
Show file tree
Hide file tree
Showing 2,307 changed files with 98,479 additions and 6,730 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Run Test Units
command: |
mkdir coverage
vendor/phpunit/phpunit/phpunit --stop-on-failure --testdox-html coverage/result.html --coverage-html coverage --verbose tests/unit/
vendor/phpunit/phpunit/phpunit --testdox-html coverage/result.html --coverage-html coverage --verbose tests/unit/
- store_artifacts:
path: coverage
destination: coverage
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ScheduleRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function handle()
return $result;
}
return true;
});
})->onOneServer();
}
});
parent::handle();
Expand Down
14 changes: 14 additions & 0 deletions app/Foundation/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Foundation;

use Illuminate\Foundation\Application as BaseApplication;

class Application extends BaseApplication
{

protected function registerBaseServiceProviders(): void
{
parent::registerBaseServiceProviders();
}
}
68 changes: 68 additions & 0 deletions app/Log/LogManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

namespace App\Log;

use Illuminate\Log\LogManager as BaseLogManager;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use ProcessMaker\Core\System;

class LogManager extends BaseLogManager
{

/**
* Get the log connection configuration.
*
* @param string $name
* @return array
*/
protected function configurationFor($name)
{
//default
if (!Str::contains($name, ':')) {
return parent::configurationFor($name);
}

//extend channel
$parse = explode(':', $name, 2);
if (empty($parse[0])) {
$parse[0] = config('logging.default');
}
$config = parent::configurationFor($parse[0]);
if (!empty($parse[1])) {
$config['name'] = $parse[1];
}

//extends
if (!defined('PATH_DATA') || !defined('PATH_SEP')) {
return $config;
}
$sys = System::getSystemConfiguration();

//level
if (!empty($sys['logging_level'])) {
$levels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'];
$level = strtolower($sys['logging_level']);
if (in_array($level, $levels)) {
$config['level'] = $level;
}
}

//path
$basePath = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
$config['path'] = $basePath . File::basename($config['path']);
if (!empty($sys['logs_location'])) {
$config['path'] = $sys['logs_location'];
}

//days
if (!empty($sys['logs_max_files'])) {
$value = intval($sys['logs_max_files']);
if ($value >= 0) {
$config['days'] = $value;
}
}

return $config;
}
}
6 changes: 4 additions & 2 deletions app/Logging/CustomizeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@

class CustomizeFormatter
{
private $format = "<%level%> %datetime% %channel% %level_name%: %message% %context%\n";
private $dateFormat = "M d H:i:s";

/**
* Customize the given logger instance.
*
* @param \Illuminate\Log\Logger $logger
* @param \Illuminate\Log\Logger $logger
* @return void
*/
public function __invoke($logger)
{
foreach ($logger->getHandlers() as $handler) {
$handler->setFormatter(new LineFormatter(null, null, true, true));
$handler->setFormatter(new LineFormatter($this->format, $this->dateFormat, true, true));
}
}
}
12 changes: 11 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@

namespace App\Providers;

use App\Helpers\Workspace;
use App\Log\LogManager;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
App::bind('workspace', function() {
return new Workspace();
});

$this->app->singleton('log', function ($app) {
return new LogManager($app);
});
}

/**
Expand Down
24 changes: 7 additions & 17 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<?php

use Illuminate\Contracts\Console\Kernel as Kernel2;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Contracts\Http\Kernel as Kernel4;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Exceptions\Handler;
use Illuminate\Foundation\Http\Kernel as Kernel3;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use ProcessMaker\Core\System;

/*
|--------------------------------------------------------------------------
| Create The Application
Expand All @@ -21,7 +11,7 @@
|
*/

$app = new Application(
$app = new App\Foundation\Application(
realpath(__DIR__ . '/../')
);

Expand All @@ -37,21 +27,21 @@
*/

$app->singleton(
Kernel4::class,
Kernel3::class
Illuminate\Contracts\Http\Kernel::class,
Illuminate\Foundation\Http\Kernel::class
);

$app->singleton(
Kernel2::class,
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);

$app->singleton(
ExceptionHandler::class,
Handler::class
Illuminate\Contracts\Debug\ExceptionHandler::class,
Illuminate\Foundation\Exceptions\Handler::class
);

$app->useStoragePath(System::getPathsInstalled()->pathData);
$app->useStoragePath(ProcessMaker\Core\System::getPathsInstalled()->pathData);

/*
|--------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"require": {
"php": ">=7.1",
"laravel/framework": "5.7.*",
"luracast/restler": "^3.0",
"luracast/restler": "3.0",
"bshaffer/oauth2-server-php": "v1.0",
"colosa/pmui": "release/3.5.0-dev",
"colosa/michelangelofe": "release/3.5.0-dev",
Expand Down Expand Up @@ -61,7 +61,8 @@
"tecnickcom/tcpdf": "6.3.*",
"fzaninotto/faker": "^1.7",
"predis/predis": "1.1.1",
"phpmyadmin/sql-parser": "^5.3"
"phpmyadmin/sql-parser": "^5.3",
"aws/aws-sdk-php": "~3.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^6.3",
Expand Down
Loading

0 comments on commit a1ce59a

Please sign in to comment.