2 //index repositories in elasticsearch
7 . PATH_SEPARATOR . get_include_path()
11 $file = str_replace(array('\\', '_'), '/', $class) . '.php';
12 $hdl = @fopen($file, 'r', true);
19 require_once __DIR__ . '/../data/config.default.php';
20 if (file_exists(__DIR__ . '/../data/config.php')) {
21 require_once __DIR__ . '/../data/config.php';
23 if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
28 $r = new \HTTP_Request2(
29 'http://localhost:9200/phorkie/repo/_query',
30 \HTTP_Request2::METHOD_DELETE
35 'match_all' => (object)array()
40 $r = new \HTTP_Request2(
41 'http://localhost:9200/phorkie/file/_query',
42 \HTTP_Request2::METHOD_DELETE
47 'match_all' => (object)array()
54 $r = new \HTTP_Request2(
55 'http://localhost:9200/phorkie/file/_mapping',
56 \HTTP_Request2::METHOD_PUT
61 'file' => (object)array(
62 '_parent' => (object)array(
73 //FIXME: define schema
74 $rs = new Repositories();
75 foreach ($rs->getList(0, 10000) as $repo) {
76 $r = new \HTTP_Request2(
77 //FIXME: make configurable
78 'http://localhost:9200/phorkie/repo/' . $repo->id,
79 \HTTP_Request2::METHOD_PUT
85 'description' => $repo->getDescription(),
91 foreach ($repo->getFiles() as $file) {
92 $r = new \HTTP_Request2(
93 //FIXME: make configurable
94 'http://localhost:9200/phorkie/file/?parent=' . $repo->id,
95 \HTTP_Request2::METHOD_POST
100 'name' => $file->getFilename(),
101 'extension' => $file->getExt(),
102 'content' => $file->isText() ? $file->getContent() : '',