code/transform/QueuedExternalContentImporter.php
public function process() {
		$remainingChildren = $this->remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}

		$this->currentStep++;

		// lets process our first item
		$pair = array_shift($remainingChildren);
		$sourceObject = ExternalContent::getDataObjectFor($pair->sourceID);
		if (!$sourceObject) {
			$this->addMessage("Missing source object for " . $pair->sourceID, 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		$targetObject = DataObject::get_by_id($pair->targetType, $pair->targetID);
		if (!$targetObject) {
			$this->addMessage("Missing target object for $pair->targetType $pair->sourceID", 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		// lets do a single import first, then check the children and append them
		$pageType = $this->getExternalType($sourceObject);
		if (isset($this->contentTransforms[$pageType])) {
			$transformer = $this->contentTransforms[$pageType];

			$result = $transformer->transform($sourceObject, $targetObject, $this->duplicateStrategy);

			// if there's more, then transform them
			if ($this->includeChildren && $result && $result->children && count($result->children)) {
				foreach ($result->children as $child) {
					$remainingChildren[] = new EC_SourceTarget($child->ID, $result->page->ID, $result->page->ClassName);
					$this->totalSteps++;
				}
			}
		}

		$this->remainingChildren = $remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}
	}
public function process() {
		$remainingChildren = $this->remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}

		$this->currentStep++;

		// lets process our first item
		$pair = array_shift($remainingChildren);
		$sourceObject = ExternalContent::getDataObjectFor($pair->sourceID);
		if (!$sourceObject) {
			$this->addMessage("Missing source object for " . $pair->sourceID, 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		$targetObject = DataObject::get_by_id($pair->targetType, $pair->targetID);
		if (!$targetObject) {
			$this->addMessage("Missing target object for $pair->targetType $pair->sourceID", 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		// lets do a single import first, then check the children and append them
		$pageType = $this->getExternalType($sourceObject);
		if (isset($this->contentTransforms[$pageType])) {
			$transformer = $this->contentTransforms[$pageType];

			$result = $transformer->transform($sourceObject, $targetObject, $this->duplicateStrategy);

			// if there's more, then transform them
			if ($this->includeChildren && $result && $result->children && count($result->children)) {
				foreach ($result->children as $child) {
					$remainingChildren[] = new EC_SourceTarget($child->ID, $result->page->ID, $result->page->ClassName);
					$this->totalSteps++;
				}
			}
		}

		$this->remainingChildren = $remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}
	}
public function process ( ) { $ remainingChildren = $ this -> remainingChildren ; if ( ! count ( $ remainingChildren ) ) { $ this -> isComplete = true ; return ; } $ this -> currentStep ++ ; // lets process our first item $ pair = array_shift ( $ remainingChildren ) ; $ sourceObject = ExternalContent :: getDataObjectFor ( $ pair -> sourceID ) ; if ( ! $ sourceObject ) { $ this -> addMessage ( "Missing source object for " . $ pair -> sourceID , 'WARNING' ) ; $ this -> remainingChildren = $ remainingChildren ; return ; } $ targetObject = DataObject :: get_by_id ( $ pair -> targetType , $ pair -> targetID ) ; if ( ! $ targetObject ) { $ this -> addMessage ( "Missing target object for $pair->targetType $pair->sourceID" , 'WARNING' ) ; $ this -> remainingChildren = $ remainingChildren ; return ; } // lets do a single import first, then check the children and append them $ pageType = $ this -> getExternalType ( $ sourceObject ) ; if ( isset ( $ this -> contentTransforms [ $ pageType ] ) ) { $ transformer = $ this -> contentTransforms [ $ pageType ] ; $ result = $ transformer -> transform ( $ sourceObject , $ targetObject , $ this -> duplicateStrategy ) ; // if there's more, then transform them if ( $ this -> includeChildren && $ result && $ result -> children && count ( $ result -> children ) ) { foreach ( $ result -> children as $ child ) { $ remainingChildren [ ] = new EC_SourceTarget ( $ child -> ID , $ result -> page -> ID , $ result -> page -> ClassName ) ; $ this -> totalSteps ++ ; } } } $ this -> remainingChildren = $ remainingChildren ; if ( ! count ( $ remainingChildren ) ) { $ this -> isComplete = true ; return ; } }
Lets process a single node, and collect its children
Lets process a single node and collect its children