forked from johsw/tagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall.php
41 lines (32 loc) · 917 Bytes
/
Install.php
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
38
39
40
<?php
/**
* @file
* Installer script.
*
* Called by itself this file will create the Tagger database tables.
* Called with the flag '-j' (json) it will fill the tables
* with data specified in the json files.
*/
require_once('Tagger.php');
require_once __ROOT__ . 'classes/TaggerInstaller.class.php';
$run_json = FALSE;
// If called from command line
if (php_sapi_name() == 'cli') {
$cargs = getopt('jf::');
if (isset($cargs['f'])) {
$file = $cargs['f'];
$tagger = Tagger::getTagger(array(), $file);
}
if (isset($cargs['j'])) {
$run_json = TRUE;
}
}
$tagger = Tagger::getTagger();
$install = new TaggerInstaller($tagger);
if ($run_json) {
require_once __ROOT__ . 'classes/JSONKeywordImporter.class.php';
$KI = new JSONKeywordImporter();
$KI->createKeywords('keywords.json');
$KI->createWordstats('keyword_texts.json');
$KI->createWordRelations('keyword_texts.json');
}