public function WebformSubmissionExportImportImporter::getTotal in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_submission_export_import/src/WebformSubmissionExportImportImporter.php \Drupal\webform_submission_export_import\WebformSubmissionExportImportImporter::getTotal()
Total number of submissions to be imported.
Return value
int The total number of submissions to be imported.
Overrides WebformSubmissionExportImportImporterInterface::getTotal
1 call to WebformSubmissionExportImportImporter::getTotal()
- WebformSubmissionExportImportImporter::requiresBatch in modules/
webform_submission_export_import/ src/ WebformSubmissionExportImportImporter.php - Determine if webform submissions must be imported using batch processing.
File
- modules/
webform_submission_export_import/ src/ WebformSubmissionExportImportImporter.php, line 989
Class
- WebformSubmissionExportImportImporter
- Webform submission export importer.
Namespace
Drupal\webform_submission_export_importCode
public function getTotal() {
if (isset($this->importTotal)) {
return $this->importTotal;
}
// Ignore the header.
$total = -1;
$handle = fopen($this->importUri, 'r');
while (!feof($handle)) {
$line = fgets($handle);
if (!empty(trim($line))) {
$total++;
}
}
$this->importTotal = $total;
return $this->importTotal;
}