Commit a91388cb authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Insert default site content into db during installation

parent 184f735e
......@@ -184,6 +184,11 @@ function upgrade_core($upgrade) {
if ($db->HasFailedTrans()) {
$status = false;
}
if (!empty($upgrade->install)) {
$status = $status && core_postinst();
}
$db->CompleteTrans();
return $status;
......@@ -315,6 +320,23 @@ function upgrade_plugin($upgrade) {
$db->CompleteTrans();
return $status;
}
function core_postinst() {
$status = true;
$pages = site_content_pages();
$now = db_format_timestamp(time());
foreach ($pages as $name) {
$page->name = $name;
$page->ctime = $now;
$page->mtime = $now;
$page->content = get_string($page->name . 'defaultcontent', 'install');
if (!insert_record('site_content',$page)) {
$status = false;
}
}
return $status;
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment