/*!
\public
Load file meta information.

\param $force If true, file stats will be refreshed
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' );
        }
    }
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;
    }
210507
public function getMetadata(Resource $resource, $forceUpdate = false) {
		if ($this->metadata === null) {
			$this->initMetadata();
		}
		
		$path = $resource->getPath();
		
		if (! is_file($path)) {
			return false;
		}
		
		// Already exists for the resource
		if (! $forceUpdate && isset($this->metadata[$path])) {
			return $this->metadata[$path];
		}
		
		if ($resource->isLocal()) {
			$fileMtime = filemtime($path);
			
			if (isset($this->metadata[$path]) && $fileMtime === $this->metadata[$path]->mtime) {
				return $this->metadata[$path];
			}
		}
		
		$fileMeta = new stdClass();
		
		$fileMeta->mtime = isset($fileMtime) ? $fileMtime : false;
		$fileMeta->hash  = substr(md5_file($path), 24);
		
		$this->metadata[$path] = $fileMeta;
		$this->metadataChanged = true;
		
		return $fileMeta;
	}
705748
public static function get($file, $key = false, $force = false)
    {
        $item = self::read($file, $force);

        if($item === false)
        {
            return false;
        }

        if($key != false && isset($item[$key]))
        {
            return $item[$key];
        }

        return $item;
    }
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;
    }
692607
public function init($force = false)
    {
        $flockFactory = new Factory(new FlockStore());

        $lock = $flockFactory->createLock('propel-cache-generation');

        // Acquire a blocking cache generation lock
        $lock->acquire(true);

        try {
            if ($force) {
                (new Filesystem())->remove($this->getPropelCacheDir());
            }

            if (!file_exists($this->getTheliaDatabaseConfigFile())) {
                return false;
            }

            $this->buildPropelConfig();

            $this->buildPropelInitFile();
            require $this->getPropelInitFile();

            $theliaDatabaseConnection = Propel::getConnection('thelia');
            $this->schemaLocator->setTheliaDatabaseConnection($theliaDatabaseConnection);

            $this->buildPropelGlobalSchema();

            $this->buildPropelModels();
            $this->registerPropelModelLoader();

            $theliaDatabaseConnection->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);

            if ($this->debug) {
                // In debug mode, we have to initialize Tlog at this point, as this class uses Propel
                Tlog::getInstance()->setLevel(Tlog::DEBUG);

                Propel::getServiceContainer()->setLogger('defaultLogger', Tlog::getInstance());
                $theliaDatabaseConnection->useDebug(true);
            }
        } catch (\Throwable $th) {
            $fs = new Filesystem();
            $fs->remove(THELIA_CACHE_DIR . $this->environment);
            $fs->remove($this->getPropelModelDir());
            throw $th;
        } finally {
            // Release cache generation lock
            $lock->release();
        }

        return true;
    }
739525
public function load($refresh = false)
    {
        $results = $this->repository->read();

        /* @var $config \Core\Config\ConfigObject */
        foreach ($results as $config) {
            $storage = $this->createStorage($config->getStorage());
            $storage->set($config->getId(), $config->getValue());
        }
    }
933550
public function compile($force = false)
    {
        $this->commandCaller->compile($this->configFile, $force, $this->target);
    }
1152781
public function add(array $file = null, $force = false)
    {
        $args   = array();
        if ($force) {
            $args[]  = '--force';
        }
        if ($file !== null) {
            $status = $this->getStatus();
            if (empty($status)) {
                return;
            }

            $files  = $this->resolveLocalGlobPath($file);
            foreach ($this->getStatus() as $status) {
                if (   $status['status'] != 'unversioned'
                    && in_array($status['file'], $files)
                ) {
                    array_splice($files, array_search($status['file'], $files), 1);
                }
            }

            if (empty($files)) {
                return;
            }

            $args[] = '--parents';
            $args[] = '--';
            $args   = array_merge($args, $files);
        } else {
            $toAdd      = array();
            $toRemove   = array();
            foreach ($this->getStatus() as $status) {
                if ($status['status'] == 'missing') {
                    $toRemove[] = $this->resolveLocalPath($status['file']);
                } else if ($status['status'] == 'unversioned') {
                    $toAdd[] = $this->resolveLocalPath($status['file']);
                }
            }

            if (!empty($toRemove)) {
                $this->remove($toRemove, false, $force);
            }
            if (empty($toAdd)) {
                return;
            }

            $args['--depth']    = 'infinity';
            $args[]             = '--';
            $args               = array_merge($args, $toAdd);
        }

        /** @var $result CallResult */
        $result = $this->getSvn()->{'add'}($this->getRepositoryPath(), $args);
        $result->assertSuccess(sprintf('Cannot add "%s" to "%s"',
            ($file !== null) ? implode(', ', $file) : '*', $this->getRepositoryPath()
        ));
    }
1135804
public function read($force = false)
	{
		// initialize the session
		$this->data = array();
		$this->keys = array();
		$this->flash = array();

		// get the session cookie
		$payload = $this->_get_cookie();

		// validate it
		if ($force)
		{
			// a forced session reset
		}
		elseif ($payload === false)
		{
			// no cookie found
		}
		elseif ( ! isset($payload[0]) or ! is_array($payload[0]))
		{
			logger('DEBUG', 'Error: not a valid cookie payload!');
		}
		elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp())
		{
			logger('DEBUG', 'Error: session id has expired!');
		}
		elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip().\Input::real_ip()))
		{
			logger('DEBUG', 'Error: IP address in the session doesn\'t match this requests source IP!');
		}
		elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent())
		{
			logger('DEBUG', 'Error: User agent in the session doesn\'t match the browsers user agent string!');
		}
		else
		{
			// session is valid, retrieve the payload
			if (isset($payload[0]) and is_array($payload[0])) $this->keys  = $payload[0];
			if (isset($payload[1]) and is_array($payload[1])) $this->data  = $payload[1];
			if (isset($payload[2]) and is_array($payload[2])) $this->flash = $payload[2];
		}

		return parent::read();
	}
996831
public function isOver32(bool $force = false): bool
    {
        // value 0xFFFFFFFF already needs a Zip64 header
        return $force ||
            max(array_slice($this->bytes, 4, 4)) > 0 ||
            min(array_slice($this->bytes, 0, 4)) === 0xFF;
    }
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;
	}
1264184
public function setup($force = false) {
		if(!$force && $this->description)
			return;
		
		$this->changeDescription($this->fetchDescription());
	}
423493
public function load()
    {
        if ($this->fs->exists($this->filename) === false) {
            return;
        }

        try {
            $data = $this->fs->readFile($this->filename);
        } catch (\Exception $e) {
            $message = sprintf('Error loading the site metadata: %s', $e->getMessage());
            throw new LoadSiteMetadataException($message, 0, $e, $this->filename);
        }

        $this->metadata = json_decode($data, true);

        if (0 < $errorCode = json_last_error()) {
            $this->throwInvalidMetadataException($errorCode);
        }
    }
509076
public function flushCacheState(bool $force = false): void
    {
        if ((!empty($this->newCacheState) && is_writable($this->cacheDir)) || $force) {
            $fullCacheMap = $this->newCacheState + $this->cacheState;
            $cachePath    = substr(var_export($this->cacheDir, true), 1, -1);
            $rootPath     = substr(var_export($this->appDir, true), 1, -1);
            $cacheData    = '<?php return ' . var_export($fullCacheMap, true) . ';';
            $cacheData    = strtr($cacheData, [
                '\'' . $cachePath => 'AOP_CACHE_DIR . \'',
                '\'' . $rootPath  => 'AOP_ROOT_DIR . \''
            ]);
            $fullCacheFileName = $this->cacheDir . self::CACHE_FILE_NAME;
            file_put_contents($fullCacheFileName, $cacheData, LOCK_EX);
            // For cache files we don't want executable bits by default
            chmod($fullCacheFileName, $this->fileMode & (~0111));

            if (function_exists('opcache_invalidate')) {
                opcache_invalidate($fullCacheFileName, true);
            }
            $this->cacheState    = $this->newCacheState + $this->cacheState;
            $this->newCacheState = [];
        }
    }
496477
public static function rm($force = false, $remove_volumes = false)
    {
        $args = [];
        if ($force) {
            $args[] = '-f';
        }
        if ($remove_volumes) {
            $args[] = '-v';
        }
        return self::runCommand('rm', $args);
    }
360617
public function gitPull(bool $force = false): void
	{
		$this->maintenance();
		if ($force) {
			$this->git->update();
		} else {
			$this->git->authorizedUpdate();
		}
		$this->maintenance(false);
	}