Set cache folder for dompdf
Overview
The cache folder for dompdf isn't set so cache files are created in the font folder (vendor/dompdf/dompdf/lib/fonts
). This is messy and can cause issues if you deploy the codebase via git or if you mount the codebase in a read only volume.
For example after creating a PDF letter via the UI, you will see the following untracked files in git:
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Helvetica-Bold.afm.json
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Helvetica-Bold.afm.php
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Helvetica.afm.json
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Helvetica.afm.php
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Times-Bold.afm.json
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Times-Roman.afm.json
src/drupal/sites/all/modules/civicrm/vendor/dompdf/dompdf/lib/fonts/Times-Roman.afm.php
Current behaviour
The cache folder for dompdf isn't set so cache files are created in the font folder.
Proposed behaviour
CiviCRM defines the cache folder for dompdf that is outside of the codebase. Files are not generated within the codebase which keeps the codebase tidier and means that the codebase can be mounted read only.