protected function FeedImportSQLHashes::_update in Feed Import 8
Makes an update.
3 calls to FeedImportSQLHashes::_update()
- FeedImportSQLHashes::protect in feed_import_base/
src/ FeedImportSQLHashes.php - Protects a hash for updates
- FeedImportSQLHashes::update in feed_import_base/
src/ FeedImportSQLHashes.php - Updates hashes.
- FeedImportSQLHashes::updateCommit in feed_import_base/
src/ FeedImportSQLHashes.php - Commits the update to storage.
File
- feed_import_base/
src/ FeedImportSQLHashes.php, line 187
Class
- FeedImportSQLHashes
- This class implements SQL hash storage
Namespace
Drupal\feed_import_baseCode
protected function _update(array &$ids, $expire) {
$this->updateFormat['expire'] = $expire;
$this->update
->fields($this->updateFormat);
// Get update conditions.
$conditions =& $this->update
->conditions();
if (count($ids) <= $this->updateChunkSize) {
// Update hashes.
$this->update
->condition('id', $ids, 'IN')
->execute();
// Remove last IN condition.
array_pop($conditions);
// Clear array.
$ids = array();
}
else {
// Split ids in chunks.
$ids = array_chunk($ids, $this->updateChunkSize);
for ($i = 0, $m = count($ids); $i < $m; $i++) {
// Update hashes.
$this->update
->condition('id', $ids[$i], 'IN')
->execute();
unset($ids[$i]);
// Remove last IN condition.
array_pop($conditions);
}
}
}