<?php !function_exists('adminmsg') && exit('Forbidden'); include_once R_P . "require/postindex.php"; $repliesArray = array('1000', '5000', '10000', '20000'); $postIndexDB = new PostIndexDB(); $postIndexDB->setPerpage(5); InitGP(array('sub'), 'G'); if (empty($sub)) { InitGP(array('replies', 'page'), 'GP'); if (empty($action) || $action == "search") { $threads = $postIndexDB->getALLIndexedThreads($page); } elseif ($action == "reset") { InitGP(array('tid', 'step', 's_step'), 'G'); !$step && ($step = 1); !$s_step && ($s_step = 1); $total = 2; if ($tid && $step <= $total) { $s_step = $postIndexDB->resetPostIndex($tid, $step, $s_step); $next = $s_step ? $step : $step + 1; } if ($next) { $j_url = "{$basename}&action=reset&step={$next}&s_step={$s_step}&tid={$tid}&page={$page}"; adminmsg('updatecache_total_step', EncodeUrl($j_url)); } else { $basename = "{$basename}&action=search&page={$page}"; adminmsg("operate_success"); } } elseif ($action == "delete") { InitGP(array('tids', 'step', 's_step'), 'GP'); !is_array($tids) && ($tids = explode(',', $tids));
/** * @param $tid * @param $postTable * @return unknown_type */ function addPostIndex($tid, $step) { $ptable = PostIndexDB::getPostTable($tid); $rt = $this->db->get_one("SELECT count(*) AS sum FROM {$ptable} p WHERE p.tid = " . S::sqlEscape($tid)); $count = $rt['sum']; !$step && ($step = 1); $next = $step + 1; $start = ($step - 1) * $this->p_c; $limit = S::sqlLimit($start, $this->p_c); $sql = "SELECT p.tid, p.pid, p.postdate, p.authorid\n\t\t\t\tFROM {$ptable} p\n\t\t\t\tWHERE p.tid = " . S::sqlEscape($tid) . " ORDER BY p.postdate {$limit}"; $query = $this->db->query($sql); while ($rt = $this->db->fetch_array($query)) { $f_data[] = array($rt["tid"], $rt["pid"]); } if (!empty($f_data)) { $this->db->update("REPLACE INTO pw_postsfloor(tid,pid) VALUES " . S::sqlMulti($f_data)); } $floor = $this->getMaxFloorByTid($tid); if ($count > $floor) { return $next; } else { #@cn0zz 添加索引完成后,才能修改帖子状态 //$sql = "UPDATE pw_threads SET tpcstatus = tpcstatus | 2 WHERE tid =".S::sqlEscape($tid); $sql = pwQuery::buildClause("UPDATE :pw_table SET tpcstatus = tpcstatus | 2 WHERE tid = :tid", array('pw_threads', $tid)); $this->db->update($sql); //* $threads = L::loadClass('Threads', 'forum'); //* $threads->delThreads($tid); return 0; } }