Skip to content

Commit 6e37dec

Browse files
authored
Create Deploy.php
1 parent 3b875fe commit 6e37dec

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

src/Mage/FPC/Console/Deploy.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Mage\FPC\Console;
9+
10+
use Symfony\Component\Console\Command\Command;
11+
use Symfony\Component\Console\Input\InputArgument;
12+
use Symfony\Component\Console\Input\InputInterface;
13+
use Symfony\Component\Console\Input\InputOption;
14+
use Symfony\Component\Console\Output\OutputInterface;
15+
16+
class Deploy extends Command
17+
{
18+
19+
const NAME_ARGUMENT = "name";
20+
const NAME_OPTION = "option";
21+
22+
/**
23+
* {@inheritdoc}
24+
*/
25+
protected function execute(
26+
InputInterface $input,
27+
OutputInterface $output
28+
) {
29+
$name = $input->getArgument(self::NAME_ARGUMENT);
30+
$option = $input->getOption(self::NAME_OPTION);
31+
$includeFile = dirname(__DIR__) . "/FPC.php";
32+
exec("sed '2 include(\"$includeFile\")'; " . BP . "/pub/index.php", $output);
33+
var_dump($output);
34+
$output->writeln("Done! Added to the pub/index.php ");
35+
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
protected function configure()
41+
{
42+
$this->setName("fpc:deploy");
43+
$this->setDescription("Deploy FPC to pub/index.php");
44+
$this->setDefinition([
45+
new InputArgument(self::NAME_ARGUMENT, InputArgument::OPTIONAL, "Name"),
46+
new InputOption(self::NAME_OPTION, "-a", InputOption::VALUE_NONE, "Option functionality")
47+
]);
48+
parent::configure();
49+
}
50+
}

0 commit comments

Comments
 (0)