Permalink
Browse files

Fix JSON import/install

  • Loading branch information...
1 parent 4fe64ac commit dc2958c0a5927d002f62957bb864eb9fcde3c612 @malthejorgensen malthejorgensen committed Jul 19, 2012
Showing with 19 additions and 17 deletions.
  1. +11 −9 Install.php
  2. +8 −8 classes/JSONKeywordImporter.class.php
View
@@ -1,15 +1,17 @@
<?php
-
-require_once('Tagger.php');
-require_once __ROOT__ . 'classes/TaggerInstaller.class.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
@@ -32,8 +34,8 @@
if ($run_json) {
require_once __ROOT__ . 'classes/JSONKeywordImporter.class.php';
$KI = new JSONKeywordImporter();
- $KI->createKeywords(__ROOT__ . 'keywords.json');
- $KI->createWordstats(__ROOT__ . 'keyword_texts.json');
- $KI->createWordRelations(__ROOT__ . 'keyword_texts.json');
+ $KI->createKeywords('keywords.json');
+ $KI->createWordstats('keyword_texts.json');
+ $KI->createWordRelations('keyword_texts.json');
}
@@ -1,10 +1,10 @@
<?php
/**
* @file
- * Definition of JSONKeywordImporter.
+ * Contains JSONKeywordImporter.
*/
-require_once __ROOT__ . 'class/KeywordImporter.class.php';
+require_once __ROOT__ . 'classes/KeywordImporter.class.php';
/**
* KeywordImporter for JSON data.
@@ -19,10 +19,10 @@ class JSONKeywordImporter extends KeywordImporter {
* @param string $filename
* The JSON file that contains the list of keywords.
*/
- public function jsonCreateKeywords($filename = 'keywords.json') {
+ public function createKeywords($filename = 'keywords.json') {
$json = $this->jsonLoad($filename);
- $this->createKeywords($json);
+ parent::createKeywords($json);
}
/**
@@ -31,15 +31,15 @@ public function jsonCreateKeywords($filename = 'keywords.json') {
* @param string $filename
* The JSON file that contains the texts with assigned keywords.
*/
- public function jsonCreateWordstats($filename = 'keyword_texts.json') {
+ public function createWordstats($filename = 'keyword_texts.json') {
$json = $this->jsonLoad($filename);
$texts = array();
foreach($json as $tid => $keyword_texts) {
$texts = array_merge($texts, $keyword_texts);
}
- return $this->createWordstats($texts);
+ return parent::createWordstats($texts);
}
/**
@@ -48,10 +48,10 @@ public function jsonCreateWordstats($filename = 'keyword_texts.json') {
* @param string $filename
* The JSON file that contains the texts with assigned keywords.
*/
- public function jsonCreateWordRelations($filename = 'keyword_texts.json') {
+ public function createWordRelations($filename = 'keyword_texts.json') {
$json = $this->jsonLoad($filename);
- $this->createWordRelations($json);
+ parent::createWordRelations($json);
}

0 comments on commit dc2958c

Please sign in to comment.