student_files.install

This file handles the installation processes (like new db tables) for the student_files module.

File

modules/student_files/student_files.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * This file handles the installation processes (like new db tables) for the student_files module.
  5. */
  6. /**
  7. * Implementation of hook_install
  8. */
  9. function student_files_install() {
  10. $q = "
  11. CREATE TABLE `student_files` (
  12. `fid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  13. `student_id` varchar(30) DEFAULT '',
  14. `original_filename` varchar(255) DEFAULT '',
  15. `filepath` text DEFAULT '',
  16. `filename` varchar(255) DEFAULT '',
  17. `filetype` varchar(255) DEFAULT '',
  18. `access_type` varchar(20) DEFAULT '',
  19. `uploaded_by_uid` int(11) DEFAULT 0,
  20. `uploaded_by_cwid` varchar(30) DEFAULT '',
  21. `is_encrypted` int(10) unsigned DEFAULT 0,
  22. `posted` int(10) unsigned DEFAULT 0,
  23. PRIMARY KEY (`fid`),
  24. KEY `student_id` (`student_id`),
  25. KEY `uploaded_by_uid` (`uploaded_by_uid`),
  26. KEY `access_type` (`access_type`),
  27. KEY `posted` (`posted`)
  28. ); ";
  29. db_query($q);
  30. $files_path = $GLOBALS["fp_system_settings"]["file_system_path"];
  31. // Create the folder...
  32. if (!is_dir("$files_path/custom/files/student_files")) {
  33. if (!mkdir("$files_path/custom/files/student_files")) {
  34. fp_add_message(t("Student Files module: Problem creating /custom/files/student_files directory. Create manually,
  35. and ensure it is allowed to be written to by the system."), "error");
  36. }
  37. // Add to our variables.
  38. variable_set("student_files_path", "$files_path/custom/files/student_files");
  39. }
  40. }
  41. function student_files_update($old_schema, $new_schema) {
  42. if (intval($old_schema) < 2) {
  43. db_query("ALTER TABLE student_files MODIFY filepath LONGTEXT");
  44. fpm("Altered student_files table to change TEXT to LONGTEXT.");
  45. }
  46. }

Functions

Namesort descending Description
student_files_install Implementation of hook_install
student_files_update