function print_pdf_update_6007 in Printer, email and PDF versions 5.4
Same name and namespace in other branches
- 6 print_pdf/print_pdf.install \print_pdf_update_6007()
- 5.x print_pdf/print_pdf.install \print_pdf_update_6007()
Update to version 5.x-4.10
File
- print_pdf/
print_pdf.install, line 209 - Install file of the print_pdf module
Code
function print_pdf_update_6007() {
$ret = array();
foreach (node_get_types() as $key => $value) {
$print_pdf_display = variable_get('print_pdf_display_' . $value->type, 1);
$print_pdf_display_comment = variable_get('print_pdf_display_comment_' . $value->type, 0);
$print_pdf_display_urllist = variable_get('print_pdf_display_urllist_' . $value->type, 1);
if (!$print_pdf_display || $print_pdf_display_comment || !$print_pdf_display_urllist) {
$result = db_query("SELECT n.nid, link, comments, url_list from {node} AS n LEFT JOIN {print_pdf_node_conf} AS pnc ON n.nid = pnc.nid WHERE type = '%s'", $value->type);
while ($conf = db_fetch_object($result)) {
if ($conf->link != NULL && $conf->comments != NULL && $conf->url_list != NULL) {
$conf->link = !$print_pdf_display ? 0 : $conf->link;
$conf->comments = $print_pdf_display_comment ? 1 : $conf->comments;
$conf->url_list = !$print_pdf_display_urllist ? 0 : $conf->url_list;
$ret[] = update_sql("UPDATE {print_pdf_node_conf} SET link = {$conf->link}, comments = {$conf->comments}, url_list = {$conf->url_list} WHERE nid = {$conf->nid}");
}
else {
$ret[] = update_sql("INSERT INTO {print_pdf_node_conf} (nid, link, comments, url_list) VALUES ({$conf->nid}, {$print_pdf_display}, {$print_pdf_display_comment}, {$print_pdf_display_urllist})");
}
}
}
}
return $ret;
}