Community Documentation

hook_install

5 install.php hook_install()
6 install.php hook_install()
7 system.api.php hook_install()
8 system.api.php hook_install()

Install the current version of the database schema, and any other setup tasks.

Implementations of this hook must be declared in the module's .install file. The hook will only be called the first time a module is installed, and the module's schema version will be set to the module's greatest numbered update hook. Because of this, anytime a hook_update_N() is added to the module, this function needs to be updated to reflect the current version of the database schema.

See the Schema API documentation at http://drupal.org/node/146843 for details on hook_schema, where a database tables are defined.

Note that functions declared in the module being installed are not yet available. The implementation of hook_install() will need to explicitly load the module before any declared functions may be invoked.

Anything added or modified in this function that can be removed during uninstall should be removed with hook_uninstall().

Related topics

▾ 65 functions implement hook_install()

aggregator.install in modules/aggregator/aggregator.install
aggregator_install in modules/aggregator/aggregator.install
Implementation of hook_install().
aggregator_uninstall in modules/aggregator/aggregator.install
Implementation of hook_uninstall().
block.install in modules/block/block.install
blogapi.install in modules/blogapi/blogapi.install
blogapi_install in modules/blogapi/blogapi.install
Implementation of hook_install().
blogapi_uninstall in modules/blogapi/blogapi.install
Implementation of hook_uninstall().
book.install in modules/book/book.install
book_install in modules/book/book.install
Implementation of hook_install().
book_uninstall in modules/book/book.install
Implementation of hook_uninstall().
color.install in modules/color/color.install
comment.install in modules/comment/comment.install
contact.install in modules/contact/contact.install
contact_install in modules/contact/contact.install
Implementation of hook_install().
contact_uninstall in modules/contact/contact.install
Implementation of hook_uninstall().
dblog.install in modules/dblog/dblog.install
dblog_install in modules/dblog/dblog.install
Implementation of hook_install().
dblog_uninstall in modules/dblog/dblog.install
Implementation of hook_uninstall().
filter.install in modules/filter/filter.install
forum.install in modules/forum/forum.install
forum_install in modules/forum/forum.install
Implementation of hook_install().
forum_uninstall in modules/forum/forum.install
Implementation of hook_uninstall().
hook_uninstall in developer/hooks/install.php
Remove any information that the module sets.
locale.install in modules/locale/locale.install
locale_install in modules/locale/locale.install
Implementation of hook_install().
locale_uninstall in modules/locale/locale.install
Implementation of hook_uninstall().
menu.install in modules/menu/menu.install
menu_install in modules/menu/menu.install
Implementation of hook_install().
menu_uninstall in modules/menu/menu.install
Implementation of hook_uninstall().
module_load_install in includes/module.inc
Load a module's installation hooks.
node.install in modules/node/node.install
openid.install in modules/openid/openid.install
openid_install in modules/openid/openid.install
Implementation of hook_install().
openid_uninstall in modules/openid/openid.install
Implementation of hook_uninstall().
php.install in modules/php/php.install
php_install in modules/php/php.install
Implementation of hook_install().
poll.install in modules/poll/poll.install
poll_install in modules/poll/poll.install
Implementation of hook_install().
poll_uninstall in modules/poll/poll.install
Implementation of hook_uninstall().
profile.install in modules/profile/profile.install
profile_install in modules/profile/profile.install
Implementation of hook_install().
profile_uninstall in modules/profile/profile.install
Implementation of hook_uninstall().
search.install in modules/search/search.install
search_install in modules/search/search.install
Implementation of hook_install().
search_uninstall in modules/search/search.install
Implementation of hook_uninstall().
statistics.install in modules/statistics/statistics.install
statistics_install in modules/statistics/statistics.install
Implementation of hook_install().
statistics_uninstall in modules/statistics/statistics.install
Implementation of hook_uninstall().
syslog.install in modules/syslog/syslog.install
Install, update and uninstall functions for the syslog module.
syslog_uninstall in modules/syslog/syslog.install
Implements hook_uninstall().
system.install in modules/system/system.install
system_install in modules/system/system.install
Implementation of hook_install().
system_modules_uninstall in modules/system/system.admin.inc
Builds a form of currently disabled modules.
taxonomy.install in modules/taxonomy/taxonomy.install
theme_system_modules_uninstall in modules/system/system.admin.inc
Themes a table of currently disabled modules.
trigger.install in modules/trigger/trigger.install
trigger_install in modules/trigger/trigger.install
Implementation of hook_install().
trigger_uninstall in modules/trigger/trigger.install
Implementation of hook_uninstall().
update.install in modules/update/update.install
update_install in modules/update/update.install
Implementation of hook_install().
update_uninstall in modules/update/update.install
Implementation of hook_uninstall().
upload.install in modules/upload/upload.install
upload_install in modules/upload/upload.install
Implementation of hook_install().
upload_uninstall in modules/upload/upload.install
Implementation of hook_uninstall().
user.install in modules/user/user.install

File

developer/hooks/install.php, line 202
Documentation for the installation and update system.

Code

<?php
function hook_install() {
  drupal_install_schema('upload');
}
?>
Login or register to post comments