function wfAddForkCount($page_id) { $count = AllSitesInfo::getPageForkCount($page_id); $pageCount = !is_null($count) ? $count : 0; $dbw = wfGetDB(DB_MASTER); $dbw->upsert('template_fork_count', array('template_id' => $page_id, 'fork_count' => 1), array('template_id' => $page_id), array('fork_count' => $pageCount + 1), __METHOD__); return 'success'; }