HOR-3670-RG Files review:
workflow/engine/classes/BpmnEngine_Services_SearchIndex.php workflow/engine/classes/Bzip_File.php workflow/engine/classes/CLI.php workflow/engine/classes/Cases.php workflow/engine/classes/Configurations.php
This commit is contained in:
63
workflow/engine/classes/BzipFile.php
Normal file
63
workflow/engine/classes/BzipFile.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* This class is derived from the class archive, is employed to use files .bzip
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
*/class BzipFile extends tar_file
|
||||
{
|
||||
|
||||
/**
|
||||
* This function is the constructor of the class bzip_file
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function BzipFile($name)
|
||||
{
|
||||
$this->tar_file($name);
|
||||
$this->options['type'] = "bzip";
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is employed to create files .
|
||||
* bzip
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function create_bzip()
|
||||
{
|
||||
if ($this->options['inmemory'] == 0) {
|
||||
$pwd = getcwd();
|
||||
chdir($this->options['basedir']);
|
||||
if ($fp = bzopen($this->options['name'], "wb")) {
|
||||
fseek($this->archive, 0);
|
||||
while ($temp = fread($this->archive, 1048576)) {
|
||||
bzwrite($fp, $temp);
|
||||
}
|
||||
bzclose($fp);
|
||||
chdir($pwd);
|
||||
} else {
|
||||
$this->error[] = "Could not open {$this->options['name']} for writing.";
|
||||
chdir($pwd);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->archive = bzcompress($this->archive, $this->options['level']);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function open a archive of the class bzip_file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function open_archive()
|
||||
{
|
||||
return @bzopen($this->options['name'], "rb");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user