blob: ea07e60a38544965e5b26911778723eaff3bddbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
//index repositories in elasticsearch
namespace phorkie;
require_once __DIR__ . '/../src/phorkie/autoload.php';
require_once __DIR__ . '/../data/config.default.php';
if (file_exists(__DIR__ . '/../data/config.php')) {
require_once __DIR__ . '/../data/config.php';
}
if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
SetupCheck::run();
}
$db = new Database();
if ($db->prefix == '\phorkie\Database_Adapter_Null') {
echo "Error: No search adapter configured.\n";
exit(1);
}
$idx = $db->getIndexer();
//create mapping
echo "Index reset\n";
$db->getSetup()->reset();
$rs = new Repositories();
list($repos, $count) = $rs->getList(0, 10000);
foreach ($repos as $repo) {
echo 'Indexing ' . $repo->id . "\n";
$commits = $repo->getHistory();
$first = count($commits)-1;
$idx->addRepo($repo, $commits[$first]->committerTime, $commits[0]->committerTime);
}
?>
|