Completed
Push — master ( 36e8c5...2454a8 )
by Tom
12:20 queued 07:25
created

VersionCheck   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkImplementation() 0 18 2
1
<?php
2
/*
3
 * this file is part of magerun
4
 *
5
 * @author Tom Klingenberg <https://github.com/ktomk>
6
 */
7
8
namespace N98\Magento\Command\System\Check\MySQL;
9
10
use N98\Magento\Command\System\Check\Result;
11
use Varien_Db_Adapter_Interface;
12
13
class VersionCheck extends ResourceCheck
14
{
15
    /**
16
     * @param Result $result
17
     * @param Varien_Db_Adapter_Interface $dbAdapter
18
     * @return void
19
     */
20
    protected function checkImplementation(Result $result, Varien_Db_Adapter_Interface $dbAdapter)
21
    {
22
        /**
23
         * Check Version
24
         */
25
        $mysqlVersion = $dbAdapter->fetchOne('SELECT VERSION()');
26
        $minimumVersionFound = version_compare($mysqlVersion, '4.1.20', '>=');
27
28
        if ($minimumVersionFound) {
29
            $result->setStatus(Result::STATUS_OK);
30
            $result->setMessage("<info>MySQL Version <comment>$mysqlVersion</comment> found.</info>");
31
        } else {
32
            $result->setStatus(Result::STATUS_ERROR);
33
            $result->setMessage(
34
                "<error>MySQL Version <comment>>$mysqlVersion</comment> found. Upgrade your MySQL Version.</error>"
35
            );
36
        }
37
    }
38
}
39