assuncao
Member
Hi,
I would like to know if does anyone know how to solve the issue that I have in this extension that I'm developing:
Once it get activated, the dashboard stop working. I just would like to make this extension to stop counting the subscribers, I think it is making the backend slow. Currently there are about 44 million subscribers.
Thanks
I would like to know if does anyone know how to solve the issue that I have in this extension that I'm developing:
PHP:
<?php defined('MW_PATH') || exit('No direct script access allowed');
class DashFasterExt extends ExtensionInit
{
public $name = 'Dashboard';
public $description = 'Makes Dashboard faster';
public $version = '1.0';
public $author = 'Author';
public $website = 'https://www.example.com.br';
public $email = 'example@example.com';
public $allowedApps = array('backend');
public $notAllowedApps = array();
protected $_canBeDeleted = true;
protected $_canBeDisabled = true;
public function run()
{
Yii::app()->hooks->addFilter('backend_dashboard_glance_stats_list', function(array $items = array(), $controller){
$cacheKey = md5('backend.dashboard.glanceStats');
$cache = Yii::app()->cache;
if (($items = $cache->get($cacheKey))) {
return $items;
}
$items = array(
array(
'count' => Yii::app()->format->formatNumber(Customer::model()->count()),
'heading' => Yii::t('dashboard', 'Customers'),
'icon' => IconHelper::make('ion-person-add'),
'url' => $this->createUrl('customers/index'),
),
array(
'count' => Yii::app()->format->formatNumber(Campaign::model()->count()),
'heading' => Yii::t('dashboard', 'Campaigns'),
'icon' => IconHelper::make('ion-ios-email-outline'),
'url' => $this->createUrl('campaigns/index'),
)
/*,
array(
'count' => Yii::app()->format->formatNumber(Lists::model()->count()),
'heading' => Yii::t('dashboard', 'Lists'),
'icon' => IconHelper::make('ion ion-clipboard'),
'url' => $this->createUrl('lists/index'),
),
*/
,
array(
'count' => Yii::app()->format->formatNumber(ListSubscriber::model()->count()),
'heading' => Yii::t('dashboard', 'Subscribers'),
'icon' => IconHelper::make('ion-ios-people'),
'url' => 'javascript:;',
),
array(
'count' => Yii::app()->format->formatNumber(ListSegment::model()->count()),
'heading' => Yii::t('dashboard', 'Segments'),
'icon' => IconHelper::make('ion-gear-b'),
'url' => 'javascript:;',
),
array(
'count' => Yii::app()->format->formatNumber(DeliveryServer::model()->count()),
'heading' => Yii::t('dashboard', 'Delivery servers'),
'icon' => IconHelper::make('ion-paper-airplane'),
'url' => $this->createUrl('delivery_servers/index'),
)
);
$cache->set($cacheKey, $items, 600);
return $items;
});
}
}
Once it get activated, the dashboard stop working. I just would like to make this extension to stop counting the subscribers, I think it is making the backend slow. Currently there are about 44 million subscribers.
Thanks
Last edited: