1
+ <?php
2
+ /**
3
+ * @package panopticon
4
+ * @copyright Copyright (c)2023-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
5
+ * @license https://www.gnu.org/licenses/agpl-3.0.txt GNU Affero General Public License, version 3 or later
6
+ */
7
+
8
+ namespace Akeeba \Panopticon \CliCommand ;
9
+
10
+ defined ('AKEEBA ' ) || die;
11
+
12
+ use Akeeba \Panopticon \CliCommand \Attribute \ConfigAssertion ;
13
+ use Akeeba \Panopticon \Factory ;
14
+ use Akeeba \Panopticon \Model \Sites ;
15
+ use Symfony \Component \Console \Attribute \AsCommand ;
16
+ use Symfony \Component \Console \Command \Command ;
17
+ use Symfony \Component \Console \Input \InputArgument ;
18
+ use Symfony \Component \Console \Input \InputInterface ;
19
+ use Symfony \Component \Console \Output \OutputInterface ;
20
+
21
+ #[AsCommand(
22
+ name: 'sites:disable ' ,
23
+ description: 'Disable a site ' ,
24
+ hidden: false ,
25
+ )]
26
+ #[ConfigAssertion(true )]
27
+ class SitesDisable extends AbstractCommand
28
+ {
29
+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
30
+ {
31
+ $ container = Factory::getContainer ();
32
+ /** @var Sites $model */
33
+ $ model = $ container ->mvcFactory ->makeTempModel ('Sites ' );
34
+
35
+ $ id = intval ($ input ->getArgument ('id ' ));
36
+
37
+ $ model
38
+ ->findOrFail ($ id )
39
+ ->unpublish ();
40
+
41
+ return Command::SUCCESS ;
42
+ }
43
+
44
+ protected function configure (): void
45
+ {
46
+ $ this
47
+ ->addArgument ('id ' , InputArgument::REQUIRED , 'The numeric site ID to disable ' );
48
+ }
49
+
50
+ }
0 commit comments