diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-03-13 21:35:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-03-13 21:35:02 +0000 |
commit | d26f29bb67e93721691f186459393d9bfea5329f (patch) | |
tree | ef8bff37cb8d54eb35d06470997c543988e3cb07 /modules/php/php.install | |
parent | 38e5e907acadd70736fbb5bff2435ae4624b639f (diff) | |
download | brdo-d26f29bb67e93721691f186459393d9bfea5329f.tar.gz brdo-d26f29bb67e93721691f186459393d9bfea5329f.tar.bz2 |
- Patch #394512 by csevb10: converted to the new database abstraction layer.
Diffstat (limited to 'modules/php/php.install')
-rw-r--r-- | modules/php/php.install | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/php/php.install b/modules/php/php.install index e8641e7d9..e758391b6 100644 --- a/modules/php/php.install +++ b/modules/php/php.install @@ -5,17 +5,29 @@ * Implementation of hook_install(). */ function php_install() { - $format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_format} WHERE name = 'PHP code'")); + $format_exists = db_query("SELECT COUNT(*) FROM {filter_format} WHERE name = 'PHP code'")->fetchField(); // Add a PHP code text format, if it does not exist. Do this only for the // first install (or if the format has been manually deleted) as there is no // reliable method to identify the format in an uninstall hook or in // subsequent clean installs. if (!$format_exists) { - db_query("INSERT INTO {filter_format} (name, roles, cache) VALUES ('PHP code', '', 0)"); - $format = db_result(db_query("SELECT MAX(format) FROM {filter_format}")); + $format = db_insert('filter_format') + ->fields(array( + 'name' => 'PHP code', + 'roles' => '', + 'cache' => 0, + )) + ->execute(); // Enable the PHP evaluator filter. - db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format); + db_insert('filter') + ->fields(array( + 'format' => $format, + 'module' => 'php', + 'delta' => 0, + 'weight' => 0, + )) + ->execute(); drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filter/' . $format)))); } |