Skip to content

Commit

Permalink
Adding supee-7405, version check by controller for 2.*
Browse files Browse the repository at this point in the history
  • Loading branch information
steverobbins committed Mar 8, 2016
1 parent c57d1c7 commit 658c981
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/MageScan/Check/Patch/MageReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MageReport extends AbstractCheck
'scan/result/supee6285',
'scan/result/supee6482',
'scan/result/supee6788',
'scan/result/supee7405',
];

/**
Expand Down
1 change: 1 addition & 0 deletions src/MageScan/Check/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Version extends AbstractCheck
protected $versionCheck = [
'FileHash',
'DocComment',
'VersionController',
];

/**
Expand Down
55 changes: 55 additions & 0 deletions src/MageScan/Check/Version/VersionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* Mage Scan
*
* PHP version 5
*
* @category MageScan
* @package MageScan
* @author Steve Robbins <[email protected]>
* @copyright 2015 Steve Robbins
* @license http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
* @link https://github.com/steverobbins/magescan
*/

namespace MageScan\Check\Version;

use MageScan\Check\AbstractCheck;
use MageScan\Check\Version;
use Mvi\Check;

/**
* Magento 2 has a controller that tells you the version
*
* @category MageScan
* @package MageScan
* @author Steve Robbins <[email protected]>
* @copyright 2015 Steve Robbins
* @license http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
* @link https://github.com/steverobbins/magescan
*/
class VersionController extends AbstractCheck
{
/**
* Check for version controller
*
* @return array|boolean
*/
public function getInfo()
{
$response = $this->getRequest()->get('magento_version');
if ($response->getStatusCode() == 200) {
preg_match("/Magento\/([0-9]\.[0-9\.]+) \(([a-zA-Z]+)\)/", $response->getBody(), $matches);
if (isset($matches[1]) && isset($matches[2])) {
$edition = $matches[2];
$version = $matches[1];
// An early versions of EE 2.0 would say it's 1.0
if ($edition == 'Enterprise' && $version == '1.0') {
$version = '2.0';
}
return [$edition, $version];
}
}
return false;
}
}
2 changes: 1 addition & 1 deletion src/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use MageScan\Command\SelfUpdateCommand;
use Symfony\Component\Console\Application;

$app = new Application('Mage Scan', '1.12.1');
$app = new Application('Mage Scan', '1.12.2');

$app->add(new AllCommand);
$app->add(new VersionCommand);
Expand Down

0 comments on commit 658c981

Please sign in to comment.