Пример #1
0
 protected function storeInSerializationCache($title, $oldid, $html, $etag)
 {
     global $wgMemc;
     // Convert the VE HTML to wikitext
     $text = $this->postHTML($title, $html, array('oldid' => $oldid), $etag);
     if ($text === false) {
         return false;
     }
     // Store the corresponding wikitext, referenceable by a new key
     $hash = md5($text);
     $key = wfMemcKey('visualeditor', 'serialization', $hash);
     $wgMemc->set($key, $text, $this->veConfig->get('VisualEditorSerializationCacheTimeout'));
     // Also parse and prepare the edit in case it might be saved later
     $page = WikiPage::factory($title);
     $content = ContentHandler::makeContent($text, $title, CONTENT_MODEL_WIKITEXT);
     $res = ApiStashEdit::parseAndStash($page, $content, $this->getUser());
     if ($res === ApiStashEdit::ERROR_NONE) {
         wfDebugLog('StashEdit', "Cached parser output for VE content key '{$key}'.");
     }
     return $hash;
 }