<commit_before><?php

class Hackathon_MageMonitoring_Block_System_Overview_Read_Tabs_Php
    extends Mage_Adminhtml_Block_Abstract
{
    protected $_template = 'monitoring/php.phtml';

    protected $_extensions = array(
        'curl',
        'dom',
        'gd',
        'hash',
        'iconv',
        'mcrypt',
        'pcre',
        'pdo',
        'pdo_mysql',
        'simplexml',
        'soap'
    );

    protected $_config = array(
        'safe_mode' => '0',
        'memory_limit' => '512', // in MB
        'post_max_size' => '100', // in MB
        'upload_max_filesize' => '100', // in MB
        'file_uploads' => '1',
        'sendmail_from' => '',
        'sendmail_path' => '',
        'smtp_port' => '',
        'SMTP' => '',
        'soap.wsdl_cache' => '',
        //'soap.wsdl_cache_dir' => '',
        'soap.wsdl_cache_enabled' => '',
        'soap.wsdl_cache_ttl' => '',
    );

    /**
     *
     * @return Hackathon_MageMonitoring_Helper_Data|Mage_Core_Block_Abstract
     */
    public function getMonitoringHelper()
    {
        return Mage::helper('magemonitoring');
    }

    /**
     * @return array
     */
    public function getPhpVersion ()
    {
        // 5.2.13 - 5.3.24, 5.4.x wtih Patch http://www.magentocommerce.com/download
        if (version_compare(phpversion(), '5.2.13', 'lt') || version_compare(phpversion(), '5.5', 'ge')) {
            $class = 'warning';
            $recommended = true;
        } else {
            $class = 'success';
            $recommended = false;
        }

        $version = array(
            'label' => $this->__('Version'),
            'installed' => phpversion(),
            'recommended' => ($recommended) ? $this->__('5.2.13 - 5.3.24, 5.4.x wtih <a href="%s">Patch</a>', 'http://www.magentocommerce.com/download') : '',
            'class' => $class
        );

        return $version;
    }

    /**
     * @return array
     */
    public function getPhpConfigCheck()
    {
        $check = array();
        foreach ($this->_config as $key => $config) {

            if (in_array($key, array('memory_limit', 'post_max_size', 'upload_max_filesize'))) {
                $class = ($this->getMonitoringHelper()->getValueInByte(ini_get($key)) < $config) ? 'warning' : 'success';
                $value = $this->getMonitoringHelper()->getValueInByte(ini_get($key), true) . 'MB';
            } else {
                $value = ini_get($key);
                $class = (empty($config) || (!empty($config) && (bool) $config == (bool) $value) ) ? 'success' : 'warning';
            }

            $check[] = array(
                'label' => $key,
                'installed' => $value,
                'recommended' => ($config) ? $config : $this->__('N/A'),
                'class' => $class,
            );
        }

        return $check;
    }

    /**
     * @return array
     */
    public function getExtensionsCheck()
    {
        $check = array();
        foreach ($this->_extensions as $extension) {
            $check[] = array(
                'label' => $extension,
                'installed' => (extension_loaded($extension)) ? $this->__('enabled') : $this->__('disabled'),
                'recommended' => true,
                'class' => (extension_loaded($extension)) ? 'success' : 'error'
            );
        }

        return $check;
    }

    /**
     * @return array
     */
    public function getAllExtensions()
    {
        $loadedExtensions = get_loaded_extensions();
        $extensions = array();
        foreach ($loadedExtensions as $extension) {
            if (in_array($extension, $this->_extensions)) {
                continue;
            }
            $extensions[] = array(
                'label' => $extension,
                'installed' => $this->__('enabled'),
                'recommended' => true,
                'class' => 'success'
            );
        }

        return $extensions;
    }

<<<<<<< HEAD
    public function getPhpInfo()
    {
        return $this->getMonitoringHelper()->getPhpInfoArray();
    }
=======
>>>>>>> 95e0c98296def85055cf1fd63ae64b9841fdaa85
}<commit_msg>Fixed merge issue<commit_after><?php

class Hackathon_MageMonitoring_Block_System_Overview_Read_Tabs_Php
    extends Mage_Adminhtml_Block_Abstract
{
    protected $_template = 'monitoring/php.phtml';

    protected $_extensions = array(
        'curl',
        'dom',
        'gd',
        'hash',
        'iconv',
        'mcrypt',
        'pcre',
        'pdo',
        'pdo_mysql',
        'simplexml',
        'soap'
    );

    protected $_config = array(
        'safe_mode' => '0',
        'memory_limit' => '512', // in MB
        'post_max_size' => '100', // in MB
        'upload_max_filesize' => '100', // in MB
        'file_uploads' => '1',
        'sendmail_from' => '',
        'sendmail_path' => '',
        'smtp_port' => '',
        'SMTP' => '',
        'soap.wsdl_cache' => '',
        //'soap.wsdl_cache_dir' => '',
        'soap.wsdl_cache_enabled' => '',
        'soap.wsdl_cache_ttl' => '',
    );

    /**
     *
     * @return Hackathon_MageMonitoring_Helper_Data|Mage_Core_Block_Abstract
     */
    public function getMonitoringHelper()
    {
        return Mage::helper('magemonitoring');
    }

    /**
     * @return array
     */
    public function getPhpVersion ()
    {
        // 5.2.13 - 5.3.24, 5.4.x wtih Patch http://www.magentocommerce.com/download
        if (version_compare(phpversion(), '5.2.13', 'lt') || version_compare(phpversion(), '5.5', 'ge')) {
            $class = 'warning';
            $recommended = true;
        } else {
            $class = 'success';
            $recommended = false;
        }

        $version = array(
            'label' => $this->__('Version'),
            'installed' => phpversion(),
            'recommended' => ($recommended) ? $this->__('5.2.13 - 5.3.24, 5.4.x wtih <a href="%s">Patch</a>', 'http://www.magentocommerce.com/download') : '',
            'class' => $class
        );

        return $version;
    }

    /**
     * @return array
     */
    public function getPhpConfigCheck()
    {
        $check = array();
        foreach ($this->_config as $key => $config) {

            if (in_array($key, array('memory_limit', 'post_max_size', 'upload_max_filesize'))) {
                $class = ($this->getMonitoringHelper()->getValueInByte(ini_get($key)) < $config) ? 'warning' : 'success';
                $value = $this->getMonitoringHelper()->getValueInByte(ini_get($key), true) . 'MB';
            } else {
                $value = ini_get($key);
                $class = (empty($config) || (!empty($config) && (bool) $config == (bool) $value) ) ? 'success' : 'warning';
            }

            $check[] = array(
                'label' => $key,
                'installed' => $value,
                'recommended' => ($config) ? $config : $this->__('N/A'),
                'class' => $class,
            );
        }

        return $check;
    }

    /**
     * @return array
     */
    public function getExtensionsCheck()
    {
        $check = array();
        foreach ($this->_extensions as $extension) {
            $check[] = array(
                'label' => $extension,
                'installed' => (extension_loaded($extension)) ? $this->__('enabled') : $this->__('disabled'),
                'recommended' => true,
                'class' => (extension_loaded($extension)) ? 'success' : 'error'
            );
        }

        return $check;
    }

    /**
     * @return array
     */
    public function getAllExtensions()
    {
        $loadedExtensions = get_loaded_extensions();
        $extensions = array();
        foreach ($loadedExtensions as $extension) {
            if (in_array($extension, $this->_extensions)) {
                continue;
            }
            $extensions[] = array(
                'label' => $extension,
                'installed' => $this->__('enabled'),
                'recommended' => true,
                'class' => 'success'
            );
        }

        return $extensions;
    }

    public function getPhpInfo()
    {
        return $this->getMonitoringHelper()->getPhpInfoArray();
    }

}
{'fraction_non_alphanumeric': 0.16876451179274105, 'fraction_numerical': 0.011976047904191617, 'mean_word_length': 1.7639311043566364, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 104, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3876531', 'n_tokens_mistral': 2602, 'n_tokens_neox': 2438, 'n_words': 434}