From bdee4112b06bf9633fe0430220e7ec29012089ef Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sat, 11 May 2013 22:33:00 +0300 Subject: [PATCH] "YiiRequirementChecker" console view has been reworked to display requirements by blocks and in brief for the successful ones. --- yii/requirements/views/console/index.php | 56 ++++++++++---------------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/yii/requirements/views/console/index.php b/yii/requirements/views/console/index.php index b6122fc..1b9c61b 100644 --- a/yii/requirements/views/console/index.php +++ b/yii/requirements/views/console/index.php @@ -10,47 +10,27 @@ echo "for running Yii application.\n"; echo "It checks if the server is running the right version of PHP,\n"; echo "if appropriate PHP extensions have been loaded, and if php.ini file settings are correct.\n"; -echo "\nConclusion:\n"; - -$columnSizes = array( - 'name' => 25, - 'condition' => 10, - 'by' => 30, - 'memo' => 50, -); - -// Headers: -$tableLength = count($columnSizes)+1; -foreach ($columnSizes as $columnSize) { - $tableLength += $columnSize; -} -echo str_pad('', $tableLength, '-'); -echo "\n"; -echo '|'.str_pad('Name', $columnSizes['name'], ' ', STR_PAD_BOTH).'|'; -echo str_pad('Result', $columnSizes['condition'], ' ', STR_PAD_BOTH).'|'; -echo str_pad('Required By', $columnSizes['by'], ' ', STR_PAD_BOTH).'|'; -echo str_pad('Memo', $columnSizes['memo'], ' ', STR_PAD_BOTH).'|'; -echo "\n"; -echo str_pad('', $tableLength, '-'); -echo "\n"; - -// Rows: -foreach ($requirements as $requirement) { - $name = $requirement['name']; - echo '|'.str_pad(' '.$name, $columnSizes['name'], ' ', STR_PAD_RIGHT).'|'; - $condition = $requirement['condition'] ? 'Passed' : ($requirement['mandatory'] ? 'FAILED' : 'WARNING'); - echo str_pad($condition, $columnSizes['condition'], ' ', STR_PAD_BOTH).'|'; - $by = strip_tags($requirement['by']); - echo str_pad($by, $columnSizes['by'], ' ', STR_PAD_BOTH).'|'; - $memo = strip_tags($requirement['memo']); - echo str_pad(' '.$memo, $columnSizes['memo'], ' ', STR_PAD_RIGHT).'|'; - echo "\n"; +$header = 'Check conclusion:'; +echo "\n{$header}\n"; +echo str_pad('', strlen($header), '-')."\n\n"; + +foreach ($requirements as $key => $requirement) { + if ($requirement['condition']) { + echo $requirement['name'].": OK\n"; + echo "\n"; + } else { + echo $requirement['name'].': '.($requirement['mandatory'] ? 'FAILED!!!' : 'WARNING!!!')."\n"; + echo 'Required by: '.strip_tags($requirement['by'])."\n"; + $memo = strip_tags($requirement['memo']); + if (!empty($memo)) { + echo 'Memo: '.strip_tags($requirement['memo'])."\n"; + } + echo "\n"; + } } -echo str_pad('', $tableLength, '-'); -echo "\n"; -// Summary $summaryString = 'Errors: '.$summary['errors'].' Warnings: '.$summary['warnings'].' Total checks: '.$summary['total']; +echo str_pad('', strlen($summaryString), '-')."\n"; echo $summaryString; echo "\n\n"; \ No newline at end of file