<?
function db_update_111_post()
{
	global $config;
	//grab the index page
	$q=$pdo->prepare("SELECT * FROM pagetext WHERE textname='index' AND year='{$config['FAIRYEAR']}'");
	$q->execute();
    if(!$q->rowCount()) {
        $q=$pdo->prepare("SELECT * FROM pagetext WHERE textname='index' AND year='-1'");
		$q->execute();
	}
	while($r=$q->fetch(PDO::FETCH_OBJ)) {
		//insert it into the CMS under index.html
		$stmt = $pdo->prepare("INSERT INTO cms (filename,dt,lang,text,showlogo) VALUES ('index.html','$r->lastupdate','$r->lang','".$r->text."','1')");
		$stmt->execute();
	}
	//and remove it from the pagetext
	$stmt = $pdo->prepare("DELETE FROM pagetext WHERE textname='index'");
	$stmt->execute();
}
?>