You are here

function _pdfpreview_prepare_filesystem in PDFPreview 7.2

Same name and namespace in other branches
  1. 6 pdfpreview.module \_pdfpreview_prepare_filesystem()
  2. 7 pdfpreview.module \_pdfpreview_prepare_filesystem()

Prepare the file system for PDF preview image creation

This function is called after the module's setting form is submitted. It checks whether the target directory for preview images exists. If this is not the case, the directory will be created.

See also

_pdfpreview_admin_settings()

system_settings_form_submit()

1 string reference to '_pdfpreview_prepare_filesystem'
pdfpreview_admin in ./pdfpreview.module
Creates the module settings render array

File

./pdfpreview.module, line 389
This file contains hooks for the pdfpreview module

Code

function _pdfpreview_prepare_filesystem($form, &$form_state) {
  $output_uri = file_default_scheme() . '://' . $form['pdfpreview_pathtoimages']['#value'];
  if (!file_prepare_directory($output_uri, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    drupal_set_message(t('Error pepraring directory %dir', array(
      '%dir' => $output_uri,
    )), 'error');
    watchdog('pdfpreview', 'Error creating directory %dir', array(
      '%dir' => $output_uri,
    ), WATCHDOG_ERROR);
  }
}