View source
<?php
if (!defined("NODE_LIMIT_NO_LIMIT")) {
define("NODE_LIMIT_NO_LIMIT", -1);
}
function node_limit_schema() {
$schema['node_limit'] = array(
'description' => 'The base Node Limit table',
'fields' => array(
'lid' => array(
'description' => 'The limit id',
'type' => 'int',
'not null' => TRUE,
),
'type' => array(
'description' => 'The {node}.type to which this limit applies',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'nlimit' => array(
'description' => 'The node limit for this limit',
'type' => 'int',
'not null' => TRUE,
'default' => NODE_LIMIT_NO_LIMIT,
),
'title' => array(
'description' => 'The display name for this limit',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => 'The weight of this limit',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'lid',
),
);
return $schema;
}
function node_limit_update_7001() {
$ret = db_query("ALTER TABLE {node_limit} CHANGE `limit` `limit_count` INT(11) NOT NULL DEFAULT '-1' COMMENT 'The node limit for this limit'");
return !empty($ret);
}
function node_limit_update_7002() {
$ret = db_change_field('node_limit', 'limit_count', 'nlimit', array(
'description' => 'The node limit for this limit',
'type' => 'int',
'not null' => TRUE,
'default' => NODE_LIMIT_NO_LIMIT,
));
return !empty($ret);
}
function node_limit_disable() {
db_delete('variable')
->condition('name', 'node_limit_%', 'LIKE')
->execute();
}