CODE STYLE, workflow/engine/classes/
FILES: class.applications.php class.archive.php class.wsTools.php
This commit is contained in:
@@ -86,8 +86,9 @@ class archive
|
|||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
$this->archive = "";
|
$this->archive = "";
|
||||||
|
}
|
||||||
switch ($this->options['type']) {
|
switch ($this->options['type']) {
|
||||||
case "zip":
|
case "zip":
|
||||||
if (! $this->create_zip()) {
|
if (! $this->create_zip()) {
|
||||||
@@ -139,8 +140,7 @@ class archive
|
|||||||
{
|
{
|
||||||
if ($this->options['inmemory'] == 0) {
|
if ($this->options['inmemory'] == 0) {
|
||||||
fwrite( $this->archive, $data );
|
fwrite( $this->archive, $data );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->archive .= $data;
|
$this->archive .= $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,16 +152,24 @@ class archive
|
|||||||
*/
|
*/
|
||||||
public function make_list ()
|
public function make_list ()
|
||||||
{
|
{
|
||||||
if (! empty( $this->exclude ))
|
if (! empty( $this->exclude )) {
|
||||||
foreach ($this->files as $key => $value)
|
foreach ($this->files as $key => $value) {
|
||||||
foreach ($this->exclude as $current)
|
foreach ($this->exclude as $current) {
|
||||||
if ($value['name'] == $current['name'])
|
if ($value['name'] == $current['name']) {
|
||||||
unset( $this->files[$key] );
|
unset( $this->files[$key] );
|
||||||
if (! empty( $this->storeonly ))
|
}
|
||||||
foreach ($this->files as $key => $value)
|
}
|
||||||
foreach ($this->storeonly as $current)
|
}
|
||||||
if ($value['name'] == $current['name'])
|
}
|
||||||
|
if (! empty( $this->storeonly )) {
|
||||||
|
foreach ($this->files as $key => $value) {
|
||||||
|
foreach ($this->storeonly as $current) {
|
||||||
|
if ($value['name'] == $current['name']) {
|
||||||
$this->files[$key]['method'] = 0;
|
$this->files[$key]['method'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unset( $this->exclude, $this->storeonly );
|
unset( $this->exclude, $this->storeonly );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,9 +182,10 @@ class archive
|
|||||||
public function add_files ($list)
|
public function add_files ($list)
|
||||||
{
|
{
|
||||||
$temp = $this->list_files( $list );
|
$temp = $this->list_files( $list );
|
||||||
foreach ($temp as $current)
|
foreach ($temp as $current) {
|
||||||
$this->files[] = $current;
|
$this->files[] = $current;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function exclude files of a list
|
* This function exclude files of a list
|
||||||
@@ -187,9 +196,10 @@ class archive
|
|||||||
public function exclude_files ($list)
|
public function exclude_files ($list)
|
||||||
{
|
{
|
||||||
$temp = $this->list_files( $list );
|
$temp = $this->list_files( $list );
|
||||||
foreach ($temp as $current)
|
foreach ($temp as $current) {
|
||||||
$this->exclude[] = $current;
|
$this->exclude[] = $current;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function store files
|
* This function store files
|
||||||
@@ -199,9 +209,10 @@ class archive
|
|||||||
public function store_files ($list)
|
public function store_files ($list)
|
||||||
{
|
{
|
||||||
$temp = $this->list_files( $list );
|
$temp = $this->list_files( $list );
|
||||||
foreach ($temp as $current)
|
foreach ($temp as $current) {
|
||||||
$this->storeonly[] = $current;
|
$this->storeonly[] = $current;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List files gives a List
|
* List files gives a List
|
||||||
@@ -229,19 +240,23 @@ class archive
|
|||||||
$regex = str_replace( "*", ".*", $regex );
|
$regex = str_replace( "*", ".*", $regex );
|
||||||
$dir = strstr( $current, "/" ) ? substr( $current, 0, strrpos( $current, "/" ) ) : ".";
|
$dir = strstr( $current, "/" ) ? substr( $current, 0, strrpos( $current, "/" ) ) : ".";
|
||||||
$temp = $this->parse_dir( $dir );
|
$temp = $this->parse_dir( $dir );
|
||||||
foreach ($temp as $current2)
|
foreach ($temp as $current2) {
|
||||||
if (preg_match( "/^{$regex}$/i", $current2['name'] ))
|
if (preg_match( "/^{$regex}$/i", $current2['name'] )) {
|
||||||
$files[] = $current2;
|
$files[] = $current2;
|
||||||
|
}
|
||||||
|
}
|
||||||
unset( $regex, $dir, $temp, $current );
|
unset( $regex, $dir, $temp, $current );
|
||||||
} elseif (@is_dir( $current )) {
|
} elseif (@is_dir( $current )) {
|
||||||
$temp = $this->parse_dir( $current );
|
$temp = $this->parse_dir( $current );
|
||||||
foreach ($temp as $file)
|
foreach ($temp as $file) {
|
||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
|
}
|
||||||
unset( $temp, $file );
|
unset( $temp, $file );
|
||||||
} else if (@file_exists( $current ))
|
} elseif (@file_exists( $current )) {
|
||||||
$files[] = array ('name' => $current,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $current, "/" )) ? substr( $current, strrpos( $current, "/" ) + 1 ) : $current ),'type' => @is_link( $current ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $current, strrpos( $current, "." ) ),'stat' => stat( $current )
|
$files[] = array ('name' => $current,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $current, "/" )) ? substr( $current, strrpos( $current, "/" ) + 1 ) : $current ),'type' => @is_link( $current ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $current, strrpos( $current, "." ) ),'stat' => stat( $current )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
unset( $current, $pwd );
|
unset( $current, $pwd );
|
||||||
usort( $files, array ("archive","sort_files"
|
usort( $files, array ("archive","sort_files"
|
||||||
@@ -257,27 +272,31 @@ class archive
|
|||||||
*/
|
*/
|
||||||
public function parse_dir ($dirname)
|
public function parse_dir ($dirname)
|
||||||
{
|
{
|
||||||
if ($this->options['storepaths'] == 1 && ! preg_match( "/^(\.+\/*)+$/", $dirname ))
|
if ($this->options['storepaths'] == 1 && ! preg_match( "/^(\.+\/*)+$/", $dirname )) {
|
||||||
$files = array (array ('name' => $dirname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $dirname, "/" )) ? substr( $dirname, strrpos( $dirname, "/" ) + 1 ) : $dirname ),'type' => 5,'stat' => stat( $dirname )
|
$files = array (array ('name' => $dirname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $dirname, "/" )) ? substr( $dirname, strrpos( $dirname, "/" ) + 1 ) : $dirname ),'type' => 5,'stat' => stat( $dirname )
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
else
|
} else {
|
||||||
$files = array ();
|
$files = array ();
|
||||||
|
}
|
||||||
$dir = @opendir( $dirname );
|
$dir = @opendir( $dirname );
|
||||||
while ($file = @readdir( $dir )) {
|
while ($file = @readdir( $dir )) {
|
||||||
$fullname = $dirname . "/" . $file;
|
$fullname = $dirname . "/" . $file;
|
||||||
if ($file == "." || $file == "..")
|
if ($file == "." || $file == "..") {
|
||||||
continue;
|
continue;
|
||||||
else if (@is_dir( $fullname )) {
|
} elseif (@is_dir( $fullname )) {
|
||||||
if (empty( $this->options['recurse'] ))
|
if (empty( $this->options['recurse'] )) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
$temp = $this->parse_dir( $fullname );
|
$temp = $this->parse_dir( $fullname );
|
||||||
foreach ($temp as $file2)
|
foreach ($temp as $file2) {
|
||||||
$files[] = $file2;
|
$files[] = $file2;
|
||||||
} else if (@file_exists( $fullname ))
|
}
|
||||||
|
} elseif (@file_exists( $fullname )) {
|
||||||
$files[] = array ('name' => $fullname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $fullname, "/" )) ? substr( $fullname, strrpos( $fullname, "/" ) + 1 ) : $fullname ),'type' => @is_link( $fullname ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $file, strrpos( $file, "." ) ),'stat' => stat( $fullname )
|
$files[] = array ('name' => $fullname,'name2' => $this->options['prepend'] . preg_replace( "/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr( $fullname, "/" )) ? substr( $fullname, strrpos( $fullname, "/" ) + 1 ) : $fullname ),'type' => @is_link( $fullname ) && $this->options['followlinks'] == 0 ? 2 : 0,'ext' => substr( $file, strrpos( $file, "." ) ),'stat' => stat( $fullname )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@closedir( $dir );
|
@closedir( $dir );
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
@@ -291,19 +310,21 @@ class archive
|
|||||||
*/
|
*/
|
||||||
public function sort_files ($a, $b)
|
public function sort_files ($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['type'] != $b['type'])
|
if ($a['type'] != $b['type']) {
|
||||||
if ($a['type'] == 5 || $b['type'] == 2)
|
if ($a['type'] == 5 || $b['type'] == 2) {
|
||||||
return - 1;
|
return - 1;
|
||||||
else if ($a['type'] == 2 || $b['type'] == 5)
|
} elseif ($a['type'] == 2 || $b['type'] == 5) {
|
||||||
return 1;
|
return 1;
|
||||||
else if ($a['type'] == 5)
|
} elseif ($a['type'] == 5) {
|
||||||
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
|
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
|
||||||
else if ($a['ext'] != $b['ext'])
|
} elseif ($a['ext'] != $b['ext']) {
|
||||||
return strcmp( $a['ext'], $b['ext'] );
|
return strcmp( $a['ext'], $b['ext'] );
|
||||||
else if ($a['stat'][7] != $b['stat'][7])
|
} elseif ($a['stat'][7] != $b['stat'][7]) {
|
||||||
return $a['stat'][7] > $b['stat'][7] ? - 1 : 1;
|
return $a['stat'][7] > $b['stat'][7] ? - 1 : 1;
|
||||||
else
|
} else {
|
||||||
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
|
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +396,9 @@ class tar_file extends archive
|
|||||||
$pwd = getcwd();
|
$pwd = getcwd();
|
||||||
chdir( $this->options['basedir'] );
|
chdir( $this->options['basedir'] );
|
||||||
foreach ($this->files as $current) {
|
foreach ($this->files as $current) {
|
||||||
if ($current['name'] == $this->options['name'])
|
if ($current['name'] == $this->options['name']) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (strlen( $current['name2'] ) > 99) {
|
if (strlen( $current['name2'] ) > 99) {
|
||||||
$path = substr( $current['name2'], 0, strpos( $current['name2'], "/", strlen( $current['name2'] ) - 100 ) + 1 );
|
$path = substr( $current['name2'], 0, strpos( $current['name2'], "/", strlen( $current['name2'] ) - 100 ) + 1 );
|
||||||
$current['name2'] = substr( $current['name2'], strlen( $path ) );
|
$current['name2'] = substr( $current['name2'], strlen( $path ) );
|
||||||
@@ -387,26 +409,30 @@ class tar_file extends archive
|
|||||||
}
|
}
|
||||||
$block = pack( "a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf( "%07o", $current['stat'][2] ), sprintf( "%07o", $current['stat'][4] ), sprintf( "%07o", $current['stat'][5] ), sprintf( "%011o", $current['type'] == 2 ? 0 : $current['stat'][7] ), sprintf( "%011o", $current['stat'][9] ), " ", $current['type'], $current['type'] == 2 ? @readlink( $current['name'] ) : "", "ustar ", " ", "Unknown", "Unknown", "", "", ! empty( $path ) ? $path : "", "" );
|
$block = pack( "a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf( "%07o", $current['stat'][2] ), sprintf( "%07o", $current['stat'][4] ), sprintf( "%07o", $current['stat'][5] ), sprintf( "%011o", $current['type'] == 2 ? 0 : $current['stat'][7] ), sprintf( "%011o", $current['stat'][9] ), " ", $current['type'], $current['type'] == 2 ? @readlink( $current['name'] ) : "", "ustar ", " ", "Unknown", "Unknown", "", "", ! empty( $path ) ? $path : "", "" );
|
||||||
$checksum = 0;
|
$checksum = 0;
|
||||||
for ($i = 0; $i < 512; $i ++)
|
for ($i = 0; $i < 512; $i ++) {
|
||||||
$checksum += ord( substr( $block, $i, 1 ) );
|
$checksum += ord( substr( $block, $i, 1 ) );
|
||||||
|
}
|
||||||
$checksum = pack( "a8", sprintf( "%07o", $checksum ) );
|
$checksum = pack( "a8", sprintf( "%07o", $checksum ) );
|
||||||
$block = substr_replace( $block, $checksum, 148, 8 );
|
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||||
if ($current['type'] == 2 || $current['stat'][7] == 0)
|
if ($current['type'] == 2 || $current['stat'][7] == 0) {
|
||||||
$this->add_data( $block );
|
$this->add_data( $block );
|
||||||
else if ($fp = @fopen( $current['name'], "rb" )) {
|
} elseif ($fp = @fopen( $current['name'], "rb" )) {
|
||||||
$this->add_data( $block );
|
$this->add_data( $block );
|
||||||
while ($temp = fread( $fp, 1048576 ))
|
while ($temp = fread( $fp, 1048576 )) {
|
||||||
$this->add_data( $temp );
|
$this->add_data( $temp );
|
||||||
|
}
|
||||||
if ($current['stat'][7] % 512 > 0) {
|
if ($current['stat'][7] % 512 > 0) {
|
||||||
$temp = "";
|
$temp = "";
|
||||||
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i ++)
|
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i ++) {
|
||||||
$temp .= "\0";
|
$temp .= "\0";
|
||||||
|
}
|
||||||
$this->add_data( $temp );
|
$this->add_data( $temp );
|
||||||
}
|
}
|
||||||
fclose( $fp );
|
fclose( $fp );
|
||||||
} else
|
} else {
|
||||||
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->add_data( pack( "a1024", "" ) );
|
$this->add_data( pack( "a1024", "" ) );
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
return 1;
|
return 1;
|
||||||
@@ -422,34 +448,38 @@ class tar_file extends archive
|
|||||||
$pwd = getcwd();
|
$pwd = getcwd();
|
||||||
chdir( $this->options['basedir'] );
|
chdir( $this->options['basedir'] );
|
||||||
if ($fp = $this->open_archive()) {
|
if ($fp = $this->open_archive()) {
|
||||||
if ($this->options['inmemory'] == 1)
|
if ($this->options['inmemory'] == 1) {
|
||||||
$this->files = array ();
|
$this->files = array ();
|
||||||
|
}
|
||||||
while ($block = fread( $fp, 512 )) {
|
while ($block = fread( $fp, 512 )) {
|
||||||
$temp = unpack( "a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block );
|
$temp = unpack( "a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block );
|
||||||
$file = array ('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'],'stat' => array (2 => $temp['mode'],4 => octdec( $temp['uid'] ),5 => octdec( $temp['gid'] ),7 => octdec( $temp['size'] ),9 => octdec( $temp['mtime'] )
|
$file = array ('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'],'stat' => array (2 => $temp['mode'],4 => octdec( $temp['uid'] ),5 => octdec( $temp['gid'] ),7 => octdec( $temp['size'] ),9 => octdec( $temp['mtime'] )
|
||||||
),'checksum' => octdec( $temp['checksum'] ),'type' => $temp['type'],'magic' => $temp['magic']
|
),'checksum' => octdec( $temp['checksum'] ),'type' => $temp['type'],'magic' => $temp['magic']
|
||||||
);
|
);
|
||||||
if ($file['checksum'] == 0x00000000)
|
if ($file['checksum'] == 0x00000000) {
|
||||||
break;
|
break;
|
||||||
else if (substr( $file['magic'], 0, 5 ) != "ustar") {
|
} elseif (substr( $file['magic'], 0, 5 ) != "ustar") {
|
||||||
$this->error[] = "This script does not support extracting this type of tar file.";
|
$this->error[] = "This script does not support extracting this type of tar file.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$block = substr_replace( $block, " ", 148, 8 );
|
$block = substr_replace( $block, " ", 148, 8 );
|
||||||
$checksum = 0;
|
$checksum = 0;
|
||||||
for ($i = 0; $i < 512; $i ++)
|
for ($i = 0; $i < 512; $i ++) {
|
||||||
$checksum += ord( substr( $block, $i, 1 ) );
|
$checksum += ord( substr( $block, $i, 1 ) );
|
||||||
if ($file['checksum'] != $checksum)
|
}
|
||||||
|
if ($file['checksum'] != $checksum) {
|
||||||
$this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
$this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||||
|
}
|
||||||
if ($this->options['inmemory'] == 1) {
|
if ($this->options['inmemory'] == 1) {
|
||||||
$file['data'] = fread( $fp, $file['stat'][7] );
|
$file['data'] = fread( $fp, $file['stat'][7] );
|
||||||
fread( $fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512) );
|
fread( $fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512) );
|
||||||
unset( $file['checksum'], $file['magic'] );
|
unset( $file['checksum'], $file['magic'] );
|
||||||
$this->files[] = $file;
|
$this->files[] = $file;
|
||||||
} elseif ($file['type'] == 5) {
|
} elseif ($file['type'] == 5) {
|
||||||
if (! is_dir( $file['name'] ))
|
if (! is_dir( $file['name'] )) {
|
||||||
//mkdir($file['name'], $file['stat'][2]);
|
//mkdir($file['name'], $file['stat'][2]);
|
||||||
mkdir( $file['name'], 0775 );
|
mkdir( $file['name'], 0775 );
|
||||||
|
}
|
||||||
} elseif ($this->options['overwrite'] == 0 && file_exists( $file['name'] )) {
|
} elseif ($this->options['overwrite'] == 0 && file_exists( $file['name'] )) {
|
||||||
$this->error[] = "{$file['name']} already exist.";
|
$this->error[] = "{$file['name']} already exist.";
|
||||||
continue;
|
continue;
|
||||||
@@ -475,8 +505,9 @@ class tar_file extends archive
|
|||||||
@touch( $file['name'], $file['stat'][9] );
|
@touch( $file['name'], $file['stat'][9] );
|
||||||
unset( $file );
|
unset( $file );
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
$this->error[] = "Could not open file {$this->options['name']}";
|
$this->error[] = "Could not open file {$this->options['name']}";
|
||||||
|
}
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,8 +557,9 @@ class gzip_file extends tar_file
|
|||||||
chdir( $this->options['basedir'] );
|
chdir( $this->options['basedir'] );
|
||||||
if ($fp = gzopen( $this->options['name'], "wb{$this->options['level']}" )) {
|
if ($fp = gzopen( $this->options['name'], "wb{$this->options['level']}" )) {
|
||||||
fseek( $this->archive, 0 );
|
fseek( $this->archive, 0 );
|
||||||
while ($temp = fread( $this->archive, 1048576 ))
|
while ($temp = fread( $this->archive, 1048576 )) {
|
||||||
gzwrite( $fp, $temp );
|
gzwrite( $fp, $temp );
|
||||||
|
}
|
||||||
gzclose( $fp );
|
gzclose( $fp );
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
} else {
|
} else {
|
||||||
@@ -535,8 +567,9 @@ class gzip_file extends tar_file
|
|||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
$this->archive = gzencode( $this->archive, $this->options['level'] );
|
$this->archive = gzencode( $this->archive, $this->options['level'] );
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,8 +620,9 @@ class bzip_file extends tar_file
|
|||||||
chdir( $this->options['basedir'] );
|
chdir( $this->options['basedir'] );
|
||||||
if ($fp = bzopen( $this->options['name'], "wb" )) {
|
if ($fp = bzopen( $this->options['name'], "wb" )) {
|
||||||
fseek( $this->archive, 0 );
|
fseek( $this->archive, 0 );
|
||||||
while ($temp = fread( $this->archive, 1048576 ))
|
while ($temp = fread( $this->archive, 1048576 )) {
|
||||||
bzwrite( $fp, $temp );
|
bzwrite( $fp, $temp );
|
||||||
|
}
|
||||||
bzclose( $fp );
|
bzclose( $fp );
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
} else {
|
} else {
|
||||||
@@ -596,9 +630,9 @@ class bzip_file extends tar_file
|
|||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
$this->archive = bzcompress( $this->archive, $this->options['level'] );
|
$this->archive = bzcompress( $this->archive, $this->options['level'] );
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,20 +674,23 @@ class zip_file extends archive
|
|||||||
$files = 0;
|
$files = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$central = "";
|
$central = "";
|
||||||
if (! empty( $this->options['sfx'] ))
|
if (! empty( $this->options['sfx'] )) {
|
||||||
if ($fp = @fopen( $this->options['sfx'], "rb" )) {
|
if ($fp = @fopen( $this->options['sfx'], "rb" )) {
|
||||||
$temp = fread( $fp, filesize( $this->options['sfx'] ) );
|
$temp = fread( $fp, filesize( $this->options['sfx'] ) );
|
||||||
fclose( $fp );
|
fclose( $fp );
|
||||||
$this->add_data( $temp );
|
$this->add_data( $temp );
|
||||||
$offset += strlen( $temp );
|
$offset += strlen( $temp );
|
||||||
unset( $temp );
|
unset( $temp );
|
||||||
} else
|
} else {
|
||||||
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
|
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
|
||||||
|
}
|
||||||
|
}
|
||||||
$pwd = getcwd();
|
$pwd = getcwd();
|
||||||
chdir( $this->options['basedir'] );
|
chdir( $this->options['basedir'] );
|
||||||
foreach ($this->files as $current) {
|
foreach ($this->files as $current) {
|
||||||
if ($current['name'] == $this->options['name'])
|
if ($current['name'] == $this->options['name']) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
$timedate = explode( " ", date( "Y n j G i s", $current['stat'][9] ) );
|
$timedate = explode( " ", date( "Y n j G i s", $current['stat'][9] ) );
|
||||||
$timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]);
|
$timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]);
|
||||||
$block = pack( "VvvvV", 0x04034b50, 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate );
|
$block = pack( "VvvvV", 0x04034b50, 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate );
|
||||||
@@ -681,8 +718,9 @@ class zip_file extends archive
|
|||||||
$temp = gzcompress( $temp, $this->options['level'] );
|
$temp = gzcompress( $temp, $this->options['level'] );
|
||||||
$size = strlen( $temp ) - 6;
|
$size = strlen( $temp ) - 6;
|
||||||
$temp = substr( $temp, 2, $size );
|
$temp = substr( $temp, 2, $size );
|
||||||
} else
|
} else {
|
||||||
$size = strlen( $temp );
|
$size = strlen( $temp );
|
||||||
|
}
|
||||||
$block .= pack( "VVVvv", $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000 );
|
$block .= pack( "VVVvv", $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000 );
|
||||||
$block .= $current['name2'];
|
$block .= $current['name2'];
|
||||||
$this->add_data( $block );
|
$this->add_data( $block );
|
||||||
@@ -692,13 +730,15 @@ class zip_file extends archive
|
|||||||
$central .= $current['name2'];
|
$central .= $current['name2'];
|
||||||
$files ++;
|
$files ++;
|
||||||
$offset += (30 + strlen( $current['name2'] ) + $size);
|
$offset += (30 + strlen( $current['name2'] ) + $size);
|
||||||
} else
|
} else {
|
||||||
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->add_data( $central );
|
$this->add_data( $central );
|
||||||
$this->add_data( pack( "VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen( $central ), $offset, ! empty( $this->options['comment'] ) ? strlen( $this->options['comment'] ) : 0x0000 ) );
|
$this->add_data( pack( "VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen( $central ), $offset, ! empty( $this->options['comment'] ) ? strlen( $this->options['comment'] ) : 0x0000 ) );
|
||||||
if (! empty( $this->options['comment'] ))
|
if (! empty( $this->options['comment'] )) {
|
||||||
$this->add_data( $this->options['comment'] );
|
$this->add_data( $this->options['comment'] );
|
||||||
|
}
|
||||||
chdir( $pwd );
|
chdir( $pwd );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,23 +8,27 @@
|
|||||||
G::LoadSystem( 'dbMaintenance' );
|
G::LoadSystem( 'dbMaintenance' );
|
||||||
G::LoadClass( "cli" );
|
G::LoadClass( "cli" );
|
||||||
G::LoadClass( "multipleFilesBackup" );
|
G::LoadClass( "multipleFilesBackup" );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class workspaceTools
|
* class workspaceTools
|
||||||
|
*
|
||||||
* @package workflow.engine.classes
|
* @package workflow.engine.classes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class workspaceTools {
|
class workspaceTools
|
||||||
var $name = NULL;
|
{
|
||||||
var $path = NULL;
|
var $name = null;
|
||||||
var $db = NULL;
|
var $path = null;
|
||||||
var $dbPath = NULL;
|
var $db = null;
|
||||||
var $dbInfo = NULL;
|
var $dbPath = null;
|
||||||
|
var $dbInfo = null;
|
||||||
var $dbInfoRegExp = "/( *define *\( *'(?P<key>.*?)' *, *\n* *')(?P<value>.*?)(' *\) *;.*)/";
|
var $dbInfoRegExp = "/( *define *\( *'(?P<key>.*?)' *, *\n* *')(?P<value>.*?)(' *\) *;.*)/";
|
||||||
var $initPropel = false;
|
var $initPropel = false;
|
||||||
var $initPropelRoot = false;
|
var $initPropelRoot = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a workspace tools object. Note that workspace might not exist when
|
* Create a workspace tools object.
|
||||||
|
* Note that workspace might not exist when
|
||||||
* this object is created, however most methods requires that a workspace with
|
* this object is created, however most methods requires that a workspace with
|
||||||
* this name does exists.
|
* this name does exists.
|
||||||
*
|
*
|
||||||
@@ -32,20 +36,23 @@ class workspaceTools {
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $workspaceName name of the workspace
|
* @param string $workspaceName name of the workspace
|
||||||
*/
|
*/
|
||||||
function __construct($workspaceName) {
|
function __construct ($workspaceName)
|
||||||
|
{
|
||||||
$this->name = $workspaceName;
|
$this->name = $workspaceName;
|
||||||
$this->path = PATH_DB . $this->name;
|
$this->path = PATH_DB . $this->name;
|
||||||
$this->dbPath = $this->path . '/db.php';
|
$this->dbPath = $this->path . '/db.php';
|
||||||
if ($this->workspaceExists())
|
if ($this->workspaceExists()) {
|
||||||
$this->getDBInfo();
|
$this->getDBInfo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the workspace already exists
|
* Returns true if the workspace already exists
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function workspaceExists() {
|
public function workspaceExists ()
|
||||||
|
{
|
||||||
return (file_exists( $this->path ) && file_exists( $this->dbPath ));
|
return (file_exists( $this->path ) && file_exists( $this->dbPath ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,11 +97,14 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @return array with database information
|
* @return array with database information
|
||||||
*/
|
*/
|
||||||
public function getDBInfo() {
|
public function getDBInfo ()
|
||||||
if (!$this->workspaceExists())
|
{
|
||||||
|
if (! $this->workspaceExists()) {
|
||||||
throw new Exception( "Could not get db.php in workspace " . $this->name );
|
throw new Exception( "Could not get db.php in workspace " . $this->name );
|
||||||
if (isset($this->dbInfo))
|
}
|
||||||
|
if (isset( $this->dbInfo )) {
|
||||||
return $this->dbInfo;
|
return $this->dbInfo;
|
||||||
|
}
|
||||||
$sDbFile = file_get_contents( $this->dbPath );
|
$sDbFile = file_get_contents( $this->dbPath );
|
||||||
/* This regular expression will match any "define ('<key>', '<value>');"
|
/* This regular expression will match any "define ('<key>', '<value>');"
|
||||||
* with any combination of whitespace between words.
|
* with any combination of whitespace between words.
|
||||||
@@ -114,22 +124,19 @@ class workspaceTools {
|
|||||||
return $this->dbInfo = $values;
|
return $this->dbInfo = $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resetDBInfoCallback($matches) {
|
private function resetDBInfoCallback ($matches)
|
||||||
|
{
|
||||||
/* This function changes the values of defines while keeping their formatting
|
/* This function changes the values of defines while keeping their formatting
|
||||||
* intact.
|
* intact.
|
||||||
* $matches will contain several groups:
|
* $matches will contain several groups:
|
||||||
* ((define('(<key>)2', ')1 (<value>)3 (');)4 )0
|
* ((define('(<key>)2', ')1 (<value>)3 (');)4 )0
|
||||||
*/
|
*/
|
||||||
$dbPrefix = array(
|
$dbPrefix = array ('DB_NAME' => 'wf_','DB_USER' => 'wf_','DB_RBAC_NAME' => 'rb_','DB_RBAC_USER' => 'rb_','DB_REPORT_NAME' => 'rp_','DB_REPORT_USER' => 'rp_'
|
||||||
'DB_NAME' => 'wf_',
|
);
|
||||||
'DB_USER' => 'wf_',
|
|
||||||
'DB_RBAC_NAME' => 'rb_',
|
|
||||||
'DB_RBAC_USER' => 'rb_',
|
|
||||||
'DB_REPORT_NAME' => 'rp_',
|
|
||||||
'DB_REPORT_USER' => 'rp_');
|
|
||||||
$key = $matches['key'];
|
$key = $matches['key'];
|
||||||
$value = $matches['value'];
|
$value = $matches['value'];
|
||||||
if (array_search($key, array('DB_HOST', 'DB_RBAC_HOST', 'DB_REPORT_HOST')) !== false) {
|
if (array_search( $key, array ('DB_HOST','DB_RBAC_HOST','DB_REPORT_HOST'
|
||||||
|
) ) !== false) {
|
||||||
/* Change the database hostname for these keys */
|
/* Change the database hostname for these keys */
|
||||||
$value = $this->newHost;
|
$value = $this->newHost;
|
||||||
} elseif (array_key_exists( $key, $dbPrefix )) {
|
} elseif (array_key_exists( $key, $dbPrefix )) {
|
||||||
@@ -160,28 +167,32 @@ class workspaceTools {
|
|||||||
* @param bool $resetDBNames if true, also reset all database names
|
* @param bool $resetDBNames if true, also reset all database names
|
||||||
* @return array contains the new database names as values
|
* @return array contains the new database names as values
|
||||||
*/
|
*/
|
||||||
public function resetDBInfo($newHost, $resetDBNames = true) {
|
public function resetDBInfo ($newHost, $resetDBNames = true)
|
||||||
if (count(explode(":", $newHost)) < 2)
|
{
|
||||||
|
if (count( explode( ":", $newHost ) ) < 2) {
|
||||||
$newHost .= ':3306';
|
$newHost .= ':3306';
|
||||||
|
}
|
||||||
$this->newHost = $newHost;
|
$this->newHost = $newHost;
|
||||||
$this->resetDBNames = $resetDBNames;
|
$this->resetDBNames = $resetDBNames;
|
||||||
$this->resetDBDiff = array ();
|
$this->resetDBDiff = array ();
|
||||||
|
|
||||||
if (!$this->workspaceExists())
|
if (! $this->workspaceExists()) {
|
||||||
throw new Exception( "Could not find db.php in the workspace" );
|
throw new Exception( "Could not find db.php in the workspace" );
|
||||||
|
}
|
||||||
$sDbFile = file_get_contents( $this->dbPath );
|
$sDbFile = file_get_contents( $this->dbPath );
|
||||||
if ($sDbFile === false)
|
if ($sDbFile === false) {
|
||||||
throw new Exception( "Could not read database information from db.php" );
|
throw new Exception( "Could not read database information from db.php" );
|
||||||
|
}
|
||||||
/* Match all defines in the config file. Check updateDBCallback to know what
|
/* Match all defines in the config file. Check updateDBCallback to know what
|
||||||
* keys are changed and what groups are matched.
|
* keys are changed and what groups are matched.
|
||||||
* This regular expression will match any "define ('<key>', '<value>');"
|
* This regular expression will match any "define ('<key>', '<value>');"
|
||||||
* with any combination of whitespace between words.
|
* with any combination of whitespace between words.
|
||||||
*/
|
*/
|
||||||
$sNewDbFile = preg_replace_callback("/( *define *\( *'(?P<key>.*?)' *, *\n* *')(?P<value>.*?)(' *\) *;.*)/",
|
$sNewDbFile = preg_replace_callback( "/( *define *\( *'(?P<key>.*?)' *, *\n* *')(?P<value>.*?)(' *\) *;.*)/", array (&$this,'resetDBInfoCallback'
|
||||||
array(&$this, 'resetDBInfoCallback'),
|
), $sDbFile );
|
||||||
$sDbFile);
|
if (file_put_contents( $this->dbPath, $sNewDbFile ) === false) {
|
||||||
if (file_put_contents($this->dbPath, $sNewDbFile) === false)
|
|
||||||
throw new Exception( "Could not write database information to db.php" );
|
throw new Exception( "Could not write database information to db.php" );
|
||||||
|
}
|
||||||
$newDBNames = $this->resetDBDiff;
|
$newDBNames = $this->resetDBDiff;
|
||||||
unset( $this->resetDBDiff );
|
unset( $this->resetDBDiff );
|
||||||
unset( $this->resetDBNames );
|
unset( $this->resetDBNames );
|
||||||
@@ -196,23 +207,13 @@ class workspaceTools {
|
|||||||
* @param string $dbName a db name, such as wf, rp and rb
|
* @param string $dbName a db name, such as wf, rp and rb
|
||||||
* @return array with all the database information.
|
* @return array with all the database information.
|
||||||
*/
|
*/
|
||||||
public function getDBCredentials($dbName) {
|
public function getDBCredentials ($dbName)
|
||||||
$prefixes = array(
|
{
|
||||||
"wf" => "",
|
$prefixes = array ("wf" => "","rp" => "REPORT_","rb" => "RBAC_"
|
||||||
"rp" => "REPORT_",
|
|
||||||
"rb" => "RBAC_"
|
|
||||||
);
|
);
|
||||||
$prefix = $prefixes[$dbName];
|
$prefix = $prefixes[$dbName];
|
||||||
$dbInfo = $this->getDBInfo();
|
$dbInfo = $this->getDBInfo();
|
||||||
return array(
|
return array ('adapter' => $dbInfo["DB_ADAPTER"],'name' => $dbInfo["DB_" . $prefix . "NAME"],'host' => $dbInfo["DB_" . $prefix . "HOST"],'user' => $dbInfo["DB_" . $prefix . "USER"],'pass' => $dbInfo["DB_" . $prefix . "PASS"],'dsn' => sprintf( "%s://%s:%s@%s/%s?encoding=utf8", $dbInfo['DB_ADAPTER'], $dbInfo["DB_" . $prefix . "USER"], $dbInfo["DB_" . $prefix . "PASS"], $dbInfo["DB_" . $prefix . "HOST"], $dbInfo["DB_" . $prefix . "NAME"] )
|
||||||
'adapter' => $dbInfo["DB_ADAPTER"],
|
|
||||||
'name' => $dbInfo["DB_".$prefix."NAME"],
|
|
||||||
'host' => $dbInfo["DB_".$prefix."HOST"],
|
|
||||||
'user' => $dbInfo["DB_".$prefix."USER"],
|
|
||||||
'pass' => $dbInfo["DB_".$prefix."PASS"],
|
|
||||||
'dsn' => sprintf("%s://%s:%s@%s/%s?encoding=utf8", $dbInfo['DB_ADAPTER'] ,
|
|
||||||
$dbInfo["DB_".$prefix."USER"], $dbInfo["DB_".$prefix."PASS"],
|
|
||||||
$dbInfo["DB_".$prefix."HOST"], $dbInfo["DB_".$prefix."NAME"])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,26 +223,18 @@ class workspaceTools {
|
|||||||
* @param bool $root wheter to also initialize a root connection
|
* @param bool $root wheter to also initialize a root connection
|
||||||
* @return the Propel connection
|
* @return the Propel connection
|
||||||
*/
|
*/
|
||||||
public function initPropel($root = false) {
|
public function initPropel ($root = false)
|
||||||
if (($this->initPropel && !$root) || ($this->initPropelRoot && $root))
|
{
|
||||||
|
if (($this->initPropel && ! $root) || ($this->initPropelRoot && $root)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
$wfDetails = $this->getDBCredentials( "wf" );
|
$wfDetails = $this->getDBCredentials( "wf" );
|
||||||
$rbDetails = $this->getDBCredentials( "rb" );
|
$rbDetails = $this->getDBCredentials( "rb" );
|
||||||
$rpDetails = $this->getDBCredentials( "rp" );
|
$rpDetails = $this->getDBCredentials( "rp" );
|
||||||
|
|
||||||
$config = array(
|
$config = array ('datasources' => array ('workflow' => array ('connection' => $wfDetails["dsn"],'adapter' => $wfDetails["adapter"]
|
||||||
'datasources' => array(
|
),'rbac' => array ('connection' => $rbDetails["dsn"],'adapter' => $rbDetails["adapter"]
|
||||||
'workflow' => array(
|
),'rp' => array ('connection' => $rpDetails["dsn"],'adapter' => $rpDetails["adapter"]
|
||||||
'connection' => $wfDetails["dsn"],
|
|
||||||
'adapter' => $wfDetails["adapter"]
|
|
||||||
),
|
|
||||||
'rbac' => array(
|
|
||||||
'connection' => $rbDetails["dsn"],
|
|
||||||
'adapter' => $rbDetails["adapter"]
|
|
||||||
),
|
|
||||||
'rp' => array(
|
|
||||||
'connection' => $rpDetails["dsn"],
|
|
||||||
'adapter' => $rpDetails["adapter"]
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -255,11 +248,7 @@ class workspaceTools {
|
|||||||
$pass = $dbHash[2];
|
$pass = $dbHash[2];
|
||||||
$dbName = $dbInfo["DB_NAME"];
|
$dbName = $dbInfo["DB_NAME"];
|
||||||
|
|
||||||
$rootConfig = array(
|
$rootConfig = array ('datasources' => array ('root' => array ('connection' => "mysql://$user:$pass@$host/$dbName?encoding=utf8",'adapter' => "mysql"
|
||||||
'datasources' => array(
|
|
||||||
'root' => array(
|
|
||||||
'connection' => "mysql://$user:$pass@$host/$dbName?encoding=utf8",
|
|
||||||
'adapter' => "mysql"
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -280,7 +269,8 @@ class workspaceTools {
|
|||||||
/**
|
/**
|
||||||
* Close the propel connection from initPropel
|
* Close the propel connection from initPropel
|
||||||
*/
|
*/
|
||||||
private function closePropel() {
|
private function closePropel ()
|
||||||
|
{
|
||||||
Propel::close();
|
Propel::close();
|
||||||
$this->initPropel = false;
|
$this->initPropel = false;
|
||||||
$this->initPropelRoot = false;
|
$this->initPropelRoot = false;
|
||||||
@@ -288,9 +278,9 @@ class workspaceTools {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade this workspace Content.
|
* Upgrade this workspace Content.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function upgradeContent($workSpace=SYS_SYS) {
|
public function upgradeContent ($workSpace = SYS_SYS)
|
||||||
|
{
|
||||||
$this->initPropel( true );
|
$this->initPropel( true );
|
||||||
require_once 'classes/model/Translation.php';
|
require_once 'classes/model/Translation.php';
|
||||||
$translation = new Translation();
|
$translation = new Translation();
|
||||||
@@ -309,7 +299,8 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @param bool $first if updating a series of workspace, true if the first
|
* @param bool $first if updating a series of workspace, true if the first
|
||||||
*/
|
*/
|
||||||
public function upgradeTranslation($first = true) {
|
public function upgradeTranslation ($first = true)
|
||||||
|
{
|
||||||
$this->initPropel( true );
|
$this->initPropel( true );
|
||||||
require_once ('classes/model/Language.php');
|
require_once ('classes/model/Language.php');
|
||||||
G::LoadThirdParty( 'pear/json', 'class.json' );
|
G::LoadThirdParty( 'pear/json', 'class.json' );
|
||||||
@@ -333,12 +324,13 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @return database connection
|
* @return database connection
|
||||||
*/
|
*/
|
||||||
private function getDatabase() {
|
private function getDatabase ()
|
||||||
if (isset($this->db) && $this->db->isConnected())
|
{
|
||||||
|
if (isset( $this->db ) && $this->db->isConnected()) {
|
||||||
return $this->db;
|
return $this->db;
|
||||||
|
}
|
||||||
G::LoadSystem( 'database_' . strtolower( $this->dbAdapter ) );
|
G::LoadSystem( 'database_' . strtolower( $this->dbAdapter ) );
|
||||||
$this->db = new database($this->dbAdapter, $this->dbHost, $this->dbUser,
|
$this->db = new database( $this->dbAdapter, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName );
|
||||||
$this->dbPass, $this->dbName);
|
|
||||||
if (! $this->db->isConnected()) {
|
if (! $this->db->isConnected()) {
|
||||||
$this->db->logQuery( 'No available connection to database!' );
|
$this->db->logQuery( 'No available connection to database!' );
|
||||||
throw new Exception( "Could not connect to database" );
|
throw new Exception( "Could not connect to database" );
|
||||||
@@ -349,17 +341,20 @@ class workspaceTools {
|
|||||||
/**
|
/**
|
||||||
* Close any database opened with getDatabase
|
* Close any database opened with getDatabase
|
||||||
*/
|
*/
|
||||||
private function closeDatabase() {
|
private function closeDatabase ()
|
||||||
if (!isset($this->db))
|
{
|
||||||
|
if (! isset( $this->db )) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
$this->db->close();
|
$this->db->close();
|
||||||
$this->db = NULL;
|
$this->db = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close all currently opened databases
|
* Close all currently opened databases
|
||||||
*/
|
*/
|
||||||
public function close() {
|
public function close ()
|
||||||
|
{
|
||||||
$this->closePropel();
|
$this->closePropel();
|
||||||
$this->closeDatabase();
|
$this->closeDatabase();
|
||||||
}
|
}
|
||||||
@@ -369,7 +364,8 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @return array with the database schema
|
* @return array with the database schema
|
||||||
*/
|
*/
|
||||||
public function getSchema() {
|
public function getSchema ()
|
||||||
|
{
|
||||||
$oDataBase = $this->getDatabase();
|
$oDataBase = $this->getDatabase();
|
||||||
|
|
||||||
$aOldSchema = array ();
|
$aOldSchema = array ();
|
||||||
@@ -379,7 +375,7 @@ class workspaceTools {
|
|||||||
$oDataset1 = $oDataBase->executeQuery( $oDataBase->generateShowTablesSQL() );
|
$oDataset1 = $oDataBase->executeQuery( $oDataBase->generateShowTablesSQL() );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$oDataBase->logQuery( $e->getmessage() );
|
$oDataBase->logQuery( $e->getmessage() );
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//going thru all tables in current WF_ database
|
//going thru all tables in current WF_ database
|
||||||
@@ -415,7 +411,9 @@ class workspaceTools {
|
|||||||
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM
|
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM
|
||||||
}
|
}
|
||||||
//finally return the array with old schema obtained from the Database
|
//finally return the array with old schema obtained from the Database
|
||||||
if ( count($aOldSchema) == 0 ) $aOldSchema = null;
|
if (count( $aOldSchema ) == 0) {
|
||||||
|
$aOldSchema = null;
|
||||||
|
}
|
||||||
return $aOldSchema;
|
return $aOldSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +425,8 @@ class workspaceTools {
|
|||||||
* @param bool $checkOnly only check if the upgrade is needed if true
|
* @param bool $checkOnly only check if the upgrade is needed if true
|
||||||
* @param string $lang not currently used
|
* @param string $lang not currently used
|
||||||
*/
|
*/
|
||||||
public function upgradeCacheView($fill=true) {
|
public function upgradeCacheView ($fill = true)
|
||||||
|
{
|
||||||
$this->initPropel( true );
|
$this->initPropel( true );
|
||||||
|
|
||||||
$lang = "en";
|
$lang = "en";
|
||||||
@@ -436,7 +435,7 @@ class workspaceTools {
|
|||||||
|
|
||||||
//check the language, if no info in config about language, the default is 'en'
|
//check the language, if no info in config about language, the default is 'en'
|
||||||
G::loadClass( 'configuration' );
|
G::loadClass( 'configuration' );
|
||||||
$oConf = new Configurations;
|
$oConf = new Configurations();
|
||||||
$oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' );
|
$oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' );
|
||||||
$appCacheViewEngine = $oConf->aConfig;
|
$appCacheViewEngine = $oConf->aConfig;
|
||||||
|
|
||||||
@@ -474,9 +473,7 @@ class workspaceTools {
|
|||||||
//build using the method in AppCacheView Class
|
//build using the method in AppCacheView Class
|
||||||
$res = $appCache->fillAppCacheView( $lang );
|
$res = $appCache->fillAppCacheView( $lang );
|
||||||
//set status in config table
|
//set status in config table
|
||||||
$confParams = Array(
|
$confParams = Array ('LANG' => $lang,'STATUS' => 'active'
|
||||||
'LANG' => $lang,
|
|
||||||
'STATUS'=> 'active'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$oConf->aConfig = $confParams;
|
$oConf->aConfig = $confParams;
|
||||||
@@ -485,7 +482,8 @@ class workspaceTools {
|
|||||||
// removing casesList configuration records. TODO: removing these lines that resets all the configurations records
|
// removing casesList configuration records. TODO: removing these lines that resets all the configurations records
|
||||||
$oCriteria = new Criteria();
|
$oCriteria = new Criteria();
|
||||||
$oCriteria->add( ConfigurationPeer::CFG_UID, "casesList" );
|
$oCriteria->add( ConfigurationPeer::CFG_UID, "casesList" );
|
||||||
$oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN);
|
$oCriteria->add( ConfigurationPeer::OBJ_UID, array ("todo","draft","sent","unassigned","paused","cancelled"
|
||||||
|
), Criteria::NOT_IN );
|
||||||
ConfigurationPeer::doDelete( $oCriteria );
|
ConfigurationPeer::doDelete( $oCriteria );
|
||||||
// end of reset
|
// end of reset
|
||||||
}
|
}
|
||||||
@@ -493,7 +491,8 @@ class workspaceTools {
|
|||||||
/**
|
/**
|
||||||
* Upgrade this workspace database to the latest plugins schema
|
* Upgrade this workspace database to the latest plugins schema
|
||||||
*/
|
*/
|
||||||
public function upgradePluginsDatabase() {
|
public function upgradePluginsDatabase ()
|
||||||
|
{
|
||||||
foreach (System::getPlugins() as $pluginName) {
|
foreach (System::getPlugins() as $pluginName) {
|
||||||
$pluginSchema = System::getPluginSchema( $pluginName );
|
$pluginSchema = System::getPluginSchema( $pluginName );
|
||||||
if ($pluginSchema !== false) {
|
if ($pluginSchema !== false) {
|
||||||
@@ -507,25 +506,26 @@ class workspaceTools {
|
|||||||
* Upgrade this workspace database to the latest system schema
|
* Upgrade this workspace database to the latest system schema
|
||||||
*
|
*
|
||||||
* @param bool $checkOnly only check if the upgrade is needed if true
|
* @param bool $checkOnly only check if the upgrade is needed if true
|
||||||
* @return array|bool see upgradeSchema for more information
|
* @return array bool upgradeSchema for more information
|
||||||
*/
|
*/
|
||||||
public function upgradeDatabase($checkOnly = false) {
|
public function upgradeDatabase ($checkOnly = false)
|
||||||
|
{
|
||||||
$systemSchema = System::getSystemSchema();
|
$systemSchema = System::getSystemSchema();
|
||||||
$this->upgradeSchema( $systemSchema );
|
$this->upgradeSchema( $systemSchema );
|
||||||
$this->upgradeData();
|
$this->upgradeData();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade this workspace database from a schema
|
* Upgrade this workspace database from a schema
|
||||||
*
|
*
|
||||||
* @param array $schema the schema information, such as returned from getSystemSchema
|
* @param array $schema the schema information, such as returned from getSystemSchema
|
||||||
* @param bool $checkOnly only check if the upgrade is needed if true
|
* @param bool $checkOnly only check if the upgrade is needed if true
|
||||||
* @return array|bool returns the changes if checkOnly is true, else return
|
* @return array bool the changes if checkOnly is true, else return
|
||||||
* true on success
|
* true on success
|
||||||
*/
|
*/
|
||||||
public function upgradeSchema($schema, $checkOnly = false) {
|
public function upgradeSchema ($schema, $checkOnly = false)
|
||||||
|
{
|
||||||
$dbInfo = $this->getDBInfo();
|
$dbInfo = $this->getDBInfo();
|
||||||
|
|
||||||
if (strcmp( $dbInfo["DB_ADAPTER"], "mysql" ) != 0) {
|
if (strcmp( $dbInfo["DB_ADAPTER"], "mysql" ) != 0) {
|
||||||
@@ -534,10 +534,7 @@ class workspaceTools {
|
|||||||
|
|
||||||
$workspaceSchema = $this->getSchema();
|
$workspaceSchema = $this->getSchema();
|
||||||
$changes = System::compareSchema( $workspaceSchema, $schema );
|
$changes = System::compareSchema( $workspaceSchema, $schema );
|
||||||
$changed = (count($changes['tablesToAdd']) > 0 ||
|
$changed = (count( $changes['tablesToAdd'] ) > 0 || count( $changes['tablesToAlter'] ) > 0 || count( $changes['tablesWithNewIndex'] ) > 0 || count( $changes['tablesToAlterIndex'] ) > 0);
|
||||||
count($changes['tablesToAlter']) > 0 ||
|
|
||||||
count($changes['tablesWithNewIndex']) > 0 ||
|
|
||||||
count($changes['tablesToAlterIndex']) > 0);
|
|
||||||
if ($checkOnly || (! $changed)) {
|
if ($checkOnly || (! $changed)) {
|
||||||
if ($changed) {
|
if ($changed) {
|
||||||
return $changes;
|
return $changes;
|
||||||
@@ -552,8 +549,9 @@ class workspaceTools {
|
|||||||
|
|
||||||
$oDataBase->logQuery( count( $changes ) );
|
$oDataBase->logQuery( count( $changes ) );
|
||||||
|
|
||||||
if (!empty($changes['tablesToAdd']))
|
if (! empty( $changes['tablesToAdd'] )) {
|
||||||
CLI::logging( "-> " . count( $changes['tablesToAdd'] ) . " tables to add\n" );
|
CLI::logging( "-> " . count( $changes['tablesToAdd'] ) . " tables to add\n" );
|
||||||
|
}
|
||||||
foreach ($changes['tablesToAdd'] as $sTable => $aColumns) {
|
foreach ($changes['tablesToAdd'] as $sTable => $aColumns) {
|
||||||
$oDataBase->executeQuery( $oDataBase->generateCreateTableSQL( $sTable, $aColumns ) );
|
$oDataBase->executeQuery( $oDataBase->generateCreateTableSQL( $sTable, $aColumns ) );
|
||||||
if (isset( $changes['tablesToAdd'][$sTable]['INDEXES'] )) {
|
if (isset( $changes['tablesToAdd'][$sTable]['INDEXES'] )) {
|
||||||
@@ -563,8 +561,9 @@ class workspaceTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($changes['tablesToAlter']))
|
if (! empty( $changes['tablesToAlter'] )) {
|
||||||
CLI::logging( "-> " . count( $changes['tablesToAlter'] ) . " tables to alter\n" );
|
CLI::logging( "-> " . count( $changes['tablesToAlter'] ) . " tables to alter\n" );
|
||||||
|
}
|
||||||
foreach ($changes['tablesToAlter'] as $sTable => $aActions) {
|
foreach ($changes['tablesToAlter'] as $sTable => $aActions) {
|
||||||
foreach ($aActions as $sAction => $aAction) {
|
foreach ($aActions as $sAction => $aAction) {
|
||||||
foreach ($aAction as $sColumn => $vData) {
|
foreach ($aAction as $sColumn => $vData) {
|
||||||
@@ -583,16 +582,18 @@ class workspaceTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($changes['tablesWithNewIndex']))
|
if (! empty( $changes['tablesWithNewIndex'] )) {
|
||||||
CLI::logging( "-> " . count( $changes['tablesWithNewIndex'] ) . " indexes to add\n" );
|
CLI::logging( "-> " . count( $changes['tablesWithNewIndex'] ) . " indexes to add\n" );
|
||||||
|
}
|
||||||
foreach ($changes['tablesWithNewIndex'] as $sTable => $aIndexes) {
|
foreach ($changes['tablesWithNewIndex'] as $sTable => $aIndexes) {
|
||||||
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
||||||
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
|
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($changes['tablesToAlterIndex']))
|
if (! empty( $changes['tablesToAlterIndex'] )) {
|
||||||
CLI::logging( "-> " . count( $changes['tablesToAlterIndex'] ) . " indexes to alter\n" );
|
CLI::logging( "-> " . count( $changes['tablesToAlterIndex'] ) . " indexes to alter\n" );
|
||||||
|
}
|
||||||
foreach ($changes['tablesToAlterIndex'] as $sTable => $aIndexes) {
|
foreach ($changes['tablesToAlterIndex'] as $sTable => $aIndexes) {
|
||||||
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
||||||
$oDataBase->executeQuery( $oDataBase->generateDropKeySQL( $sTable, $sIndexName ) );
|
$oDataBase->executeQuery( $oDataBase->generateDropKeySQL( $sTable, $sIndexName ) );
|
||||||
@@ -603,7 +604,8 @@ class workspaceTools {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeData() {
|
public function upgradeData ()
|
||||||
|
{
|
||||||
if (file_exists( PATH_CORE . 'data' . PATH_SEP . 'check.data' )) {
|
if (file_exists( PATH_CORE . 'data' . PATH_SEP . 'check.data' )) {
|
||||||
$checkData = unserialize( file_get_contents( PATH_CORE . 'data' . PATH_SEP . 'check.data' ) );
|
$checkData = unserialize( file_get_contents( PATH_CORE . 'data' . PATH_SEP . 'check.data' ) );
|
||||||
if (is_array( $checkData )) {
|
if (is_array( $checkData )) {
|
||||||
@@ -614,7 +616,8 @@ class workspaceTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateThisRegistry($data) {
|
public function updateThisRegistry ($data)
|
||||||
|
{
|
||||||
$dataBase = $this->getDatabase();
|
$dataBase = $this->getDatabase();
|
||||||
$sql = '';
|
$sql = '';
|
||||||
switch ($data['action']) {
|
switch ($data['action']) {
|
||||||
@@ -653,7 +656,8 @@ class workspaceTools {
|
|||||||
* @param string $path the directory where to create the sql files
|
* @param string $path the directory where to create the sql files
|
||||||
* @return array information about this workspace
|
* @return array information about this workspace
|
||||||
*/
|
*/
|
||||||
public function getMetadata() {
|
public function getMetadata ()
|
||||||
|
{
|
||||||
$Fields = array_merge( System::getSysInfo(), $this->getDBInfo() );
|
$Fields = array_merge( System::getSysInfo(), $this->getDBInfo() );
|
||||||
$Fields['WORKSPACE_NAME'] = $this->name;
|
$Fields['WORKSPACE_NAME'] = $this->name;
|
||||||
|
|
||||||
@@ -670,6 +674,7 @@ class workspaceTools {
|
|||||||
// $availdb .= $val['name'];
|
// $availdb .= $val['name'];
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
G::LoadClass( 'net' );
|
G::LoadClass( 'net' );
|
||||||
$dbNetView = new NET( $this->dbHost );
|
$dbNetView = new NET( $this->dbHost );
|
||||||
$dbNetView->loginDbServer( $this->dbUser, $this->dbPass );
|
$dbNetView->loginDbServer( $this->dbUser, $this->dbPass );
|
||||||
@@ -697,49 +702,47 @@ class workspaceTools {
|
|||||||
/**
|
/**
|
||||||
* Print the system information gathered from getSysInfo
|
* Print the system information gathered from getSysInfo
|
||||||
*/
|
*/
|
||||||
public static function printSysInfo() {
|
public static function printSysInfo ()
|
||||||
|
{
|
||||||
$fields = System::getSysInfo();
|
$fields = System::getSysInfo();
|
||||||
|
|
||||||
$info = array(
|
$info = array ('ProcessMaker Version' => $fields['PM_VERSION'],'System' => $fields['SYSTEM'],'PHP Version' => $fields['PHP'],'Server Address' => $fields['SERVER_ADDR'],'Client IP Address' => $fields['IP'],'Plugins' => (count( $fields['PLUGINS_LIST'] ) > 0) ? $fields['PLUGINS_LIST'][0] : 'None'
|
||||||
'ProcessMaker Version' => $fields['PM_VERSION'],
|
|
||||||
'System' => $fields['SYSTEM'],
|
|
||||||
'PHP Version' => $fields['PHP'],
|
|
||||||
'Server Address' => $fields['SERVER_ADDR'],
|
|
||||||
'Client IP Address' => $fields['IP'],
|
|
||||||
'Plugins' => (count($fields['PLUGINS_LIST']) > 0) ? $fields['PLUGINS_LIST'][0] : 'None'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($fields['PLUGINS_LIST'] as $k => $v) {
|
foreach ($fields['PLUGINS_LIST'] as $k => $v) {
|
||||||
if ($k == 0)
|
if ($k == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
$info[] = $v;
|
$info[] = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($info as $k => $v) {
|
foreach ($info as $k => $v) {
|
||||||
if (is_numeric($k)) $k = "";
|
if (is_numeric( $k )) {
|
||||||
|
$k = "";
|
||||||
|
}
|
||||||
CLI::logging( sprintf( "%20s %s\n", $k, pakeColor::colorize( $v, 'INFO' ) ) );
|
CLI::logging( sprintf( "%20s %s\n", $k, pakeColor::colorize( $v, 'INFO' ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printInfo($fields = NULL) {
|
public function printInfo ($fields = null)
|
||||||
if (!$fields)
|
{
|
||||||
|
if (! $fields) {
|
||||||
$fields = $this->getMetadata();
|
$fields = $this->getMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
$wfDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_USER'] . ':' . $fields['DB_PASS'] . '@' . $fields['DB_HOST'] . '/' . $fields['DB_NAME'];
|
$wfDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_USER'] . ':' . $fields['DB_PASS'] . '@' . $fields['DB_HOST'] . '/' . $fields['DB_NAME'];
|
||||||
$rbDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_RBAC_USER'] . ':' . $fields['DB_RBAC_PASS'] . '@' . $fields['DB_RBAC_HOST'] . '/' . $fields['DB_RBAC_NAME'];
|
$rbDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_RBAC_USER'] . ':' . $fields['DB_RBAC_PASS'] . '@' . $fields['DB_RBAC_HOST'] . '/' . $fields['DB_RBAC_NAME'];
|
||||||
$rpDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_REPORT_USER'] . ':' . $fields['DB_REPORT_PASS'] . '@' . $fields['DB_REPORT_HOST'] . '/' . $fields['DB_REPORT_NAME'];
|
$rpDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_REPORT_USER'] . ':' . $fields['DB_REPORT_PASS'] . '@' . $fields['DB_REPORT_HOST'] . '/' . $fields['DB_REPORT_NAME'];
|
||||||
|
|
||||||
$info = array(
|
$info = array ('Workspace Name' => $fields['WORKSPACE_NAME'],
|
||||||
'Workspace Name' => $fields['WORKSPACE_NAME'],
|
|
||||||
//'Available Databases' => $fields['AVAILABLE_DB'],
|
//'Available Databases' => $fields['AVAILABLE_DB'],
|
||||||
'Workflow Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'] , $fields['DB_USER'], $fields['DB_PASS'], $fields['DB_HOST'], $fields['DB_NAME']),
|
'Workflow Database' => sprintf( "%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_USER'], $fields['DB_PASS'], $fields['DB_HOST'], $fields['DB_NAME'] ),'RBAC Database' => sprintf( "%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_RBAC_USER'], $fields['DB_RBAC_PASS'], $fields['DB_RBAC_HOST'], $fields['DB_RBAC_NAME'] ),'Report Database' => sprintf( "%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_REPORT_USER'], $fields['DB_REPORT_PASS'], $fields['DB_REPORT_HOST'], $fields['DB_REPORT_NAME'] ),'MySql Version' => $fields['DATABASE']
|
||||||
'RBAC Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'] , $fields['DB_RBAC_USER'], $fields['DB_RBAC_PASS'], $fields['DB_RBAC_HOST'], $fields['DB_RBAC_NAME']),
|
|
||||||
'Report Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'] , $fields['DB_REPORT_USER'], $fields['DB_REPORT_PASS'], $fields['DB_REPORT_HOST'], $fields['DB_REPORT_NAME']),
|
|
||||||
'MySql Version' => $fields['DATABASE'],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($info as $k => $v) {
|
foreach ($info as $k => $v) {
|
||||||
if (is_numeric($k)) $k = "";
|
if (is_numeric( $k )) {
|
||||||
|
$k = "";
|
||||||
|
}
|
||||||
CLI::logging( sprintf( "%20s %s\n", $k, pakeColor::colorize( $v, 'INFO' ) ) );
|
CLI::logging( sprintf( "%20s %s\n", $k, pakeColor::colorize( $v, 'INFO' ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,7 +752,8 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @param bool $printSysInfo include sys info as well or not
|
* @param bool $printSysInfo include sys info as well or not
|
||||||
*/
|
*/
|
||||||
public function printMetadata($printSysInfo = true) {
|
public function printMetadata ($printSysInfo = true)
|
||||||
|
{
|
||||||
if ($printSysInfo) {
|
if ($printSysInfo) {
|
||||||
workspaceTools::printSysInfo();
|
workspaceTools::printSysInfo();
|
||||||
CLI::logging( "\n" );
|
CLI::logging( "\n" );
|
||||||
@@ -765,14 +769,15 @@ class workspaceTools {
|
|||||||
*
|
*
|
||||||
* @param string $path the directory where to create the sql files
|
* @param string $path the directory where to create the sql files
|
||||||
*/
|
*/
|
||||||
public function exportDatabase($path) {
|
public function exportDatabase ($path)
|
||||||
|
{
|
||||||
$dbInfo = $this->getDBInfo();
|
$dbInfo = $this->getDBInfo();
|
||||||
$databases = array("wf", "rp", "rb");
|
$databases = array ("wf","rp","rb"
|
||||||
|
);
|
||||||
$dbNames = array ();
|
$dbNames = array ();
|
||||||
foreach ($databases as $db) {
|
foreach ($databases as $db) {
|
||||||
$dbInfo = $this->getDBCredentials( $db );
|
$dbInfo = $this->getDBCredentials( $db );
|
||||||
$oDbMaintainer = new DataBaseMaintenance($dbInfo["host"], $dbInfo["user"],
|
$oDbMaintainer = new DataBaseMaintenance( $dbInfo["host"], $dbInfo["user"], $dbInfo["pass"] );
|
||||||
$dbInfo["pass"]);
|
|
||||||
CLI::logging( "Saving database {$dbInfo["name"]}\n" );
|
CLI::logging( "Saving database {$dbInfo["name"]}\n" );
|
||||||
$oDbMaintainer->connect( $dbInfo["name"] );
|
$oDbMaintainer->connect( $dbInfo["name"] );
|
||||||
$oDbMaintainer->lockTables();
|
$oDbMaintainer->lockTables();
|
||||||
@@ -787,7 +792,8 @@ class workspaceTools {
|
|||||||
/**
|
/**
|
||||||
* adds files to the backup archive
|
* adds files to the backup archive
|
||||||
*/
|
*/
|
||||||
private function addToBackup($backup, $filename, $pathRoot, $archiveRoot = "") {
|
private function addToBackup ($backup, $filename, $pathRoot, $archiveRoot = "")
|
||||||
|
{
|
||||||
if (is_file( $filename )) {
|
if (is_file( $filename )) {
|
||||||
CLI::logging( "-> $filename\n" );
|
CLI::logging( "-> $filename\n" );
|
||||||
$backup->addModify( $filename, $archiveRoot, $pathRoot );
|
$backup->addModify( $filename, $archiveRoot, $pathRoot );
|
||||||
@@ -798,6 +804,7 @@ class workspaceTools {
|
|||||||
// $this->addToBackup($backup, $item, $pathRoot, $archiveRoot);
|
// $this->addToBackup($backup, $item, $pathRoot, $archiveRoot);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,12 +814,15 @@ class workspaceTools {
|
|||||||
* @param string $filename the backup filename
|
* @param string $filename the backup filename
|
||||||
* @param bool $compress wheter to compress or not
|
* @param bool $compress wheter to compress or not
|
||||||
*/
|
*/
|
||||||
static public function createBackup($filename, $compress = true) {
|
static public function createBackup ($filename, $compress = true)
|
||||||
|
{
|
||||||
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
if (!file_exists(dirname($filename)))
|
if (! file_exists( dirname( $filename ) )) {
|
||||||
mkdir( dirname( $filename ) );
|
mkdir( dirname( $filename ) );
|
||||||
if (file_exists($filename))
|
}
|
||||||
|
if (file_exists( $filename )) {
|
||||||
unlink( $filename );
|
unlink( $filename );
|
||||||
|
}
|
||||||
$backup = new Archive_Tar( $filename );
|
$backup = new Archive_Tar( $filename );
|
||||||
return $backup;
|
return $backup;
|
||||||
}
|
}
|
||||||
@@ -827,7 +837,8 @@ class workspaceTools {
|
|||||||
* archive object created by createBackup
|
* archive object created by createBackup
|
||||||
* @param bool $compress specifies wheter the backup is compressed or not
|
* @param bool $compress specifies wheter the backup is compressed or not
|
||||||
*/
|
*/
|
||||||
public function backup($backupFile, $compress = true) {
|
public function backup ($backupFile, $compress = true)
|
||||||
|
{
|
||||||
/* $filename can be a string, in which case it's used as the filename of
|
/* $filename can be a string, in which case it's used as the filename of
|
||||||
* the backup, or it can be a previously created tar, which allows for
|
* the backup, or it can be a previously created tar, which allows for
|
||||||
* multiple workspaces in one backup.
|
* multiple workspaces in one backup.
|
||||||
@@ -842,22 +853,24 @@ class workspaceTools {
|
|||||||
$backup = $backupFile;
|
$backup = $backupFile;
|
||||||
$filename = $backup->_tarname;
|
$filename = $backup->_tarname;
|
||||||
}
|
}
|
||||||
if (!file_exists(PATH_DATA . "upgrade/"))
|
if (! file_exists( PATH_DATA . "upgrade/" )) {
|
||||||
mkdir( PATH_DATA . "upgrade/" );
|
mkdir( PATH_DATA . "upgrade/" );
|
||||||
|
}
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
||||||
mkdir( $tempDirectory );
|
mkdir( $tempDirectory );
|
||||||
$metadata = $this->getMetadata();
|
$metadata = $this->getMetadata();
|
||||||
CLI::logging( "Backing up database...\n" );
|
CLI::logging( "Backing up database...\n" );
|
||||||
$metadata["databases"] = $this->exportDatabase( $tempDirectory );
|
$metadata["databases"] = $this->exportDatabase( $tempDirectory );
|
||||||
$metadata["directories"] = array("{$this->name}.files");
|
$metadata["directories"] = array ("{$this->name}.files"
|
||||||
|
);
|
||||||
$metadata["version"] = 1;
|
$metadata["version"] = 1;
|
||||||
$metaFilename = "$tempDirectory/{$this->name}.meta";
|
$metaFilename = "$tempDirectory/{$this->name}.meta";
|
||||||
/* Write metadata to file, but make it prettier before. The metadata is just
|
/* Write metadata to file, but make it prettier before. The metadata is just
|
||||||
* a JSON codified array.
|
* a JSON codified array.
|
||||||
*/
|
*/
|
||||||
if (!file_put_contents($metaFilename,
|
if (! file_put_contents( $metaFilename, str_replace( array (",","{","}"
|
||||||
str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"),
|
), array (",\n ","{\n ","\n}\n"
|
||||||
G::json_encode($metadata)))) {
|
), G::json_encode( $metadata ) ) )) {
|
||||||
throw new Exception( "Could not create backup metadata" );
|
throw new Exception( "Could not create backup metadata" );
|
||||||
}
|
}
|
||||||
CLI::logging( "Copying database to backup...\n" );
|
CLI::logging( "Copying database to backup...\n" );
|
||||||
@@ -883,27 +896,32 @@ class workspaceTools {
|
|||||||
* @param string $hostname the hostname the user will be connecting from
|
* @param string $hostname the hostname the user will be connecting from
|
||||||
* @param string $database the database to grant permissions
|
* @param string $database the database to grant permissions
|
||||||
*/
|
*/
|
||||||
private function createDBUser($username, $password, $hostname, $database) {
|
private function createDBUser ($username, $password, $hostname, $database)
|
||||||
|
{
|
||||||
mysql_select_db( "mysql" );
|
mysql_select_db( "mysql" );
|
||||||
$hostname = array_shift( explode( ":", $hostname ) );
|
$hostname = array_shift( explode( ":", $hostname ) );
|
||||||
$sqlstmt = "SELECT * FROM user WHERE user = '$username' AND host = '$hostname'";
|
$sqlstmt = "SELECT * FROM user WHERE user = '$username' AND host = '$hostname'";
|
||||||
$result = mysql_query( $sqlstmt );
|
$result = mysql_query( $sqlstmt );
|
||||||
if ($result === false)
|
if ($result === false) {
|
||||||
throw new Exception( "Unable to retrieve users: " . mysql_error() );
|
throw new Exception( "Unable to retrieve users: " . mysql_error() );
|
||||||
|
}
|
||||||
$users = mysql_num_rows( $result );
|
$users = mysql_num_rows( $result );
|
||||||
if ($users != 0) {
|
if ($users != 0) {
|
||||||
$result = mysql_query( "DROP USER '$username'@'$hostname'" );
|
$result = mysql_query( "DROP USER '$username'@'$hostname'" );
|
||||||
if ($result === false)
|
if ($result === false) {
|
||||||
throw new Exception( "Unable to drop user: " . mysql_error() );
|
throw new Exception( "Unable to drop user: " . mysql_error() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
CLI::logging( "Creating user $username for $hostname\n" );
|
CLI::logging( "Creating user $username for $hostname\n" );
|
||||||
$result = mysql_query( "CREATE USER '$username'@'$hostname' IDENTIFIED BY '$password'" );
|
$result = mysql_query( "CREATE USER '$username'@'$hostname' IDENTIFIED BY '$password'" );
|
||||||
if ($result === false)
|
if ($result === false) {
|
||||||
throw new Exception( "Unable to create user $username: " . mysql_error() );
|
throw new Exception( "Unable to create user $username: " . mysql_error() );
|
||||||
|
}
|
||||||
$result = mysql_query( "GRANT ALL ON $database.* TO '$username'@'$hostname'" );
|
$result = mysql_query( "GRANT ALL ON $database.* TO '$username'@'$hostname'" );
|
||||||
if ($result === false)
|
if ($result === false) {
|
||||||
throw new Exception( "Unable to grant priviledges to user $username: " . mysql_error() );
|
throw new Exception( "Unable to grant priviledges to user $username: " . mysql_error() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Move to class.dbMaintenance.php
|
//TODO: Move to class.dbMaintenance.php
|
||||||
/**
|
/**
|
||||||
@@ -916,24 +934,27 @@ class workspaceTools {
|
|||||||
* @param string $filename the script filename
|
* @param string $filename the script filename
|
||||||
* @param string $database the database to execute this script into
|
* @param string $database the database to execute this script into
|
||||||
*/
|
*/
|
||||||
private function executeSQLScript($database, $filename) {
|
private function executeSQLScript ($database, $filename)
|
||||||
|
{
|
||||||
mysql_query( "CREATE DATABASE IF NOT EXISTS " . mysql_real_escape_string( $database ) );
|
mysql_query( "CREATE DATABASE IF NOT EXISTS " . mysql_real_escape_string( $database ) );
|
||||||
mysql_select_db( $database );
|
mysql_select_db( $database );
|
||||||
$script = file_get_contents( $filename );
|
$script = file_get_contents( $filename );
|
||||||
$lines = explode( "\n", $script );
|
$lines = explode( "\n", $script );
|
||||||
$previous = NULL;
|
$previous = null;
|
||||||
foreach ($lines as $j => $line) {
|
foreach ($lines as $j => $line) {
|
||||||
// Remove comments from the script
|
// Remove comments from the script
|
||||||
$line = trim( $line );
|
$line = trim( $line );
|
||||||
if (strpos( $line, "--" ) === 0) {
|
if (strpos( $line, "--" ) === 0) {
|
||||||
$line = substr( $line, 0, strpos( $line, "--" ) );
|
$line = substr( $line, 0, strpos( $line, "--" ) );
|
||||||
}
|
}
|
||||||
if (empty($line))
|
if (empty( $line )) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// Concatenate the previous line, if any, with the current
|
// Concatenate the previous line, if any, with the current
|
||||||
if ($previous)
|
if ($previous) {
|
||||||
$line = $previous . " " . $line;
|
$line = $previous . " " . $line;
|
||||||
$previous = NULL;
|
}
|
||||||
|
$previous = null;
|
||||||
// If the current line doesnt end with ; then put this line together
|
// If the current line doesnt end with ; then put this line together
|
||||||
// with the next one, thus supporting multi-line statements.
|
// with the next one, thus supporting multi-line statements.
|
||||||
if (strrpos( $line, ";" ) != strlen( $line ) - 1) {
|
if (strrpos( $line, ";" ) != strlen( $line ) - 1) {
|
||||||
@@ -942,16 +963,19 @@ class workspaceTools {
|
|||||||
}
|
}
|
||||||
$line = substr( $line, 0, strrpos( $line, ";" ) );
|
$line = substr( $line, 0, strrpos( $line, ";" ) );
|
||||||
$result = mysql_query( $line );
|
$result = mysql_query( $line );
|
||||||
if ($result === false)
|
if ($result === false) {
|
||||||
throw new Exception( "Error when running script '$filename', line $j, query '$line': " . mysql_error() );
|
throw new Exception( "Error when running script '$filename', line $j, query '$line': " . mysql_error() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public function restoreLegacy($directory) {
|
static public function restoreLegacy ($directory)
|
||||||
|
{
|
||||||
throw new Exception( "Use gulliver to restore backups from old versions" );
|
throw new Exception( "Use gulliver to restore backups from old versions" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function getBackupInfo($filename) {
|
static public function getBackupInfo ($filename)
|
||||||
|
{
|
||||||
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
$backup = new Archive_Tar( $filename );
|
$backup = new Archive_Tar( $filename );
|
||||||
//Get a temporary directory in the upgrade directory
|
//Get a temporary directory in the upgrade directory
|
||||||
@@ -961,8 +985,10 @@ class workspaceTools {
|
|||||||
foreach ($backup->listContent() as $backupFile) {
|
foreach ($backup->listContent() as $backupFile) {
|
||||||
$filename = $backupFile["filename"];
|
$filename = $backupFile["filename"];
|
||||||
if (strpos( $filename, "/" ) === false && substr_compare( $filename, ".meta", - 5, 5, true ) === 0) {
|
if (strpos( $filename, "/" ) === false && substr_compare( $filename, ".meta", - 5, 5, true ) === 0) {
|
||||||
if (!$backup->extractList(array($filename), $tempDirectory))
|
if (! $backup->extractList( array ($filename
|
||||||
|
), $tempDirectory )) {
|
||||||
throw new Exception( "Could not extract backup" );
|
throw new Exception( "Could not extract backup" );
|
||||||
|
}
|
||||||
$metafiles[] = "$tempDirectory/$filename";
|
$metafiles[] = "$tempDirectory/$filename";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -980,16 +1006,19 @@ class workspaceTools {
|
|||||||
G::rm_dir( $tempDirectory );
|
G::rm_dir( $tempDirectory );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function dirPerms($filename, $owner, $group, $perms) {
|
static public function dirPerms ($filename, $owner, $group, $perms)
|
||||||
|
{
|
||||||
$chown = @chown( $filename, $owner );
|
$chown = @chown( $filename, $owner );
|
||||||
$chgrp = @chgrp( $filename, $group );
|
$chgrp = @chgrp( $filename, $group );
|
||||||
$chmod = @chmod( $filename, $perms );
|
$chmod = @chmod( $filename, $perms );
|
||||||
if ($chgrp === false || $chmod === false || $chown === false)
|
if ($chgrp === false || $chmod === false || $chown === false) {
|
||||||
CLI::logging( CLI::error( "Failed to set permissions for $filename" ) . "\n" );
|
CLI::logging( CLI::error( "Failed to set permissions for $filename" ) . "\n" );
|
||||||
|
}
|
||||||
if (is_dir( $filename )) {
|
if (is_dir( $filename )) {
|
||||||
foreach (array_merge( glob( $filename . "/*" ), glob( $filename . "/.*" ) ) as $item) {
|
foreach (array_merge( glob( $filename . "/*" ), glob( $filename . "/.*" ) ) as $item) {
|
||||||
if (basename($item) == "." || basename($item) == "..")
|
if (basename( $item ) == "." || basename( $item ) == "..") {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
workspaceTools::dirPerms( $item, $owner, $group, $perms );
|
workspaceTools::dirPerms( $item, $owner, $group, $perms );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1005,7 +1034,8 @@ class workspaceTools {
|
|||||||
* @param string $newWorkspaceName if defined, supplies the name for the
|
* @param string $newWorkspaceName if defined, supplies the name for the
|
||||||
* workspace to restore to
|
* workspace to restore to
|
||||||
*/
|
*/
|
||||||
static public function restore($filename, $srcWorkspace, $dstWorkspace = NULL, $overwrite = true) {
|
static public function restore ($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
||||||
|
{
|
||||||
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
$backup = new Archive_Tar( $filename );
|
$backup = new Archive_Tar( $filename );
|
||||||
//Get a temporary directory in the upgrade directory
|
//Get a temporary directory in the upgrade directory
|
||||||
@@ -1025,23 +1055,28 @@ class workspaceTools {
|
|||||||
$metaFiles = glob( $tempDirectory . "/*.meta" );
|
$metaFiles = glob( $tempDirectory . "/*.meta" );
|
||||||
if (empty( $metaFiles )) {
|
if (empty( $metaFiles )) {
|
||||||
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
||||||
if (!empty($metaFiles))
|
if (! empty( $metaFiles )) {
|
||||||
return workspaceTools::restoreLegacy( $tempDirectory );
|
return workspaceTools::restoreLegacy( $tempDirectory );
|
||||||
else
|
} else {
|
||||||
throw new Exception( "No metadata found in backup" );
|
throw new Exception( "No metadata found in backup" );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
||||||
foreach ($metaFiles as $metafile)
|
foreach ($metaFiles as $metafile) {
|
||||||
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
||||||
}
|
}
|
||||||
if (count($metaFiles) > 1 && (!isset($srcWorkspace)))
|
}
|
||||||
|
if (count( $metaFiles ) > 1 && (! isset( $srcWorkspace ))) {
|
||||||
throw new Exception( "Multiple workspaces in backup but no workspace specified to restore" );
|
throw new Exception( "Multiple workspaces in backup but no workspace specified to restore" );
|
||||||
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(basename, $metaFiles)))
|
}
|
||||||
|
if (isset( $srcWorkspace ) && ! in_array( "$srcWorkspace.meta", array_map( BASENAME, $metaFiles ) )) {
|
||||||
throw new Exception( "Workspace $srcWorkspace not found in backup" );
|
throw new Exception( "Workspace $srcWorkspace not found in backup" );
|
||||||
|
}
|
||||||
foreach ($metaFiles as $metaFile) {
|
foreach ($metaFiles as $metaFile) {
|
||||||
$metadata = G::json_decode( file_get_contents( $metaFile ) );
|
$metadata = G::json_decode( file_get_contents( $metaFile ) );
|
||||||
if ($metadata->version != 1)
|
if ($metadata->version != 1) {
|
||||||
throw new Exception( "Backup version {$metadata->version} not supported" );
|
throw new Exception( "Backup version {$metadata->version} not supported" );
|
||||||
|
}
|
||||||
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
||||||
if (isset( $dstWorkspace )) {
|
if (isset( $dstWorkspace )) {
|
||||||
$workspaceName = $dstWorkspace;
|
$workspaceName = $dstWorkspace;
|
||||||
@@ -1057,12 +1092,13 @@ class workspaceTools {
|
|||||||
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
||||||
}
|
}
|
||||||
$workspace = new workspaceTools( $workspaceName );
|
$workspace = new workspaceTools( $workspaceName );
|
||||||
if ($workspace->workspaceExists())
|
if ($workspace->workspaceExists()) {
|
||||||
if ($overwrite)
|
if ($overwrite) {
|
||||||
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
||||||
else
|
} else {
|
||||||
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
||||||
|
}
|
||||||
|
}
|
||||||
if (file_exists( $workspace->path )) {
|
if (file_exists( $workspace->path )) {
|
||||||
G::rm_dir( $workspace->path );
|
G::rm_dir( $workspace->path );
|
||||||
}
|
}
|
||||||
@@ -1077,18 +1113,19 @@ class workspaceTools {
|
|||||||
|
|
||||||
CLI::logging( "> Changing file permissions\n" );
|
CLI::logging( "> Changing file permissions\n" );
|
||||||
$shared_stat = stat( PATH_DATA );
|
$shared_stat = stat( PATH_DATA );
|
||||||
if ($shared_stat !== false)
|
if ($shared_stat !== false) {
|
||||||
workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
||||||
else
|
} else {
|
||||||
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
||||||
|
}
|
||||||
list ($dbHost, $dbUser, $dbPass) = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
|
list ($dbHost, $dbUser, $dbPass) = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
|
||||||
|
|
||||||
CLI::logging( "> Connecting to system database in '$dbHost'\n" );
|
CLI::logging( "> Connecting to system database in '$dbHost'\n" );
|
||||||
$link = mysql_connect( $dbHost, $dbUser, $dbPass );
|
$link = mysql_connect( $dbHost, $dbUser, $dbPass );
|
||||||
@mysql_query( "SET NAMES 'utf8';" );
|
@mysql_query( "SET NAMES 'utf8';" );
|
||||||
if (!$link)
|
if (! $link) {
|
||||||
throw new Exception( 'Could not connect to system database: ' . mysql_error() );
|
throw new Exception( 'Could not connect to system database: ' . mysql_error() );
|
||||||
|
}
|
||||||
|
|
||||||
$newDBNames = $workspace->resetDBInfo( $dbHost, $createWorkspace );
|
$newDBNames = $workspace->resetDBInfo( $dbHost, $createWorkspace );
|
||||||
|
|
||||||
@@ -1112,6 +1149,5 @@ class workspaceTools {
|
|||||||
|
|
||||||
CLI::logging( CLI::info( "Done restoring" ) . "\n" );
|
CLI::logging( CLI::info( "Done restoring" ) . "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user