class AcsfDuplicationScrubNodeHandler in Acquia Cloud Site Factory Connector 8
Same name and namespace in other branches
- 8.2 src/Event/AcsfDuplicationScrubNodeHandler.php \Drupal\acsf\Event\AcsfDuplicationScrubNodeHandler
 
Handles the scrubbing of Drupal nodes.
Hierarchy
- class \Drupal\acsf\Event\AcsfEventHandler
- class \Drupal\acsf\Event\AcsfDuplicationScrubEntityHandler
- class \Drupal\acsf\Event\AcsfDuplicationScrubNodeHandler
 
 
 - class \Drupal\acsf\Event\AcsfDuplicationScrubEntityHandler
 
Expanded class hierarchy of AcsfDuplicationScrubNodeHandler
1 file declares its use of AcsfDuplicationScrubNodeHandler
- acsf_duplication.drush.inc in acsf_duplication/
acsf_duplication.drush.inc  - Provides drush commands necessary for site duplication.
 
File
- src/
Event/ AcsfDuplicationScrubNodeHandler.php, line 8  
Namespace
Drupal\acsf\EventView source
class AcsfDuplicationScrubNodeHandler extends AcsfDuplicationScrubEntityHandler {
  /**
   * Constructor.
   *
   * @param AcsfEvent $event
   *   The event that has been initiated.
   */
  public function __construct(AcsfEvent $event) {
    $this->entityTypeId = 'node';
    parent::__construct($event);
  }
  /**
   * Implements AcsfEventHandler::handle().
   */
  public function handle() {
    $options = $this->event->context['scrub_options'];
    if ($options['retain_content']) {
      // We still want to log that we were here.
      drush_print(dt('Entered @class', [
        '@class' => get_class($this),
      ]));
      return;
    }
    parent::handle();
  }
  /**
   * {@inheritdoc}
   */
  protected function getBaseQuery() {
    $entity_query = parent::getBaseQuery();
    $entity_query
      ->condition('uid', $this
      ->getPreservedUsers(), 'NOT IN');
    return $entity_query;
  }
  /**
   * {@inheritdoc}
   */
  protected function getPreservedUsers() {
    $preserved_uids = parent::getPreservedUsers();
    // Remove the anonymous user from the list, since we do want to delete that
    // content.
    if (($key = array_search(0, $preserved_uids)) !== FALSE) {
      unset($preserved_uids[$key]);
    }
    return $preserved_uids;
  }
}