fgcf.drush.inc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * Fonctions de ligne de commande pour FGCF
  6. *
  7. * - importation de prestataires
  8. * - importation de fiches de formation
  9. *
  10. * Copyright 2010 Ouest Systemes Informatiques (OSInet)
  11. *
  12. * Licensed under the General Public License, version 2 or later
  13. */
  14. /**
  15. * Implements hook_drush_command().
  16. *
  17. * @return array
  18. */
  19. function fgcf_drush_command() {
  20. $items['fgcf-import-prestataires'] = array(
  21. // a short description of your command
  22. 'description' => "Importe des fiches de prestataires depuis un fichier",
  23. 'aliases' => array('fgcf-p'),
  24. );
  25. $items['fgcf-import-formations'] = array(
  26. // a short description of your command
  27. 'description' => "Importe des fiches de formation depuis un fichier",
  28. 'aliases' => array('fgcf-f'),
  29. );
  30. return $items;
  31. }
  32. /**
  33. * Implements hook_drush_help().
  34. *
  35. * @param string $section
  36. */
  37. function fgcf_drush_help($section) {
  38. $help = array(
  39. 'fgcf-import-prestataires' => dt('Importe toutes les fiches de prestataires trouvées dans le fichier passé en argument'),
  40. 'fgcf-import-formations' => dt('Importe toutes les fiches de formations trouvées dans le fichier passé en argument'),
  41. );
  42. $key = substr($section, strlen('drush:')); // drupal_substr() not available
  43. return array_key_exists($key, $help) ? $help[$key] : NULL;
  44. }
  45. /**
  46. * Command callback for fgcf-import-prestataire.
  47. *
  48. * @param string $filename
  49. */
  50. function drush_fgcf_import_prestataires($filename) {
  51. drush_print($filename);
  52. var_dump($GLOBALS);
  53. var_export(func_get_args());
  54. }