require_once "includes/Wiki.php"; $mediaWiki = new MediaWiki(); wfProfileIn('main-misc-setup'); OutputPage::setEncodings(); # Not really used yet # Query string fields $action = $wgRequest->getVal('action', 'view'); $title = $wgRequest->getVal('title'); # # Send Ajax requests to the Ajax dispatcher. # if ($wgUseAjax && $action == 'ajax') { require_once $IP . '/includes/AjaxDispatcher.php'; $dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); $mediaWiki->restInPeace($wgLoadBalancer); exit; } $wgTitle = $mediaWiki->checkInitialQueries($title, $action, $wgOut, $wgRequest, $wgContLang); if ($wgTitle == NULL) { unset($wgTitle); } wfProfileOut('main-misc-setup'); # Setting global variables in mediaWiki $mediaWiki->setVal('Server', $wgServer); $mediaWiki->setVal('DisableInternalSearch', $wgDisableInternalSearch); $mediaWiki->setVal('action', $action); $mediaWiki->setVal('SquidMaxage', $wgSquidMaxage); $mediaWiki->setVal('EnableDublinCoreRdf', $wgEnableDublinCoreRdf); $mediaWiki->setVal('EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf); $mediaWiki->setVal('CommandLineMode', $wgCommandLineMode);
$action = $wgRequest->getVal('action', 'view'); $title = $wgRequest->getVal('title'); # Set title from request parameters $wgTitle = $mediaWiki->checkInitialQueries($title, $action); if ($wgTitle === null) { unset($wgTitle); } wfProfileOut('main-misc-setup'); # # Send Ajax requests to the Ajax dispatcher. # if ($wgUseAjax && $action == 'ajax') { require_once $IP . '/includes/AjaxDispatcher.php'; $dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); $mediaWiki->restInPeace(); exit; } if ($wgUseFileCache && isset($wgTitle)) { wfProfileIn('main-try-filecache'); // Raw pages should handle cache control on their own, // even when using file cache. This reduces hits from clients. if ($action != 'raw' && HTMLFileCache::useFileCache()) { /* Try low-level file cache hit */ $cache = new HTMLFileCache($wgTitle, $action); if ($cache->isFileCacheGood()) { /* Check incoming headers to see if client has this cached */ if (!$wgOut->checkLastModified($cache->fileCacheTime())) { $cache->loadFromFileCache(); } # Do any stats increment/watchlist stuff
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file * @author Aaron Schulz */ if (!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '0:0:0:0:0:0:0:1', '::1'), true)) { die("Only loopback requests are allowed.\n"); } elseif ($_SERVER['REQUEST_METHOD'] !== 'POST') { die("Request must use POST.\n"); } require_once __DIR__ . '/../multiversion/MWVersion.php'; $wiki = isset($_GET['wiki']) ? $_GET['wiki'] : ''; require getMediaWiki('includes/WebStart.php', $wiki); error_reporting(E_ERROR); // fatals but not random I/O warnings ini_set('display_errors', 1); $wgShowExceptionDetails = true; if (method_exists('LBFactory', 'disableChronologyProtection')) { // This is not helpful here and will slow things down in some cases wfGetLBFactory()->disableChronologyProtection(); } try { $mediawiki = new MediaWiki(); $runner = new JobRunner(); $response = $runner->run(array('type' => isset($_GET['type']) ? $_GET['type'] : false, 'maxJobs' => isset($_GET['maxjobs']) ? $_GET['maxjobs'] : false, 'maxTime' => isset($_GET['maxtime']) ? $_GET['maxtime'] : 30)); print json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $mediawiki->restInPeace(); } catch (Exception $e) { MWExceptionHandler::handleException($e); }