コード例 #1
0
ファイル: Maintenance.php プロジェクト: Kaph-Noir/mediawiki
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @ingroup Maintenance
 * @defgroup Maintenance Maintenance
 */
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
require_once dirname(__FILE__) . '/../includes/PHPVersionCheck.php';
// @codingStandardsIgnoreEnd
wfEntryPointCheck('cli');
/**
 * @defgroup MaintenanceArchive Maintenance archives
 * @ingroup Maintenance
 */
// Define this so scripts can easily find doMaintenance.php
define('RUN_MAINTENANCE_IF_MAIN', __DIR__ . '/doMaintenance.php');
define('DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN);
// original name, harmless
$maintClass = false;
use MediaWiki\Logger\LoggerFactory;
/**
 * Abstract maintenance class for quickly writing and churning out
 * maintenance scripts with minimal effort. All that _must_ be defined
 * is the execute() method. See docs/maintenance.txt for more info
 * and a quick demo of how to use it.
コード例 #2
0
ファイル: avatar.php プロジェクト: nbdd0121/MW-Avatar
<?php

// For some configurations, extensions are symbolic linked
// This is the workaround for ../..
$dir = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
// This switches working directory to the root directory of MediaWiki.
// This is essential for the page to work
chdir($dir);
// Start up MediaWiki
require_once 'includes/PHPVersionCheck.php';
wfEntryPointCheck('avatar.php');
require 'includes/WebStart.php';
// URL safety checks
if (!$wgRequest->checkUrlExtension()) {
    return;
}
$query = $wgRequest->getQueryValues();
$path = null;
if (isset($query['user'])) {
    $username = $query['user'];
    if (isset($query['res'])) {
        $res = \Avatar\Avatars::normalizeResolution($query['res']);
    } else {
        global $wgDefaultAvatarRes;
        $res = $wgDefaultAvatarRes;
    }
    $user = User::newFromName($username);
    if ($user) {
        $path = \Avatar\Avatars::getAvatar($user, $res);
    }
}
コード例 #3
0
ファイル: load.php プロジェクト: MediaWiki-stable/1.26.1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @author Roan Kattouw
 * @author Trevor Parscal
 */
use MediaWiki\Logger\LoggerFactory;
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
require_once dirname(__FILE__) . '/includes/PHPVersionCheck.php';
wfEntryPointCheck('load.php');
require __DIR__ . '/includes/WebStart.php';
// URL safety checks
if (!$wgRequest->checkUrlExtension()) {
    return;
}
// Respond to resource loading request.
// foo()->bar() syntax is not supported in PHP4, and this file needs to *parse* in PHP4.
$configFactory = ConfigFactory::getDefaultInstance();
$resourceLoader = new ResourceLoader($configFactory->makeConfig('main'), LoggerFactory::getInstance('resourceloader'));
$resourceLoader->respond(new ResourceLoaderContext($resourceLoader, $wgRequest));
Profiler::instance()->setTemplated(true);
$mediawiki = new MediaWiki();
$mediawiki->doPostOutputShutdown('fast');
コード例 #4
0
ファイル: index.php プロジェクト: MediaWiki-stable/1.26.1
 * See the README, INSTALL, and UPGRADE files for basic setup instructions
 * and pointers to the online documentation.
 *
 * https://www.mediawiki.org/
 *
 * ----------
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
require_once dirname(__FILE__) . '/includes/PHPVersionCheck.php';
wfEntryPointCheck('index.php');
require __DIR__ . '/includes/WebStart.php';
$mediaWiki = new MediaWiki();
$mediaWiki->run();
コード例 #5
0
ファイル: index.php プロジェクト: MediaWiki-stable/1.26.1
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
require_once dirname(__FILE__) . '/../includes/PHPVersionCheck.php';
wfEntryPointCheck('mw-config/index.php');
define('MW_CONFIG_CALLBACK', 'Installer::overrideConfig');
define('MEDIAWIKI_INSTALL', true);
// Resolve relative to regular MediaWiki root
// instead of mw-config subdirectory.
chdir(dirname(__DIR__));
require dirname(__DIR__) . '/includes/WebStart.php';
wfInstallerMain();
function wfInstallerMain()
{
    global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
    $installer = InstallerOverrides::getWebInstaller($wgRequest);
    if (!$installer->startSession()) {
        if ($installer->request->getVal("css")) {
            // Do not display errors on css pages
            $installer->outputCss();
コード例 #6
0
ファイル: api.php プロジェクト: eliagbayani/LiteratureEditor
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */
use MediaWiki\Logger\LegacyLogger;
// So extensions (and other code) can check whether they're running in API mode
define('MW_API', true);
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
require_once dirname(__FILE__) . '/includes/PHPVersionCheck.php';
wfEntryPointCheck('api.php');
require __DIR__ . '/includes/WebStart.php';
$starttime = microtime(true);
// URL safety checks
if (!$wgRequest->checkUrlExtension()) {
    return;
}
// Verify that the API has not been disabled
if (!$wgEnableAPI) {
    header($_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500);
    echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php' . '<pre><b>$wgEnableAPI=true;</b></pre>';
    die(1);
}
// Set a dummy $wgTitle, because $wgTitle == null breaks various things
// In a perfect world this wouldn't be necessary
$wgTitle = Title::makeTitle(NS_SPECIAL, 'Badtitle/dummy title for API calls set in api.php');