View source
<?php
function autoload_schema() {
$schema['autoload_registry'] = array(
'description' => "Each record is a function, class, or interface name and the file it is in.",
'fields' => array(
'name' => array(
'description' => 'The name of the function, class, or interface.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'type' => array(
'description' => 'Either function or class or interface.',
'type' => 'varchar',
'length' => 9,
'not null' => TRUE,
'default' => '',
),
'filename' => array(
'description' => 'Name of the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'module' => array(
'description' => 'Name of the module the file belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'name',
'type',
),
'indexes' => array(
'hook' => array(
'type',
'weight',
'module',
),
),
);
$schema['autoload_registry_file'] = array(
'description' => "Files parsed to build the registry.",
'fields' => array(
'filename' => array(
'description' => 'Path to the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'hash' => array(
'description' => "sha-256 hash of the file's contents when last parsed.",
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
),
'primary key' => array(
'filename',
),
);
return $schema;
}
function autoload_install() {
drupal_install_schema('autoload');
}
function autoload_enable() {
db_query("UPDATE {system} SET weight = -100 WHERE name = 'autoload' AND type = 'module'");
spl_autoload_register('autoload_class');
spl_autoload_register('autoload_interface');
}
function autoload_uninstall() {
drupal_uninstall_schema('autoload');
variable_del('autoload_registry_watchdog_misses');
}
function autoload_update_6001() {
db_query("UPDATE {system} SET weight = -100 WHERE name = 'autoload' AND type = 'module'");
return array();
}
function autoload_update_6200() {
$schema['autoload_registry'] = array(
'description' => "Each record is a function, class, or interface name and the file it is in.",
'fields' => array(
'name' => array(
'description' => 'The name of the function, class, or interface.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'type' => array(
'description' => 'Either function or class or interface.',
'type' => 'varchar',
'length' => 9,
'not null' => TRUE,
'default' => '',
),
'filename' => array(
'description' => 'Name of the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'module' => array(
'description' => 'Name of the module the file belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'name',
'type',
),
'indexes' => array(
'hook' => array(
'type',
'weight',
'module',
),
),
);
$schema['autoload_registry_file'] = array(
'description' => "Files parsed to build the registry.",
'fields' => array(
'filename' => array(
'description' => 'Path to the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'hash' => array(
'description' => "sha-256 hash of the file's contents when last parsed.",
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
),
'primary key' => array(
'filename',
),
);
$ret = array();
foreach ($schema as $table => $table_schema) {
db_create_table($ret, $table, $table_schema);
}
return $ret;
}