mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 20:27:07 +09:00
Apply PHP Code Styling & Quality Changes (#1672)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
This commit is contained in:
1 parent
730333f448
commit
d3f8cb3301
3 files changed
+13
-14
No files matched your search
@@ -180,14 +180,10 @@ class i18n
|
||||
{
|
||||
if ($disabled) {
|
||||
// Only get a list of the disabled locales
|
||||
$locales = array_filter(glob(PATH_LANGS . DIRECTORY_SEPARATOR . '*'), function ($dir) {
|
||||
return is_dir($dir) && file_exists($dir . DIRECTORY_SEPARATOR . '.disabled');
|
||||
});
|
||||
$locales = array_filter(glob(PATH_LANGS . DIRECTORY_SEPARATOR . '*'), fn($dir) => is_dir($dir) && file_exists($dir . DIRECTORY_SEPARATOR . '.disabled'));
|
||||
} else {
|
||||
// Only get a list of the enabled locales
|
||||
$locales = array_filter(glob(PATH_LANGS . DIRECTORY_SEPARATOR . '*'), function ($dir) {
|
||||
return is_dir($dir) && !file_exists($dir . DIRECTORY_SEPARATOR . '.disabled');
|
||||
});
|
||||
$locales = array_filter(glob(PATH_LANGS . DIRECTORY_SEPARATOR . '*'), fn($dir) => is_dir($dir) && !file_exists($dir . DIRECTORY_SEPARATOR . '.disabled'));
|
||||
}
|
||||
|
||||
$locales = array_map('basename', $locales); // get only the directory name
|
||||
|
||||
@@ -71,15 +71,16 @@ class Admin extends \Api_Abstract
|
||||
public function languages(array $data): array
|
||||
{
|
||||
$data['disabled'] ??= false;
|
||||
|
||||
return \FOSSBilling\i18n::getLocales(true, $data['disabled']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles a given locale to either enable or disable it depending on it's current status.
|
||||
*
|
||||
*
|
||||
* @param array $data The post data sent to the API. Should contain a key named `locale_id` which is set to the locale ID to change. (`en_US` for example)
|
||||
*
|
||||
* @throws \Box_Exception
|
||||
*
|
||||
* @throws \Box_Exception
|
||||
*/
|
||||
public function toggle_language(array $data): bool
|
||||
{
|
||||
@@ -88,11 +89,13 @@ class Admin extends \Api_Abstract
|
||||
];
|
||||
|
||||
$this->di['validator']->checkRequiredParamsForArray($required, $data);
|
||||
|
||||
return \FOSSBilling\i18n::toggleLocale($data['locale_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how complete a given locale is.
|
||||
*
|
||||
* @param array $data $data The post data sent to the API. Should contain a key named `locale_id` which is set to the locale ID to get the completion percentage for. (`en_US` for example)
|
||||
*/
|
||||
public function locale_completion(array $data): int
|
||||
@@ -102,6 +105,7 @@ class Admin extends \Api_Abstract
|
||||
];
|
||||
|
||||
$this->di['validator']->checkRequiredParamsForArray($required, $data);
|
||||
|
||||
return \FOSSBilling\i18n::getLocaleCompletionPercent($data['locale_id']);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
namespace Box\Mod\System;
|
||||
|
||||
use FOSSBilling\Environment;
|
||||
use Pimple\Container;
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
use FOSSBilling\Environment;
|
||||
|
||||
class Service
|
||||
{
|
||||
@@ -221,7 +221,7 @@ class Service
|
||||
{
|
||||
$msgs = [];
|
||||
|
||||
// Check if there's an update available
|
||||
// Check if there's an update available
|
||||
try {
|
||||
$updater = $this->di['updater'];
|
||||
if ($updater->isUpdateAvailable()) {
|
||||
@@ -236,16 +236,15 @@ class Service
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
$last_exec = $this->getParamValue('last_cron_exec');
|
||||
$disableAutoCron = $this->di['config']['disable_auto_cron'] ?? false;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Here we check if cron has been run at all or within a recent timeframe.
|
||||
* No matter what, a message will be displayed within the dashboard and by default cron will also be performed to ensure functionality, however this can be disabled.
|
||||
* Results are cached so even if `getMessages` is called multiple times it will still display correctly & so it won't go away before it's noticed.
|
||||
*/
|
||||
if ((Environment::isProduction())) {
|
||||
if (Environment::isProduction()) {
|
||||
$cronService = $this->di['mod_service']('cron');
|
||||
|
||||
$result = $this->di['cache']->get('cron_issue', function (ItemInterface $item) use ($cronService, $last_exec, $disableAutoCron) {
|
||||
|
||||
Reference in new issue
Block a user