Remove obsolete code
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / search / AbstractSearchIndexManager.class.php
CommitLineData
b52f751b 1<?php
a9229942 2
b52f751b 3namespace wcf\system\search;
a9229942 4
b52f751b
AE
5use wcf\data\object\type\ObjectType;
6use wcf\data\object\type\ObjectTypeList;
7use wcf\system\SingletonFactory;
8use wcf\system\WCF;
9
10/**
11 * Default implementation for search index managers, this class should be extended by
12 * all search index managers to preserve compatibility in case of interface changes.
a9229942
TD
13 *
14 * @author Alexander Ebert
15 * @copyright 2001-2019 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
b52f751b 17 */
a9229942
TD
18abstract class AbstractSearchIndexManager extends SingletonFactory implements ISearchIndexManager
19{
a9229942
TD
20 /**
21 * @inheritDoc
22 */
23 public function createSearchIndices()
24 {
25 // get definition id
26 $sql = "SELECT definitionID
27 FROM wcf" . WCF_N . "_object_type_definition
28 WHERE definitionName = ?";
29 $statement = WCF::getDB()->prepareStatement($sql);
30 $statement->execute(['com.woltlab.wcf.searchableObjectType']);
31 $row = $statement->fetchArray();
32
33 $objectTypeList = new ObjectTypeList();
34 $objectTypeList->getConditionBuilder()->add("object_type.definitionID = ?", [$row['definitionID']]);
35 $objectTypeList->readObjects();
36
37 foreach ($objectTypeList as $objectType) {
38 $this->createSearchIndex($objectType);
39 }
40 }
41
42 /**
ddfd8566 43 * Creates the search index for given object type.
a9229942
TD
44 */
45 abstract protected function createSearchIndex(ObjectType $objectType);
46
47 /**
48 * @inheritDoc
49 */
50 public function beginBulkOperation()
51 {
52 // does nothing
53 }
54
55 /**
56 * @inheritDoc
57 */
58 public function commitBulkOperation()
59 {
60 // does nothing
61 }
b52f751b 62}