tripal_pub.drush.inc 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * @file
  4. * Contains function relating to drush-integration of this module.
  5. */
  6. /**
  7. * Describes each drush command implemented by the module
  8. *
  9. * @return
  10. * The first line of description when executing the help for a given command
  11. *
  12. * @ingroup tripal_drush
  13. */
  14. function tripal_pub_drush_help($command) {
  15. switch ($command) {
  16. case 'drush:tripal-import-pubs':
  17. return dt('Imports publications from remote databases using saved configuration settings.');
  18. case 'drush:tripal-update-pubs':
  19. return dt('Updates publication information for publications with a supported database cross-reference.');
  20. }
  21. }
  22. /**
  23. * Registers a drush command and constructs the full help for that command
  24. *
  25. * @return
  26. * And array of command descriptions
  27. *
  28. * @ingroup tripal_drush
  29. */
  30. function tripal_pub_drush_command() {
  31. $items = [];
  32. // Deprecated commands
  33. $items['tripal-pubs-import'] = [
  34. 'description' => dt('DEPRECATED. Please see: trp-import-pubs.'),
  35. 'options' => [
  36. 'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
  37. 'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642).'),
  38. 'report' => dt("Set to the email address of the recipient who should receive an HTML report of the publications that have been added."),
  39. 'update' => dt("Set to 'Y' to update existing pubs. By default only new pubs are inserted."),
  40. ],
  41. 'examples' => [
  42. 'Standard example' => 'drush tripal-pubs-import',
  43. 'Standard example' => 'drush -l http://[site url] tripal-pubs-import --report=[email]. Where [site url] is the URL of the website and [email] is the email address of the recipient to receive the HTML report',
  44. 'Import single publication' => 'drush tripal-pub-import --dbxref=PMID:23582642',
  45. ],
  46. 'aliases' => ['tpubs-import'],
  47. ];
  48. $items['tripal-pubs-update'] = [
  49. 'description' => dt('DEPRECATED. Please see: trp-update-pubs.'),
  50. 'options' => [
  51. 'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
  52. 'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642)'),
  53. 'db' => dt('The database name (e.g. PMID or AGL)'),
  54. ],
  55. 'examples' => [
  56. 'Standard example' => 'drush tripal-pubs-update',
  57. 'Create contacts during update' => 'drush tripal-pubs-update --create_contacts=1',
  58. 'Update a single record' => 'drush tripal-pubs-update --dbxref=PMID:23582642',
  59. 'Update all records for a single database' => 'drush tripal-pubs-update --db=PMID',
  60. ],
  61. 'aliases' => ['tpubs-update'],
  62. ];
  63. return $items;
  64. }
  65. /**
  66. * DEPRECATED. Imports publications into Chado
  67. *
  68. * @ingroup tripal_drush
  69. */
  70. function drush_tripal_pub_tripal_pubs_import() {
  71. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
  72. "continue to work but please consider using the 'trp-import-pubs' command.\n\n");
  73. drush_tripal_pub_trp_import_pubs();
  74. }
  75. /**
  76. * DEPRECATED. Imports publications into Chado
  77. *
  78. * @ingroup tripal_drush
  79. */
  80. function drush_tripal_pub_tripal_pubs_update() {
  81. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
  82. "continue to work but please consider using the 'trp-update-pubs' command.\n\n");
  83. drush_tripal_pub_trp_update_pubs();
  84. }