tripal_db.DEPRECATED.inc

  1. 2.x tripal_db/api/tripal_db.DEPRECATED.inc
  2. 3.x legacy/tripal_db/api/tripal_db.DEPRECATED.inc

Wrapper functions to provide backwards compatibility for the tripal db api

File

tripal_db/api/tripal_db.DEPRECATED.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal db api
  5. */
  6. /**
  7. * @deprecated Restructured API to make naming more readable and consistent.
  8. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  9. * This function has been replaced by tripal_get_db().
  10. *
  11. * @see tripal_get_db().
  12. */
  13. function tripal_db_get_db($select_values) {
  14. tripal_report_error(
  15. 'tripal_deprecated',
  16. TRIPAL_NOTICE,
  17. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  18. array(
  19. '%old_function'=>'tripal_db_get_db',
  20. '%new_function' => 'tripal_get_db'
  21. )
  22. );
  23. return tripal_get_db($select_values);
  24. }
  25. /**
  26. * @deprecated Restructured API to make naming more readable and consistent.
  27. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  28. * This function has been replaced by tripal_get_db().
  29. *
  30. * @see tripal_get_db().
  31. */
  32. function tripal_db_get_db_by_db_id($db_id) {
  33. tripal_report_error(
  34. 'tripal_deprecated',
  35. TRIPAL_NOTICE,
  36. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  37. array(
  38. '%old_function'=>'tripal_db_get_db_by_db_id',
  39. '%new_function' => 'tripal_get_db'
  40. )
  41. );
  42. return tripal_get_db(array('db_id' => $db_id));
  43. }
  44. /**
  45. * @deprecated Restructured API to make naming more readable and consistent.
  46. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  47. * This function has been replaced by tripal_get_db().
  48. *
  49. * @see tripal_get_db().
  50. */
  51. function tripal_db_get_db_by_name($name) {
  52. tripal_report_error(
  53. 'tripal_deprecated',
  54. TRIPAL_NOTICE,
  55. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  56. array(
  57. '%old_function'=>'tripal_db_get_db_by_name',
  58. '%new_function' => 'tripal_get_db'
  59. )
  60. );
  61. return tripal_get_db(array('name' => $name));
  62. }
  63. /**
  64. * @deprecated Restructured API to make naming more readable and consistent.
  65. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  66. * This function has been replaced by tripal_get_db_select_options().
  67. *
  68. * @see tripal_get_db_select_options().
  69. */
  70. function tripal_db_get_db_options() {
  71. tripal_report_error(
  72. 'tripal_deprecated',
  73. TRIPAL_NOTICE,
  74. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  75. array(
  76. '%old_function'=>'tripal_db_get_db_options',
  77. '%new_function' => 'tripal_get_db_select_options'
  78. )
  79. );
  80. return tripal_get_db_select_options();
  81. }
  82. /**
  83. * @deprecated Restructured API to make naming more readable and consistent.
  84. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  85. * This function has been replaced by tripal_get_db().
  86. *
  87. * @see tripal_get_dbxref().
  88. */
  89. function tripal_db_get_dbxref($select_values) {
  90. tripal_report_error(
  91. 'tripal_deprecated',
  92. TRIPAL_NOTICE,
  93. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  94. array(
  95. '%old_function'=>'tripal_db_get_dbxref',
  96. '%new_function' => 'tripal_get_dbxref'
  97. )
  98. );
  99. return tripal_get_dbxref($select_values);
  100. }
  101. /**
  102. * @deprecated Restructured API to make naming more readable and consistent.
  103. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  104. * This function has been replaced by tripal_get_db().
  105. *
  106. * @see tripal_get_dbxref().
  107. */
  108. function tripal_db_get_dbxref_by_accession($accession, $db_id=0) {
  109. tripal_report_error(
  110. 'tripal_deprecated',
  111. TRIPAL_NOTICE,
  112. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  113. array(
  114. '%old_function'=>'tripal_db_get_dbxref_by_accession',
  115. '%new_function' => 'tripal_get_dbxref'
  116. )
  117. );
  118. $identifiers = array(
  119. 'accession' => $accession
  120. );
  121. if ($db_id > 0) {
  122. $identifiers['db'] = array(
  123. 'db_id' => $db_id
  124. );
  125. }
  126. return tripal_get_dbxref($identifiers);
  127. }
  128. /**
  129. * @deprecated Restructured API to make naming more readable and consistent.
  130. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  131. * This function has been replaced by tripal_insert_db().
  132. *
  133. * @see tripal_insert_db().
  134. */
  135. function tripal_db_add_db($dbname, $description = '', $url = '', $urlprefix = '', $update = 0) {
  136. tripal_report_error(
  137. 'tripal_deprecated',
  138. TRIPAL_NOTICE,
  139. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  140. array(
  141. '%old_function'=>'tripal_db_add_db',
  142. '%new_function' => 'tripal_insert_db'
  143. )
  144. );
  145. return tripal_insert_db(
  146. array(
  147. 'name' => $dbname,
  148. 'description' => $description,
  149. 'url' => $url,
  150. 'urlprefix' => $urlprefix
  151. ),
  152. array(
  153. 'update_existing' => $update
  154. )
  155. );
  156. }
  157. /**
  158. * @deprecated Restructured API to make naming more readable and consistent.
  159. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  160. * This function has been replaced by tripal_insert_dbxref().
  161. *
  162. * @see tripal_insert_dbxref().
  163. */
  164. function tripal_db_add_dbxref($db_id, $accession, $version = '', $description = '') {
  165. tripal_report_error(
  166. 'tripal_deprecated',
  167. TRIPAL_NOTICE,
  168. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  169. array(
  170. '%old_function'=>'tripal_db_add_dbxref',
  171. '%new_function' => 'tripal_insert_dbxref'
  172. )
  173. );
  174. return tripal_insert_dbxref(array(
  175. 'db_id' => $db_id,
  176. 'accession' => $accession,
  177. 'version' => $version,
  178. 'description' => $description
  179. ));
  180. }
  181. /**
  182. * @deprecated Restructured API to make naming more readable and consistent.
  183. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  184. * This function has been replaced by tripal_associate_dbxref().
  185. *
  186. * @see tripal_associate_dbxref().
  187. */
  188. function tripal_db_add_dbxref_link($linking_table, $dbxref_id, $foreignkey_name, $foreignkey_id) {
  189. tripal_report_error(
  190. 'tripal_deprecated',
  191. TRIPAL_NOTICE,
  192. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  193. array(
  194. '%old_function'=>'tripal_db_add_dbxref_link',
  195. '%new_function' => 'tripal_associate_dbxref'
  196. )
  197. );
  198. if (preg_match('/(\w+)_dbxref/',$linking_table,$matches)) {
  199. $basetable = $matches[1];
  200. return tripal_associate_dbxref($basetable, $foreignkey_id, array('dbxref_id' => $dbxref_id));
  201. }
  202. else {
  203. return FALSE;
  204. }
  205. }