Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDl-33607 wiki-2: check subwiki before fetching it from db

  • Loading branch information...
commit 840818cce43a26afde8b1d79a0c78d6691603477 1 parent 4776262
Rajesh Taneja authored June 15, 2012

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. 9  mod/wiki/pagelib.php
9  mod/wiki/pagelib.php
@@ -946,9 +946,12 @@ function create_page($pagetitle) {
946 946
         } else {
947 947
             $groupid = '0';
948 948
         }
949  
-        if (!$this->subwiki = wiki_get_subwiki_by_group($this->wid, $groupid)) {
950  
-            $swid = wiki_add_subwiki($PAGE->activityrecord->id, $groupid, $this->uid);
951  
-            $this->subwiki = wiki_get_subwiki($swid);
  949
+        if (empty($this->subwiki)) {
  950
+            // If subwiki is not set then try find one and set else create one.
  951
+            if (!$this->subwiki = wiki_get_subwiki_by_group($this->wid, $groupid)) {
  952
+                $swid = wiki_add_subwiki($PAGE->activityrecord->id, $groupid, $this->uid);
  953
+                $this->subwiki = wiki_get_subwiki($swid);
  954
+            }
952 955
         }
953 956
         if ($data) {
954 957
             $this->set_title($data->pagetitle);

0 notes on commit 840818c

Please sign in to comment.
Something went wrong with that request. Please try again.