* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseDht extends BaseHubSystem {
+ /**
+ * "Cached" instance of a publish helper
+ */
+ private $publishHelperInstance = NULL;
+
/**
* Stacker name for "INSERT" node data
*/
$isPending = ($this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_PENDING_PUBLISHING) === FALSE);
// Return status
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] isPending=' . intval($isPending));
return $isPending;
}
* corresponding dabase entry.
*
* @return void
+ * @todo Find out if loadDescriptorXml() can be called only once to avoid a lot methods working.
*/
public function publishEntry () {
- $this->partialStub('Unimplemented method.');
+ // This test must not fail
+ assert($this->hasEntriesPendingPublication());
+
+ // Is there an instance?
+ if (!$this->publishHelperInstance instanceof HelpableDht) {
+ // Get a helper instance
+ $this->publishHelperInstance = ObjectFactory::createObjectByConfiguredName('dht_publish_entry_helper_class');
+ } // END - if
+
+ // Load the announcement descriptor
+ $this->publishHelperInstance->loadDescriptorXml($this);
+
+ // Compile all variables
+ $this->publishHelperInstance->getTemplateInstance()->compileConfigInVariables();
+
+ // "Publish" the descriptor by sending it to the bootstrap/list nodes
+ $this->publishHelperInstance->sendPackage($this);
}
}