Replace sectors by job terms in profile and search (job and mentoring).
[platal.git] / upgrade / 1.0.1 / tokenize_job_terms.php
CommitLineData
468c1813
PC
1#!/usr/bin/php5
2<?php
3require_once 'connect.db.inc.php';
3ac45f10 4require_once 'class/jobterms.php';
468c1813
PC
5
6$globals->debug = 0; //do not store backtraces
7
8$terms = XDB::iterator('SELECT `jtid`, `name` FROM `profile_job_term_enum`');
9while ($term = $terms->next()) {
3ac45f10 10 $tokens = array_unique(JobTerms::tokenize($term['name']));
468c1813
PC
11 if (!count($tokens)) {
12 continue;
13 }
14 $values = array();
15 foreach ($tokens as $t) {
16 $values[] = '('.XDB::escape($t).','.XDB::escape($term['jtid']).')';
17 }
18 XDB::execute('INSERT IGNORE INTO `profile_job_term_search` (`search`,`jtid`) VALUES '.implode(',',$values));
19}
20
21/* vim:set et sw=4 sts=4 ts=4: */
22?>