Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderschnitzler committed Sep 27, 2016
0 parents commit aa80306
Show file tree
Hide file tree
Showing 19 changed files with 2,065 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
109 changes: 109 additions & 0 deletions Classes/Command/CheckCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Install\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Install\Status\StatusInterface;
use TYPO3\CMS\Install\SystemEnvironment\Check;

/**
* Class TYPO3\CMS\Install\Command\CheckCommand
*/
class CheckCommand extends Command
{

/**
* @return void
*/
protected function configure()
{
$this->setName('check');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$statuus = (new Check())->getStatus();

$dots = [];
$oks = [];
$warnings = [];
$errors = [];
foreach ($statuus as $status) {
/** @var StatusInterface $status */

switch ($status->getSeverity()) {
case 'notice':
$dots[] = '<info>.</info>';
$oks[] = $status->getTitle();
break;
case 'information':
$dots[] = '<info>.</info>';
$oks[] = $status->getTitle();
break;
case 'ok':
$dots[] = '<info>.</info>';
$oks[] = $status->getTitle();
break;
case 'warning':
$dots[] = '<comment>W</comment>';
$warnings[] = $status->getTitle();
break;
case 'error':
$dots[] = '<error>E</error>';
$errors[] = $status->getTitle();
break;
case 'alert':
$dots[] = '<error>E</error>';
$errors[] = $status->getTitle();
break;
default:
break;
}
}

/** @var FormatterHelper $formatter */
$formatter = $this->getHelper('formatter');

$output->writeln('');
$output->writeln('> PHP is using the following php.ini file:');
$output->writeln(' <info>' . get_cfg_var('cfg_file_path') . '</info>');
$output->writeln('');

$output->writeln('> Checking TYPO3 requirements:');
$output->writeln(' ' . implode('', $dots));
$output->writeln('');

$output->writeln($formatter->formatSection('Errors', '', 'error'));
$output->writeln($formatter->formatBlock($errors, 'error'));
$output->writeln('');

$output->writeln($formatter->formatSection('Warning', '', 'comment'));
$output->writeln($formatter->formatBlock($warnings, 'comment'));
$output->writeln('');

$output->writeln($formatter->formatSection('OK', '', 'info'));
$output->writeln($formatter->formatBlock($oks, 'info'));

return 0;
}
}
22 changes: 22 additions & 0 deletions Classes/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace TYPO3\CMS\Install;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* A generic install exception
*/
class Exception extends \Exception
{
}
84 changes: 84 additions & 0 deletions Classes/Status/AbstractStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Abstract status
*/
abstract class AbstractStatus implements StatusInterface
{
/**
* @var string Severity
*/
protected $severity = '';

/**
* @var string Title
*/
protected $title = '';

/**
* @var string Status message
*/
protected $message = '';

/**
* @return string The severity
*/
public function getSeverity()
{
return $this->severity;
}

/**
* @return string The title
*/
public function getTitle()
{
return $this->title;
}

/**
* Set title
*
* @param string $title The title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}

/**
* Get status message
*
* @return string Status message
*/
public function getMessage()
{
return $this->message;
}

/**
* Set status message
*
* @param string $message Status message
* @return void
*/
public function setMessage($message)
{
$this->message = $message;
}
}
26 changes: 26 additions & 0 deletions Classes/Status/AlertStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Alert level status
*/
class AlertStatus extends AbstractStatus implements StatusInterface
{
/**
* @var string The severity
*/
protected $severity = 'alert';
}
26 changes: 26 additions & 0 deletions Classes/Status/ErrorStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Error level status
*/
class ErrorStatus extends AbstractStatus implements StatusInterface
{
/**
* @var string The severity
*/
protected $severity = 'error';
}
22 changes: 22 additions & 0 deletions Classes/Status/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* A status exception
*/
class Exception extends \TYPO3\CMS\Install\Exception
{
}
26 changes: 26 additions & 0 deletions Classes/Status/InfoStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Info level status
*/
class InfoStatus extends AbstractStatus implements StatusInterface
{
/**
* @var string The severity
*/
protected $severity = 'information';
}
26 changes: 26 additions & 0 deletions Classes/Status/LoadingStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Loading level status - Used in Extension compatibility tester
*/
class LoadingStatus extends AbstractStatus implements StatusInterface
{
/**
* @var string The severity
*/
protected $severity = 'loading';
}
26 changes: 26 additions & 0 deletions Classes/Status/NoticeStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace TYPO3\CMS\Install\Status;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Notice level status
*/
class NoticeStatus extends AbstractStatus implements StatusInterface
{
/**
* @var string The severity
*/
protected $severity = 'notice';
}
Loading

0 comments on commit aa80306

Please sign in to comment.