/**
  * Constructor
  */
 public function __construct($name, $right)
 {
     $this->mConfSettings = ConfigurationSettings::singleton($this->getSettingMask());
     # Reload data WITHOUT CACHE
     global $wgConf;
     $wgConf->initialise(false);
     parent::__construct($name, $right);
 }
Ejemplo n.º 2
0
 public static function load($path)
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     $_paths = self::$_instance->getValidPaths($path);
     foreach ($_paths as $_path) {
         //Get file information
         $info = pathinfo($_path);
         $extension = isset($info['extension']) ? $info['extension'] : '';
         $parser = self::$_instance->getFileParser($extension);
         // Try and load file
         self::$_data = array_replace_recursive(self::$_data, call_user_func([$parser, 'parse'], $_path));
     }
     return self::$_data;
 }
 protected function doSubmit()
 {
     global $wgConf, $wgConfigureUpdateCacheEpoch;
     $reason = $this->getRequest()->getText('wpReason');
     $settings = $this->importFromRequest();
     ## Add extensions settings, so we don't lose them..
     $extSettings = ConfigurationSettings::singleton(CONF_SETTINGS_EXT)->getAllSettings();
     $current = $wgConf->getCurrent($this->mWiki);
     foreach ($extSettings as $name => $type) {
         if (isset($current[$name])) {
             $settings[$name] = $current[$name];
         }
     }
     ## Also save activated extensions :)
     $settings['__includes'] = $wgConf->getIncludedFiles($this->mWiki);
     $settings = $this->removeDefaults($settings);
     if ($wgConfigureUpdateCacheEpoch) {
         $settings['wgCacheEpoch'] = max($settings['wgCacheEpoch'], wfTimestampNow());
     }
     $ok = $wgConf->saveNewSettings($settings, $this->getUser(), $this->mWiki, $reason);
     $result = $ok ? 'success' : 'failure';
     $url = $this->getTitle()->getLocalURL("result={$result}");
     $this->getOutput()->redirect($url);
 }
Ejemplo n.º 4
0
 /**
  * @todo Maybe split this in sub functions
  */
 function execute()
 {
     global $IP;
     if ($this->hasOption('ext')) {
         $exts = ConfigurationSettings::singleton(CONF_SETTINGS_EXT)->getAllExtensionsObjects();
         $ignoreList = array('wgTitle', 'wgArticle', 'wgContLang', 'wgLang', 'wgOut', 'wgParser', 'wgMessageCache', 'wgVersion', 'wgAbuseFilterStyleVersion', 'wgAdminLinksIP', 'wgExtCategoryTests', 'wgCategoryTreeUseCategoryTable', 'wgCategoryTreeVersion', 'wgCategoryWatch', 'wgCentralAuthStyleVersion', 'wgCheckUserStyleVersion', 'wgCaptcha', 'wgConfirmEditIP', 'wgCitationCache', 'wgCitationCounter', 'wgCitationRunning', 'wgCollectionVersion', 'wgCollectionStyleVersion', 'wgCSS', 'wgDeleteQueueStyleVersion', 'wgDraftsStyleVersion', 'edgIP', 'edgValues', 'wgErrorHandlerErrors', 'wgErrorHandlerOutputDone', 'wgFlaggedRevStyleVersion', 'wgFlaggedRevsRCCrap', 'wgGoogleAdSenseCssLocation', 'wgOggScriptVersion', 'wgEnableJS2system', 'wgPFHookStub', 'wgQPollFunctionsHook', 'cell', 'celltag', 'sdgIP', 'sdgScriptPath', 'sdgNamespaceIndex', 'sfgIP', 'sfgScriptPath', 'sfgPartialPath', 'sfgNamespaceIndex', 'sfgFancyBoxIncluded', 'sfgAdderButtons', 'sfgRemoverButtons', 'sfgShowOnSelectCalls', 'sfgJSValidationCalls', 'sfgAutocompleteMappings', 'sfgAutocompleteDataTypes', 'sfgAutocompleteValues', 'sfgComboBoxInputs', 'sfgAutogrowInputs', 'smwgIP', 'smwgScriptPath', 'smwgNamespaceIndex', 'smwgRAPPath', 'smwgSMWBetaCompatible', 'srfgIP', 'srfgScriptPath', 'srfgJQPlotIncluded', 'wgUserBoardScripts', 'wgUserProfileDirectory', 'wgUserProfileScripts', 'wgUserRelationshipScripts', 'wgTimelineSettings', 'wgTitleBlacklist', 'wgAutoCreateCategoryPagesObject', 'wgSpecialRefactorVersion', 'wgUniwikiFormatChangesObject', 'wgGenericEditPageClass', 'wgSwitchMode', 'egValidatorDir', 'wgWatchersAddCache', 'wgWikiArticleFeedsParser', 'wgWikiFeedPresent', 'wgWikilogStyleVersion');
         $ignoreObsolete = array('wgCommentSpammerLog', 'qp_enable_showresults');
         foreach ($exts as $ext) {
             $name = $ext->getName();
             if (!$ext->isInstalled()) {
                 $this->output("Extension {$name} is not installed\n");
                 continue;
             }
             $file = file_get_contents($ext->getSettingsFile());
             $m = array();
             preg_match_all('/\\$((wg|eg|edg|sdg|sfg|smwg|srfg|abc|ce[^n]|ub|whoiswatching|wminc)[A-Za-z0-9_]+)\\s*\\=/', $file, $m);
             $definedSettings = array_unique($m[1]);
             $allSettings = array_keys($ext->getSettings());
             $remain = array_diff($definedSettings, $allSettings);
             $obsolete = array_diff($allSettings, $definedSettings, $ignoreObsolete);
             $missing = array();
             foreach ($remain as $setting) {
                 if (!ConfigurationSettings::singleton(CONF_SETTINGS_CORE)->isSettingAvailable($setting) && !in_array($setting, $ignoreList)) {
                     $missing[] = $setting;
                 }
             }
             if (count($missing) == 0 && count($obsolete) == 0) {
                 # echo "Extension $name ok\n";
             } else {
                 $this->output("Extension {$name}:\n");
                 $this->printArray('  missing', $missing);
                 $this->printArray('  obsolete', $obsolete);
             }
         }
     } else {
         // Get our settings defs
         if ($this->hasOption('from-doc')) {
             if ($this->hasOption('alpha')) {
                 $page = "Manual:Configuration_settings_(alphabetical)";
             } else {
                 $page = "Manual:Configuration_settings";
             }
             $cont = Http::get("http://www.mediawiki.org/w/index.php?title={$page}&action=raw");
             $m = array();
             preg_match_all('/\\[\\[[Mm]anual:\\$(wg[A-Za-z0-9]+)\\|/', $cont, $m);
             $allSettings = array_unique($m[1]);
             $ignoreList = array('wgEnableNewpagesUserFilter', 'wgOldChangeTagsIndex');
         } else {
             $allSettings = array_keys(ConfigurationSettings::singleton(CONF_SETTINGS_CORE)->getAllSettings());
             $ignoreList = array('wgAPIListModules', 'wgAPIMetaModules', 'wgAPIModules', 'wgAPIPropModules', 'wgAjaxExportList', 'wgAuth', 'wgAutoloadClasses', 'wgAvailableRights', 'wgCommandLineMode', 'wgConf', 'wgDBmysql4', 'wgDummyLanguageCodes', 'wgEditEncoding', 'wgEnableNewpagesUserFilter', 'wgEnableSorbs', 'wgExceptionHooks', 'wgExperimentalHtmlIds', 'wgExtensionAliasesFiles', 'wgExtensionCredits', 'wgExtensionFunctions', 'wgExtensionMessagesFiles', 'wgFilterCallback', 'wgHooks', 'wgInputEncoding', 'wgJobClasses', 'wgLegacySchemaConversion', 'wgLogActions', 'wgLogActionsHandlers', 'wgLogHeaders', 'wgLogNames', 'wgLogTypes', 'wgMaintenanceScripts', 'wgMemCachedDebug', 'wgOldChangeTagsIndex', 'wgOutputEncoding', 'wgPagePropLinkInvalidations', 'wgParserOutputHooks', 'wgParserTestFiles', 'wgProxyKey', 'wgResourceModules', 'wgSeleniumTestConfigs', 'wgSkinExtensionFunctions', 'wgSpecialPageCacheUpdates', 'wgSpecialPages', 'wgSorbsUrl', 'wgStyleSheetPath', 'wgTrivialMimeDetection', 'wgValidSkinNames', 'wgVersion');
         }
         // Now we'll need to open DefaultSettings.php
         $m = array();
         $defaultSettings = file_get_contents("{$IP}/includes/DefaultSettings.php");
         preg_match_all('/\\$(wg[A-Za-z0-9]+)\\s*\\=/', $defaultSettings, $m);
         $definedSettings = array_unique($m[1]);
         $missing = array_diff($definedSettings, $allSettings);
         $remain = array_diff($allSettings, $definedSettings);
         $reallyMissing = array_diff($missing, $ignoreList);
         $obsolete = array();
         foreach ($remain as $setting) {
             if (ConfigurationSettings::singleton(CONF_SETTINGS_CORE)->isSettingAvailable($setting)) {
                 $obsolete[] = $setting;
             }
         }
         // let's show the results:
         $this->printArray('missing', $reallyMissing);
         $this->printArray('obsolete', $obsolete);
         if (count($reallyMissing) == 0 && count($obsolete) == 0) {
             $this->output("Looks good!\n");
         }
     }
 }
Ejemplo n.º 5
0
 protected function ajaxGetNewGroup($setting, $group)
 {
     $settings = ConfigurationSettings::singleton(CONF_SETTINGS_BOTH);
     if ($settings->getSettingType($setting) != 'array') {
         return array('error', 'notarray');
     }
     $type = $settings->getArrayType($setting);
     switch ($type) {
         case 'group-bool':
             if (isset($GLOBALS[$setting]) && isset($GLOBALS[$setting][$group])) {
                 return array('error', 'exists');
             }
             $row = ConfigurationPage::buildGroupSettingRow($setting, $type, User::getAllRights(), true, $group, array());
             // Firefox seems to not like that :(
             return array('ajax', str_replace(' ', ' ', $row));
         case 'promotion-conds':
             if (isset($GLOBALS[$setting]) && isset($GLOBALS[$setting][$group])) {
                 return array('error', 'exists');
             }
             return array('ajax', ConfigurationPage::buildPromotionCondsSettingRow($setting, true, $group, array()));
         default:
             return array('error', 'notvalidarray');
     }
 }
Ejemplo n.º 6
0
 public function snapshotDefaults()
 {
     wfProfileIn(__METHOD__);
     $options = func_get_args();
     $noOverride = in_array('no_override', $options);
     if (!is_array($this->mDefaults) || in_array('allow_empty', $options)) {
         if (!is_array($this->mDefaults)) {
             $this->mDefaults = array();
         }
         $settings = ConfigurationSettings::singleton(CONF_SETTINGS_CORE)->getSnapshotSettings();
         foreach ($settings as $setting) {
             if (array_key_exists($setting, $GLOBALS) && !($noOverride && array_key_exists($setting, $this->mDefaults))) {
                 $this->mDefaults[$setting] = $GLOBALS[$setting];
             }
         }
     }
     wfProfileOut(__METHOD__);
 }
 protected function getArrayType($setting)
 {
     return ConfigurationSettings::singleton(CONF_SETTINGS_BOTH)->getArrayType($setting);
 }