public function WordPressItemSource::computeCount in WordPress Migrate 7.2
Return a count of all available source records.
Overrides MigrateSourceXML::computeCount
File
- ./
wordpress_item.inc, line 82 - Support for migrating posts and pages from a WordPress blog into Drupal.
Class
- WordPressItemSource
- Implementation of MigrateSource, to handle migrating items from WordPress XML dumps.
Code
public function computeCount() {
$count = 0;
foreach ($this->sourceUrls as $url) {
$reader = new $this->readerClass($url, $this->elementQuery, $this->idQuery);
foreach ($reader as $element) {
// Only count relevant postType
$field = 'wp:post_type';
$post_type = current($element
->xpath($field));
if ($post_type == $this->postType) {
$count++;
}
}
}
return $count;
}