/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvArray()=' . count($csvArray) . ' - AFTER!');
$this->enqueueInFileStack($csvArray);
- // Debug message
+ // Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!');
}
*/
private function isCsvFileAdded () {
// Check whether the stacker is not empty
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
$isAdded = (($this->getStackSourceInstance()->isStackInitialized(self::STACK_NAME_CSV_FILE)) && (!$this->getStackSourceInstance()->isStackEmpty(self::STACK_NAME_CSV_FILE)));
// Return the result
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: isAdded=%d - EXIT!', intval($isAdded)));
return $isAdded;
}
*/
private function isCsvEntryAdded () {
// Check whether the stacker is not empty
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
$isAdded = (($this->getStackSourceInstance()->isStackInitialized(self::STACK_NAME_CSV_ENTRY)) && (!$this->getStackSourceInstance()->isStackEmpty(self::STACK_NAME_CSV_ENTRY)));
// Return the result
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: isAdded=%d - EXIT!', intval($isAdded)));
return $isAdded;
}
+ /**
+ * Checks wether lastCsvFileInstance has already been imported
+ *
+ * @return $isImported Whether lastCsvFileInstance has already been imported
+ */
+ private function isLastCsvFileImported () {
+ // Determine it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
+ $isImported = in_array($this->lastCsvFileInstance->getFileObject()->getBasename(), $this->csvFileImported);
+
+ // Return result
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: isImported=%d - EXIT!', intval($isImported)));
+ return $isImported;
+ }
+
/**
* Initializes the import of the CSV file which is being processed by other task
*
if (is_null($this->lastCsvFileInstance)) {
// This should not happen
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (in_array($this->lastCsvFileInstance->getFileObject()->getBasename(), $this->csvFileImported)) {
+ } elseif ($this->isLastCsvFileImported()) {
// Already stacked
return;
}
* @return void
*/
private function parseCsvFile () {
- // Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
-
// Get next entry
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
$csvFileInstance = $this->getStackSourceInstance()->popNamed(self::STACK_NAME_CSV_FILE);
// Read full "CSV line"
// Push array on next stack
$this->getStackSourceInstance()->pushNamed(self::STACK_NAME_CSV_ENTRY, $csvData);
- // Debug message
+ // Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!');
}
* @return void
*/
private function parseCsvEntry () {
- // Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
-
// Pop it from stack
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
$csvData = $this->getStackSourceInstance()->popNamed(self::STACK_NAME_CSV_ENTRY);
- // Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE));
-
// It must have a fixed amount of elements (see method parseCsvFile() for details)
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE));
assert(count($csvData) == self::CRAWL_ENTRY_SIZE);
// Save it in crawler queue (which will enrich it with way more informations
$this->saveCsvDataInCrawlerQueue($csvData);
- // Debug message
+ // Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!');
}