| @@ 23-62 (lines=40) @@ | ||
| 20 | /** |
|
| 21 | * A Search Engine slot handling CreateUserSignal. |
|
| 22 | */ |
|
| 23 | class CreateUser extends Slot |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * Receive the given $signal and react on it. |
|
| 27 | * |
|
| 28 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 29 | */ |
|
| 30 | public function receive(Signal $signal) |
|
| 31 | { |
|
| 32 | if (!$signal instanceof Signal\UserService\CreateUserSignal) { |
|
| 33 | return; |
|
| 34 | } |
|
| 35 | ||
| 36 | if (!$this->searchHandler instanceof Indexer) { |
|
| 37 | return; |
|
| 38 | } |
|
| 39 | ||
| 40 | $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( |
|
| 41 | $signal->userId |
|
| 42 | ); |
|
| 43 | ||
| 44 | if ($this->searchHandler instanceof ContentIndexer || $this->searchHandler instanceof FullTextIndexer) { |
|
| 45 | $this->searchHandler->indexContent( |
|
| 46 | $this->persistenceHandler->contentHandler()->load( |
|
| 47 | $userContentInfo->id, |
|
| 48 | $userContentInfo->currentVersionNo |
|
| 49 | ) |
|
| 50 | ); |
|
| 51 | } |
|
| 52 | ||
| 53 | if ($this->searchHandler instanceof LocationIndexer) { |
|
| 54 | $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( |
|
| 55 | $userContentInfo->id |
|
| 56 | ); |
|
| 57 | foreach ($locations as $location) { |
|
| 58 | $this->searchHandler->indexLocation($location); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 23-62 (lines=40) @@ | ||
| 20 | /** |
|
| 21 | * A Search Engine slot handling CreateUserGroupSignal. |
|
| 22 | */ |
|
| 23 | class CreateUserGroup extends Slot |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * Receive the given $signal and react on it. |
|
| 27 | * |
|
| 28 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 29 | */ |
|
| 30 | public function receive(Signal $signal) |
|
| 31 | { |
|
| 32 | if (!$signal instanceof Signal\UserService\CreateUserGroupSignal) { |
|
| 33 | return; |
|
| 34 | } |
|
| 35 | ||
| 36 | if (!$this->searchHandler instanceof Indexer) { |
|
| 37 | return; |
|
| 38 | } |
|
| 39 | ||
| 40 | $userGroupContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( |
|
| 41 | $signal->userGroupId |
|
| 42 | ); |
|
| 43 | ||
| 44 | if ($this->searchHandler instanceof ContentIndexer || $this->searchHandler instanceof FullTextIndexer) { |
|
| 45 | $this->searchHandler->indexContent( |
|
| 46 | $this->persistenceHandler->contentHandler()->load( |
|
| 47 | $userGroupContentInfo->id, |
|
| 48 | $userGroupContentInfo->currentVersionNo |
|
| 49 | ) |
|
| 50 | ); |
|
| 51 | } |
|
| 52 | ||
| 53 | if ($this->searchHandler instanceof LocationIndexer) { |
|
| 54 | $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent( |
|
| 55 | $userGroupContentInfo->id |
|
| 56 | ); |
|
| 57 | foreach ($locations as $location) { |
|
| 58 | $this->searchHandler->indexLocation($location); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 23-58 (lines=36) @@ | ||
| 20 | /** |
|
| 21 | * A Search Engine slot handling SetContentStateSignal. |
|
| 22 | */ |
|
| 23 | class SetContentState extends Slot |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * Receive the given $signal and react on it. |
|
| 27 | * |
|
| 28 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
|
| 29 | */ |
|
| 30 | public function receive(Signal $signal) |
|
| 31 | { |
|
| 32 | if (!$signal instanceof Signal\ObjectStateService\SetContentStateSignal) { |
|
| 33 | return; |
|
| 34 | } |
|
| 35 | ||
| 36 | if (!$this->searchHandler instanceof Indexer || $this->searchHandler instanceof FullTextIndexer) { |
|
| 37 | return; |
|
| 38 | } |
|
| 39 | ||
| 40 | $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($signal->contentId); |
|
| 41 | ||
| 42 | if ($this->searchHandler instanceof ContentIndexer) { |
|
| 43 | $this->searchHandler->indexContent( |
|
| 44 | $this->persistenceHandler->contentHandler()->load( |
|
| 45 | $contentInfo->id, |
|
| 46 | $contentInfo->currentVersionNo |
|
| 47 | ) |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | if ($this->searchHandler instanceof LocationIndexer) { |
|
| 52 | $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentInfo->id); |
|
| 53 | foreach ($locations as $location) { |
|
| 54 | $this->searchHandler->indexLocation($location); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||