本文整理汇总了PHP中ExtensionRegistry::readFromQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionRegistry::readFromQueue方法的具体用法?PHP ExtensionRegistry::readFromQueue怎么用?PHP ExtensionRegistry::readFromQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionRegistry
的用法示例。
在下文中一共展示了ExtensionRegistry::readFromQueue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCSS
/**
* Get the stylesheet of the MediaWiki skin.
*
* @return string
*/
public function getCSS()
{
global $wgStyleDirectory;
$moduleNames = array('mediawiki.legacy.shared', 'mediawiki.skinning.interface');
$resourceLoader = new ResourceLoader();
if (file_exists("{$wgStyleDirectory}/Vector/skin.json")) {
// Force loading Vector skin if available as a fallback skin
// for whatever ResourceLoader wants to have as the default.
$registry = new ExtensionRegistry();
$data = $registry->readFromQueue(array("{$wgStyleDirectory}/Vector/skin.json" => 1));
if (isset($data['globals']['wgResourceModules'])) {
$resourceLoader->register($data['globals']['wgResourceModules']);
}
$moduleNames[] = 'skins.vector.styles';
}
$moduleNames[] = 'mediawiki.legacy.config';
$rlContext = new ResourceLoaderContext($resourceLoader, new FauxRequest(array('debug' => 'true', 'lang' => $this->getLanguageCode(), 'only' => 'styles')));
$styles = array();
foreach ($moduleNames as $moduleName) {
/** @var ResourceLoaderFileModule $module */
$module = $resourceLoader->getModule($moduleName);
if (!$module) {
// T98043: Don't fatal, but it won't look as pretty.
continue;
}
// Based on: ResourceLoaderFileModule::getStyles (without the DB query)
$styles = array_merge($styles, ResourceLoader::makeCombinedStyles($module->readStyleFiles($module->getStyleFiles($rlContext), $module->getFlip($rlContext))));
}
return implode("\n", $styles);
}
示例2: fwrite
if (strval($fileName) === '') {
continue;
}
if (empty($mmfl['quiet'])) {
fwrite(STDERR, "Loading data from {$fileName}\n");
}
// Using extension.json or skin.json
if (substr($fileName, -strlen('.json')) === '.json') {
$queue[$fileName] = 1;
} else {
require_once $fileName;
}
}
if ($queue) {
$registry = new ExtensionRegistry();
$data = $registry->readFromQueue($queue);
foreach (array('wgExtensionMessagesFiles', 'wgMessagesDirs') as $var) {
if (isset($data['globals'][$var])) {
$GLOBALS[$var] = array_merge($data['globals'][$var], $GLOBALS[$var]);
}
}
}
fwrite(STDERR, "\n");
$s = "<" . "?php\n" . "## This file is generated by mergeMessageFileList.php. Do not edit it directly.\n\n" . "if ( defined( 'MW_NO_EXTENSION_MESSAGES' ) ) return;\n\n" . '$wgExtensionMessagesFiles = ' . var_export($wgExtensionMessagesFiles, true) . ";\n\n" . '$wgMessagesDirs = ' . var_export($wgMessagesDirs, true) . ";\n\n";
$dirs = array($IP, dirname(__DIR__), realpath($IP));
foreach ($dirs as $dir) {
$s = preg_replace("/'" . preg_quote($dir, '/') . "([^']*)'/", '"$IP\\1"', $s);
}
if (isset($mmfl['output'])) {
file_put_contents($mmfl['output'], $s);
} else {
示例3: includeExtensions
/**
* Installs the auto-detected extensions.
*
* @return Status
*/
protected function includeExtensions()
{
global $IP;
$exts = $this->getVar('_Extensions');
$IP = $this->getVar('IP');
/**
* We need to include DefaultSettings before including extensions to avoid
* warnings about unset variables. However, the only thing we really
* want here is $wgHooks['LoadExtensionSchemaUpdates']. This won't work
* if the extension has hidden hook registration in $wgExtensionFunctions,
* but we're not opening that can of worms
* @see https://phabricator.wikimedia.org/T28857
*/
global $wgAutoloadClasses;
$wgAutoloadClasses = [];
$queue = [];
require "{$IP}/includes/DefaultSettings.php";
foreach ($exts as $e) {
if (file_exists("{$IP}/extensions/{$e}/extension.json")) {
$queue["{$IP}/extensions/{$e}/extension.json"] = 1;
} else {
require_once "{$IP}/extensions/{$e}/{$e}.php";
}
}
$registry = new ExtensionRegistry();
$data = $registry->readFromQueue($queue);
$wgAutoloadClasses += $data['autoload'];
$hooksWeWant = isset($wgHooks['LoadExtensionSchemaUpdates']) ? $wgHooks['LoadExtensionSchemaUpdates'] : [];
if (isset($data['globals']['wgHooks']['LoadExtensionSchemaUpdates'])) {
$hooksWeWant = array_merge_recursive($hooksWeWant, $data['globals']['wgHooks']['LoadExtensionSchemaUpdates']);
}
// Unset everyone else's hooks. Lord knows what someone might be doing
// in ParserFirstCallInit (see bug 27171)
$GLOBALS['wgHooks'] = ['LoadExtensionSchemaUpdates' => $hooksWeWant];
return Status::newGood();
}