tripal_pub.DEPRECATED.inc

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

Wrapper functions to provide backwards compatibility for the tripal analysis api

File

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