You are here

class WordPressAttachmentSource in WordPress Migrate 7.2

Same name and namespace in other branches
  1. 7 wordpress_attachment.inc \WordPressAttachmentSource

Override WordPressItemSource, to add additional fields for attachments.

Hierarchy

Expanded class hierarchy of WordPressAttachmentSource

File

./wordpress_attachment.inc, line 6

View source
class WordPressAttachmentSource extends WordPressItemSource {

  /**
   * List of additional source fields for attachments.
   *
   * @var array
   */
  protected $attachmentFields = array(
    'wp:attachment_url' => 'The URL of the attached file',
    '_wp_attached_file' => 'Local (to WordPress) filespec',
    '_wp_attachment_metadata' => 'Serialized metadata (image size etc.)',
  );

  /**
   * Simple initialization.
   *
   */
  public function __construct($filename, $cache_key) {
    parent::__construct($filename, 'attachment', $cache_key);
    $this->fields += $this->attachmentFields;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateSource::$activeMap protected property The MigrateMap class for the current migration.
MigrateSource::$activeMigration protected property The Migration class currently invoking us, during rewind() and next().
MigrateSource::$cacheCounts protected property Whether this instance should cache the source count.
MigrateSource::$cacheKey protected property Key to use for caching counts.
MigrateSource::$currentKey protected property The primary key of the current row
MigrateSource::$currentRow protected property The current row from the quey
MigrateSource::$highwaterField protected property Information on the highwater mark for the current migration, if any.
MigrateSource::$idList protected property List of source IDs to process.
MigrateSource::$mapRowAdded protected property By default, next() will directly read the map row and add it to the data row. A source plugin implementation may do this itself (in particular, the SQL source can incorporate the map table into the query) - if so, it should set this TRUE so we…
MigrateSource::$multikeySeparator protected property Used in the case of multiple key sources that need to use idlist.
MigrateSource::$numIgnored protected property Number of rows intentionally ignored (prepareRow() returned FALSE)
MigrateSource::$numProcessed protected property Number of rows we've at least looked at. 1
MigrateSource::$originalHighwater protected property The highwater mark at the beginning of the import operation.
MigrateSource::$skipCount protected property Whether this instance should not attempt to count the source.
MigrateSource::$trackChanges protected property If TRUE, we will maintain hashed source rows to determine whether incoming data has changed.
MigrateSource::count public function Return a count of available source records, from the cache if appropriate. Returns -1 if the source is not countable.
MigrateSource::current public function Implementation of Iterator::current() - called when entering a loop iteration, returning the current row
MigrateSource::dataChanged protected function Determine whether this row has changed, and therefore whether it should be processed.
MigrateSource::getCurrentKey public function
MigrateSource::getIgnored public function
MigrateSource::getProcessed public function
MigrateSource::key public function Implementation of Iterator::key - called when entering a loop iteration, returning the key of the current row. It must be a scalar - we will serialize to fulfill the requirement, but using getCurrentKey() is preferable.
MigrateSource::next public function Implementation of Iterator::next() - subclasses of MigrateSource should implement getNextRow() to retrieve the next valid source rocord to process.
MigrateSource::prepareRow protected function Give the calling migration a shot at manipulating, and possibly rejecting, the source row.
MigrateSource::resetStats public function Reset numIgnored back to 0.
MigrateSource::rewind public function Implementation of Iterator::rewind() - subclasses of MigrateSource should implement performRewind() to do any class-specific setup for iterating source records.
MigrateSource::valid public function Implementation of Iterator::valid() - called at the top of the loop, returning TRUE to process the loop and FALSE to terminate it
MigrateSourceXML::$activeUrl protected property Holds our current position within the $source_urls array
MigrateSourceXML::$elementQuery protected property Store the query string used to recognize elements being iterated so we can create reader objects on the fly.
MigrateSourceXML::$idQuery protected property Store the query string used to retrieve the primary key value from each element so we can create reader objects on the fly.
MigrateSourceXML::$namespaces protected property An array of namespaces to explicitly register before Xpath queries.
MigrateSourceXML::$reader protected property
MigrateSourceXML::$readerClass protected property Store the reader class used to query XML so we can create reader objects on the fly.
MigrateSourceXML::$sourceUrls protected property The source URLs to load XML from
MigrateSourceXML::activeUrl public function Returns the active Url.
MigrateSourceXML::getNextRow public function Implementation of MigrationSource::getNextRow().
MigrateSourceXML::getNextSource public function Advances the reader to the next source from source_urls.
MigrateSourceXML::getReader public function The MigrateXMLReader object serving as a cursor over the XML source.
MigrateSourceXML::hash protected function Generate a hash of the source row. Overrides MigrateSource::hash
MigrateSourceXML::performRewind public function Implementation of MigrateSource::performRewind().
MigrateSourceXML::registerNamespaces protected function Explicitly register namespaces on an XML element.
MigrateSourceXML::__toString public function Return a string representing the source query.
WordPressAttachmentSource::$attachmentFields protected property List of additional source fields for attachments.
WordPressAttachmentSource::__construct public function Simple initialization. Overrides WordPressItemSource::__construct
WordPressItemSource::$fields protected property List of available source fields. Overrides MigrateSourceXML::$fields
WordPressItemSource::$postType protected property The <wp:post_type> value we're looking for in this migration (post/page/attachment).
WordPressItemSource::computeCount public function Return a count of all available source records. Overrides MigrateSourceXML::computeCount
WordPressItemSource::fields public function Provides a list of available source fields, keyed by the field name as it appears in the source data, with descriptions as the values. Overrides MigrateSourceXML::fields