function migrateposts() { global $data, $man; $data->loadfile('posts' . DIRECTORY_SEPARATOR . 'index'); $posts = tposts::instance(); $posts->lock(); if (dbversion) { $man = tdbmanager::instance(); $man->setautoincrement('posts', $data->lastid); } else { $posts->autoid = $data->lastid; } $tags = ttags::instance(); $tags->lock(); $tags->itemsposts->lock(); $cats = tcategories::instance(); $cats->lock(); $cats->itemsposts->lock(); $items = $data->data['items']; foreach ($items as $id => $item) { $post = migratepost($id); savepost($post); $cats->itemsposts->setitems($post->id, $post->categories); $tags->itemsposts->setitems($post->id, $post->tags); migratecomments($id); if (!dbversion) { $posts->items[$post->id] = array('posted' => $post->posted); if ($post->status != 'published') { $posts->items[$post->id]['status'] = $post->status; } if ($post->author > 1) { $posts->items[$post->id]['author'] = $post->author; } } } $posts->UpdateArchives(); $posts->addrevision(); $posts->unlock(); $tags->itemsposts->unlock(); $tags->unlock(); $cats->itemsposts->unlock(); $cats->unlock(); $arch = tarchives::instance(); $arch->postschanged(); //update trust values if (dbversion) { $db = litepublisher::$db; $trusts = $db->res2assoc($db->query("SELECT author as 'author', count(author) as 'count' FROM {$db->comments} \r\nwhere status = 'approved' GROUP BY author")); $db->table = 'comusers'; foreach ($trusts as $r) { $db->setvalue($r['author'], 'trust', $r['count']); } unset($trust); } }
require_once litepublisher::$paths->lib . 'events.class.php'; require_once litepublisher::$paths->lib . 'items.class.php'; require_once litepublisher::$paths->lib . 'classes.php'; require_once litepublisher::$paths->lib . 'options.class.php'; } else { require_once litepublisher::$paths->lib . 'kernel.php'; } litepublisher::$classes = tclasses::instance(); litepublisher::$options = toptions::instance(); if (!litepublisher::$options->installed) { require_once litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'install.php'; } if (dbversion) { litepublisher::$db = new tdatabase(); } litepublisher::$options->admincookie = litepublisher::$options->cookieenabled && litepublisher::$options->authcookie(); litepublisher::$urlmap = turlmap::instance(); if (!defined('litepublisher_mode')) { litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $_SERVER['REQUEST_URI']); } litepublisher::$options->cache = false; litepublisher::$options->savemodified(); litepublisher::$options->showerrors(); if (dbversion && !preg_match('/(^\\/rpc\\.xml|\\/rss|\\/comments\\.)|(\\.xml$)/', $_SERVER['REQUEST_URI'])) { echo "<pre>\n"; $man = tdbmanager::instance(); //$man->deletealltables(); //echo $man->performance(); //file_put_contents(litepublisher::$pathshome. "litepublisher::$domain .sql", $man->export()); } //