37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
|
<?php
|
||
|
//sync seekspace data
|
||
|
error_reporting(E_ALL|E_STRICT);
|
||
|
ini_set('display_errors', 1);
|
||
|
date_default_timezone_set('Asia/Shanghai');
|
||
|
|
||
|
// directory setup and class loading
|
||
|
set_include_path('.' . PATH_SEPARATOR . '../include/'
|
||
|
. PATH_SEPARATOR . '../application/models'
|
||
|
. PATH_SEPARATOR . '../application/default/controllers'
|
||
|
. PATH_SEPARATOR . get_include_path());
|
||
|
include "Zend/Loader.php";
|
||
|
Zend_Loader::registerAutoload();
|
||
|
$config = new Zend_Config_Ini('config.ini', 'general');
|
||
|
$db = Zend_Db::factory($config->db);
|
||
|
Zend_Db_Table::setDefaultAdapter($db);
|
||
|
$sql="select item_id,title from knl_article";
|
||
|
$rs=$db->fetchAll($sql);
|
||
|
foreach($rs as $r)
|
||
|
{
|
||
|
$sql="select item_id,place,keyword from knl_keyword where item_id=?";
|
||
|
$rs1=$db->fetchAll($sql,array($r['item_id']));
|
||
|
foreach($rs1 as $r1)
|
||
|
{
|
||
|
$sql="update knl_article set keywords[?]=? where item_id=?";
|
||
|
$db->query($sql,array($r1['place'],$r1['keyword'],$r1['item_id']));
|
||
|
}
|
||
|
$sql="select item_id,place,author from knl_author where item_id=?";
|
||
|
$rs1=$db->fetchAll($sql,array($r['item_id']));
|
||
|
foreach($rs1 as $r1)
|
||
|
{
|
||
|
$sql="update knl_article set authors[?]=? where item_id=?";
|
||
|
$db->query($sql,array($r1['place'],$r1['author'],$r1['item_id']));
|
||
|
}
|
||
|
print $r['title']."...\n";
|
||
|
}
|
||
|
?>
|