public function ReportFileSystem::__construct in Forena Reports 8
Constructor Sets the initial reort directory
Overrides FileSystemBase::__construct
1 method overrides ReportFileSystem::__construct()
- TestingReportFileSystem::__construct in tests/
src/ Unit/ Mock/ TestingReportFileSystem.php - Constructor Sets the initial reort directory
File
- src/
File/ ReportFileSystem.php, line 31
Class
Namespace
Drupal\forena\FileCode
public function __construct() {
parent::__construct();
//@TODO: Find out drupal languages
//$this->language = $language->language;
//$this->language = language_default();
// Load default directory from configuration.
$report_path = \Drupal::config('forena.settings')
->get('report_repos');
if (!$report_path) {
// @TODO: determine default file configuration.
$report_path = \Drupal::service('file_system')
->realpath('public://') . '/reports';
if (!file_exists($report_path)) {
@mkdir($report_path, 0777, TRUE);
}
}
$default_directory = rtrim($report_path, '/');
$this->dir = $default_directory;
// Load directories from module.forena.yml files
$providers = AppService::instance()
->getForenaProviders();
$directories = [];
foreach ($providers as $module_name => $provider) {
if (isset($provider['report directory'])) {
$directories[] = $provider['report directory'];
}
}
// Add directories form module hooks.
$directories += \Drupal::moduleHandler()
->invokeAll('forena_report_directory');
foreach ($directories as $dir) {
$this->includes[] = rtrim($dir, '/');
}
}