Commit 6721bc58 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#166593 by hswong3i: move literal values out of some core queries to support...

#166593 by hswong3i: move literal values out of some core queries to support cross-database compatibility (ie. better SQL parsing and altering options)
parent 2f834f03
...@@ -70,7 +70,7 @@ function drupal_get_installed_schema_version($module, $reset = FALSE) { ...@@ -70,7 +70,7 @@ function drupal_get_installed_schema_version($module, $reset = FALSE) {
if (!$versions) { if (!$versions) {
$versions = array(); $versions = array();
$result = db_query("SELECT name, schema_version FROM {system} WHERE type = 'module'"); $result = db_query("SELECT name, schema_version FROM {system} WHERE type = '%s'", 'module');
while ($row = db_fetch_object($result)) { while ($row = db_fetch_object($result)) {
$versions[$row->name] = $row->schema_version; $versions[$row->name] = $row->schema_version;
} }
...@@ -312,7 +312,7 @@ function drupal_install_profile($profile, $module_list) { ...@@ -312,7 +312,7 @@ function drupal_install_profile($profile, $module_list) {
module_invoke('system', 'install'); module_invoke('system', 'install');
$system_versions = drupal_get_schema_versions('system'); $system_versions = drupal_get_schema_versions('system');
$system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', 'module', '', 1, 0, 0, %d)", $system_path .'/system.module', 'system', $system_version); db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path .'/system.module', 'system', 'module', '', 1, 0, 0, $system_version);
// Now that we've installed things properly, bootstrap the full Drupal environment // Now that we've installed things properly, bootstrap the full Drupal environment
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
......
...@@ -1443,7 +1443,7 @@ function _menu_navigation_links_rebuild($menu) { ...@@ -1443,7 +1443,7 @@ function _menu_navigation_links_rebuild($menu) {
array_multisort($sort, SORT_NUMERIC, $menu_links); array_multisort($sort, SORT_NUMERIC, $menu_links);
foreach ($menu_links as $item) { foreach ($menu_links as $item) {
$existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized FROM {menu_links} WHERE link_path = '%s' AND module = 'system'", $item['link_path'])); $existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['link_path'], 'system'));
if ($existing_item) { if ($existing_item) {
$item['mlid'] = $existing_item['mlid']; $item['mlid'] = $existing_item['mlid'];
$item['menu_name'] = $existing_item['menu_name']; $item['menu_name'] = $existing_item['menu_name'];
......
...@@ -242,10 +242,10 @@ function module_load_all_includes($type, $name = NULL) { ...@@ -242,10 +242,10 @@ function module_load_all_includes($type, $name = NULL) {
function module_enable($module_list) { function module_enable($module_list) {
$invoke_modules = array(); $invoke_modules = array();
foreach ($module_list as $module) { foreach ($module_list as $module) {
$existing = db_fetch_object(db_query("SELECT status FROM {system} WHERE type = 'module' AND name = '%s'", $module)); $existing = db_fetch_object(db_query("SELECT status FROM {system} WHERE type = '%s' AND name = '%s'", 'module', $module));
if ($existing->status == 0) { if ($existing->status == 0) {
module_load_install($module); module_load_install($module);
db_query("UPDATE {system} SET status = 1, throttle = 0 WHERE type = 'module' AND name = '%s'", $module); db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 1, 0, 'module', $module);
drupal_load('module', $module); drupal_load('module', $module);
$invoke_modules[] = $module; $invoke_modules[] = $module;
} }
...@@ -275,7 +275,7 @@ function module_disable($module_list) { ...@@ -275,7 +275,7 @@ function module_disable($module_list) {
if (module_exists($module)) { if (module_exists($module)) {
module_load_install($module); module_load_install($module);
module_invoke($module, 'disable'); module_invoke($module, 'disable');
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module' AND name = '%s'", $module); db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 0, 0, 'module', $module);
$invoke_modules[] = $module; $invoke_modules[] = $module;
} }
} }
......
...@@ -337,7 +337,7 @@ function list_themes($refresh = FALSE) { ...@@ -337,7 +337,7 @@ function list_themes($refresh = FALSE) {
if (empty($list)) { if (empty($list)) {
$list = array(); $list = array();
$result = db_query("SELECT * FROM {system} WHERE type = 'theme'"); $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'theme');
while ($theme = db_fetch_object($result)) { while ($theme = db_fetch_object($result)) {
if (file_exists($theme->filename)) { if (file_exists($theme->filename)) {
$theme->info = unserialize($theme->info); $theme->info = unserialize($theme->info);
...@@ -384,7 +384,7 @@ function list_theme_engines($refresh = FALSE) { ...@@ -384,7 +384,7 @@ function list_theme_engines($refresh = FALSE) {
if (!$list) { if (!$list) {
$list = array(); $list = array();
$result = db_query("SELECT * FROM {system} WHERE type = 'theme_engine' AND status = '1' ORDER BY name"); $result = db_query("SELECT * FROM {system} WHERE type = '%s' AND status = %d ORDER BY name", 'theme_engine', '1');
while ($engine = db_fetch_object($result)) { while ($engine = db_fetch_object($result)) {
if (file_exists($engine->filename)) { if (file_exists($engine->filename)) {
$engine->info = unserialize($engine->info); $engine->info = unserialize($engine->info);
......
...@@ -126,7 +126,7 @@ function install_main() { ...@@ -126,7 +126,7 @@ function install_main() {
*/ */
function install_verify_drupal() { function install_verify_drupal() {
// Read the variable manually using the @ so we don't trigger an error if it fails. // Read the variable manually using the @ so we don't trigger an error if it fails.
$result = @db_query("SELECT value FROM {variable} WHERE name = 'install_task'"); $result = @db_query("SELECT value FROM {variable} WHERE name = '%s'", 'install_task');
if ($result) { if ($result) {
return unserialize(db_result($result)); return unserialize(db_result($result));
} }
......
...@@ -1093,7 +1093,7 @@ function system_theme_data() { ...@@ -1093,7 +1093,7 @@ function system_theme_data() {
$engines = drupal_system_listing('\.engine$', 'themes/engines'); $engines = drupal_system_listing('\.engine$', 'themes/engines');
// Remove all theme engines from the system table // Remove all theme engines from the system table
db_query("DELETE FROM {system} WHERE type = 'theme_engine'"); db_query("DELETE FROM {system} WHERE type = '%s'", 'theme_engine');
foreach ($engines as $engine) { foreach ($engines as $engine) {
// Insert theme engine into system table // Insert theme engine into system table
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment