Load a configuration for the loggers from `.settings.php` or `.settings_extra.php`.

@param bool $force Load even if the configuration has already been loaded.

@return bool
515929
public static function loadConfiguration($force = false)
    {
        if ($force === false && static::$isConfigurationLoaded === true)
        {
            return true;
        }

        if (class_exists('\Bitrix\Main\Config\Configuration'))
        {
            $config = Configuration::getInstance()->get('monolog');

            if (is_array($config) && !empty($config))
            {
                Cascade::fileConfig($config);

                return true;
            }
        }

        return false;
    }
1374077
public function load($url, $override = false)
    {
        if (!$this->isLoaded($url))
        {
            $translations = array();

            foreach ($this->find($url) as $file)
            {
                try {
                    $loaded = $this->getObject('object.config.factory')->fromFile($file)->toArray();
                } catch (Exception $e) {
                    return false;
                }

                $translations = array_merge($translations, $loaded);
            }

            $this->getCatalogue()->add($translations, $override);

            $this->setLoaded($url);
        }

        return true;
    }
491763
protected function load_course_settings($forceopen = false) {
        global $CFG;
        require_once($CFG->dirroot . '/course/lib.php');

        $course = $this->page->course;
        $coursecontext = context_course::instance($course->id);
        $adminoptions = course_get_user_administration_options($course, $coursecontext);

        // note: do not test if enrolled or viewing here because we need the enrol link in Course administration section

        $coursenode = $this->add(get_string('courseadministration'), null, self::TYPE_COURSE, null, 'courseadmin');
        if ($forceopen) {
            $coursenode->force_open();
        }


        if ($adminoptions->update) {
            // Add the course settings link
            $url = new moodle_url('/course/edit.php', array('id'=>$course->id));
            $coursenode->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, 'editsettings', new pix_icon('i/settings', ''));
        }

        if ($this->page->user_allowed_editing()) {
            // Add the turn on/off settings

            if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) {
                // We are on the course page, retain the current page params e.g. section.
                $baseurl = clone($this->page->url);
                $baseurl->param('sesskey', sesskey());
            } else {
                // Edit on the main course page.
                $baseurl = new moodle_url('/course/view.php', array('id'=>$course->id, 'return'=>$this->page->url->out_as_local_url(false), 'sesskey'=>sesskey()));
            }

            $editurl = clone($baseurl);
            if ($this->page->user_is_editing()) {
                $editurl->param('edit', 'off');
                $editstring = get_string('turneditingoff');
            } else {
                $editurl->param('edit', 'on');
                $editstring = get_string('turneditingon');
            }
            $coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, 'turneditingonoff', new pix_icon('i/edit', ''));
        }

        if ($adminoptions->editcompletion) {
            // Add the course completion settings link
            $url = new moodle_url('/course/completion.php', array('id' => $course->id));
            $coursenode->add(get_string('coursecompletion', 'completion'), $url, self::TYPE_SETTING, null, null,
                             new pix_icon('i/settings', ''));
        }

        if (!$adminoptions->update && $adminoptions->tags) {
            $url = new moodle_url('/course/tags.php', array('id' => $course->id));
            $coursenode->add(get_string('coursetags', 'tag'), $url, self::TYPE_SETTING, null, 'coursetags', new pix_icon('i/settings', ''));
        }

        // add enrol nodes
        enrol_add_course_navigation($coursenode, $course);

        // Manage filters
        if ($adminoptions->filters) {
            $url = new moodle_url('/filter/manage.php', array('contextid'=>$coursecontext->id));
            $coursenode->add(get_string('filters', 'admin'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/filter', ''));
        }

        // View course reports.
        if ($adminoptions->reports) {
            $reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, 'coursereports',
                    new pix_icon('i/stats', ''));
            $coursereports = core_component::get_plugin_list('coursereport');
            foreach ($coursereports as $report => $dir) {
                $libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
                if (file_exists($libfile)) {
                    require_once($libfile);
                    $reportfunction = $report.'_report_extend_navigation';
                    if (function_exists($report.'_report_extend_navigation')) {
                        $reportfunction($reportnav, $course, $coursecontext);
                    }
                }
            }

            $reports = get_plugin_list_with_function('report', 'extend_navigation_course', 'lib.php');
            foreach ($reports as $reportfunction) {
                $reportfunction($reportnav, $course, $coursecontext);
            }
        }

        // Check if we can view the gradebook's setup page.
        if ($adminoptions->gradebook) {
            $url = new moodle_url('/grade/edit/tree/index.php', array('id' => $course->id));
            $coursenode->add(get_string('gradebooksetup', 'grades'), $url, self::TYPE_SETTING,
                null, 'gradebooksetup', new pix_icon('i/settings', ''));
        }

        // Add the context locking node.
        $this->add_context_locking_node($coursenode, $coursecontext);

        //  Add outcome if permitted
        if ($adminoptions->outcomes) {
            $url = new moodle_url('/grade/edit/outcome/course.php', array('id'=>$course->id));
            $coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', ''));
        }

        //Add badges navigation
        if ($adminoptions->badges) {
            require_once($CFG->libdir .'/badgeslib.php');
            badges_add_course_navigation($coursenode, $course);
        }

        // Backup this course
        if ($adminoptions->backup) {
            $url = new moodle_url('/backup/backup.php', array('id'=>$course->id));
            $coursenode->add(get_string('backup'), $url, self::TYPE_SETTING, null, 'backup', new pix_icon('i/backup', ''));
        }

        // Restore to this course
        if ($adminoptions->restore) {
            $url = new moodle_url('/backup/restorefile.php', array('contextid'=>$coursecontext->id));
            $coursenode->add(get_string('restore'), $url, self::TYPE_SETTING, null, 'restore', new pix_icon('i/restore', ''));
        }

        // Import data from other courses
        if ($adminoptions->import) {
            $url = new moodle_url('/backup/import.php', array('id'=>$course->id));
            $coursenode->add(get_string('import'), $url, self::TYPE_SETTING, null, 'import', new pix_icon('i/import', ''));
        }

        // Publish course on a hub
        if ($adminoptions->publish) {
            $url = new moodle_url('/course/publish/index.php', array('id'=>$course->id));
            $coursenode->add(get_string('publish', 'core_hub'), $url, self::TYPE_SETTING, null, 'publish',
                new pix_icon('i/publish', ''));
        }

        // Reset this course
        if ($adminoptions->reset) {
            $url = new moodle_url('/course/reset.php', array('id'=>$course->id));
            $coursenode->add(get_string('reset'), $url, self::TYPE_SETTING, null, 'reset', new pix_icon('i/return', ''));
        }

        // Questions
        require_once($CFG->libdir . '/questionlib.php');
        question_extend_settings_navigation($coursenode, $coursecontext)->trim_if_empty();

        if ($adminoptions->update) {
            // Repository Instances
            if (!$this->cache->cached('contexthasrepos'.$coursecontext->id)) {
                require_once($CFG->dirroot . '/repository/lib.php');
                $editabletypes = repository::get_editable_types($coursecontext);
                $haseditabletypes = !empty($editabletypes);
                unset($editabletypes);
                $this->cache->set('contexthasrepos'.$coursecontext->id, $haseditabletypes);
            } else {
                $haseditabletypes = $this->cache->{'contexthasrepos'.$coursecontext->id};
            }
            if ($haseditabletypes) {
                $url = new moodle_url('/repository/manage_instances.php', array('contextid' => $coursecontext->id));
                $coursenode->add(get_string('repositories'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/repository', ''));
            }
        }

        // Manage files
        if ($adminoptions->files) {
            // hidden in new courses and courses where legacy files were turned off
            $url = new moodle_url('/files/index.php', array('contextid'=>$coursecontext->id));
            $coursenode->add(get_string('courselegacyfiles'), $url, self::TYPE_SETTING, null, 'coursefiles', new pix_icon('i/folder', ''));

        }

        // Let plugins hook into course navigation.
        $pluginsfunction = get_plugins_with_function('extend_navigation_course', 'lib.php');
        foreach ($pluginsfunction as $plugintype => $plugins) {
            // Ignore the report plugin as it was already loaded above.
            if ($plugintype == 'report') {
                continue;
            }
            foreach ($plugins as $pluginfunction) {
                $pluginfunction($coursenode, $course, $coursecontext);
            }
        }

        // Return we are done
        return $coursenode;
    }
1236470
public function save($force = false) {
        if (!$this->writeable) {
            return false;
        }

        if (!$this->dirty && !$force) {
            return null;
        }

        $savetype = $force ? 'forced ' : '';
        if (is_null($force)) {
            $savetype = 'auto ';
        }

        $path = dirname($this->file);
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        $data = $this->store->dump();
        $conf = version_compare(PHP_VERSION, '5.4', '>=') ? json_encode($data, JSON_PRETTY_PRINT) : json_encode($data);
        unset($data);
        if (!$conf || !json_decode($conf)) {
            return;
        }
        $saved = (bool)$this->writeAtomic($this->file, $conf, 0755);

        if ($saved) {
            $this->dirty = false;
        }

        return $saved;
    }
1267798
public function load($configuration = false) {
        global $CFG;

        if ($configuration === false) {
            $configuration = $this->include_configuration();
        }

        $this->configstores = array();
        $this->configdefinitions = array();
        $this->configlocks = array();
        $this->configmodemappings = array();
        $this->configdefinitionmappings = array();
        $this->configlockmappings = array();

        $siteidentifier = 'unknown';
        if (array_key_exists('siteidentifier', $configuration)) {
            $siteidentifier = $configuration['siteidentifier'];
        }
        $this->siteidentifier = $siteidentifier;

        // Filter the lock instances.
        $defaultlock = null;
        foreach ($configuration['locks'] as $conf) {
            if (!is_array($conf)) {
                // Something is very wrong here.
                continue;
            }
            if (!array_key_exists('name', $conf)) {
                // Not a valid definition configuration.
                continue;
            }
            $name = $conf['name'];
            if (array_key_exists($name, $this->configlocks)) {
                debugging('Duplicate cache lock detected. This should never happen.', DEBUG_DEVELOPER);
                continue;
            }
            $conf['default'] = (!empty($conf['default']));
            if ($defaultlock === null || $conf['default']) {
                $defaultlock = $name;
            }
            $this->configlocks[$name] = $conf;
        }

        // Filter the stores.
        $availableplugins = cache_helper::early_get_cache_plugins();
        foreach ($configuration['stores'] as $store) {
            if (!is_array($store) || !array_key_exists('name', $store) || !array_key_exists('plugin', $store)) {
                // Not a valid instance configuration.
                debugging('Invalid cache store in config. Missing name or plugin.', DEBUG_DEVELOPER);
                continue;
            }
            $plugin = $store['plugin'];
            $class = 'cachestore_'.$plugin;
            $exists = array_key_exists($plugin, $availableplugins);
            if (!$exists) {
                // Not a valid plugin, or has been uninstalled, just skip it an carry on.
                debugging('Invalid cache store in config. Not an available plugin.', DEBUG_DEVELOPER);
                continue;
            }
            $file = $CFG->dirroot.'/cache/stores/'.$plugin.'/lib.php';
            if (!class_exists($class) && file_exists($file)) {
                require_once($file);
            }
            if (!class_exists($class)) {
                continue;
            }
            if (!array_key_exists('cache_store', class_parents($class))) {
                continue;
            }
            if (!array_key_exists('configuration', $store) || !is_array($store['configuration'])) {
                $store['configuration'] = array();
            }
            $store['class'] = $class;
            $store['default'] = !empty($store['default']);
            if (!array_key_exists('lock', $store) || !array_key_exists($store['lock'], $this->configlocks)) {
                $store['lock'] = $defaultlock;
            }

            $this->configstores[$store['name']] = $store;
        }

        // Filter the definitions.
        foreach ($configuration['definitions'] as $id => $conf) {
            if (!is_array($conf)) {
                // Something is very wrong here.
                continue;
            }
            if (!array_key_exists('mode', $conf) || !array_key_exists('component', $conf) || !array_key_exists('area', $conf)) {
                // Not a valid definition configuration.
                continue;
            }
            if (array_key_exists($id, $this->configdefinitions)) {
                debugging('Duplicate cache definition detected. This should never happen.', DEBUG_DEVELOPER);
                continue;
            }
            $conf['mode'] = (int)$conf['mode'];
            if ($conf['mode'] < cache_store::MODE_APPLICATION || $conf['mode'] > cache_store::MODE_REQUEST) {
                // Invalid cache mode used for the definition.
                continue;
            }
            if ($conf['mode'] === cache_store::MODE_SESSION || $conf['mode'] === cache_store::MODE_REQUEST) {
                // We force this for session and request caches.
                // They are only allowed to use the default as we don't want people changing them.
                $conf['sharingoptions'] = cache_definition::SHARING_DEFAULT;
                $conf['selectedsharingoption'] = cache_definition::SHARING_DEFAULT;
                $conf['userinputsharingkey'] = '';
            } else {
                // Default the sharing option as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['sharingoptions'])) {
                    $conf['sharingoptions'] = cache_definition::SHARING_DEFAULTOPTIONS;
                }
                // Default the selected sharing option as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['selectedsharingoption'])) {
                    $conf['selectedsharingoption'] = cache_definition::SHARING_DEFAULT;
                }
                // Default the user input sharing key as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['userinputsharingkey'])) {
                    $conf['userinputsharingkey'] = '';
                }
            }
            $this->configdefinitions[$id] = $conf;
        }

        // Filter the mode mappings.
        foreach ($configuration['modemappings'] as $mapping) {
            if (!is_array($mapping) || !array_key_exists('mode', $mapping) || !array_key_exists('store', $mapping)) {
                // Not a valid mapping configuration.
                debugging('A cache mode mapping entry is invalid.', DEBUG_DEVELOPER);
                continue;
            }
            if (!array_key_exists($mapping['store'], $this->configstores)) {
                // Mapped array instance doesn't exist.
                debugging('A cache mode mapping exists for a mode or store that does not exist.', DEBUG_DEVELOPER);
                continue;
            }
            $mapping['mode'] = (int)$mapping['mode'];
            if ($mapping['mode'] < 0 || $mapping['mode'] > 4) {
                // Invalid cache type used for the mapping.
                continue;
            }
            if (!array_key_exists('sort', $mapping)) {
                $mapping['sort'] = 0;
            }
            $this->configmodemappings[] = $mapping;
        }

        // Filter the definition mappings.
        foreach ($configuration['definitionmappings'] as $mapping) {
            if (!is_array($mapping) || !array_key_exists('definition', $mapping) || !array_key_exists('store', $mapping)) {
                // Not a valid mapping configuration.
                continue;
            }
            if (!array_key_exists($mapping['store'], $this->configstores)) {
                // Mapped array instance doesn't exist.
                continue;
            }
            if (!array_key_exists($mapping['definition'], $this->configdefinitions)) {
                // Mapped array instance doesn't exist.
                continue;
            }
            if (!array_key_exists('sort', $mapping)) {
                $mapping['sort'] = 0;
            }
            $this->configdefinitionmappings[] = $mapping;
        }

        usort($this->configmodemappings, array($this, 'sort_mappings'));
        usort($this->configdefinitionmappings, array($this, 'sort_mappings'));

        return true;
    }
775155
public function load_config($fname = 'config.inc.php')
    {
        if (in_array($fname, $this->loaded_config)) {
            return true;
        }

        $this->loaded_config[] = $fname;

        $fpath = $this->home.'/'.$fname;
        $rcube = rcube::get_instance();

        if (($is_local = is_file($fpath)) && !$rcube->config->load_from_file($fpath)) {
            rcube::raise_error(array(
                'code' => 527, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Failed to load config from $fpath"), true, false);
            return false;
        }
        else if (!$is_local) {
            // Search plugin_name.inc.php file in any configured path
            return $rcube->config->load_from_file($this->ID . '.inc.php');
        }

        return true;
    }
1008849
public function register($provider, $force = false)
    {
        if (($registered = $this->getProvider($provider)) && ! $force) {
            return $registered;
        }

        // If the given "provider" is a string, we will resolve it, passing in the
        // application instance automatically for the developer. This is simply
        // a more convenient way of specifying your service provider classes.
        if (is_string($provider)) {
            $provider = $this->resolveProvider($provider);
        }

        $provider->register();

        // If there are bindings / singletons set as properties on the provider we
        // will spin through them and register them with the application, which
        // serves as a convenience layer while registering a lot of bindings.
        if (property_exists($provider, 'bindings')) {
            foreach ($provider->bindings as $key => $value) {
                $this->bind($key, $value);
            }
        }

        if (property_exists($provider, 'singletons')) {
            foreach ($provider->singletons as $key => $value) {
                $this->singleton($key, $value);
            }
        }

        $this->markAsRegistered($provider);

        // If the application has already booted, we will call this boot method on
        // the provider class so it has an opportunity to do its boot logic and
        // will be ready for any usage by this developer's application logic.
        if ($this->booted) {
            $this->bootProvider($provider);
        }

        return $provider;
    }
1266366
protected function loadMetadata(bool $force = false) {
        if (!$this->metadata || $force) {
            $meta = $this->getMetadataFromFedora();

            if (count($meta->propertyUris()) === 0) {
                throw new RuntimeException('No resource metadata. Please check a value of the fedoraApiUrl configuration property.');
            }

            $this->setMetadata($meta);
        }
    }
479720
public function get_preload( $force = false ) {

		if( !$force ) {
			return $this->preload;
		}

		$tArray = array(
			'action' => 'query',
			'prop'   => 'info',
			'inprop' => 'preload',
			'titles' => $this->title,
		);

		pecho( "Getting the preload text for {$this->title}..\n\n", PECHO_NORMAL );

		$tRes = $this->wiki->apiQuery( $tArray );

		if( isset( $tRes['query']['pages'][$this->pageid]['preload'] ) ) {
			$this->preload = $tRes['query']['pages'][$this->pageid]['preload'];
		} else $this->preload = null;

		return $this->preload;
	}
222572
public function loadConfig($file)
    {
        $config;

        switch (pathinfo($file, PATHINFO_EXTENSION)) {
        case 'json':
            $config = json_decode(file_get_contents($file));
            break;
        case 'php':
            $config = include $file;
            break;
        default:
            return $this;
        }

        $this->doCallback('configurationLoaded', array($config, $this));
        
        return $config;
    }
1215810
private function setup($force = false)
    {
        // Set a default error code to indicate if anything changes
        $this->errorCode = NULL;

        // Indicate if this is a forced procedure
        $this->force = $force;

        // Load the current user
        $this->getUser();

        // Get the current bcrypt cost
		$this->_cost = Cii::getBcryptCost();

        // Preload the number of password attempts. As of 1.10.0
        $this->getPasswordAttempts();

        return;
    }
817850
public function load($alias)
    {
        if (array_key_exists($alias, $this->aliases)) {
            return class_alias($this->aliases[$alias], $alias);
        }

        return false;
    }
813279
public function load( $reset = true )
    {
        if ( $this->UseCache )
        {
            $this->loadCache( $reset );
        }
        else
        {
            $this->parse( false, false, $reset );
        }
    }
875921
public function load($key, &$loaded) {
    $file = $this->getFile($this->getKey($key));
    if ($this->validate($file)) {
      $loaded = TRUE;
      
      return $this->direct ? $file : $file->getContents();
    }
    $loaded = FALSE;
  }
482461
function loadMetaData( $force = false )
    {
        if ( $this->filePath !== false )
        {
            eZDebug::accumulatorStart( 'dbfile', false, 'dbfile' );
            if ( $force )
            {
                clearstatcache();
                eZDebugSetting::writeDebug( 'kernel-clustering', ' clearstatcache called on ' . $this->filePath, __METHOD__ );
            }

            $this->metaData = file_exists( $this->filePath ) ? stat( $this->filePath ) : false;
            eZDebug::accumulatorStop( 'dbfile' );
        }
    }
122187
public function findAllToRefreshToken(bool $force = false)
    {
        $query = $this->newQuery();

        return $force ? $query->get() : $query->whereNull('token')->get();
    }
1264184
public function setup($force = false) {
		if(!$force && $this->description)
			return;
		
		$this->changeDescription($this->fetchDescription());
	}