tripal_pub.DEPRECATED.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal analysis
  5. * api
  6. */
  7. /**
  8. * @deprecated Restructured API to make naming more readable and consistent.
  9. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  10. * now. This function has been replaced by tripal_search_publications().
  11. *
  12. * @see tripal_search_publications().
  13. */
  14. function pub_search($search_array, $offset, $limit, &$total_records) {
  15. tripal_report_error(
  16. 'tripal_deprecated',
  17. TRIPAL_NOTICE,
  18. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  19. [
  20. '%old_function' => 'pub_search',
  21. '%new_function' => 'tripal_search_pubs',
  22. ]
  23. );
  24. return tripal_search_publications($search_array, $offset, $limit, $total_records);
  25. }
  26. /**
  27. * @deprecated Restructured API to make naming more readable and consistent.
  28. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  29. * now. This function has been replaced by tripal_publication_exists().
  30. *
  31. * @see tripal_publication_exists().
  32. */
  33. function chado_does_pub_exist($pub_details) {
  34. tripal_report_error(
  35. 'tripal_deprecated',
  36. TRIPAL_NOTICE,
  37. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  38. [
  39. '%old_function' => 'chado_does_pub_exist',
  40. '%new_function' => 'tripal_publication_exists',
  41. ]
  42. );
  43. return tripal_publication_exists($pub_details);
  44. }
  45. /**
  46. * @deprecated Restructured API to make naming more readable and consistent.
  47. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  48. * now. This function has been replaced by tripal_get_remote_pubs().
  49. *
  50. * @see tripal_get_remote_pubs().
  51. */
  52. function tripal_pub_get_remote_search_results($remote_db, $search_array, $num_to_retrieve, $page = 0) {
  53. tripal_report_error(
  54. 'tripal_deprecated',
  55. TRIPAL_NOTICE,
  56. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  57. [
  58. '%old_function' => 'tripal_pub_get_remote_search_results',
  59. '%new_function' => 'tripal_get_remote_pubs',
  60. ]
  61. );
  62. return tripal_get_remote_pubs($remote_db, $search_array, $num_to_retrieve, $page);;
  63. }
  64. /**
  65. * @deprecated Restructured API to make naming more readable and consistent.
  66. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  67. * now. This function has been replaced by chado_get_remote_pub_record().
  68. *
  69. * @see chado_get_remote_pub_record().
  70. */
  71. function tripal_pub_get_raw_data($dbxref) {
  72. tripal_report_error(
  73. 'tripal_deprecated',
  74. TRIPAL_NOTICE,
  75. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  76. [
  77. '%old_function' => 'tripal_pub_get_raw_data',
  78. '%new_function' => 'chado_get_remote_pub_record',
  79. ]
  80. );
  81. return tripal_get_remote_pub($dbxref);
  82. }
  83. /**
  84. * @deprecated Restructured API to make naming more readable and consistent.
  85. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  86. * now. This function has been replaced by
  87. * chado_update_multiple_publications().
  88. *
  89. * @see chado_update_multiple_publications().
  90. */
  91. function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db = NULL) {
  92. tripal_report_error(
  93. 'tripal_deprecated',
  94. TRIPAL_NOTICE,
  95. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  96. [
  97. '%old_function' => 'tripal_pub_update_publications',
  98. '%new_function' => 'chado_reimport_publications',
  99. ]
  100. );
  101. return chado_reimport_publications($do_contact, $dbxref, $db);
  102. }
  103. /**
  104. * @deprecated Restructured API to make naming more readable and consistent.
  105. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  106. * now. This function has been replaced by
  107. * chado_import_multiple_publications().
  108. *
  109. * @see chado_import_multiple_publications().
  110. */
  111. function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL) {
  112. tripal_report_error(
  113. 'tripal_deprecated',
  114. TRIPAL_NOTICE,
  115. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  116. [
  117. '%old_function' => 'tripal_pub_import_publications_by_import_id',
  118. '%new_function' => 'chado_execute_pub_importer',
  119. ]
  120. );
  121. return chado_execute_pub_importer($import_id, TRUE, FALSE, $job_id);
  122. }
  123. /**
  124. * @deprecated Restructured API to make naming more readable and consistent.
  125. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  126. * now. This function has been replaced by
  127. * chado_import_multiple_publications().
  128. *
  129. * @see chado_import_multiple_publications().
  130. */
  131. function tripal_pub_import_publications($report_email = FALSE, $do_update = FALSE) {
  132. tripal_report_error(
  133. 'tripal_deprecated',
  134. TRIPAL_NOTICE,
  135. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  136. [
  137. '%old_function' => 'tripal_pub_import_publications',
  138. '%new_function' => 'tripal_execute_active_pub_importers',
  139. ]
  140. );
  141. return tripal_execute_active_pub_importers($report_email, $do_update);
  142. }
  143. /**
  144. * @deprecated Restructured API to make naming more readable and consistent.
  145. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  146. * now. This function has been replaced by
  147. * chado_import_multiple_publications().
  148. *
  149. * @see chado_import_multiple_publications().
  150. */
  151. function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_update) {
  152. tripal_report_error(
  153. 'tripal_deprecated',
  154. TRIPAL_NOTICE,
  155. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  156. [
  157. '%old_function' => 'tripal_pub_import_by_dbxref',
  158. '%new_function' => 'chado_import_multiple_publications',
  159. ]
  160. );
  161. return tripal_import_pub_by_dbxref($pub_dbxref, $do_contact, $do_udpate);
  162. }
  163. /**
  164. * @deprecated Restructured API to make naming more readable and consistent.
  165. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  166. * now. This function has been replaced by tripal_associate_dbxref().
  167. *
  168. * @see tripal_associate_dbxref().
  169. */
  170. function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
  171. tripal_report_error(
  172. 'tripal_deprecated',
  173. TRIPAL_NOTICE,
  174. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  175. [
  176. '%old_function' => 'tripal_pub_add_pub_dbxref',
  177. '%new_function' => 'tripal_associate_dbxref',
  178. ]
  179. );
  180. $dbxref = [];
  181. if (preg_match('/^(.*?):(.*?)$/', trim($pub_dbxref), $matches)) {
  182. $dbxref['db_name'] = $matches[1];
  183. $dbxref['accession'] = $matches[2];
  184. }
  185. return tripal_associate_dbxref('pub', $pub_id, $dbxref);
  186. }
  187. /**
  188. * @deprecated Restructured API to make naming more readable and consistent.
  189. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  190. * now. This function has been replaced by chado_get_publication().
  191. *
  192. * @see chado_get_publication().
  193. */
  194. function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
  195. tripal_report_error(
  196. 'tripal_deprecated',
  197. TRIPAL_NOTICE,
  198. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  199. [
  200. '%old_function' => 'tripal_pub_get_pubs_by_dbxref',
  201. '%new_function' => 'chado_get_publication',
  202. ]
  203. );
  204. $pub = chado_get_publication(['dbxref' => $pub_dbxref]);
  205. if ($pub) {
  206. // the original function returned an array of pub_ids
  207. return [$pub->pub_id];
  208. }
  209. else {
  210. return [];
  211. }
  212. }
  213. /**
  214. * @deprecated Restructured API to make naming more readable and consistent.
  215. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  216. * now. This function has been replaced by chado_get_publication().
  217. *
  218. * @see chado_get_publication().
  219. */
  220. function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) {
  221. tripal_report_error(
  222. 'tripal_deprecated',
  223. TRIPAL_NOTICE,
  224. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  225. [
  226. '%old_function' => 'tripal_pub_get_pubs_by_title_type_pyear_series',
  227. '%new_function' => 'chado_get_publication',
  228. ]
  229. );
  230. $pub_details = [
  231. 'Title' => $title,
  232. 'Year' => $pyear,
  233. 'Series Name' => $series_name,
  234. 'Publication Type' => $type,
  235. ];
  236. return chado_does_pub_exist($pub_details);
  237. }
  238. /**
  239. * @deprecated Restructured API to make naming more readable and consistent.
  240. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  241. * now. This function has been replaced by chado_get_publication().
  242. *
  243. * @see chado_get_publication().
  244. */
  245. function tripal_pub_get_pub_by_uniquename($uniquenname) {
  246. tripal_report_error(
  247. 'tripal_deprecated',
  248. TRIPAL_NOTICE,
  249. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  250. [
  251. '%old_function' => 'tripal_pub_get_pub_by_uniquename',
  252. '%new_function' => 'chado_get_publication',
  253. ]
  254. );
  255. $pub = chado_get_publication(['uniquename' => $uniquenname]);
  256. if ($pub) {
  257. // the original version of this function returned an array of matching pub_ids
  258. return [$pub->pub_id];
  259. }
  260. return [];
  261. }
  262. /**
  263. * @deprecated Restructured API to make naming more readable and consistent.
  264. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  265. * now. This function has been replaced by chado_get_property().
  266. *
  267. * @see chado_get_property().
  268. */
  269. function tripal_pub_get_property($pub_id, $property) {
  270. tripal_report_error(
  271. 'tripal_deprecated',
  272. TRIPAL_NOTICE,
  273. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  274. [
  275. '%old_function' => 'tripal_pub_get_property',
  276. '%new_function' => 'chado_get_property',
  277. ]
  278. );
  279. $record = [
  280. 'table' => 'pub',
  281. 'id' => $pub_id,
  282. ];
  283. $property = [
  284. 'type_name' => $property,
  285. 'cv_name' => 'tripal_pub',
  286. ];
  287. return chado_get_property($record, $property);
  288. }
  289. /**
  290. * @deprecated Restructured API to make naming more readable and consistent.
  291. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  292. * now. This function has been replaced by chado_insert_property().
  293. *
  294. * @see chado_insert_property().
  295. */
  296. function tripal_pub_insert_property($pub_id, $property, $value, $update_if_present = 0) {
  297. tripal_report_error(
  298. 'tripal_deprecated',
  299. TRIPAL_NOTICE,
  300. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  301. [
  302. '%old_function' => 'tripal_pub_insert_property',
  303. '%new_function' => 'chado_insert_property',
  304. ]
  305. );
  306. $record = [
  307. 'table' => 'pub',
  308. 'id' => $pub_id,
  309. ];
  310. $property = [
  311. 'type_name' => $property,
  312. 'cv_name' => 'tripal_pub',
  313. 'value' => $value,
  314. ];
  315. $options = [
  316. 'insert_if_missing' => $insert_if_missing,
  317. ];
  318. return chado_insert_property($record, $property, $options);
  319. }
  320. /**
  321. * @deprecated Restructured API to make naming more readable and consistent.
  322. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  323. * now. This function has been replaced by chado_update_property().
  324. *
  325. * @see chado_update_property().
  326. */
  327. function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missing = 0) {
  328. tripal_report_error(
  329. 'tripal_deprecated',
  330. TRIPAL_NOTICE,
  331. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  332. [
  333. '%old_function' => 'tripal_pub_update_property',
  334. '%new_function' => 'chado_update_property',
  335. ]
  336. );
  337. $record = [
  338. 'table' => 'pub',
  339. 'id' => $pub_id,
  340. ];
  341. $property = [
  342. 'type_name' => $property,
  343. 'cv_name' => 'tripal_pub',
  344. 'value' => $value,
  345. ];
  346. $options = [
  347. 'update_if_present' => $update_if_present,
  348. ];
  349. return chado_update_property($record, $property, $options);
  350. }
  351. /**
  352. * @deprecated Restructured API to make naming more readable and consistent.
  353. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  354. * now. This function has been replaced by chado_delete_property().
  355. *
  356. * @see chado_delete_property().
  357. */
  358. function tripal_pub_delete_property($pub_id, $property) {
  359. tripal_report_error(
  360. 'tripal_deprecated',
  361. TRIPAL_NOTICE,
  362. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  363. [
  364. '%old_function' => 'tripal_pub_delete_property',
  365. '%new_function' => 'chado_delete_property',
  366. ]
  367. );
  368. $record = [
  369. 'table' => 'pub',
  370. 'id' => $pub_id,
  371. ];
  372. $property = [
  373. 'type_name' => $property,
  374. 'cv_name' => 'tripal_pub',
  375. ];
  376. return chado_delete_property($record, $property);
  377. }