| 1 |
<?php |
<?php |
| 2 |
// $Id: nodewords.install,v 1.18.2.6 2009/11/06 20:07:21 kiam Exp $ |
// $Id: nodewords.install,v 1.18.2.7 2009/11/07 21:16:59 kiam Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 237 |
* Implementation of hook_update_N(). |
* Implementation of hook_update_N(). |
| 238 |
*/ |
*/ |
| 239 |
function nodewords_update_6302() { |
function nodewords_update_6302() { |
| 240 |
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'nodewords\_basic\_user\_teaser\_%'"); |
$node_types = array_keys(node_get_types('names')); |
| 241 |
$ret = array(); |
$ret = array(); |
| 242 |
|
|
| 243 |
while ($row = db_fetch_object($result)) { |
foreach ($node_types as $node_type) { |
| 244 |
$variable = str_replace('nodewords_basic_user_', 'nodewords_basic_use_', $row->name); |
$value = variable_get('nodewords_basic_user_teaser_' . $node_type, NULL); |
| 245 |
|
if (isset($value)) { |
| 246 |
if (!db_result(db_query("SELECT 1 FROM {variable} WHERE name = '%s'", $variable))) { |
variable_set('nodewords_basic_use_teaser_' . $node_type, $value); |
|
$ret[] = update_sql( |
|
|
"UPDATE {variable} SET name = '" . |
|
|
$variable . "' WHERE name = '" . $row->name . "'" |
|
|
); |
|
| 247 |
} |
} |
| 248 |
} |
} |
| 249 |
|
|
| 250 |
|
$ret[] = array( |
| 251 |
|
'success' => TRUE, |
| 252 |
|
'query' => 'UPDATE MODULE SETTINGS', |
| 253 |
|
); |
| 254 |
|
|
| 255 |
return $ret; |
return $ret; |
| 256 |
} |
} |
| 257 |
|
|
| 259 |
* Implementation of hook_update_N(). |
* Implementation of hook_update_N(). |
| 260 |
*/ |
*/ |
| 261 |
function nodewords_update_6303() { |
function nodewords_update_6303() { |
| 262 |
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'nodewords\_basic_use\_teaser\_%'"); |
$node_types = array_keys(node_get_types('names')); |
| 263 |
$ret = array(); |
$ret = array(); |
| 264 |
|
|
| 265 |
$ret[] = update_sql("UPDATE {variable} SET name = 'nodewords_use_teaser' WHERE name = 'nodewords_basic_use_teaser'"); |
$value = variable_get('nodewords_basic_use_teaser', NULL); |
| 266 |
$ret[] = update_sql("UPDATE {variable} SET name = 'nodewords_use_alt_attribute' WHERE name = 'nodewords_basic_use_alt_attribute'"); |
if (isset($value)) { |
| 267 |
|
variable_set('nodewords_use_teaser', $value); |
| 268 |
|
} |
| 269 |
|
|
| 270 |
while ($row = db_fetch_object($result)) { |
$value = variable_get('nodewords_basic_use_alt_attribute', NULL); |
| 271 |
$variable = str_replace('nodewords_basic_use_', 'nodewords_use_', $row->name); |
if (isset($value)) { |
| 272 |
|
variable_set('nodewords_use_alt_attribute', $value); |
| 273 |
|
} |
| 274 |
|
|
| 275 |
if (!db_result(db_query("SELECT 1 FROM {variable} WHERE name = '%s'", $variable))) { |
foreach ($node_types as $node_type) { |
| 276 |
$ret[] = update_sql( |
$value = variable_get('nodewords_basic_use_teaser_' . $node_type, NULL); |
| 277 |
"UPDATE {variable} SET name = '" . |
if (isset($value)) { |
| 278 |
$variable . "' WHERE name = '" . $row->name . "'" |
variable_set('nodewords_use_teaser_' . $node_type, $value); |
|
); |
|
| 279 |
} |
} |
| 280 |
} |
} |
| 281 |
|
|
| 282 |
|
$ret[] = array( |
| 283 |
|
'success' => TRUE, |
| 284 |
|
'query' => 'UPDATE MODULE SETTINGS', |
| 285 |
|
); |
| 286 |
|
|
| 287 |
return $ret; |
return $ret; |
| 288 |
} |
} |
| 289 |
|
|