Tripal v1.0 (6.x-1.0)
Files API

Functions

 tripal_create_moddir ($module_name)
 tripal_get_moddir ($module_name)

Detailed Description

Provides an application programming interface (API) for managing files within the Tripal data directory structure.


Function Documentation

tripal_create_moddir ( module_name)

This function is typically used in the '.install' file for a Tripal module Each module should call this function during installation to create the module data directory which is sites/default/files/tripal/[module_name] for default Drupal settings. This directory can then be used by the module for storing files.

Parameters:
$module_namethe name of the module being installed.
Returns:
nothing

Definition at line 34 of file tripal_core_files.api.inc.

                                            {

  // make the data directory for this module
  $data_dir = file_directory_path() . "/tripal/$module_name";
  if (!file_check_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');
    watchdog('tripal_core', $message, array(), WATCHDOG_ERROR);
  }
}
tripal_get_moddir ( module_name)

Each Tripal module has a unique data directory which was creatd using the tripal_create_moddir function during installation. This function retrieves the directory path.

Parameters:
$module_nameThe name of the module
Returns:
The path within the Drupal installation where the data directory resides

Definition at line 60 of file tripal_core_files.api.inc.

                                         {
  $data_dir = file_directory_path() . "/tripal/$module_name";
  return $data_dir;
}
 All Classes Files Functions Variables