function close() { if (isset($this->_result)) { POD::free($this->_result); unset($this->_result); } $this->_count = 0; $this->reset(); }
function load() { global $database; $this->reset(); if ($result = POD::query("SELECT visits FROM {$database['prefix']}BlogStatistics WHERE blogid = " . getBlogId())) { if ($row = POD::fetch($result)) { foreach ($row as $name => $value) { if ($name == 'owner') { continue; } $this->{$name} = $value; } POD::free($result); return true; } POD::free($result); } return false; }
trashCommentInOwner($blogid, $comment['id']); } } } POD::free($result); } if ($result = POD::query("SELECT id, url, site, subject, excerpt FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}")) { while ($trackback = POD::fetch($result)) { setProgress($item++ / $items * 100, _t('걸린 글 데이터를 교정하고 있습니다.')); $correction = ''; if (!Utils_Unicode::validate($trackback['url'])) { $correction .= ' url = \'' . POD::escapeString(Utils_Unicode::correct($trackback['url'], '?')) . '\''; } if (!Utils_Unicode::validate($trackback['site'])) { $correction .= ' site = \'' . POD::escapeString(Utils_Unicode::correct($trackback['site'], '?')) . '\''; } if (!Utils_Unicode::validate($trackback['subject'])) { $correction .= ' subject = \'' . POD::escapeString(Utils_Unicode::correct($trackback['subject'], '?')) . '\''; } if (!Utils_Unicode::validate($trackback['excerpt'])) { $correction .= ' excerpt = \'' . POD::escapeString(Utils_Unicode::correct($trackback['excerpt'], '?')) . '\''; } if (strlen($correction) > 0) { POD::query("UPDATE {$database['prefix']}RemoteResponses SET {$correction} WHERE blogid = {$blogid} AND id = {$trackback['id']}"); $corrected++; } } POD::free($result); } setProgress(100, _t('완료되었습니다.') . "({$corrected})"); finish();
function checkTables($version, $prefix) { if (!($tables = getTables($version, $prefix))) { return false; } foreach ($tables as $table) { if ($result = POD::query("DESCRIBE {$table}")) { POD::free($result); } else { return false; } } return true; }
function correctTagsAll() { global $database; $targetresult = POD::query("SELECT * FROM {$database['prefix']}TagRelations"); if ($targetresult != false) { while ($target = POD::fetch($targetresult)) { $oldtag = POD::queryRow("SELECT id, name FROM {$database['prefix']}Tags WHERE id = {$target['tag']}"); if (!is_null($oldtag)) { $tagid = POD::queryCell("SELECT id FROM {$database['prefix']}Tags WHERE name = '" . POD::escapeString($oldtag['name']) . "' LIMIT 1 "); if (is_null($tagid)) { POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$target['blogid']} AND tag = {$target['tag']} AND entry = {$target['entry']}"); } else { if ($tagid == $oldtag['id']) { continue; } if (POD::execute("UPDATE {$database['prefix']}TagRelations SET tag = {$tagid} WHERE blogid = {$target['blogid']} AND tag = {$target['tag']} AND entry = {$target['entry']}") == false) { // maybe duplicated tag POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$target['blogid']} AND tag = {$target['tag']} AND entry = {$target['entry']}"); } } } else { // Ooops! POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$target['blogid']} AND tag = {$target['tag']} AND entry = {$target['entry']}"); } } POD::free($targetresult); } $targetresult = POD::query("SELECT id FROM {$database['prefix']}Tags LEFT JOIN {$database['prefix']}TagRelations ON id = tag WHERE tag IS NULL"); if ($targetresult != false) { while ($target = POD::fetch($targetresult)) { $tag = $target['id']; POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id = {$tag} "); } POD::free($targetresult); } }