tripal_core.drush.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <?php
  2. /**
  3. * @file
  4. * Contains function relating to drush-integration of this module.
  5. */
  6. /**
  7. * @defgroup tripal_drush Tripal Drush Integration
  8. * @{
  9. * Contains function relating to drush-integration of various tripal modules.
  10. * @}
  11. */
  12. /**
  13. * Describes each drush command implemented by the module
  14. *
  15. * @return
  16. * The first line of description when executing the help for a given command
  17. *
  18. * @ingroup tripal_drush
  19. */
  20. function tripal_core_drush_help($command) {
  21. switch ($command) {
  22. // TRIPAL JOBS
  23. case 'trp-run-jobs':
  24. return dt('Launches pending jobs waiting in the queue.');
  25. break;
  26. case 'trp-rerun-job':
  27. return dt('Rerun a job in the queue.');
  28. break;
  29. case 'trp-get-currjob':
  30. return dt('Returns details about the currently running tripal job including percent complete.');
  31. break;
  32. // Placeholders for unimplmeneted jobs
  33. case 'trp-show-job':
  34. break;
  35. case 'trp-revert-jobs':
  36. break;
  37. case 'trp-cancel-job':
  38. break;
  39. case 'trp-list-jobs':
  40. break;
  41. // Deprecated functions
  42. case 'drush:tripal-launch-jobs':
  43. return dt('DEPRECATED. Please use: trp-run-jobs.');
  44. break;
  45. case 'drush:tripal-current-job':
  46. return dt('DEPRECATED. Please use: trp-get-currjob.');
  47. break;
  48. case 'drush:tripal-rerun-job':
  49. return dt('DEPRECATED. Please use: trp-rerun-job.');
  50. break;
  51. // Tripal Materialized Views
  52. case 'drush:tripal-update-mview':
  53. return dt('Updates the specified materialized view.');
  54. break;
  55. // Chado Specific
  56. case 'drush:tripal-chado-version':
  57. return dt('Returns the current version of chado associated with this drupal site.');
  58. break;
  59. case 'drush:tripal-chadotable-desc':
  60. return dt('Returns the table description as specified in the Tripal Schema API for the supplied table.');
  61. break;
  62. }
  63. }
  64. /**
  65. * Registers a drush command and constructs the full help for that command.
  66. *
  67. * @return
  68. * And array of command descriptions
  69. *
  70. * @ingroup tripal_drush
  71. */
  72. function tripal_core_drush_command() {
  73. $items = array();
  74. $items['trp-refresh-mview'] = array(
  75. 'description' => dt('Refreshes the contents of the specified materialized view.'),
  76. 'arguments' => array(),
  77. 'examples' => array(
  78. 'By Materialized View ID' => 'drush trp-refresh-mview --mview=5',
  79. 'By Table Name' => 'drush trp-refresh-mview --table=organism_feature_count'
  80. ),
  81. 'options' => array(
  82. 'mview' => dt('The ID of the materialized view to update'),
  83. 'table' => dt('The name of the materialized view table to update.'),
  84. ),
  85. );
  86. $items['trp-get-currjob'] = array(
  87. 'description' => dt('Returns details about the currently running job including percent complete.'),
  88. 'arguments' => array(),
  89. 'examples' => array(
  90. 'Standard example' => 'drush trp-get-currjob',
  91. ),
  92. );
  93. $items['trp-run-jobs'] = array(
  94. 'description' => dt('Launches jobs waiting in the queue. Only one job can execute at a time unless the --parllel=1 option is provided.'),
  95. 'examples' => array(
  96. 'Single Job' => 'drush trp-run-jobs --username=administrator',
  97. 'Parallel Job' => 'drush trp-run-jobs --username=administrator --parallel=1'
  98. ),
  99. 'arguments' => array(),
  100. 'options' => array(
  101. 'user' => array(
  102. 'description' => dt('DEPRECATED. Conflicts with Drush 7.x --user argument. Please use the --username argument.'),
  103. ),
  104. 'username' => array(
  105. 'description' => dt('The Drupal user name for which the job should be run. The permissions for this user will be used.'),
  106. ),
  107. 'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
  108. 'job_id' => dt('Provide a job_id to run a specific job. Only jobs that have not been run already can be used'),
  109. ),
  110. );
  111. $items['trp-rerun-job'] = array(
  112. 'description' => dt('Re-run a specific job from the queue.'),
  113. 'examples' => array(
  114. 'Single Job' => 'drush trp-rerun-job --username=administrator --job_id=2',
  115. 'Parallel Job' => 'drush trp-rerun-job --username=administrator --job_id=2 --parallel=1'
  116. ),
  117. 'arguments' => array(),
  118. 'options' => array(
  119. 'user' => array(
  120. 'description' => dt('DEPRECATED. Conflicts with Drush 7.x --user argument. Please use the --username argument.'),
  121. ),
  122. 'username' => array(
  123. 'description' => dt('The Drupal user name for which the job should be run. The permissions for this user will be used.'),
  124. ),
  125. 'job_id' => array(
  126. 'description' => dt('The job ID to run.'),
  127. 'required' => TRUE,
  128. ),
  129. 'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
  130. ),
  131. );
  132. $items['trp-get-cversion'] = array(
  133. 'description' => dt('Returns the current installed version of Chado.'),
  134. 'arguments' => array(),
  135. 'examples' => array(
  136. 'Standard Example' => 'drush trp-get-cversion',
  137. ),
  138. );
  139. $items['trp-get-table'] = array(
  140. 'description' => dt('Returns a table description in Drupal Schema API format.'),
  141. 'arguments' => array(),
  142. 'examples' => array(
  143. 'By Table Name' => 'drush trp-get-table --table=feature',
  144. 'By Section' => 'drush trp-get-table --table=feature --section=fields'
  145. ),
  146. 'options' => array(
  147. 'table' => array(
  148. 'description' => dt('The name of the table. The table can be a true Chado table or a custom Chado table.'),
  149. 'required' => TRUE,
  150. ),
  151. 'section' => dt('Only return the specified section of the schema array. Possible sections include: description, fields, primary key, unique keys, foreign keys, indexes, referring_tables.'),
  152. ),
  153. );
  154. $items['trp-clean-nodes'] = array(
  155. 'description' => dt('Removes orphaned Drupal nodes.'),
  156. 'arguments' => array(),
  157. 'examples' => array(
  158. 'Standard Example' => 'drush trp-clean-nodes table=feature'
  159. ),
  160. 'options' => array(
  161. 'table' => array(
  162. 'description' => dt('The name of the table that corresonds to the node type to ' .
  163. 'clean up. (e.g organism, feature, stock, library, analysis, pub, etc.)'),
  164. 'required' => TRUE,
  165. ),
  166. ),
  167. );
  168. // DEPRECATED COMMANDS. Deprecated as of Tripal v2.0-rc
  169. $items['tripal-mview-update'] = array(
  170. 'description' => dt('DEPRECATED. Please see: trp-refresh-mview.'),
  171. 'arguments' => array(),
  172. 'examples' => array(
  173. 'By Materialized View ID' => 'drush tripal-update-mview --mview_id=5',
  174. 'By Table Name' => 'drush tripal-update-mview --table_name=organism_feature_count'
  175. ),
  176. 'options' => array(
  177. 'mview_id' => dt('The ID of the materialized view to update'),
  178. 'table_name' => dt('The name of the materialized view table to update.'),
  179. ),
  180. 'aliases' => array('trpmv-up')
  181. );
  182. $items['tripal-jobs-current'] = array(
  183. 'description' => dt('DEPRECATED. Please see: trp-get-currjob.'),
  184. 'arguments' => array(),
  185. 'examples' => array(
  186. 'Standard example' => 'drush tripal-jobs-current',
  187. ),
  188. 'aliases' => array('trpjob-cur'),
  189. );
  190. $items['tripal-jobs-launch'] = array(
  191. 'description' => dt('DEPRECATED. Please see: trp-run-jobs. '),
  192. 'examples' => array(
  193. 'Normal Job' => 'drush tripal-jobs-launch admin',
  194. 'Parallel Job' => 'drush tripal-jobs-launch admin --parallel=1'
  195. ),
  196. 'arguments' => array(
  197. 'username' => dt('The Drupal username under which the job should be run. The permissions for this user will be used.'),
  198. ),
  199. 'options' => array(
  200. 'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
  201. 'job_id' => dt('Provide a job_id to run a specific job. Only jobs that have not been run already can be used'),
  202. ),
  203. 'aliases' => array('trpjob-run')
  204. );
  205. $items['tripal-jobs-rerun'] = array(
  206. 'description' => dt('DEPRECATED. Please see: trp-rerun-job. '),
  207. 'examples' => array(
  208. 'Normal Job' => 'drush tripal-jobs-rerun admin 2',
  209. 'Parallel Job' => 'drush tripal-jobs-rerun admin 2 --parallel=1'
  210. ),
  211. 'arguments' => array(
  212. 'username' => dt('The Drupal username under which the job should be run. The permissions for this user will be used.'),
  213. 'job_id' => dt('The job ID to run.'),
  214. ),
  215. 'options' => array(
  216. 'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
  217. ),
  218. 'aliases' => array('trpjob-rerun')
  219. );
  220. $items['tripal-chado-version'] = array(
  221. 'description' => dt('DEPRECATED. Please see: trp-get-cversion. '),
  222. 'arguments' => array(),
  223. 'examples' => array(
  224. 'Standard Example' => 'drush tripal-chado-version',
  225. ),
  226. 'aliases' => array('trpchado-ver')
  227. );
  228. $items['tripal-chadotable-desc'] = array(
  229. 'description' => dt('DEPRECATED. Please see: trp-get-table. '),
  230. 'arguments' => array(
  231. 'table_name' => dt('The name of the chado table.'),
  232. ),
  233. 'examples' => array(
  234. 'By Table Name' => 'drush tripal-chadotable-desc --table_name=feature'
  235. ),
  236. 'options' => array(
  237. 'section' => dt('Only return the specified section of the schema table description. Possible sections include: description, fields, primary key, unique keys, foreign keys, indexes, referring_tables.'),
  238. ),
  239. 'aliases' => array('trpschema-tbl')
  240. );
  241. $items['tripal-node-clean'] = array(
  242. 'description' => dt('DEPRECATED. Please see: trp-clean-nodes.'),
  243. 'arguments' => array(
  244. 'module' => dt('The name of the chado-centric module to clean-up.'),
  245. ),
  246. 'examples' => array(
  247. 'By Table Name' => 'drush tripal-node-clean feature'
  248. ),
  249. 'options' => array(),
  250. 'aliases' => array('trpnode-cln')
  251. );
  252. return $items;
  253. }
  254. /**
  255. * Set the user to run a drush job.
  256. *
  257. * @ingroup tripal_drush
  258. */
  259. function drush_tripal_core_set_user($username) {
  260. if ($username) {
  261. $sql = "SELECT uid FROM {users} WHERE name = :name";
  262. $results = db_query($sql, array(':name' => $username));
  263. $u = $results->fetchObject();
  264. if (!$u) {
  265. drush_print('ERROR: Please provide a valid username (--username argument) for running this job.');
  266. exit;
  267. }
  268. global $user;
  269. $user = user_load($u->uid);
  270. return $u->uid;
  271. }
  272. else {
  273. drush_print('ERROR: Please provide a username (--username argument) for running this job.');
  274. exit;
  275. }
  276. }
  277. /**
  278. * Executes jobs in the Tripal Jobs Queue.
  279. *
  280. * Executed when 'drush trp-run-job' is called.
  281. *
  282. * @ingroup tripal_drush
  283. */
  284. function drush_tripal_core_trp_run_jobs() {
  285. $parallel = drush_get_option('parallel');
  286. $job_id = drush_get_option('job_id');
  287. // Unfortunately later versions of Drush use the '--user' argument which
  288. // makes it incompatible with how Tripal was using it. For backwards
  289. // compatabiliy we will accept --user with a non numeric value only. The
  290. // numeric value should be for Drush. Tripal will instead use the
  291. // --username argument for the fture.
  292. $user = drush_get_option('user');
  293. $uname = drush_get_option('username');
  294. if ($user and is_numeric($user)) {
  295. }
  296. elseif ($user) {
  297. $username = $user;
  298. }
  299. if ($uname) {
  300. $username = $uname;
  301. }
  302. drush_tripal_core_set_user($username);
  303. if ($parallel) {
  304. drush_print("Tripal Job Launcher (in parallel)");
  305. drush_print("Running as user '$username'");
  306. drush_print("-------------------");
  307. tripal_launch_job($parallel, $job_id);
  308. }
  309. else {
  310. drush_print("Tripal Job Launcher");
  311. drush_print("Running as user '$username'");
  312. drush_print("-------------------");
  313. tripal_launch_job(0, $job_id);
  314. }
  315. }
  316. /**
  317. * DEPRECATED. Executes jobs in the Tripal Jobs Queue.
  318. *
  319. * Executed when drush 'trpjob-run' or 'drush tripal-launch-jobs' is called.
  320. *
  321. * @ingroup tripal_drush
  322. */
  323. function drush_tripal_core_tripal_jobs_launch($username) {
  324. $parallel = drush_get_option('parallel');
  325. $job_id = drush_get_option('job_id');
  326. drush_tripal_core_set_user($username);
  327. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  328. "continue to work but please consider using the 'trp-run-jobs' command.\n\n");
  329. if ($parallel) {
  330. drush_print("Tripal Job Launcher (in parallel)");
  331. drush_print("Running as user '$username'");
  332. drush_print("-------------------");
  333. tripal_launch_job($parallel, $job_id);
  334. }
  335. else {
  336. drush_print("Tripal Job Launcher");
  337. drush_print("Running as user '$username'");
  338. drush_print("-------------------");
  339. tripal_launch_job(0, $job_id);
  340. }
  341. }
  342. /**
  343. * Executes jobs in the Tripal Jobs Queue.
  344. *
  345. * Executed when 'drush trp-rerun-job' is called.
  346. *
  347. * @ingroup tripal_drush
  348. */
  349. function drush_tripal_core_trp_rerun_job() {
  350. // Unfortunately later versions of Drush use the '--user' argument which
  351. // makes it incompatible with how Tripal was using it. For backwards
  352. // compatabiliy we will accept --user with a non numeric value only. The
  353. // numeric value should be for Drush. Tripal will instead use the
  354. // --username argument for the fture.
  355. $user = drush_get_option('user');
  356. $uname = drush_get_option('username');
  357. print "USER: '$user', UNAME: '$uname'\n";
  358. if ($user and is_numeric($user)) {
  359. }
  360. elseif ($user) {
  361. $username = $user;
  362. }
  363. if ($uname) {
  364. $username = $uname;
  365. }
  366. $parallel = drush_get_option('parallel');
  367. $job_id = drush_get_option('job_id');
  368. drush_tripal_core_set_user($username);
  369. $new_job_id = tripal_rerun_job($job_id, FALSE);
  370. if ($parallel) {
  371. drush_print("Tripal Job Launcher (in parallel)");
  372. drush_print("Running as user '$username'");
  373. drush_print("-------------------");
  374. tripal_launch_job($parallel, $new_job_id);
  375. }
  376. else {
  377. drush_print("Tripal Job Launcher");
  378. drush_print("Running as user '$username'");
  379. drush_print("-------------------");
  380. tripal_launch_job(0, $new_job_id);
  381. }
  382. }
  383. /**
  384. * DEPRECATED. Executes jobs in the Tripal Jobs Queue.
  385. *
  386. * Executed when 'drush tripal-jobs-rerun' is called.
  387. *
  388. * @ingroup tripal_drush
  389. */
  390. function drush_tripal_core_tripal_jobs_rerun($username, $job_id) {
  391. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  392. "continue to work but please consider using the 'trp-rerun-job' command.\n\n");
  393. drush_tripal_core_set_user($username);
  394. $new_job_id = tripal_rerun_job($job_id, FALSE);
  395. drush_tripal_core_tripal_jobs_launch($username, $new_job_id);
  396. }
  397. /**
  398. * Prints details about the current running job.
  399. *
  400. * Executed when 'drush trp-get-currjob' is called.
  401. *
  402. * @ingroup tripal_drush
  403. */
  404. function drush_tripal_core_trp_get_currjob() {
  405. $sql = "
  406. SELECT *
  407. FROM {tripal_jobs} TJ
  408. WHERE TJ.end_time IS NULL and NOT TJ.start_time IS NULL
  409. ";
  410. $jobs = db_query($sql);
  411. foreach ($jobs as $job) {
  412. $job_pid = $job->pid;
  413. $output = "Name: " . $job->job_name . "\n" .
  414. "Submitted: " . date(DATE_RFC822, $job->submit_date) . "\n" .
  415. "Started: " . date(DATE_RFC822, $job->start_time) . "\n" .
  416. "Module: " . $job->modulename . "\n" .
  417. "Callback: " . $job->callback . "\n" .
  418. "Process ID: " . $job->pid . "\n" .
  419. "Progress: " . $job->progress . "%\n";
  420. drush_print($output);
  421. }
  422. if (!$job_pid) {
  423. drush_print('There are currently no running jobs.');
  424. }
  425. //log to the command line with an OK status
  426. drush_log('Running tripal-current-job', 'ok');
  427. }
  428. /**
  429. * DEPRECATED. Prints details about the current running job.
  430. *
  431. * Executed when 'drush trpjob-curr' or 'drush tripal-current-job' is called.
  432. *
  433. * @ingroup tripal_drush
  434. */
  435. function drush_tripal_core_tripal_jobs_current() {
  436. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  437. "continue to work but please consider using the 'trp-get-currjob' command.\n\n");
  438. drush_tripal_core_trp_get_currjob();
  439. }
  440. /**
  441. * Updates the specified materialized view
  442. *
  443. * @ingroup tripal_drush
  444. */
  445. function drush_tripal_core_trp_refresh_mview() {
  446. $mview_id = drush_get_option('mview');
  447. $table_name = drush_get_option('table');
  448. // Either table_name or mview is required
  449. if (!$mview_id) {
  450. if ($table_name) {
  451. // if table_name supplied use that to get mview_id
  452. $sql = "SELECT mview_id FROM {tripal_mviews} WHERE mv_table = :mv_table";
  453. $results = db_query($sql, array(':mv_table' => $table_name));
  454. $r = $resuls->fetchObject();
  455. if (!$r->mview_id) {
  456. drush_set_error('No Materialized View associated with that table_name.');
  457. }
  458. $mview_id=$r->mview_id;
  459. }
  460. else {
  461. drush_set_error('Plese provide one option of --mview or --table.');
  462. }
  463. }
  464. drush_print('Updating the Materialized View with ID=' . $mview_id);
  465. $status = tripal_populate_mview($mview_id);
  466. if ($status) {
  467. drush_log('Materialized View Updated', 'ok');
  468. }
  469. else {
  470. drush_set_error('Update failed.');
  471. }
  472. }
  473. /**
  474. * DEPRECATED. Updates the specified materialized view.
  475. *
  476. * @ingroup tripal_drush
  477. */
  478. function drush_tripal_core_tripal_update_mview() {
  479. $mview_id = drush_get_option('mview_id');
  480. $table_name = drush_get_option('table_name');
  481. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  482. "continue to work but please consider using the 'trp-refresh-mview' command.\n\n");
  483. // Either table_name or mview is required
  484. if (!$mview_id) {
  485. if ($table_name) {
  486. // if table_name supplied use that to get mview_id
  487. $sql = "SELECT mview_id FROM {tripal_mviews} WHERE mv_table = :mv_table";
  488. $results = db_query($sql, array(':mv_table' => $table_name));
  489. $r = $resuls->fetchObject();
  490. if (!$r->mview_id) {
  491. drush_set_error('No Materialized View associated with that table_name.');
  492. }
  493. $mview_id=$r->mview_id;
  494. }
  495. else {
  496. drush_set_error('Either mview_id OR table_name are required.');
  497. }
  498. }
  499. drush_print('Updating the Materialized View with ID=' . $mview_id);
  500. $status = tripal_populate_mview($mview_id);
  501. if ($status) {
  502. drush_log('Materialized View Updated', 'ok');
  503. }
  504. else {
  505. drush_set_error('Update failed.');
  506. }
  507. }
  508. /**
  509. * DEPRECATED. Returns the current version of chado.
  510. *
  511. * @ingroup tripal_drush
  512. */
  513. function drush_tripal_core_tripal_chado_version() {
  514. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  515. "continue to work but please consider using the 'trp-get-cversion' command.\n\n");
  516. drush_tripal_core_trp_get_cversion();
  517. }
  518. /**
  519. * Returns the current version of chado.
  520. *
  521. * @ingroup tripal_drush
  522. */
  523. function drush_tripal_core_trp_get_cversion() {
  524. $version = $GLOBALS["exact_chado_version"];
  525. drush_print('Current Chado Version: ' . $version);
  526. }
  527. /**
  528. * Returns the Tripal Schema API Description of the given table
  529. *
  530. * @ingroup tripal_drush
  531. */
  532. function drush_tripal_core_trp_get_table() {
  533. $section = drush_get_option('section');
  534. $table_name = drush_get_option('table');
  535. drush_print("Schema API Description for $table_name:");
  536. $desc = chado_get_schema($table_name);
  537. if (!empty($section)) {
  538. drush_print("$section = " . print_r($desc[$section], TRUE));
  539. }
  540. else {
  541. drush_print(print_r($desc, TRUE));
  542. }
  543. }
  544. /**
  545. * DEPRECATED. Returns the Tripal Schema API Description of the given table.
  546. *
  547. * @param $table_name
  548. * The name of the table to return the description of
  549. *
  550. * @ingroup tripal_drush
  551. */
  552. function drush_tripal_core_tripal_chadotable_desc($table_name) {
  553. $section = drush_get_option('section');
  554. drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
  555. "continue to work but please consider using the 'trp-get-table' command.\n\n");
  556. drush_print("Schema API Description for $table_name:");
  557. $desc = chado_get_schema($table_name);
  558. if (!empty($section)) {
  559. drush_print("$section = " . print_r($desc[$section], TRUE));
  560. }
  561. else {
  562. drush_print(print_r($desc, TRUE));
  563. }
  564. }
  565. /**
  566. * Clean-up orphaned Drupal nodes and chado records.
  567. *
  568. * @ingroup tripal_drush
  569. */
  570. function drush_tripal_core_trp_clean_nodes() {
  571. $table = drush_get_option('table');
  572. chado_cleanup_orphaned_nodes($table, 0);
  573. }
  574. /**
  575. * DEPRECATED. Clean-up orphaned Drupal nodes and chado records.
  576. *
  577. * @param $module
  578. * The name of a module with nodes associated with it. For example, feature
  579. *
  580. * @ingroup tripal_drush
  581. */
  582. function drush_tripal_core_tripal_node_clean($module) {
  583. chado_cleanup_orphaned_nodes($module, 0);
  584. }