View source
<?php
require_once dirname(__FILE__) . '/answers.features.field.inc';
function answers_uninstall() {
variable_del('answers_new_answer_notice_subject');
variable_del('answers_new_answer_notice_body');
variable_del('answers_new_answer_notice_allow_p');
variable_del('answers_question_create_button_text');
variable_del('answers_question_edit_button_text');
variable_del('answers_answer_create_button_text');
variable_del('answers_answer_edit_button_text');
}
function answers_requirements($phase) {
if ($phase == 'runtime') {
$t = get_t();
$info = system_get_info('module', 'answers');
$requirements['answers'] = array(
'title' => $t('Answers'),
'value' => $info['version'],
'severity' => REQUIREMENT_OK,
);
$orphan_nids = _answers_orphan_nids();
$questions = node_load_multiple($orphan_nids);
$orphans = count($questions);
if ($orphans > 0) {
$d_options = array_merge(array(
'!count' => $orphans,
'@url' => url('admin/config/content/answers/orphan'),
), answers_translation());
$requirements['answers']['description'] = $t('!count <a href="@url">Orphaned</a> !answers', $d_options);
$requirements['answers']['severity'] = REQUIREMENT_WARNING;
}
return $requirements;
}
}
function answers_update_7200() {
$fields = answers_field_default_fields();
if (!field_info_field('field_question_locked_p')) {
$field = $fields['node-question-field_question_locked_p']['field_config'];
field_create_field($field);
}
if (!field_info_instance('node', 'field_question_locked_p', 'question')) {
$instance = $fields['node-question-field_question_locked_p']['field_instance'];
field_create_instance($instance);
}
return array();
}
function answers_update_7201() {
$result = db_query("SELECT * from {node} WHERE type = 'question';");
foreach ($result as $question) {
$question = node_load($question->nid);
$changed_p = FALSE;
if (isset($question->field_answer_count['und'][0]['count'])) {
$question->field_question_locked_p['und'][0]['count'] = 0;
$changed_p = TRUE;
}
if (isset($question->field_notify_p['und'][0]['value'])) {
$question->field_notify_p['und'][0]['value'] = 0;
$changed_p = TRUE;
}
if (isset($question->field_question_locked_p['und'][0]['value'])) {
$question->field_question_locked_p['und'][0]['value'] = 0;
$changed_p = TRUE;
}
if ($changed_p) {
watchdog('answers', 'Set default question fields for nid :nid', array(
':nid' => $question->nid,
));
node_save($question);
}
}
return array();
}
function answers_update_7300() {
watchdog('answers', 'Enable answers theming');
drupal_theme_rebuild();
return t('Enable answers theming.');
}
function answers_update_7304() {
drupal_flush_all_caches();
return array();
}