Nahraje databazi
@param string $file
@throws \Exception
480481
public function loadDatabase(string $file): void
	{
		$this->connection->transactional(function (Connection $db) use ($file) {
			$db->query('SET foreign_key_checks = 0');
			FileImporter::executeFile($db, $file);
			$db->query('SET foreign_key_checks = 1');
		});
	}
806383
public function loadDatabase(string $file): void
	{
		Helpers::loadFromFile($this->context->getConnection(), $file);
	}
332490
public function read($file)
    {
        $this->filePath = $file;
        $this->config = parse_ini_file($this->filePath);
    }
144755
public function save($file)
	{
		$handle = strcasecmp(substr($file, -3), '.gz') ? fopen($file, 'wb') : gzopen($file, 'wb');
		if (!$handle) {
			throw new Exception("ERROR: Cannot write file '$file'.");
		}
		$this->write($handle);
	}
1351261
public function addFile($file) {
        $baseName = basename($file, '.php');

        $components = explode('.', $baseName);
        $language = $components[1];

        $data = require($file);

        $this->add($data, $language);
    }
623966
public function parseFile($file)
    {
        $str = @\file_get_contents($file);
        if (false === $str) {
            throw new Exception('Can\'t read file.');
        }

        return $this->parse($str);
    }
1108930
public function addFile($file, $resource = null)
    {
        if (!file_exists($file) || !is_file($file)) {
            throw new \Exception('The configuration file ' . $file . ' does not exist.');
        } else {
            if ($resource === null) {
                $resource = $file;
            }

            if (!array_key_exists($resource, self::$parameters)) {
                self::$parameters[$resource] = new ParameterBag();
            }

            $content = YamlParser::parse(file_get_contents($file));

            if ($content !== null) {
                $content = self::parseImports($content, $resource);

                $content = self::parseParameters($content, $resource);

                self::addConfig($content, $resource);
            }
        }

        return self::getInstance();
    }
519570
public function loadFile(string $file)
    {
        $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
        switch ($extension) {
            case "ini":
                $this->loadIni($file);
                break;
            case "xml":
                $this->loadXml($file);
                break;
            case "yml":
                $this->loadYaml($file);
                break;
            case "php":
                $this->loadPhp($file);
                break;
            default:
                //不用处理
                break;
        }
    }
1222166
public function execute($files)
  {
    printLn('=> PageWriter.');
    $pages = Application::db()->retrieve('page_list');

    $writer = new DataWriter();

    foreach($pages as $page) {
      $tmpl = $this->make_data($page);
      $writer->write($tmpl['slug'], 'index.html', $tmpl['html']);
    }
  }
1000445
public function writePoFile(string $file): void
    {
        $source = $this->dumpString();
        $testName = file_exists($file) ? $file : dirname($file);
        $status = is_writable($testName);
        if ($status === true) {
            $status = file_put_contents($file, $source);
        }
        if (false === $status) {
            throw new FileNotWritableException($file);
        }
    }
672835
public static function eTagChanged($file, $etag = null) {

        $etag = trim($etag, '" ');

        if (!$etag) {
            return true;
        }

        if (!file_exists($file)) {
            throw new Exception("File '$file' not exists");
        }

        if (!is_file($file)) {
            throw new Exception("'$file' is not file");
        }

        if (!is_readable($file)) {
            throw new Exception("File '$file' not readable");
        }

        return hash_file('crc32', $file) !== $etag;
    }
618744
private function load_xmldb_file($file) {
        $xmldb_file = new xmldb_file($file);

        if (!$xmldb_file->fileExists()) {
            throw new ddl_exception('ddlxmlfileerror', null, 'File does not exist');
        }

        $loaded = $xmldb_file->loadXMLStructure();
        if (!$loaded || !$xmldb_file->isLoaded()) {
            // Show info about the error if we can find it
            if ($structure = $xmldb_file->getStructure()) {
                if ($errors = $structure->getAllErrors()) {
                    throw new ddl_exception('ddlxmlfileerror', null, 'Errors found in XMLDB file: '. implode (', ', $errors));
                }
            }
            throw new ddl_exception('ddlxmlfileerror', null, 'not loaded??');
        }

        return $xmldb_file;
    }
154917
protected function assertData($data, string $file): void
    {
        if ($data === null && json_last_error() !== JSON_ERROR_NONE) {
            throw new LoadException("Failed to load settings from '$file': " . json_last_error_msg());
        }

        if (!$data instanceof stdClass) {
            throw new LoadException("Failed to load settings from '$file': Data should be an object");
        }
    }
380527
public function render(string $file = null): string
    {
        if ($file) {
            $this->setFile($file);
        }

        if (empty($this->file)) {
            throw new \Exception('You must set the file to use within your view before rendering');
        }

        return $this->capture($this->file, $this->data, static::$globalData);
    }
31171
protected function assertData($data, string $file): void
    {
        if ($data === false || $data === null) {
            throw new LoadException("Failed to load settings from '$file'");
        }

        if (!$data instanceof stdClass && !is_associative_array($data)) {
            throw new LoadException("Failed to load settings from '$file': data should be key/value pairs");
        }
    }
514381
public static function start(String $file)
    {
        if( ! Info::available($file) )
        {
            throw new Exception\FileNotFoundException($file);
        }

        self::readFileContent($file);
    }
1055469
public static function removeFile(string $file): void
    {
        if (\is_file($file)) {
            if (!@\unlink($file)) {
                throw new \RuntimeException(\sprintf('Unable to delete file "%s"%s', $file, self::getErrorInfo()));
            }
        }
        
        \clearstatcache(true, $file);
    }