Пример #1
0
 private function assertArrayEntryExists($target, $entry, $config, $type = 'class')
 {
     $config = $config + $this->defaultConfig;
     $this->assertEmpty($config[$target][$entry], "Asserts that {$entry} is empty");
     $instance = new Setup($this->applicationFactory, $config, 'Foo');
     $instance->run();
     $this->assertNotEmpty($config[$target][$entry]);
     switch ($type) {
         case 'class':
             $this->assertTrue(class_exists($config[$target][$entry]));
             break;
         case 'file':
             $this->assertTrue(file_exists($config[$target][$entry]));
             break;
     }
 }
// Load global constants
require_once __DIR__ . '/includes/Defines.php';
// Temporary measure to ease Composer/MW 1.22 migration
require_once __DIR__ . '/includes/NamespaceManager.php';
// Load global functions
require_once __DIR__ . '/includes/GlobalFunctions.php';
// Load default settings
require_once __DIR__ . '/SemanticMediaWiki.settings.php';
// Because of MW 1.19 we need to register message files here
$GLOBALS['wgMessagesDirs']['SemanticMediaWiki'] = $GLOBALS['smwgIP'] . 'i18n';
$GLOBALS['wgExtensionMessagesFiles']['SemanticMediaWiki'] = $GLOBALS['smwgIP'] . 'languages/SMW_Messages.php';
$GLOBALS['wgExtensionMessagesFiles']['SemanticMediaWikiAlias'] = $GLOBALS['smwgIP'] . 'languages/SMW_Aliases.php';
$GLOBALS['wgExtensionMessagesFiles']['SemanticMediaWikiMagic'] = $GLOBALS['smwgIP'] . 'languages/SMW_Magic.php';
/**
 * Setup and initialization
 *
 * @note $wgExtensionFunctions variable is an array that stores
 * functions to be called after most of MediaWiki initialization
 * has finalized
 *
 * @see https://www.mediawiki.org/wiki/Manual:$wgExtensionFunctions
 *
 * @since  1.9
 */
$GLOBALS['wgExtensionFunctions'][] = function () {
    $applicationFactory = ApplicationFactory::getInstance();
    $namespace = new NamespaceManager($GLOBALS, __DIR__);
    $namespace->run();
    $setup = new Setup($applicationFactory, $GLOBALS, __DIR__);
    $setup->run();
};
Пример #3
0
 /**
  * Setup and initialization
  *
  * @note $wgExtensionFunctions variable is an array that stores
  * functions to be called after most of MediaWiki initialization
  * has finalized
  *
  * @see https://www.mediawiki.org/wiki/Manual:$wgExtensionFunctions
  *
  * @since  1.9
  */
 public static function onExtensionFunction()
 {
     // 3.x reverse the order to ensure that smwgMainCacheType is used
     // as main and smwgCacheType being deprecated with 3.x
     $GLOBALS['smwgMainCacheType'] = $GLOBALS['smwgCacheType'];
     $applicationFactory = ApplicationFactory::getInstance();
     $namespace = new NamespaceManager($GLOBALS);
     $namespace->init();
     $setup = new Setup($applicationFactory, $GLOBALS, __DIR__);
     $setup->run();
 }