Esempio n. 1
0
                if ($count) {
                    $query = DB::query("SELECT tid FROM " . DB::table($table) . " WHERE posttableid='0' AND displayorder>='0' ORDER BY lastpost LIMIT 0, 1000");
                    movedate($query);
                }
                if ($tableindex + 1 < count($threadtableids)) {
                    $tableindex++;
                    $status = gettablestatus(DB::table(getposttable($targettableid)), false);
                    $targetsize = $sourcesize + $movesize * 1048576;
                    $nowdatasize = $targetsize - $status['Data_length'];
                    cpmsg('postsplit_doing', 'action=postsplit&operation=movepost&fromtable=' . $tableid . '&movesize=' . $movesize . '&targettable=' . $targettableid . '&hash=' . $hash . '&tindex=' . $tableindex, 'loadingform', array('datalength' => sizecount($status['Data_length']), 'nowdatalength' => sizecount($nowdatasize)));
                }
            } else {
                $count = DB::result_first("SELECT count(*) FROM " . DB::table(getposttable($fromtableid)) . " WHERE `first`='1'");
                if ($count) {
                    $query = DB::query("SELECT tid FROM " . DB::table(getposttable($fromtableid)) . " WHERE `first`='1' LIMIT 0, 1000");
                    movedate($query);
                } else {
                    cpmsg('postsplit_done', 'action=postsplit&operation=optimize&tableid=' . $fromtableid, 'form');
                }
            }
        }
    } else {
        cpmsg('postsplit_abnormal', 'action=postsplit', 'succeed');
    }
} elseif ($operation == 'optimize') {
    if (!$_G['setting']['bbclosed']) {
        cpmsg('postsplit_forum_must_be_closed', 'action=postsplit&operation=manage', 'error');
    }
    $fromtableid = intval($_G['gp_tableid']);
    $optimize = true;
    $tablename = getposttable($fromtableid);
Esempio n. 2
0
                        $tids[$tid] = $tid;
                    }
                    movedate($tids);
                }
                if ($tableindex + 1 < count($threadtableids)) {
                    $tableindex++;
                    $status = helper_dbtool::gettablestatus(getposttable($targettableid, true), false);
                    $targetsize = $sourcesize + $movesize * 1048576;
                    $nowdatasize = $targetsize - $status['Data_length'];
                    cpmsg('postsplit_doing', 'action=postsplit&operation=movepost&fromtable=' . $tableid . '&movesize=' . $movesize . '&targettable=' . $targettableid . '&hash=' . $hash . '&tindex=' . $tableindex, 'loadingform', array('datalength' => sizecount($status['Data_length']), 'nowdatalength' => sizecount($nowdatasize)));
                }
            } else {
                $count = C::t('forum_post')->count_by_first($fromtableid, 1);
                if ($count) {
                    $tids = C::t('forum_post')->fetch_all_tid_by_first($fromtableid, 1, 0, 1000);
                    movedate($tids);
                } else {
                    cpmsg('postsplit_done', 'action=postsplit&operation=optimize&tableid=' . $fromtableid, 'form');
                }
            }
        }
    } else {
        cpmsg('postsplit_abnormal', 'action=postsplit', 'succeed');
    }
} elseif ($operation == 'optimize') {
    if (!$_G['setting']['bbclosed']) {
        cpmsg('postsplit_forum_must_be_closed', 'action=postsplit&operation=manage', 'error');
    }
    $fromtableid = intval($_GET['tableid']);
    $optimize = true;
    $tablename = getposttable($fromtableid);