Skip to content

Commit

Permalink
MDl-33607 wiki-2: check subwiki before fetching it from db
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Jun 15, 2012
1 parent 63e5dde commit f68fd67
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mod/wiki/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,12 @@ function create_page($pagetitle) {
} else {
$groupid = '0';
}
if (!$this->subwiki = wiki_get_subwiki_by_group($this->wid, $groupid)) {
$swid = wiki_add_subwiki($PAGE->activityrecord->id, $groupid, $this->uid);
$this->subwiki = wiki_get_subwiki($swid);
if (empty($this->subwiki)) {
// If subwiki is not set then try find one and set else create one.
if (!$this->subwiki = wiki_get_subwiki_by_group($this->wid, $groupid)) {
$swid = wiki_add_subwiki($PAGE->activityrecord->id, $groupid, $this->uid);
$this->subwiki = wiki_get_subwiki($swid);
}
}
if ($data) {
$this->set_title($data->pagetitle);
Expand Down

0 comments on commit f68fd67

Please sign in to comment.