static function undoTip($tipId, $qcId, $userId) { if (!$tipId || !$qcId) { return false; } // tip is is QC, remove it from there QCRuleTip::deleteIfNotPatrolled($qcId, $userId); // we just need to get the tip page and the tip from here $tipData = TipsPatrol::getTipLogRow($tipId); // tip data to add back to tipsandwarnings table $data = array("tw_page" => $tipData['tw_page'], "tw_tip" => $tipData['tw_tip'], "tw_user" => $userId, "tw_timestamp" => wfTimestampNow()); // now delete the tips with this id from the log and put it back into the main queue $dbw = wfGetDB(DB_MASTER); $dbw->insert('tipsandwarnings', $data, __METHOD__, array('IGNORE')); $dbw->delete('tipsandwarnings_log', array('tw_id' => $tipId)); return true; }
function undoTip($tipId) { $tipData = TipsPatrol::getTipLogRow($tipId); $action = $tipData['tw_action']; if ($action == TipsPatrol::TIP_ACTION_KEEP) { // undo the revision $success = TipsPatrol::revertTipOnArticle($tipData['tw_page'], $tipData['tw_rev_this']); if (!$success) { return false; } } // tip data to add back to tipsandwarnings table $data = array("tw_page" => $tipData['tw_page'], "tw_tip" => $tipData['tw_tip'], "tw_user" => 0, "tw_timestamp" => wfTimestampNow()); $dbw = wfGetDB(DB_MASTER); if ($action != TipsPatrol::TIP_ACTION_SKIP) { $dbw->insert('tipsandwarnings', $data, __METHOD__, array('IGNORE')); } $dbw->delete('tipsandwarnings_log', array('tw_id' => $tipId)); return true; }