view og_statistics.install @ 1:0aae3e2e6309

Fix d'un warning dans le cas node_load(node_save());
author Franck Deroche <franck@defr.org>
date Tue, 24 Nov 2009 14:26:41 +0100
parents 9ce879ecbce6
children 48f07e7acaca
line wrap: on
line source
<?php
// $Id: og_statistics.install,v 1.2 2009/05/29 16:46:25 dereine Exp $

/**
 * @file
 *   Installs the og_statistics module.
 */

/**
 * Implemenation of hook_install().
 */
function og_statistics_install() {
  drupal_install_schema('og_statistics');
}

/**
 * Implemenation of hook_schema().
 */
function og_statistics_schema() {
  $schema['og_statistics'] = array(
    'description' => 'Saves some statistics foreach group',
    'fields'          => array(
      'nid'             => array(
        'description'     => "The groups's {node}.nid.",
        'type'            => 'int',
        'size'            => 'normal',
        'not null'        => TRUE,
      ),
      'members_count' => array(
        'description' => 'How many members has a group',
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'posts_count' => array(
        'description' => 'How many posts has a group',
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'comments_count' => array(
        'description' => 'How many comments has a group',
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'last_node_timestamp' => array(
        'description'     => 'Last Time when a in the group was created.',
        'type'            => 'int',
        'size'            => 'normal',
        'not null'        => FALSE,
        'default'         => 0,
      ),
      'last_comment_timestamp' => array(
        'description'     => 'Last Time when a comment in the group was created.',
        'type'            => 'int',
        'size'            => 'normal',
        'not null'        => FALSE,
        'default'         => 0,
      ),
      'last_member_timestamp' => array(
        'description'     => 'Last Time when a user joins a group.',
        'type'            => 'int',
        'size'            => 'normal',
        'not null'        => FALSE,
        'default'         => 0,
      ),
    ),
    'primary key' => array('nid'),
  );

  return $schema;
}

/**
 * Implemenation of hook_uninstall().
 */
function og_statistics_uninstall() {
  drupal_uninstall_schema('og_statistics');
}