File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ transferring the configuration settings from the old version.
1717After upgrading the files, you can run ``dj_setup_database upgrade ``
1818to migrate the database.
1919
20- If you have any active contests, we recommend to run "Refresh
21- scoreboard cache" from the DOMjudge web interface after the upgrade.
22-
2320Upgrading from pre-7.0 versions
2421-------------------------------
2522The upgrade procedure described above works from DOMjudge 7.0
Original file line number Diff line number Diff line change @@ -363,6 +363,8 @@ upgrade)
363363
364364 symfony_console doctrine:migrations:migrate -n
365365 DBUSER=$domjudge_DBUSER PASSWD=$domjudge_PASSWD symfony_console domjudge:load-default-data
366+
367+ symfony_console domjudge:refresh-cache
366368 verbose " DOMjudge database upgrade completed."
367369 ;;
368370
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace App \Command ;
4+
5+ use App \Entity \Contest ;
6+ use App \Service \ScoreboardService ;
7+ use Doctrine \ORM \EntityManagerInterface ;
8+ use Symfony \Component \Console \Attribute \AsCommand ;
9+ use Symfony \Component \Console \Command \Command ;
10+ use Symfony \Component \Console \Input \InputInterface ;
11+ use Symfony \Component \Console \Output \OutputInterface ;
12+ use Symfony \Component \Console \Style \SymfonyStyle ;
13+
14+ #[AsCommand(
15+ name: 'domjudge:refresh-cache ' ,
16+ description: 'Refreshes the scoreboard caches for all contests '
17+ )]
18+ class RefreshCacheCommand extends Command
19+ {
20+ public function __construct (
21+ protected readonly EntityManagerInterface $ em ,
22+ protected readonly ScoreboardService $ scoreboardService ,
23+ ) {
24+ parent ::__construct ();
25+ }
26+
27+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
28+ {
29+ $ style = new SymfonyStyle ($ input , $ output );
30+
31+ $ contests = $ this ->em ->getRepository (Contest::class)->findAll ();
32+ foreach ($ contests as $ contest ) {
33+ $ this ->scoreboardService ->refreshCache ($ contest );
34+ $ style ->success ("Refreshed cache for contest {$ contest ->getName ()}. " );
35+ }
36+
37+ return Command::SUCCESS ;
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments