Skip to content

Commit

Permalink
Bugfix/performance issue (#90)
Browse files Browse the repository at this point in the history
* Fix performance issue and remove use statements from localconf
  • Loading branch information
digedag authored Jan 6, 2024
1 parent ddbb1bb commit a7abd6d
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 144 deletions.
49 changes: 10 additions & 39 deletions .github/workflows/php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,57 +74,28 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
php-qs:
name: "PHP QS"

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

needs: php-lint

strategy:
matrix:
command:
- "test:phpcs"
# - "test:phpmd"
# - "test:phpstan"
php-version:
- "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
-
name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""
-
name: "Cache dependencies installed with composer"
uses: "actions/[email protected]"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"
-
name: "Install composer dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
-
name: "Run command"
run: "composer ${{ matrix.command }}"

# - run: composer require friendsofphp/php-cs-fixer
# - run: .Build/bin/php-cs-fixer fix --diff --dry-run
php-version: 8.1
- run: "composer install --no-interaction --no-progress --no-suggest"
# - run: composer require friendsofphp/php-cs-fixer:3.35.1
- run: .Build/bin/php-cs-fixer fix --diff --dry-run

php-unit:
name: "PHP Unit"

runs-on: "ubuntu-latest"

needs: ["php-lint", "php-qs"]
needs: ["php-lint", "php-cs-fixer"]

strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

$config = new PhpCsFixer\Config();
return $config->setFinder($finder)
->setCacheFile('.Build/.php_cs.cache')
->setRules([
'@Symfony' => true,
'phpdoc_align' => false,
Expand Down
2 changes: 1 addition & 1 deletion Classes/Statistics/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static function createStatistics(&$matches, $scopeArr, &$services, &$conf
*/
public static function lookupStatistics($config)
{
$provider = \System25\T3sports\Statistics\Service\StatsServiceProvider::getInstance();
$provider = Service\StatsServiceProvider::getInstance();
$types = $provider->getStatsTypes();
// FIXME: das sollte besser gehen...
$labelPrefix = 'LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.statistics.type.%s';
Expand Down
4 changes: 2 additions & 2 deletions Classes/Table/DefaultMatchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2008-2022 Rene Nitzsche ([email protected])
* (c) 2008-2024 Rene Nitzsche ([email protected])
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
Expand Down Expand Up @@ -422,7 +422,7 @@ public function setCurrentRound($round)
*/
public function getClubIdsOfRunningMatches()
{
if (!$this->clubIdsOfRunningMatches) {
if (null === $this->clubIdsOfRunningMatches) {
$values = [];

foreach ($this->getRounds() as $round) {
Expand Down
8 changes: 6 additions & 2 deletions Classes/Table/Volleyball/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
/***************************************************************
* Copyright notice
*
<<<<<<< HEAD
* (c) 2011-2024 Rene Nitzsche ([email protected])
=======
* (c) 2011-2023 Rene Nitzsche ([email protected])
>>>>>>> master
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
Expand Down Expand Up @@ -45,10 +49,10 @@ public function setTeamData(array &$teamdata)
public function compare($t1, $t2)
{
// Zwangsabstieg prüfen
if ($t1['static_position'] ?? false) {
if (-1 == ($t1['static_position'] ?? 0)) {
return 1;
}
if ($t2['static_position'] ?? false) {
if (-1 == ($t2['static_position'] ?? 0)) {
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Table/Volleyball/Comparator3Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public function setTeamData(array &$teamdata)
public function compare($t1, $t2)
{
// Zwangsabstieg prüfen
if ($t1['static_position']) {
if (-1 == ($t2['static_position'] ?? 0)) {
return 1;
}
if ($t2['static_position']) {
if (-1 == ($t2['static_position'] ?? 0)) {
return -1;
}

Expand Down
8 changes: 4 additions & 4 deletions Classes/Twig/Data/MatchReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected function getLineup($players, $system)
/**
* @param Profile $player
*
* @return \System25\T3sports\Twig\Data\Player
* @return Player
*/
protected function substPlayer(Profile $player)
{
Expand Down Expand Up @@ -259,7 +259,7 @@ protected function initMatchTicker()
$player = Profile::getProfileInstance($playerUid);
$player = $this->buildPlayer($player);
}
$matchNote = new \System25\T3sports\Twig\Data\MatchNote($note, $player);
$matchNote = new MatchNote($note, $player);
if ($player) {
$player->addMatchNote($matchNote);
}
Expand Down Expand Up @@ -295,15 +295,15 @@ protected function uniquePlayerNames()
/**
* @param Profile $player
*
* @return \System25\T3sports\Twig\Data\Player
* @return Player
*/
protected function buildPlayer($player)
{
if (is_object($player)) {
if (isset($this->players[$player->getUid()])) {
$player = $this->players[$player->getUid()];
} else {
$player = new \System25\T3sports\Twig\Data\Player($player);
$player = new Player($player);
// Keep a reference to each player
$this->players[$player->getUid()] = $player;

Expand Down
6 changes: 3 additions & 3 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$extKey = 'cfc_league_fe';

// list static templates in templates selection
\Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/', 'T3sports');
\Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/cal/', 'T3sports cal-events');
\Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/volleyball/', 'T3sports for Volleyball');
Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/', 'T3sports');
Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/cal/', 'T3sports cal-events');
Sys25\RnBase\Utility\Extensions::addStaticFile($extKey, 'static/volleyball/', 'T3sports for Volleyball');
});
8 changes: 4 additions & 4 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
// Das tt_content-Feld pi_flexform einblenden
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['tx_cfcleaguefe_competition'] = 'pi_flexform';

\Sys25\RnBase\Utility\Extensions::addPiFlexFormValue(
Sys25\RnBase\Utility\Extensions::addPiFlexFormValue(
'tx_cfcleaguefe_competition',
'FILE:EXT:cfc_league_fe/Configuration/Flexform/plugin_competition.xml'
);

\Sys25\RnBase\Utility\Extensions::addPlugin(
Sys25\RnBase\Utility\Extensions::addPlugin(
[
'LLL:EXT:'.$extKey.'/Resources/Private/Language/locallang_db.xlf:plugin.competition.label',
'tx_cfcleaguefe_competition',
Expand All @@ -41,7 +41,7 @@
// Das tt_content-Feld pi_flexform einblenden
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['tx_cfcleaguefe_report'] = 'pi_flexform';

\Sys25\RnBase\Utility\Extensions::addPiFlexFormValue(
Sys25\RnBase\Utility\Extensions::addPiFlexFormValue(
'tx_cfcleaguefe_report',
'FILE:EXT:cfc_league_fe/Configuration/Flexform/plugin_report.xml'
);
Expand All @@ -62,7 +62,7 @@
* @param string $extensionKey The extension key
* @throws \RuntimeException
*/
\Sys25\RnBase\Utility\Extensions::addPlugin(
Sys25\RnBase\Utility\Extensions::addPlugin(
[
'LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.report.label',
'tx_cfcleaguefe_report',
Expand Down
120 changes: 60 additions & 60 deletions Migrations/Code/ClassAliasMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@
declare(strict_types=1);

return [
'tx_cfcleaguefe_actions_ClubList' => \System25\T3sports\Frontend\Action\ClubList::class,
'tx_cfcleaguefe_actions_ClubView' => \System25\T3sports\Frontend\Action\ClubDetails::class,
'tx_cfcleaguefe_actions_LeagueTable' => \System25\T3sports\Frontend\Action\LeagueTable::class,
'tx_cfcleaguefe_actions_LeagueTableShow' => \System25\T3sports\Frontend\Action\LeagueTable::class,
'tx_cfcleaguefe_actions_LeagueTableAllTime' => \System25\T3sports\Frontend\Action\LeagueTableAllTime::class,
'tx_cfcleaguefe_actions_LiveTickerList' => \System25\T3sports\Frontend\Action\LiveTickerList::class,
'tx_cfcleaguefe_actions_MatchCrossTable' => \System25\T3sports\Frontend\Action\MatchCrossTable::class,
'tx_cfcleaguefe_actions_MatchReport' => \System25\T3sports\Frontend\Action\MatchReport::class,
'tx_cfcleaguefe_actions_MatchTable' => \System25\T3sports\Frontend\Action\MatchTable::class,
'tx_cfcleaguefe_actions_ProfileList' => \System25\T3sports\Frontend\Action\ProfileList::class,
'tx_cfcleaguefe_actions_StadiumView' => \System25\T3sports\Frontend\Action\StadiumDetails::class,
'tx_cfcleaguefe_actions_StadiumList' => \System25\T3sports\Frontend\Action\StadiumList::class,
'tx_cfcleaguefe_actions_ProfileView' => \System25\T3sports\Frontend\Action\ProfileDetails::class,
'tx_cfcleaguefe_actions_TableChart' => \System25\T3sports\Frontend\Action\TableChart::class,
'tx_cfcleaguefe_actions_TeamList' => \System25\T3sports\Frontend\Action\TeamList::class,
'tx_cfcleaguefe_actions_TeamView' => \System25\T3sports\Frontend\Action\TeamDetails::class,
'tx_cfcleaguefe_actions_Statistics' => \System25\T3sports\Frontend\Action\Statistics::class,
'tx_cfcleaguefe_actions_CompetitionSelection' => \System25\T3sports\Frontend\Action\ScopeSelection::class,
'tx_cfcleaguefe_actions_ClubList' => System25\T3sports\Frontend\Action\ClubList::class,
'tx_cfcleaguefe_actions_ClubView' => System25\T3sports\Frontend\Action\ClubDetails::class,
'tx_cfcleaguefe_actions_LeagueTable' => System25\T3sports\Frontend\Action\LeagueTable::class,
'tx_cfcleaguefe_actions_LeagueTableShow' => System25\T3sports\Frontend\Action\LeagueTable::class,
'tx_cfcleaguefe_actions_LeagueTableAllTime' => System25\T3sports\Frontend\Action\LeagueTableAllTime::class,
'tx_cfcleaguefe_actions_LiveTickerList' => System25\T3sports\Frontend\Action\LiveTickerList::class,
'tx_cfcleaguefe_actions_MatchCrossTable' => System25\T3sports\Frontend\Action\MatchCrossTable::class,
'tx_cfcleaguefe_actions_MatchReport' => System25\T3sports\Frontend\Action\MatchReport::class,
'tx_cfcleaguefe_actions_MatchTable' => System25\T3sports\Frontend\Action\MatchTable::class,
'tx_cfcleaguefe_actions_ProfileList' => System25\T3sports\Frontend\Action\ProfileList::class,
'tx_cfcleaguefe_actions_StadiumView' => System25\T3sports\Frontend\Action\StadiumDetails::class,
'tx_cfcleaguefe_actions_StadiumList' => System25\T3sports\Frontend\Action\StadiumList::class,
'tx_cfcleaguefe_actions_ProfileView' => System25\T3sports\Frontend\Action\ProfileDetails::class,
'tx_cfcleaguefe_actions_TableChart' => System25\T3sports\Frontend\Action\TableChart::class,
'tx_cfcleaguefe_actions_TeamList' => System25\T3sports\Frontend\Action\TeamList::class,
'tx_cfcleaguefe_actions_TeamView' => System25\T3sports\Frontend\Action\TeamDetails::class,
'tx_cfcleaguefe_actions_Statistics' => System25\T3sports\Frontend\Action\Statistics::class,
'tx_cfcleaguefe_actions_CompetitionSelection' => System25\T3sports\Frontend\Action\ScopeSelection::class,

'tx_cfcleaguefe_filter_Match' => \System25\T3sports\Filter\MatchFilter::class,
'tx_cfcleaguefe_filter_MatchNote' => \System25\T3sports\Filter\MatchNoteFilter::class,
'tx_cfcleaguefe_filter_Stadium' => \System25\T3sports\Filter\StadiumFilter::class,
'tx_cfcleaguefe_filter_Team' => \System25\T3sports\Filter\TeamFilter::class,
'tx_cfcleaguefe_filter_Match' => System25\T3sports\Filter\MatchFilter::class,
'tx_cfcleaguefe_filter_MatchNote' => System25\T3sports\Filter\MatchNoteFilter::class,
'tx_cfcleaguefe_filter_Stadium' => System25\T3sports\Filter\StadiumFilter::class,
'tx_cfcleaguefe_filter_Team' => System25\T3sports\Filter\TeamFilter::class,

'tx_cfcleaguefe_search_Builder' => \System25\T3sports\Search\SearchBuilder::class,
'tx_cfcleaguefe_search_Competition' => \System25\T3sports\Search\CompetitionSearch::class,
'tx_cfcleaguefe_search_Profile' => \System25\T3sports\Search\ProfileSearch::class,
'tx_cfcleaguefe_search_Team' => \System25\T3sports\Search\TeamSearch::class,
'tx_cfcleaguefe_search_Builder' => System25\T3sports\Search\SearchBuilder::class,
'tx_cfcleaguefe_search_Competition' => System25\T3sports\Search\CompetitionSearch::class,
'tx_cfcleaguefe_search_Profile' => System25\T3sports\Search\ProfileSearch::class,
'tx_cfcleaguefe_search_Team' => System25\T3sports\Search\TeamSearch::class,

'tx_cfcleaguefe_sv1_Competitions' => \System25\T3sports\Service\CompetitionService::class,
'tx_cfcleaguefe_sv1_Teams' => \System25\T3sports\Service\TeamService::class,
'tx_cfcleaguefe_sv1_Profiles' => \System25\T3sports\Service\ProfileService::class,
'tx_cfcleaguefe_sv1_Matches' => \System25\T3sports\Service\MatchService::class,
'tx_cfcleaguefe_sv1_Competitions' => System25\T3sports\Service\CompetitionService::class,
'tx_cfcleaguefe_sv1_Teams' => System25\T3sports\Service\TeamService::class,
'tx_cfcleaguefe_sv1_Profiles' => System25\T3sports\Service\ProfileService::class,
'tx_cfcleaguefe_sv1_Matches' => System25\T3sports\Service\MatchService::class,

'tx_cfcleaguefe_sv2_PlayerStatistics' => \System25\T3sports\Statistics\Service\PlayerStatistics::class,
'tx_cfcleaguefe_sv2_PlayerStatisticsMarker' => \System25\T3sports\Statistics\PlayerStatisticsMarker::class,
'tx_cfcleaguefe_sv2_PlayerSummaryStatistics' => \System25\T3sports\Statistics\Service\PlayerSummaryStatistics::class,
'tx_cfcleaguefe_sv2_PlayerSummaryStatisticsMarker' => \System25\T3sports\Statistics\PlayerSummaryStatisticsMarker::class,
'tx_cfcleaguefe_sv2_AssistStatistics' => \System25\T3sports\Statistics\Service\AssistStatistics::class,
'tx_cfcleaguefe_sv2_ScorerStatistics' => \System25\T3sports\Statistics\Service\ScorerStatistics::class,
'tx_cfcleaguefe_sv2_VisitorStatistics' => \System25\T3sports\Statistics\Service\VisitorStatistics::class,
'tx_cfcleaguefe_sv2_TeamStatisticsMarker' => \System25\T3sports\Statistics\TeamStatisticsMarker::class,
'tx_cfcleaguefe_sv2_PlayerStatistics' => System25\T3sports\Statistics\Service\PlayerStatistics::class,
'tx_cfcleaguefe_sv2_PlayerStatisticsMarker' => System25\T3sports\Statistics\PlayerStatisticsMarker::class,
'tx_cfcleaguefe_sv2_PlayerSummaryStatistics' => System25\T3sports\Statistics\Service\PlayerSummaryStatistics::class,
'tx_cfcleaguefe_sv2_PlayerSummaryStatisticsMarker' => System25\T3sports\Statistics\PlayerSummaryStatisticsMarker::class,
'tx_cfcleaguefe_sv2_AssistStatistics' => System25\T3sports\Statistics\Service\AssistStatistics::class,
'tx_cfcleaguefe_sv2_ScorerStatistics' => System25\T3sports\Statistics\Service\ScorerStatistics::class,
'tx_cfcleaguefe_sv2_VisitorStatistics' => System25\T3sports\Statistics\Service\VisitorStatistics::class,
'tx_cfcleaguefe_sv2_TeamStatisticsMarker' => System25\T3sports\Statistics\TeamStatisticsMarker::class,

'tx_cfcleaguefe_util_AddressMarker' => \System25\T3sports\Frontend\Marker\AddressMarker::class,
'tx_cfcleaguefe_util_ClubMarker' => \System25\T3sports\Frontend\Marker\ClubMarker::class,
'tx_cfcleaguefe_util_CompetitionMarker' => \System25\T3sports\Frontend\Marker\CompetitionMarker::class,
'tx_cfcleaguefe_util_Maps' => \System25\T3sports\Utility\MapsUtil::class,
'tx_cfcleaguefe_util_MatchMarker' => \System25\T3sports\Frontend\Marker\MatchMarker::class,
'tx_cfcleaguefe_util_ProfileMarker' => \System25\T3sports\Frontend\Marker\ProfileMarker::class,
'tx_cfcleaguefe_util_ScopeController' => \System25\T3sports\Utility\ScopeController::class,
'tx_cfcleaguefe_util_StadiumMarker' => \System25\T3sports\Frontend\Marker\StadiumMarker::class,
'tx_cfcleaguefe_util_TeamMarker' => \System25\T3sports\Frontend\Marker\TeamMarker::class,
'tx_cfcleaguefe_util_AddressMarker' => System25\T3sports\Frontend\Marker\AddressMarker::class,
'tx_cfcleaguefe_util_ClubMarker' => System25\T3sports\Frontend\Marker\ClubMarker::class,
'tx_cfcleaguefe_util_CompetitionMarker' => System25\T3sports\Frontend\Marker\CompetitionMarker::class,
'tx_cfcleaguefe_util_Maps' => System25\T3sports\Utility\MapsUtil::class,
'tx_cfcleaguefe_util_MatchMarker' => System25\T3sports\Frontend\Marker\MatchMarker::class,
'tx_cfcleaguefe_util_ProfileMarker' => System25\T3sports\Frontend\Marker\ProfileMarker::class,
'tx_cfcleaguefe_util_ScopeController' => System25\T3sports\Utility\ScopeController::class,
'tx_cfcleaguefe_util_StadiumMarker' => System25\T3sports\Frontend\Marker\StadiumMarker::class,
'tx_cfcleaguefe_util_TeamMarker' => System25\T3sports\Frontend\Marker\TeamMarker::class,

'tx_cfcleaguefe_models_address' => \System25\T3sports\Model\Address::class,
'tx_cfcleaguefe_models_club' => \System25\T3sports\Model\Club::class,
'tx_cfcleaguefe_models_competition' => \System25\T3sports\Model\Competition::class,
'tx_cfcleaguefe_models_competition_penalty' => \System25\T3sports\Model\CompetitionPenalty::class,
'tx_cfcleaguefe_models_competition_round' => \System25\T3sports\Model\CompetitionRound::class,
'tx_cfcleaguefe_models_match' => \System25\T3sports\Model\Fixture::class,
'tx_cfcleaguefe_models_match_note' => \System25\T3sports\Model\MatchNote::class,
'tx_cfcleaguefe_models_matchtable' => \System25\T3sports\Utility\MatchTableBuilder::class,
'tx_cfcleaguefe_models_profile' => \System25\T3sports\Model\Profile::class,
'tx_cfcleaguefe_models_saison' => \System25\T3sports\Model\Saison::class,
'tx_cfcleaguefe_models_team' => \System25\T3sports\Model\Team::class,
'tx_cfcleaguefe_models_teamNote' => \System25\T3sports\Model\TeamNote::class,
'tx_cfcleaguefe_models_teamNoteType' => \System25\T3sports\Model\TeamNoteType::class,
'tx_cfcleaguefe_models_address' => System25\T3sports\Model\Address::class,
'tx_cfcleaguefe_models_club' => System25\T3sports\Model\Club::class,
'tx_cfcleaguefe_models_competition' => System25\T3sports\Model\Competition::class,
'tx_cfcleaguefe_models_competition_penalty' => System25\T3sports\Model\CompetitionPenalty::class,
'tx_cfcleaguefe_models_competition_round' => System25\T3sports\Model\CompetitionRound::class,
'tx_cfcleaguefe_models_match' => System25\T3sports\Model\Fixture::class,
'tx_cfcleaguefe_models_match_note' => System25\T3sports\Model\MatchNote::class,
'tx_cfcleaguefe_models_matchtable' => System25\T3sports\Utility\MatchTableBuilder::class,
'tx_cfcleaguefe_models_profile' => System25\T3sports\Model\Profile::class,
'tx_cfcleaguefe_models_saison' => System25\T3sports\Model\Saison::class,
'tx_cfcleaguefe_models_team' => System25\T3sports\Model\Team::class,
'tx_cfcleaguefe_models_teamNote' => System25\T3sports\Model\TeamNote::class,
'tx_cfcleaguefe_models_teamNoteType' => System25\T3sports\Model\TeamNoteType::class,
];
Loading

0 comments on commit a7abd6d

Please sign in to comment.