Drupal & API: Core Database Tables Flashcards

Database
Terms Definitions
What are the five core modules that are ALWAYS enabled in Drupal 7?
The five core modules that are always enabled in Drupal:

1. user
2. block
3. node
4. filter
5. system
What tables are created by the user module?

How do we find those tables quickly in the code?
The following tables are installed and used by the user module.

a. authmap; Stores distributed authentication mapping.
b. role_permission; Stores the permissions assigned to user roles.
c. role; Stores user roles.
d. users; Stores user data. Drupal Admin UID = 1.
e. users_roles; Maps users to roles.
--
To learn what a module installs with regard to tables, look for and return lines with the string "schema" in that module's .install file.

$ cd /web/root/
$ cat modules/user/user.install | grep schema

RESULT:

* Implements hook_schema().
function user_schema() {
$schema['authmap'] = array(
$schema['role_permission'] = array(
$schema['role'] = array(
$schema['users'] = array(
$schema['users_roles'] = array(
return $schema;
* This function is valid for a database schema version 7000.
// schema found.
* Update the database to match the schema.
What tables are created by the block module?

How do we find those tables quickly in the code?
The following tables are installed and used by the block module:

a. block
Stores block settings, such as region and visibility settings.
b. block_role
Sets up access permissions for blocks based on user roles.
c. block_custom; Stores contents of custom-made blocks.
d. cache_block
Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.
--
To learn what a module installs with regard to tables, look into that module's .install file for lines with the string "schema" and return them.

$ cd /web/root/
$ cat modules/block/block.install | grep schema

RESULTS

* Implements hook_schema().
function block_schema() {
$schema['block'] = array(
$schema['block_role'] = array(
$schema['block_custom'] = array(
$schema['cache_block'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_block']['description'] = 'Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.';
return $schema;
$schema = system_schema_cache_7054();
db_create_table('cache_block', $schema);
* Update database to match Drupal 7 schema.
What tables are created by the node module?

How do we find those tables quickly in the code?
The following tables are installed and used by the node module:

a. node; The base table for nodes.
b. node_access; Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.
c. node_revision
Stores information about each saved version of a {node}.
d. node_type; Stores information about all defined {node} types.
e. block_node_type
Sets up display criteria for blocks based on content types.
f. history
A record of which {users} have read which {node}s.

To learn what a module installs with regard to tables, look for and return lines with the string "schema" in that module's .install file.

$ cd /web/root/
$ cat modules/node/node.install | grep schema

RESULTS

* Implements hook_schema().
function node_schema() {
$schema['node'] = array(
$schema['node_access'] = array(
$schema['node_revision'] = array(
$schema['node_type'] = array(
$schema['block_node_type'] = array(
$schema['history'] = array(
return $schema;
* This function is valid for a database schema version 7000.
if (drupal_get_installed_schema_version('statistics') == SCHEMA_UNINSTALLED) {
// schema structure in memory (but not yet from the database),
$schema['block_node_type'] = array(
db_create_table('block_node_type', $schema['block_node_type']);
* Update the database from Drupal 6 to match the schema.
What tables are created by the filter module?

How do we find those tables quickly in the code?
The following tables are installed and used by the filter module:

a. filter; Table that maps filters (HTML corrector) to text formats (Filtered HTML).
b. filter_format; Stores text formats: custom groupings of filters, such as Filtered HTML.
c. cache_filter
Cache table for the Filter module to store already filtered pieces of text, identified by text format and hash of the text.
--
To learn what a module installs with regard to tables, look for and return lines with the string "schema" in that module's .install file.

$ cd /web/root/
$ cat modules/filter/filter.install | grep schema

RESULTS

* Implements hook_schema().
function filter_schema() {
$schema['filter'] = array(
$schema['filter_format'] = array(
$schema['cache_filter'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_filter']['description'] = 'Cache table for the Filter module to store already filtered pieces of text, identified by text format and hash of the text.';
return $schema;
$schema = system_schema_cache_7054();
db_create_table('cache_filter', $schema);
What tables are created by the system module?

How do we find those tables quickly in the code?
The following tables are installed and used by the system module:

a. variable
b. actions
c. batch
d. blocked_ips
e. cache
f. cache_bootstrap
g. cache_form
h. cache_page
i. cache_menu
j. cache_path
k. date_format_type
l. date_formats
m. date_format_locale
n. file_managed
o. file_usage
p. flood
q. menu_router
r. menu_links
s. queue
t. registry
u. registry_file
v. semaphore
w. sequences
x. sessions
y. system
z. url_alias
--
To learn what a module installs with regard to tables, look for and return lines with the string "schema" in that module's .install file.

$ cd /web/root/
$ cat modules/system/system.install | grep schema
What is the purpose for the table installed by system.install: variable?
variable
Named variable/value pairs created by Drupal core or any other module or theme. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.
What is the purpose for the table installed by system.install: actions?
actions
Stores action information.
What is the purpose for the table installed by system.install: batch?
c. batch
Stores details about batches (processes that run in multiple HTTP requests).
What is the purpose for the table installed by system.install: blocked_ips?
blocked_ips; Stores blocked IP addresses.
What is the purpose for the table installed by system.install: cache?
cache
Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.
What is the purpose for the table installed by system.install: cache_bootstrap?
cache_bootstrap
Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.
What is the purpose for the table installed by system.install: cache_form?
cache_form
Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.
What is the purpose for the table installed by system.install: cache_page?
cache_page
Cache table used to store compressed pages for anonymous users, if page caching is enabled.
What is the purpose for the table installed by system.install: cache_menu?
cache_menu
Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.
What is the purpose for the table installed by system.install: cache_path?
cache_path
Cache table for path alias lookup.
What is the purpose for the table installed by system.install: date_format_type?
date_format_type
Stores configured date format types.
What is the purpose for the table installed by system.install: date_formats?
date_formats
Stores configured date formats.
What is the purpose for the table installed by system.install: date_format_locale?
date_format_locale
Stores configured date formats for each locale.
What is the purpose for the table installed by system.install: file_managed?
file_managed
Stores information for uploaded files.
What is the purpose for the table installed by system.install: file_usage?
file_usage
Track where a file is used.
What is the purpose for the table installed by system.install: flood?
flood
Flood controls the threshold of events, such as the number of contact attempts.
What is the purpose for the table installed by system.install: menu_router?
menu_router
Maps paths to various callbacks (access, page and title)
What is the purpose for the table installed by system.install: menu_links?
menu_links
Contains the individual links within a menu.
What is the purpose for the table installed by system.install: queue?
queue
Stores items in queues.
What is the purpose for the table installed by system.install: registry?
registry
Each record is a function, class, or interface name and the file it is in.
What is the purpose for the table installed by system.install: registry_file?
registry_file
Files parsed to build the registry.
What is the purpose for the table installed by system.install: semaphore?
semaphore
Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.
What is the purpose for the table installed by system.install: sequences?
sequences
Stores IDs.
What is the purpose for the table installed by system.install: sessions?
sessions
Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.
What is the purpose for the table installed by system.install: system?
system
A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system.
What is the purpose for the table installed by system.install: url_alias?
url_alias
A list of URL aliases for Drupal paths; a user may visit either the source or destination path.
What is a 'Drupal path'?

What are the main core drupal paths?
Drupal paths are the appended logical menu path and arguments and parameters, like admin/people/create, which is where the admin can create a new user.

PATTERN: [scope/]object/action

Core Drupal paths follow a REST-like pattern:

node object: {node_type, owner, editor, etc}
node/add
user object: {login, logout, password, register, validate_email, etc}
user/register

ADMIN HOME (admin)
| - admin/dashboard
| - admin/content
| - admin/structure
| - admin/appearance
| - admin/people
| - admin/modules
| - admin/config
| - admin/reports
| - admin/help

This contributed module generates a tree that can be used as a drupal path site map:
http://drupal.org/project/menutree
What are core, contributed and custom modules?
Core modules are those which ship with Drupal 7 core.
Five must be enabled at all times: user, node, block, filter, system

Contributed modules can be found under http://drupal.org/project/[project name]

Custom modules are those which are coded ourselves from scratch.
What are some crucial modules for cool sites?
Taxonomy
Views
Panels
What are some crucial Drupal 7 modules for helping developers implement Drupal module code correctly?
devel
coder
What is git and how does that fit into Drupal 7?
git is the de facto team dev code project versioning tool.

git is open source software and github.com is a free web-based service to developers who use git.

Developers of all languages use git to manage their code collaboratively. As of Drupal 7, all core and contributed projects are managed as git repositories, still hosted at drupal.org.
What are Drupal Themers?
Drupal Themers are the members of the software development team concerned with screens, interaction and user interface design. Their languages include html, css, jquery.

They also do need to know VERY LITTLE php. VERY LITTLE!

Themers are either sub-theming, tweaking and merging existing themes, or creating custom themes from scratch.
What are Drupal Module Developers?
Drupal Module Developers are the members of the software development team concerned with information architecture and logical functionality. Their languages include php, mysql, bash.

Module developers are either implementing core and contributed modules in Drupal, or porting modules to the current version, or perhaps creating custom modules.
What is LAMP and what are LAMP engineers?
networks
hosts
services
environments
What are software project managers and testing methods?
/ 41
Term:
Definition:
Definition:

Leave a Comment ({[ getComments().length ]})

Comments ({[ getComments().length ]})

{[comment.username]}

{[ comment.comment ]}

View All {[ getComments().length ]} Comments
Ask a homework question - tutors are online