コード例 #1
0
 public function processCreateWikiplace($formData)
 {
     if (!isset($formData['Name'])) {
         //check the key exists and value is not NULL
         throw new MWException('Cannot create Wikiplace, no data.');
     }
     $user = $this->getUser();
     $content = self::preparePageContent($formData['Template'], $formData['License']);
     $homepage = WpWikiplace::initiateCreation($formData['Name'], $user, $content);
     if (!$homepage instanceof Title) {
         $key = array_shift($homepage);
         return wfMessage($key, $homepage)->parse();
         // error while creating
     }
     $homepage_dbkey = $homepage->getDBkey();
     $this->homepageString = $homepage->getText();
     if ($formData['CreateTalk'] === true) {
         // The wikiplace was created by a hook and is not accessible from here, so we need to get the wikiplace this way
         $talkContent = '{{Subst:' . wfMessage('wp-default-talk')->text() . '}}';
         $talk_page = WpPage::createTalk($homepage, $user, $talkContent);
         if (!$talk_page instanceof Title) {
             // wikiplace was created, but, error on talk
             /** @todo show a warning ? */
         }
     }
     return true;
     // say: all ok
 }