Mygento_Geoip_Adminhtml_GeoipController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A statusAction() 0 7 2
A synchronizeAction() 0 5 1
1
<?php
2
3
/**
4
 *
5
 *
6
 * @category Mygento
7
 * @package Mygento_Geoip
8
 * @copyright 2014 NKS LLC. (https://www.mygento.ru)
9
 */
10
class Mygento_Geoip_Adminhtml_GeoipController extends Mage_Adminhtml_Controller_Action
11
{
12
13
    public function statusAction()
14
    {
15
        $_realSize = filesize(Mage::getModel('geoip/info')->getArchivePath());
16
        $_totalSize = Mage::getSingleton('core/session')->getData('_geoip_file_size');
17
        $result = $_totalSize ? $_realSize / $_totalSize * 100 : 0;
18
        $this->getResponse()->setBody($result);
19
    }
20
21
    public function synchronizeAction()
22
    {
23
        $result = Mage::getModel('geoip/info')->update();
24
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
25
    }
26
}
27