File tree Expand file tree Collapse file tree 7 files changed +90
-2
lines changed
conduit/method/conduit/connect
search/index/indexer/user Expand file tree Collapse file tree 7 files changed +90
-2
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env php
2
+ <?php
3
+
4
+ /*
5
+ * Copyright 2011 Facebook, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ $ root = dirname (dirname (dirname (__FILE__ )));
21
+ require_once $ root .'/scripts/__init_script__.php ' ;
22
+ require_once $ root .'/scripts/__init_env__.php ' ;
23
+
24
+ $ users = id (new PhabricatorUser ())->loadAll ();
25
+ echo "Indexing " .count ($ users )." users " ;
26
+ foreach ($ users as $ user ) {
27
+ PhabricatorSearchUserIndexer::indexUser ($ user );
28
+ echo '. ' ;
29
+ }
30
+ echo "\n" ;
31
+ echo "Done. \n" ;
32
+
Original file line number Diff line number Diff line change 493
493
'PhabricatorSearchQuery ' => 'applications/search/storage/query ' ,
494
494
'PhabricatorSearchRelationship ' => 'applications/search/constants/relationship ' ,
495
495
'PhabricatorSearchSelectController ' => 'applications/search/controller/select ' ,
496
+ 'PhabricatorSearchUserIndexer ' => 'applications/search/index/indexer/user ' ,
496
497
'PhabricatorSetup ' => 'infrastructure/setup ' ,
497
498
'PhabricatorStandardPageView ' => 'view/page/standard ' ,
498
499
'PhabricatorStatusController ' => 'applications/status/base ' ,
951
952
'PhabricatorSearchMySQLExecutor ' => 'PhabricatorSearchExecutor ' ,
952
953
'PhabricatorSearchQuery ' => 'PhabricatorSearchDAO ' ,
953
954
'PhabricatorSearchSelectController ' => 'PhabricatorSearchController ' ,
955
+ 'PhabricatorSearchUserIndexer ' => 'PhabricatorSearchDocumentIndexer ' ,
954
956
'PhabricatorStandardPageView ' => 'AphrontPageView ' ,
955
957
'PhabricatorStatusController ' => 'PhabricatorController ' ,
956
958
'PhabricatorTaskmasterDaemon ' => 'PhabricatorDaemon ' ,
Original file line number Diff line number Diff line change 10
10
phutil_require_module ('phabricator ' , 'applications/conduit/protocol/exception ' );
11
11
phutil_require_module ('phabricator ' , 'applications/conduit/storage/connectionlog ' );
12
12
phutil_require_module ('phabricator ' , 'applications/people/storage/user ' );
13
- phutil_require_module ('phabricator ' , 'infrastructure/env ' );
14
13
15
14
phutil_require_module ('phutil ' , 'utils ' );
16
15
Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ public function save() {
79
79
if (!$ this ->conduitCertificate ) {
80
80
$ this ->conduitCertificate = $ this ->generateConduitCertificate ();
81
81
}
82
- return parent ::save ();
82
+ $ result = parent ::save ();
83
+
84
+ PhabricatorSearchUserIndexer::indexUser ($ this );
85
+
86
+ return $ result ;
83
87
}
84
88
85
89
private function generateConduitCertificate () {
Original file line number Diff line number Diff line change 11
11
phutil_require_module ('phabricator ' , 'applications/people/storage/preferences ' );
12
12
phutil_require_module ('phabricator ' , 'applications/phid/constants ' );
13
13
phutil_require_module ('phabricator ' , 'applications/phid/storage/phid ' );
14
+ phutil_require_module ('phabricator ' , 'applications/search/index/indexer/user ' );
14
15
phutil_require_module ('phabricator ' , 'infrastructure/env ' );
15
16
phutil_require_module ('phabricator ' , 'storage/queryfx ' );
16
17
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * Copyright 2011 Facebook, Inc.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ class PhabricatorSearchUserIndexer
20
+ extends PhabricatorSearchDocumentIndexer {
21
+
22
+ public static function indexUser (PhabricatorUser $ user ) {
23
+ $ doc = new PhabricatorSearchAbstractDocument ();
24
+ $ doc ->setPHID ($ user ->getPHID ());
25
+ $ doc ->setDocumentType (PhabricatorPHIDConstants::PHID_TYPE_USER );
26
+ $ doc ->setDocumentTitle ($ user ->getUserName ().'( ' .$ user ->getRealName ().') ' );
27
+ $ doc ->setDocumentCreated ($ user ->getDateCreated ());
28
+ $ doc ->setDocumentModified ($ user ->getDateModified ());
29
+
30
+ // TODO: Index the blurbs from their profile or something? Probably not
31
+ // actually useful...
32
+
33
+ PhabricatorSearchDocument::reindexAbstractDocument ($ doc );
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file is automatically generated. Lint this module to rebuild it.
4
+ * @generated
5
+ */
6
+
7
+
8
+
9
+ phutil_require_module ('phabricator ' , 'applications/phid/constants ' );
10
+ phutil_require_module ('phabricator ' , 'applications/search/index/abstractdocument ' );
11
+ phutil_require_module ('phabricator ' , 'applications/search/index/indexer/base ' );
12
+ phutil_require_module ('phabricator ' , 'applications/search/storage/document/document ' );
13
+
14
+
15
+ phutil_require_source ('PhabricatorSearchUserIndexer.php ' );
You can’t perform that action at this time.
0 commit comments