Beispiel #1
0
 function doEdit($edit)
 {
     // create "fake" EditPage
     $editor = (object) array('textbox1' => isset($edit['text']) ? $edit['text'] : '');
     // try to get section name
     MyHome::getSectionName($editor, '', !empty($edit['section']) ? $edit['section'] : false, $errno);
     // create "fake" RecentChange object
     $row = (object) array('rev_timestamp' => time(), 'rev_user' => 1, 'rev_user_text' => 'test', 'page_namespace' => NS_MAIN, 'page_title' => 'Test', 'rev_comment' => isset($edit['comment']) ? $edit['comment'] : '', 'rev_minor_edit' => true, 'page_is_new' => !empty($edit['is_new']), 'page_id' => 1, 'rev_id' => 1, 'rc_id' => 1, 'rc_patrolled' => 1, 'rc_old_len' => 1, 'rc_new_len' => 1, 'rc_deleted' => 1, 'rc_timestamp' => time());
     $rc = RecentChange::newFromCurRow($row);
     // call MyHome to add its data to rc object and Wikia vars
     MyHome::storeInRecentChanges($rc);
     $data = Wikia::getVar('rc_data');
     unset($data['articleComment']);
     return $data;
 }
Beispiel #2
0
 /**
  * Hook that's called when a RecentChange is saved.  This prevents any problems from race-conditions between
  * the creation of a RecentChange and the awarding of its corresponding Achievement (they occur on the same
  * page-load, but one isn't guaranteed to be before the other).
  */
 public static function savingAnRc(&$rc)
 {
     global $wgAchievementToAddToRc, $wgWikiaForceAIAFdebug;
     wfProfileIn(__METHOD__);
     // If an achievement is spooled from earlier in the pageload, stuff it into this RecentChange.
     Wikia::log(__METHOD__, "", "RecentChange has arrived.", $wgWikiaForceAIAFdebug);
     if (!empty($wgAchievementToAddToRc)) {
         Wikia::log(__METHOD__, "", "RecentChange arrived. Storing achievement that we've already seen.", $wgWikiaForceAIAFdebug);
         $additionalData = array('Badge' => $wgAchievementToAddToRc);
         MyHome::storeInRecentChanges($rc, $additionalData);
         unset($wgAchievementToAddToRc);
     }
     wfProfileOut(__METHOD__);
     return true;
 }