Mercurial > defr > drupal > core
annotate modules/php/php.install @ 1:c1f4ac30525a 6.0
Drupal 6.0
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:28:28 +0100 |
parents | |
children |
rev | line source |
---|---|
webmaster@1 | 1 <?php |
webmaster@1 | 2 // $Id: php.install,v 1.1 2007/04/24 10:54:34 dries Exp $ |
webmaster@1 | 3 |
webmaster@1 | 4 /** |
webmaster@1 | 5 * Implementation of hook_install(). |
webmaster@1 | 6 */ |
webmaster@1 | 7 function php_install() { |
webmaster@1 | 8 $format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_formats} WHERE name = 'PHP code'")); |
webmaster@1 | 9 // Add a PHP code input format, if it does not exist. Do this only for the |
webmaster@1 | 10 // first install (or if the format has been manually deleted) as there is no |
webmaster@1 | 11 // reliable method to identify the format in an uninstall hook or in |
webmaster@1 | 12 // subsequent clean installs. |
webmaster@1 | 13 if (!$format_exists) { |
webmaster@1 | 14 db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('PHP code', '', 0)"); |
webmaster@1 | 15 $format = db_result(db_query("SELECT MAX(format) FROM {filter_formats}")); |
webmaster@1 | 16 |
webmaster@1 | 17 // Enable the PHP evaluator filter. |
webmaster@1 | 18 db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format); |
webmaster@1 | 19 |
webmaster@1 | 20 drupal_set_message(t('A !php-code input format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filters/'. $format)))); |
webmaster@1 | 21 } |
webmaster@1 | 22 } |
webmaster@1 | 23 |
webmaster@1 | 24 /** |
webmaster@1 | 25 * Implementation of hook_disable(). |
webmaster@1 | 26 */ |
webmaster@1 | 27 function php_disable() { |
webmaster@1 | 28 drupal_set_message(t('The PHP module has been disabled. Please note that any existing content that was using the PHP filter will now be visible in plain text. This might pose a security risk by exposing sensitive information, if any, used in the PHP code.')); |
webmaster@1 | 29 } |