TripalImporter.inc 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. <?php
  2. class TripalImporter {
  3. // --------------------------------------------------------------------------
  4. // EDITABLE STATIC CONSTANTS
  5. //
  6. // The following constants SHOULD be set for each descendent class. They are
  7. // used by the static functions to provide information to Drupal about
  8. // the field and it's default widget and formatter.
  9. // --------------------------------------------------------------------------
  10. /**
  11. * The name of this loader. This name will be presented to the site
  12. * user.
  13. */
  14. public static $name = 'Tripal Loader';
  15. /**
  16. * The machine name for this loader. This name will be used to construct
  17. * the URL for the loader.
  18. */
  19. public static $machine_name = 'tripal_loader';
  20. /**
  21. * A brief description for this loader. This description will be
  22. * presented to the site user.
  23. */
  24. public static $description = 'A base loader for all Tripal loaders';
  25. /**
  26. * An array containing the extensions of allowed file types.
  27. */
  28. public static $file_types = [];
  29. /**
  30. * Provides information to the user about the file upload. Typically this
  31. * may include a description of the file types allowed.
  32. */
  33. public static $upload_description = '';
  34. /**
  35. * The title that should appear above the upload button.
  36. */
  37. public static $upload_title = 'File Upload';
  38. /**
  39. * If the loader should require an analysis record. To maintain provenance
  40. * we should always indicate where the data we are uploading comes from.
  41. * The method that Tripal attempts to use for this by associating upload files
  42. * with an analysis record. The analysis record provides the details for
  43. * how the file was created or obtained. Set this to FALSE if the loader
  44. * should not require an analysis when loading. if $use_analysis is set to
  45. * true then the form values will have an 'analysis_id' key in the $form_state
  46. * array on submitted forms.
  47. */
  48. public static $use_analysis = TRUE;
  49. /**
  50. * If the $use_analysis value is set above then this value indicates if the
  51. * analysis should be required.
  52. */
  53. public static $require_analysis = TRUE;
  54. /**
  55. * Text that should appear on the button at the bottom of the importer
  56. * form.
  57. */
  58. public static $button_text = 'Import File';
  59. /**
  60. * If the form submit button that is provided by the Importer is not
  61. * needed (i.e. the child class wants to do something different). Then
  62. * set this to FALSE.
  63. */
  64. public static $use_button = TRUE;
  65. /**
  66. * Indicates the methods that the file uploader will support.
  67. */
  68. public static $methods = [
  69. // Allow the user to upload a file to the server.
  70. 'file_upload' => TRUE,
  71. // Allow the user to provide the path on the Tripal server for the file.
  72. 'file_local' => TRUE,
  73. // Allow the user to provide a remote URL for the file.
  74. 'file_remote' => TRUE,
  75. ];
  76. /**
  77. * Indicates if the file must be provided. An example when it may not be
  78. * necessary to require that the user provide a file for uploading if the
  79. * loader keeps track of previous files and makes those available for
  80. * selection.
  81. */
  82. public static $file_required = TRUE;
  83. /**
  84. * The array of arguments used for this loader. Each argument should
  85. * be a separate array containing a machine_name, name, and description
  86. * keys. This information is used to build the help text for the loader.
  87. */
  88. public static $argument_list = [];
  89. /**
  90. * Indicates how many files are allowed to be uploaded. By default this is
  91. * set to allow only one file. Change to any positive number. A value of
  92. * zero indicates an unlimited number of uploaded files are allowed.
  93. */
  94. public static $cardinality = 1;
  95. /**
  96. * Be default, all loaders are automaticlly added to the Admin >
  97. * Tripal > Data Loaders menu. However, if this loader should be
  98. * made available via a different menu path, then set it here. If the
  99. * value is empty then the path will be the default.
  100. */
  101. public static $menu_path = '';
  102. /**
  103. * If your importer requires more flexibility and advanced features than
  104. * the TripalImporter provides, you can indicate a callback function. If set,
  105. * the callback will be used to provide the importer interface to the
  106. * end-user. However, because this bypasses the class infrastructure the
  107. * run() function will also not be available and your importer must be
  108. * fully self-sufficient outside of this class. The benefit for using a
  109. * TripalImporter despite your loader being self-sufficient is that Tripal
  110. * will treat your loader like all others providing a consistent location
  111. * in the menu and set of permissions.
  112. *
  113. * Note: use of a callback is discouraged as the importer provides a
  114. * consistent workflow for all importers. Try your best to fit your importer
  115. * within the class. Use this if you absolutely cannot fit your importer
  116. * into TripalImporter implementation.
  117. *
  118. */
  119. public static $callback = '';
  120. /**
  121. * The name of the module that provides the callback function.
  122. */
  123. public static $callback_module = '';
  124. /**
  125. * An include path for the callback function. Use a relative path within
  126. * this scope of this module
  127. * (e.g. includes/loaders/tripal_chado_pub_importers).
  128. */
  129. public static $callback_path = '';
  130. // --------------------------------------------------------------------------
  131. // PRIVATE MEMBERS -- DO NOT EDIT or OVERRIDE
  132. // --------------------------------------------------------------------------
  133. /**
  134. * The number of items that this importer needs to process. A progress
  135. * can be calculated by dividing the number of items process by this
  136. * number.
  137. */
  138. private $total_items;
  139. /**
  140. * The number of items that have been handled so far. This must never
  141. * be below 0 and never exceed $total_items;
  142. */
  143. private $num_handled;
  144. /**
  145. * The interval when the job progress should be updated. Updating the job
  146. * progress incurrs a database write which takes time and if it occurs to
  147. * frequently can slow down the loader. This should be a value between
  148. * 0 and 100 to indicate a percent interval (e.g. 1 means update the
  149. * progress every time the num_handled increases by 1%).
  150. */
  151. private $interval;
  152. /**
  153. * Each time the job progress is updated this variable gets set. It is
  154. * used to calculate if the $interval has passed for the next update.
  155. */
  156. private $prev_update;
  157. /**
  158. * The job that this importer is associated with. This is needed for
  159. * updating the status of the job.
  160. */
  161. protected $job;
  162. /**
  163. * The arguments needed for the importer. This is a list of key/value
  164. * pairs in an associative array.
  165. */
  166. protected $arguments;
  167. /**
  168. * The ID for this import record.
  169. */
  170. protected $import_id;
  171. /**
  172. * Prior to running an importer it must be prepared to make sure the file
  173. * is available. Preparing the importer will download all the necessary
  174. * files. This value is set to TRUE after the importer is prepared for
  175. * funning.
  176. */
  177. protected $is_prepared;
  178. /**
  179. * Stores the last percentage that progress was reported.
  180. *
  181. * @var integer
  182. */
  183. protected $reported = 0;
  184. // --------------------------------------------------------------------------
  185. // CONSTRUCTORS
  186. // --------------------------------------------------------------------------
  187. /**
  188. * Instantiates a new TripalImporter object.
  189. *
  190. * @param TripalJob $job
  191. * An optional TripalJob object that this loader is associated with.
  192. */
  193. public function __construct(TripalJob $job = NULL) {
  194. // Intialize the private member variables.
  195. $this->is_prepared = FALSE;
  196. $this->import_id = NULL;
  197. $this->arguments = [];
  198. $this->job = NULL;
  199. $this->total_items = 0;
  200. $this->interval = 1;
  201. $this->num_handled = 0;
  202. $this->prev_update = 0;
  203. }
  204. /**
  205. * Instantiates a new TripalImporter object using the import record ID.
  206. *
  207. * This function will automatically instantiate the correct TripalImporter
  208. * child class that is appropriate for the provided ID.
  209. *
  210. * @param $import_id
  211. * The ID of the import recrod.
  212. *
  213. * @return
  214. * An TripalImporter object of the appropriate child class.
  215. */
  216. static public function byID($import_id) {
  217. // Get the importer.
  218. $import = db_select('tripal_import', 'ti')
  219. ->fields('ti')
  220. ->condition('ti.import_id', $import_id)
  221. ->execute()
  222. ->fetchObject();
  223. if (!$import) {
  224. throw new Exception('Cannot find an importer that matches the given import ID.');
  225. }
  226. $class = $import->class;
  227. tripal_load_include_importer_class($class);
  228. if (class_exists($class)) {
  229. $loader = new $class();
  230. $loader->load($import_id);
  231. return $loader;
  232. }
  233. else {
  234. throw new Exception('Cannot find the matching class for this import record.');
  235. }
  236. }
  237. /**
  238. * Associate this importer with the Tripal job that is running it.
  239. *
  240. * Associating an import with a job will allow the importer to log messages
  241. * to the job log.
  242. *
  243. * @param TripalJob $job
  244. * An instance of a TripalJob.
  245. */
  246. public function setJob(TripalJob $job) {
  247. $this->job = $job;
  248. }
  249. /**
  250. * Creates a new importer record.
  251. *
  252. * @param $run_args
  253. * An associative array of the arguments needed to run the importer. Each
  254. * importer will have its own defined set of arguments.
  255. *
  256. * @param $file_details
  257. * An associative array with one of the following keys:
  258. * -fid: provides the Drupal managed File ID for the file.
  259. * -file_local: provides the full path to the file on the server.
  260. * -file_remote: provides the remote URL for the file.
  261. * This argument is optional if the loader does not use the built-in
  262. * file loader.
  263. *
  264. * @throws Exception
  265. */
  266. public function create($run_args, $file_details = []) {
  267. global $user;
  268. $class = get_called_class();
  269. try {
  270. // Build the values for the tripal_importer table insert.
  271. $values = [
  272. 'uid' => $user->uid,
  273. 'class' => $class,
  274. 'submit_date' => time(),
  275. ];
  276. // Build the arguments array, which consists of the run arguments
  277. // and the file.
  278. $arguments = [
  279. 'run_args' => $run_args,
  280. 'files' => [],
  281. ];
  282. // Get the file argument.
  283. $has_file = 0;
  284. if (array_key_exists('file_local', $file_details)) {
  285. $arguments['files'][] = [
  286. 'file_local' => $file_details['file_local'],
  287. 'file_path' => $file_details['file_local'],
  288. ];
  289. $has_file++;
  290. }
  291. if (array_key_exists('file_remote', $file_details)) {
  292. $arguments['files'][] = [
  293. 'file_remote' => $file_details['file_remote'],
  294. ];
  295. $has_file++;
  296. }
  297. if (array_key_exists('fid', $file_details)) {
  298. $values['fid'] = $file_details['fid'];
  299. // Handle multiple file uploads.
  300. if (preg_match('/\|/', $file_details['fid'])) {
  301. $fids = explode('|', $file_details['fid']);
  302. foreach ($fids as $fid) {
  303. $file = file_load($fid);
  304. $arguments['files'][] = [
  305. 'file_path' => drupal_realpath($file->uri),
  306. 'fid' => $fid,
  307. ];
  308. $has_file++;
  309. }
  310. }
  311. // Handle a single file.
  312. else {
  313. $fid = $file_details['fid'];
  314. $file = file_load($fid);
  315. $arguments['files'][] = [
  316. 'file_path' => drupal_realpath($file->uri),
  317. 'fid' => $fid,
  318. ];
  319. $has_file++;
  320. // For backwards compatibility add the old 'file' element.
  321. $arguments['file'] = [
  322. 'file_path' => drupal_realpath($file->uri),
  323. 'fid' => $fid,
  324. ];
  325. }
  326. }
  327. // Validate the $file_details argument.
  328. if ($has_file == 0 and $class::$file_required == TRUE) {
  329. throw new Exception("Must provide a proper file identifier for the \$file_details argument.");
  330. }
  331. // Store the arguments in the class and serialize for table insertion.
  332. $this->arguments = $arguments;
  333. $values['arguments'] = serialize($arguments);
  334. // Insert the importer record.
  335. $import_id = db_insert('tripal_import')
  336. ->fields($values)
  337. ->execute();
  338. $this->import_id = $import_id;
  339. } catch (Exception $e) {
  340. throw new Exception('Cannot create importer: ' . $e->getMessage());
  341. }
  342. }
  343. /**
  344. * Loads an existing import record into this object.
  345. *
  346. * @param $import_id
  347. * The ID of the import record.
  348. */
  349. public function load($import_id) {
  350. $class = get_called_class();
  351. // Get the importer.
  352. $import = db_select('tripal_import', 'ti')
  353. ->fields('ti')
  354. ->condition('ti.import_id', $import_id)
  355. ->execute()
  356. ->fetchObject();
  357. if (!$import) {
  358. throw new Exception('Cannot find an importer that matches the given import ID.');
  359. }
  360. if ($import->class != $class) {
  361. throw new Exception('The importer specified by the given ID does not match this importer class.');
  362. }
  363. $this->arguments = unserialize($import->arguments);
  364. $this->import_id = $import_id;
  365. }
  366. /**
  367. * Submits the importer for execution as a job.
  368. *
  369. * @return
  370. * The ID of the newly submitted job.
  371. */
  372. public function submitJob() {
  373. global $user;
  374. $class = get_called_class();
  375. if (!$this->import_id) {
  376. throw new Exception('Cannot submit an importer job without an import record. Please run create() first.');
  377. }
  378. // Add a job to run the importer.
  379. try {
  380. $args = [$this->import_id];
  381. $includes = [];
  382. $job_id = tripal_add_job($class::$button_text, 'tripal',
  383. 'tripal_run_importer', $args, $user->uid, 10, $includes);
  384. return $job_id;
  385. } catch (Exception $e) {
  386. throw new Exception('Cannot create importer job: ' . $e->getMessage());
  387. }
  388. }
  389. /**
  390. * Prepares the importer files for execution.
  391. *
  392. * This function must be run prior to the run() function to ensure that
  393. * the import file is ready to go.
  394. */
  395. public function prepareFiles() {
  396. $class = get_called_class();
  397. // If no file is required then just indicate that all is good to go.
  398. if ($class::$file_required == FALSE) {
  399. $this->is_prepared = TRUE;
  400. return;
  401. }
  402. try {
  403. for ($i = 0; $i < count($this->arguments['files']); $i++) {
  404. if (!empty($this->arguments['files'][$i]['file_remote'])) {
  405. $file_remote = $this->arguments['files'][$i]['file_remote'];
  406. $this->logMessage('Download file: !file_remote...', ['!file_remote' => $file_remote]);
  407. // If this file is compressed then keepthe .gz extension so we can
  408. // uncompress it.
  409. $ext = '';
  410. if (preg_match('/^(.*?)\.gz$/', $file_remote)) {
  411. $ext = '.gz';
  412. }
  413. // Create a temporary file.
  414. $temp = tempnam("temporary://", 'import_') . $ext;
  415. $this->logMessage("Saving as: !file", ['!file' => $temp]);
  416. $url_fh = fopen($file_remote, "r");
  417. $tmp_fh = fopen($temp, "w");
  418. if (!$url_fh) {
  419. throw new Exception(t("Unable to download the remote file at %url. Could a firewall be blocking outgoing connections?",
  420. ['%url', $file_remote]));
  421. }
  422. // Write the contents of the remote file to the temp file.
  423. while (!feof($url_fh)) {
  424. fwrite($tmp_fh, fread($url_fh, 255), 255);
  425. }
  426. // Set the path to the file for the importer to use.
  427. $this->arguments['files'][$i]['file_path'] = $temp;
  428. $this->is_prepared = TRUE;
  429. }
  430. // Is this file compressed? If so, then uncompress it
  431. $matches = [];
  432. if (preg_match('/^(.*?)\.gz$/', $this->arguments['files'][$i]['file_path'], $matches)) {
  433. $this->logMessage("Uncompressing: !file", ['!file' => $this->arguments['files'][$i]['file_path']]);
  434. $buffer_size = 4096;
  435. $new_file_path = $matches[1];
  436. $gzfile = gzopen($this->arguments['files'][$i]['file_path'], 'rb');
  437. $out_file = fopen($new_file_path, 'wb');
  438. if (!$out_file) {
  439. throw new Exception("Cannot uncompress file: new temporary file, '$new_file_path', cannot be created.");
  440. }
  441. // Keep repeating until the end of the input file
  442. while (!gzeof($gzfile)) {
  443. // Read buffer-size bytes
  444. // Both fwrite and gzread and binary-safe
  445. fwrite($out_file, gzread($gzfile, $buffer_size));
  446. }
  447. // Files are done, close files
  448. fclose($out_file);
  449. gzclose($gzfile);
  450. // Now remove the .gz file and reset the file_path to the new
  451. // uncompressed version.
  452. unlink($this->arguments['files'][$i]['file_path']);
  453. $this->arguments['files'][$i]['file_path'] = $new_file_path;
  454. }
  455. }
  456. } catch (Exception $e) {
  457. throw new Exception('Cannot prepare the importer: ' . $e->getMessage());
  458. }
  459. }
  460. /**
  461. * Cleans up any temporary files that were created by the prepareFile().
  462. *
  463. * This function should be called after a run() to remove any temporary
  464. * files and keep them from building up on the server.
  465. */
  466. public function cleanFile() {
  467. try {
  468. // If a remote file was downloaded then remove it.
  469. for ($i = 0; $i < count($this->arguments['files']); $i++) {
  470. if (!empty($this->arguments['files'][$i]['file_remote']) and
  471. file_exists($this->arguments['files'][$i]['file_path'])) {
  472. $this->logMessage('Removing downloaded file...');
  473. unlink($this->arguments['files'][$i]['file_path']);
  474. $this->is_prepared = FALSE;
  475. }
  476. }
  477. } catch (Exception $e) {
  478. throw new Exception('Cannot prepare the importer: ' . $e->getMessage());
  479. }
  480. }
  481. /**
  482. * Logs a message for the importer.
  483. *
  484. * There is no distinction between status messages and error logs. Any
  485. * message that is intended for the user to review the status of the loading
  486. * can be provided here. If this importer is associated with a job then
  487. * the logging is passed on to the job for storage.
  488. *
  489. * Messages that are are of severity TRIPAL_CRITICAL or TRIPAL_ERROR
  490. * are also logged to the watchdog.
  491. *
  492. * @param $message
  493. * The message to store in the log. Keep $message translatable by not
  494. * concatenating dynamic values into it! Variables in the message should
  495. * be added by using placeholder strings alongside the variables argument
  496. * to declare the value of the placeholders. See t() for documentation on
  497. * how $message and $variables interact.
  498. * @param $variables
  499. * Array of variables to replace in the message on display or NULL if
  500. * message is already translated or not possible to translate.
  501. * @param $severity
  502. * The severity of the message; one of the following values:
  503. * - TRIPAL_CRITICAL: Critical conditions.
  504. * - TRIPAL_ERROR: Error conditions.
  505. * - TRIPAL_WARNING: Warning conditions.
  506. * - TRIPAL_NOTICE: Normal but significant conditions.
  507. * - TRIPAL_INFO: (default) Informational messages.
  508. * - TRIPAL_DEBUG: Debug-level messages.
  509. */
  510. public function logMessage($message, $variables = [], $severity = TRIPAL_INFO) {
  511. // Generate a translated message.
  512. $tmessage = t($message, $variables);
  513. // If we have a job then pass along the messaging to the job.
  514. if ($this->job) {
  515. $this->job->logMessage($message, $variables, $severity);
  516. }
  517. // If we don't have a job then just use the drpual_set_message.
  518. else {
  519. // Report this message to watchdog or set a message.
  520. if ($severity == TRIPAL_CRITICAL or $severity == TRIPAL_ERROR) {
  521. drupal_set_message($tmessage, 'error');
  522. }
  523. if ($severity == TRIPAL_WARNING) {
  524. drupal_set_message($tmessage, 'warning');
  525. }
  526. }
  527. }
  528. /**
  529. * Sets the total number if items to be processed.
  530. *
  531. * This should typically be called near the beginning of the loading process
  532. * to indicate the number of items that must be processed.
  533. *
  534. * @param $total_items
  535. * The total number of items to process.
  536. */
  537. protected function setTotalItems($total_items) {
  538. $this->total_items = $total_items;
  539. }
  540. /**
  541. * Adds to the count of the total number of items that have been handled.
  542. *
  543. * @param $num_handled
  544. */
  545. protected function addItemsHandled($num_handled) {
  546. $items_handled = $this->num_handled = $this->num_handled + $num_handled;
  547. $this->setItemsHandled($items_handled);
  548. }
  549. /**
  550. * Sets the number of items that have been processed.
  551. *
  552. * This should be called anytime the loader wants to indicate how many
  553. * items have been processed. The amount of progress will be
  554. * calculated using this number. If the amount of items handled exceeds
  555. * the interval specified then the progress is reported to the user. If
  556. * this loader is associated with a job then the job progress is also updated.
  557. *
  558. * @param $total_handled
  559. * The total number of items that have been processed.
  560. */
  561. protected function setItemsHandled($total_handled) {
  562. // First set the number of items handled.
  563. $this->num_handled = $total_handled;
  564. if ($total_handled == 0) {
  565. $memory = number_format(memory_get_usage());
  566. print t("Percent complete: 0%. Memory: !memory bytes.", ['!memory' => $memory]) . "\r";
  567. return;
  568. }
  569. // Now see if we need to report to the user the percent done. A message
  570. // will be printed on the command-line if the job is run there.
  571. $percent = ($this->num_handled / $this->total_items) * 100;
  572. $ipercent = (int) $percent;
  573. // If we've reached our interval then print update info.
  574. if ($ipercent > 0 and $ipercent != $this->reported and $ipercent % $this->interval == 0) {
  575. $memory = number_format(memory_get_usage());
  576. $spercent = sprintf("%.2f", $percent);
  577. print t("Percent complete: !percent %. Memory: !memory bytes.",
  578. ['!percent' => $spercent, '!memory' => $memory]) . "\r";
  579. // If we have a job the update the job progress too.
  580. if ($this->job) {
  581. $this->job->setProgress($percent);
  582. }
  583. $this->reported = $ipercent;
  584. }
  585. }
  586. /**
  587. * Updates the percent interval when the job progress is updated.
  588. *
  589. * Updating the job progress incurrs a database write which takes time
  590. * and if it occurs to frequently can slow down the loader. This should
  591. * be a value between 0 and 100 to indicate a percent interval (e.g. 1
  592. * means update the progress every time the num_handled increases by 1%).
  593. *
  594. * @param $interval
  595. * A number between 0 and 100.
  596. */
  597. protected function setInterval($interval) {
  598. $this->interval = $interval;
  599. }
  600. // --------------------------------------------------------------------------
  601. // OVERRIDEABLE FUNCTIONS
  602. // --------------------------------------------------------------------------
  603. /**
  604. * Provides form elements to be added to the loader form.
  605. *
  606. * These form elements are added after the file uploader section that
  607. * is automaticaly provided by the TripalImporter.
  608. *
  609. * @return
  610. * A $form array.
  611. */
  612. public function form($form, &$form_state) {
  613. return $form;
  614. }
  615. /**
  616. * Handles submission of the form elements.
  617. *
  618. * The form elements provided in the implementation of the form() function
  619. * can be used for special submit if needed.
  620. */
  621. public function formSubmit($form, &$form_state) {
  622. }
  623. /**
  624. * Handles validation of the form elements.
  625. *
  626. * The form elements provided in the implementation of the form() function
  627. * should be validated using this function.
  628. */
  629. public function formValidate($form, &$form_state) {
  630. }
  631. /**
  632. * Performs the import.
  633. */
  634. public function run() {
  635. }
  636. /**
  637. * Performs the import.
  638. */
  639. public function postRun() {
  640. }
  641. /**
  642. * Retrieves the list of arguments that were provided to the importer.
  643. *
  644. * @return
  645. * The array of arguments as passed to create function.
  646. */
  647. public function getArguments() {
  648. return $this->arguments;
  649. }
  650. }