function flipping_book_settings_form_submit in Flipping Book 7
Submit callback.
See also
1 string reference to 'flipping_book_settings_form_submit'
- flipping_book_settings_form in includes/
flipping_book.admin.inc - Flipping Book settings form.
File
- includes/
flipping_book.admin.inc, line 42 - Flipping Book Admin UI.
Code
function flipping_book_settings_form_submit($form, &$form_state) {
flipping_book_prepare_directory();
$items = db_select('flipping_book', 'f')
->fields('f', array(
'dir',
))
->execute()
->fetchCol();
$schema = variable_get('flipping_book_schema', 'public');
$old_schema = $schema == 'private' ? 'public' : 'private';
$source_dir = drupal_realpath("{$old_schema}://flipping_book");
$destination_dir = drupal_realpath("{$schema}://flipping_book");
foreach ($items as $item) {
$source = "{$source_dir}/{$item}";
if (file_exists($source)) {
$destination = "{$destination_dir}/{$item}";
file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
rename($source, $destination);
}
}
if (file_exists($source_dir)) {
rmdir($source_dir);
}
}