jabberwooki
8/8/2013 - 1:05 PM

migrate_sitra_requirements

function migrate_sitra_requirements($phase) {
	$requirements = array();
	if ($phase == 'install') {
		$t = get_t();
		// We need to create the sitra-exports directory to store export zip files generated by Sitra
		// and the sitra-imports directory to unarchive the zip file to be imported into Drupal.
		// If the creation is possible for one directory, it will be possible for the second one,
		// so we need to test only one.
		$exports_path = 'public://sitra-exports';
		if (!file_prepare_directory($exports_path, FILE_CREATE_DIRECTORY)) {
			$desc = $t('The Migrate Sitra directory %path1 could not be created. Please ensure that the webserver has permission to create directory.', file_uri_target($exports_path));
			$requirements['migrate_sitra_directories'] = array(
				'title' => $t('Migrate Sitra directories creation'),
				'description' => $desc,
				'severity' => REQUIREMENT_ERROR,
				'value' => $t('Unable to create directory'),
			);
		}
	}

	return $requirements;
}