Skip to content

Commit

Permalink
removes obsolete parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Jul 26, 2024
1 parent 6fa5c8b commit b3359d6
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 215 deletions.
23 changes: 2 additions & 21 deletions config/parameters.yml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Template for the 'parameters.yml' config file (same directory).
# Currently only the db parameters are required.
# Currently only the db parameters and locale are required.

parameters:

# database
secret: change_me

database_version: 8.0
database_driver: pdo_mysql
Expand All @@ -19,21 +18,3 @@ parameters:
test_database_name: '%database_name%_test'
test_database_user: '%database_user%'
test_database_password: '%database_password%'

# mail

mailer_transport: smtp
mailer_encryption: ~
mailer_auth_mode: ~
mailer_host: ~
mailer_port: ~
mailer_user: ~
mailer_password: ~

# others

locale: fr
secret: change_me

# logs
non_repeatable_log_time_in_seconds: 600
4 changes: 2 additions & 2 deletions src/main/app/API/Finder/AbstractFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function configureQueryBuilder(QueryBuilder $qb, array $searches = [], ar
return $qb;
}

public function find(?array $filters = [], array $sortBy = null, ?int $page = 0, ?int $limit = -1, ?bool $count = false)
public function find(?array $filters = [], array $sortBy = null, ?int $page = 0, ?int $limit = -1, ?bool $count = false): int|array
{
// sorting is not required when we count stuff
$sortBy = $count ? null : $sortBy;
Expand Down Expand Up @@ -125,7 +125,7 @@ protected function addSort(string $handlerClass, QueryBuilder $qb, string $alias
return $qb;
}

protected function setDefaults(QueryBuilder $qb, string $filterName, $filterValue): void
protected function setDefaults(QueryBuilder $qb, string $filterName, mixed $filterValue): void
{
$property = $filterName;
if (array_key_exists($filterName, $this->getExtraFieldMapping())) {
Expand Down
10 changes: 2 additions & 8 deletions src/main/app/API/FinderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function searchEntities(string $class, array $finderParams = []): array
/**
* Builds and fires the query for a given class. There will be no serialization here.
*/
public function fetch(string $class, ?array $filters = [], array $sortBy = null, ?int $page = 0, ?int $limit = -1, ?bool $count = false)
public function fetch(string $class, ?array $filters = [], array $sortBy = null, ?int $page = 0, ?int $limit = -1, ?bool $count = false): int|array
{
try {
return $this->get($class)->find($filters, $sortBy, $page, $limit, $count);
Expand Down Expand Up @@ -150,7 +150,7 @@ public static function parseQueryParams(array $finderParams = []): array
];
}

private static function formatPaginatedData($data, $total, $page, $limit, $filters, $sortBy): array
private static function formatPaginatedData(array $data, int $total, int $page, int $limit, ?array $filters = [], ?array $sortBy = []): array
{
return [
'data' => $data,
Expand All @@ -162,9 +162,6 @@ private static function formatPaginatedData($data, $total, $page, $limit, $filte
];
}

/**
* @todo : we should make UI and API formats uniform to avoid such transformations
*/
private static function parseSortBy(?string $sortBy): array
{
// default values
Expand Down Expand Up @@ -221,9 +218,6 @@ private static function parseFilters(array $filters): array
return $parsed;
}

/**
* @todo : we should make UI and API formats uniform to avoid such transformations
*/
private static function decodeFilters(array $filters): array
{
$decodedFilters = [];
Expand Down
22 changes: 7 additions & 15 deletions src/main/app/API/Utils/ArrayUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ class ArrayUtils
{
/**
* This is more or less the equivalent of lodash set for array.
*
* @param string $keys - the property path
* @param $value
*
* @throws \Exception
*/
public static function set(array &$object, string $keys, $value)
public static function set(array &$object, string $keys, mixed $value): void
{
$keys = explode('.', $keys);
$depth = count($keys);
Expand All @@ -31,7 +26,7 @@ public static function set(array &$object, string $keys, $value)
}
}

public static function remove(array &$object, string $keys)
public static function remove(array &$object, string $keys): void
{
// because sometimes there are keys with dot in it (eg. Scorm props cmi.*)
// we check the whole key exist before starting the recursive search
Expand All @@ -55,13 +50,10 @@ public static function remove(array &$object, string $keys)
/**
* This is more or less the equivalent of lodash get for array.
*
* @param array $object - the array
* @param string $keys - the property path
* @param mixed $default
*
* @return mixed
* @param array $object - the array
* @param string $keys - the property path
*/
public static function get(array $object, string $keys, $default = null)
public static function get(array $object, string $keys, mixed $default = null): mixed
{
// because sometimes there are keys with dot in it (eg. Scorm props cmi.*)
// we check the whole key exist before starting the recursive search
Expand Down Expand Up @@ -113,7 +105,7 @@ public static function has(array $object, string $keys): bool
return false;
}

public static function getPropertiesName(array $object, $titles = [], $currentPos = null)
public static function getPropertiesName(array $object, $titles = [], $currentPos = null): array
{
$keys = array_keys($object);

Expand All @@ -132,7 +124,7 @@ public static function getPropertiesName(array $object, $titles = [], $currentPo
return $titles;
}

public static function isAssociative(array $array)
public static function isAssociative(array $array): bool
{
return count(array_filter(array_keys($array), 'is_string')) > 0;
}
Expand Down
8 changes: 0 additions & 8 deletions src/main/app/ClarolineAppBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Claroline\AppBundle;

use Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle;
use Claroline\AppBundle\DependencyInjection\Compiler\RouterPass;
use Claroline\KernelBundle\Bundle\AutoConfigurableInterface;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use FOS\JsRoutingBundle\FOSJsRoutingBundle;
Expand All @@ -29,13 +28,6 @@

class ClarolineAppBundle extends Bundle implements AutoConfigurableInterface
{
public function build(ContainerBuilder $container)
{
parent::build($container);

$container->addCompilerPass(new RouterPass());
}

public function supports(string $environment): bool
{
return true;
Expand Down
15 changes: 0 additions & 15 deletions src/main/app/DependencyInjection/Compiler/RouterPass.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/app/Manager/PlatformManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getUrl(): ?string
$request = $this->requestStack->getCurrentRequest();

// add protocol
$url = ($request && $request->isSecure()) || $this->config->getParameter('ssl.enabled') ? 'https://' : 'http://';
$url = $request && $request->isSecure() ? 'https://' : 'http://';

// add host
if ($this->config->getParameter('internet.domain_name')) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/app/Resources/config/services/routing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
services:
Claroline\AppBundle\Routing\Router:
parent: router.default

Claroline\AppBundle\Routing\Finder:
arguments:
- '@router'
Expand Down
4 changes: 1 addition & 3 deletions src/main/app/Resources/config/suggested/framework_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ framework:
form: false
validation:
enable_annotations: true
translator:
fallback: en
default_locale: "%locale%"
default_locale: en
session:
name: claroline
handler_id: "claroline.session_handler.file" # Overridden by SessionConfigPass
Expand Down
59 changes: 0 additions & 59 deletions src/main/app/Routing/Router.php

This file was deleted.

3 changes: 0 additions & 3 deletions src/main/core/ClarolineCoreBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Claroline\CoreBundle\DependencyInjection\Compiler\MailingConfigPass;
use Claroline\CoreBundle\DependencyInjection\Compiler\MessengerConfigPass;
use Claroline\CoreBundle\DependencyInjection\Compiler\PlatformConfigPass;
use Claroline\CoreBundle\DependencyInjection\Compiler\RegisterResourceSubscriberPass;
use Claroline\CoreBundle\DependencyInjection\Compiler\SessionConfigPass;
use Claroline\KernelBundle\Bundle\DistributionPluginBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -33,7 +32,5 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new SessionConfigPass());
$container->addCompilerPass(new MessengerConfigPass());
$container->addCompilerPass(new GeoipPass());

//$container->addCompilerPass(new RegisterResourceSubscriberPass());
}
}
18 changes: 0 additions & 18 deletions src/main/core/Configuration/LegacyParametersMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,17 @@ public function getMapping(): array
'support_email' => 'help.support_email',
'footer' => 'footer.content',
'logo' => 'display.logo',
'allow_self_registration' => 'registration.self',
'locale_language' => 'locales.default',
'theme' => 'display.theme',
'default_role' => 'registration.default_role',
'mailer_transport' => 'mailer.transport',
'mailer_host' => 'mailer.host',
'mailer_port' => 'mailer.port',
'mailer_encryption' => 'mailer.encryption',
'mailer_username' => 'mailer.username',
'mailer_password' => 'mailer.password',
'mailer_auth_mode' => 'mailer.auth_mode',
'mailer_api_key' => 'mailer.api_key',
'mailer_tag' => 'mailer.tag',
'terms_of_service' => 'privacy.tos.enabled',
'account_duration' => 'security.account_duration',
'username_regex' => 'registration.username_regex',
'header_locale' => 'footer.show_locale',
'token' => 'statistics.token',
'country' => 'country',
'registration_mail_validation' => 'registration.validation',
'show_help_button' => 'help.show',
'show_about_button' => 'show_about_button',
'help_url' => 'help.url',
'locales' => 'locale.available',
'domain_name' => 'internet.domain_name',
'platform_url' => 'internet.platform_url',
'mailer_from' => 'mailer.from',
'ssl_enabled' => 'ssl.enabled',
'ssl_version_value' => 'ssl.version',
'resource_icon_set' => 'display.resource_icon_set',
'auto_validate_email' => 'database_restoration.auto_validate_email',
'auto_enable_email_redirect' => 'database_restoration.auto_enable_email_redirect',
Expand Down
5 changes: 0 additions & 5 deletions src/main/core/Configuration/PlatformDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ public function getDefaultParameters(): array
'tag' => null,
'from' => '[email protected]',
],
'ssl' => [ // to remove
'enabled' => false,
'version' => 3,
],
'locales' => [ // to move in `intl` block
'default' => 'fr',
'available' => ['fr', 'en'],
Expand All @@ -124,7 +120,6 @@ public function getDefaultParameters(): array
'show_progression' => false,
'menu' => null,
],
'show_about_button' => true,
'javascripts' => [],
'restrictions' => [
'users' => null,
Expand Down
Loading

0 comments on commit b3359d6

Please sign in to comment.