Пример #1
0
 /**
  * Compiles the history-file. This is to be done when the writing to the history-file is complete.
  * This essentialy puts the file in a closed state, gzipping it while also optionally adding extra data.
  * @param string|null $historyOutput A filepath-string to the file to be created. This may be omitted in which case
  *		the output-file will be the same as the input.
  * @param mixed $customData Anything that is json-friendly can be passed here. It will be assigned to the root of
  *		the final, compiled json-object with the same name("customData")
  * @param bool $keepInputFile If this is set to true then the uncompiled input-file will not be deleted. An example
  *		of a useful case for this would be if daily history-files are generated, and one would like to view the
  *		history so far of today. For this to work $historyOutput needs to be set.
  * @return bool Returns true for success*/
 public function compileHistory($historyOutput = null, $customData = null, $keepInputFile = false)
 {
     //$this->historyFileObject needs to be unset so that gzip can remove the input file as its supposed to(unless
     //$keepInputFile is set to true), and we can't save it to a local variable and then remove it from instance
     //and call compile with local, since this local variable in this function will still be holdig it then which
     //would prevent the file from getting removed.
     $historyFilePath = $this->historyFileObject->getPathname();
     $this->historyFileObject = null;
     Hicurl::compileHistoryStatic($historyFilePath, $historyOutput, $customData, $keepInputFile);
 }
Пример #2
0
<?php

require_once '../src/hicurl.php';
unlink('data/history.tmp');
Hicurl::loadSingleStatic('www.google.com', null, ['history' => 'data/history.tmp']);
Hicurl::compileHistoryStatic('data/history.tmp', 'data/history.gz');
include "assets/test.htm";