示例#1
0
 function processExternalLinks($source)
 {
     $eContentAttachmentLogEntry = new EContentAttachmentLogEntry();
     $eContentAttachmentLogEntry->dateStarted = time();
     $eContentAttachmentLogEntry->sourcePath = 'Attaching External links to ' . $source;
     $eContentAttachmentLogEntry->recordsProcessed = 0;
     $eContentAttachmentLogEntry->insert();
     //Get a list of all records that do not have items for the source
     $econtentRecord = new EContentRecord();
     $econtentRecord->source = $source;
     $econtentRecord->find();
     while ($econtentRecord->fetch()) {
         if ($econtentRecord->getNumItems() == 0 && $econtentRecord->sourceUrl != null && strlen($econtentRecord->sourceUrl) > 0) {
             $sourceUrl = $econtentRecord->sourceUrl;
             $econtentItem = new EContentItem();
             $econtentItem->recordId = $econtentRecord->id;
             $econtentItem->item_type = 'externalLink';
             $econtentItem->addedBy = 1;
             $econtentItem->date_added = time();
             $econtentItem->date_updated = time();
             $econtentItem->link = $sourceUrl;
             $econtentItem->insert();
             $eContentAttachmentLogEntry->recordsProcessed++;
             //Increase processing time since this can take awhile
             set_time_limit(30);
         }
     }
     $eContentAttachmentLogEntry->dateFinished = time();
     $eContentAttachmentLogEntry->status = 'finished';
     $eContentAttachmentLogEntry->update();
 }