summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-11-28 09:45:47 +0000
committerDries Buytaert <dries@buytaert.net>2007-11-28 09:45:47 +0000
commit673aba159b039568b93b015c5c8b97a71ec530f6 (patch)
treef3c35650ba1f522252792d25a08b5bee5dc086a2 /modules/system
parent76ea0a9476cbdaa58e938b8a00cca579fb5f148c (diff)
downloadbrdo-673aba159b039568b93b015c5c8b97a71ec530f6.tar.gz
brdo-673aba159b039568b93b015c5c8b97a71ec530f6.tar.bz2
- Patch #194304 by Gabor: upgrade should only enable PHP module if necessary.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.install26
1 files changed, 7 insertions, 19 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 1f036b28f..7e48a8c7e 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -1784,31 +1784,19 @@ function system_update_6008() {
function system_update_6009() {
$ret = array();
- // Delete existing PHP filter and input format.
- $ret[] = update_sql("DELETE FROM {filter_formats} WHERE format = 2");
- $ret[] = update_sql("DELETE FROM {filters} WHERE format = 2");
-
- // Enable the PHP filter module.
- $ret[] = update_sql("UPDATE {system} SET status = 1 WHERE name = 'php' AND type = 'module'");
-
- // Add the PHP Code input format.
- $ret[] = update_sql("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('PHP code', '', 0)");
- $format = db_result(db_query("SELECT MAX(format) FROM {filter_formats}"));
-
- // Enable the PHP evaluator filter.
- db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format);
-
- // If any other input formats use the PHP evaluator, update them accordingly.
- $ret[] = update_sql("UPDATE {filters} SET delta = 0, module = 'php' WHERE module = 'filter' AND delta = 1");
+ // If any input format used the Drupal 5 PHP filter.
+ if (db_result(db_query("SELECT COUNT(format) FROM {filters} WHERE module = 'filter' AND delta = 1"))) {
+ // Enable the PHP filter module.
+ $ret[] = update_sql("UPDATE {system} SET status = 1 WHERE name = 'php' AND type = 'module'");
+ // Update the input filters.
+ $ret[] = update_sql("UPDATE {filters} SET delta = 0, module = 'php' WHERE module = 'filter' AND delta = 1");
+ }
// With the removal of the PHP evaluator filter, the deltas of the line break
// and URL filter have changed.
$ret[] = update_sql("UPDATE {filters} SET delta = 1 WHERE module = 'filter' AND delta = 2");
$ret[] = update_sql("UPDATE {filters} SET delta = 2 WHERE module = 'filter' AND delta = 3");
- // Update any nodes associated with the PHP input format.
- db_query("UPDATE {node_revisions} SET format = %d WHERE format = 2", $format);
-
return $ret;
}