function yandex_metrics_update_6100 in Yandex.Metrics 6.2
Same name and namespace in other branches
- 6 yandex_metrics.install \yandex_metrics_update_6100()
Implementation of hook_update_N().
File
- ./
yandex_metrics.install, line 23 - Install, uninstall and update the module.
Code
function yandex_metrics_update_6100() {
$schema['yandex_metrics_popular_content'] = array(
'description' => 'Stores the popular content.',
'fields' => array(
'url' => array(
'description' => 'The url obtained from Yandex.metrika.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'page_title' => array(
'description' => 'The page title of the url.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'page_views' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Page views of this url.',
),
),
'unique keys' => array(
'url' => array(
'url',
),
),
);
$ret = array();
if (!db_table_exists('yandex_metrics_popular_content')) {
db_create_table($ret, 'yandex_metrics_popular_content', $schema['yandex_metrics_popular_content']);
}
// Clear CSS and JS caches.
drupal_clear_css_cache();
drupal_clear_js_cache();
// Rebuild the menu to add new item admin/yandex_metrics_ajax/%/%/%.
menu_rebuild();
// Flush content caches.
cache_clear_all();
$ret[] = array(
'success' => TRUE,
'query' => 'Caches have been flushed',
);
return $ret;
}