You are here

function print_pdf_update_7201 in Printer, email and PDF versions 7.2

Update pdf_tool variable to new module|path format.

File

print_pdf/print_pdf.install, line 260
Install, update and uninstall functions for the print_pdf module.

Code

function print_pdf_update_7201(&$sandbox) {
  $tool = explode('|', variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT));
  if (count($tool) == 1) {

    // Not an array yet, update variable to new format.
    if (preg_match('!dompdf_config.inc.php$!', $tool[0])) {
      $tool[0] = 'print_pdf_dompdf|' . $tool[0];
    }
    elseif (preg_match('!tcpdf.php$!', $tool[0])) {
      $tool[0] = 'print_pdf_tcpdf|' . $tool[0];
    }
    elseif (preg_match('!wkhtmltopdf!', $tool[0])) {
      $tool[0] = 'print_pdf_wkhtmltopdf|' . $tool[0];
    }
    else {
      $tool[0] = PRINT_PDF_PDF_TOOL_DEFAULT;
    }
    variable_set('print_pdf_pdf_tool', $tool[0]);
  }
}