1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- function tripal_create_files_dir($module_name, $path = FALSE) {
-
-
- if (!$path) {
-
- $data_dir = tripal_get_files_dir() . "/$module_name";
- if (!file_prepare_directory($data_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
- $message = "Cannot create directory $data_dir. This module may not " .
- "behave correctly without this directory. Please create " .
- "the directory manually or fix the problem and reinstall.";
- drupal_set_message(check_plain(t($message)), 'error');
- tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
- }
- }
- else {
-
-
- tripal_create_files_dir($module_name);
-
- $sub_dir = tripal_get_files_dir() . $module_name . $path;
- if (!file_prepare_directory($sub_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
- $message = "Cannot create directory $sub_dir. ";
- drupal_set_message(check_plain(t($message)), 'error');
- tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
- }
- }
- }
- function tripal_get_files_dir($module_name = FALSE) {
- $data_dir = variable_get('file_public_path', conf_path() . '/files/tripal');
- if ($module_name) {
- $data_dir .= "/$module_name";
- }
- return $data_dir;
- }
|