2013-03-13 Kikuchi Koichiro <koichiro@rworks.jp>
* extensions/update_manager/lib/functions.ajax.php: Added proxy and bsdtar support. Merged from: branch_4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7844 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3ee7e319e8
commit
494dc8e5a1
|
@ -1,3 +1,10 @@
|
||||||
|
2013-03-13 Kikuchi Koichiro <koichiro@rworks.jp>
|
||||||
|
|
||||||
|
* extensions/update_manager/lib/functions.ajax.php: Added proxy
|
||||||
|
and bsdtar support.
|
||||||
|
|
||||||
|
Merged from: branch_4.0
|
||||||
|
|
||||||
2013-03-13 Kikuchi Koichiro <koichiro@rworks.jp>
|
2013-03-13 Kikuchi Koichiro <koichiro@rworks.jp>
|
||||||
|
|
||||||
* extensions/update_manager/lib/xmlrpc/xmlrpc.inc: Keep original
|
* extensions/update_manager/lib/xmlrpc/xmlrpc.inc: Keep original
|
||||||
|
|
|
@ -179,12 +179,23 @@ function update_pandora_download_package() {
|
||||||
$package_url . " -O " . $dir . $package .
|
$package_url . " -O " . $dir . $package .
|
||||||
" -o /tmp/" . $package . ".info.txt";
|
" -o /tmp/" . $package . ".info.txt";
|
||||||
|
|
||||||
|
if (!empty($settings->proxy)) {
|
||||||
|
$command .= ' -e http_proxy=' . $settings->proxy;
|
||||||
|
if (!empty($settings->proxy_port))
|
||||||
|
$command .= ':' . $settings->proxy_port;
|
||||||
|
}
|
||||||
|
if (!empty($settings->proxy_user))
|
||||||
|
$command .= ' --proxy_user="' . $settings->proxy_user . '"';
|
||||||
|
if (!empty($settings->proxy_pass))
|
||||||
|
$command .= ' --proxy_password="' . $settings->proxy_pass . '"';
|
||||||
|
|
||||||
$return = array('correct' => 0);
|
$return = array('correct' => 0);
|
||||||
|
|
||||||
exec($command);
|
exec($command, $output, $status);
|
||||||
unlink('/tmp/' . $package . '.info.txt');
|
unlink('/tmp/' . $package . '.info.txt');
|
||||||
|
|
||||||
$return['correct'] = 1;
|
if ($status == 0)
|
||||||
|
$return['correct'] = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (empty($package_url)) {
|
if (empty($package_url)) {
|
||||||
|
@ -208,6 +219,12 @@ function update_pandora_download_package() {
|
||||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($c, CURLOPT_FILE, $file);
|
curl_setopt($c, CURLOPT_FILE, $file);
|
||||||
|
if (!empty($settings->proxy))
|
||||||
|
curl_setopt($c, CURLOPT_PROXY, $settings->proxy);
|
||||||
|
if (!empty($settings->proxy_port))
|
||||||
|
curl_setopt($c, CURLOPT_PROXYPORT, $settings->proxy_port);
|
||||||
|
if (!empty($settings->proxy_user) || !empty($settings->proxy_pass))
|
||||||
|
curl_setopt($c, CURLOPT_PROXYUSERPWD, $settings->proxy_user . ':' . $settings->proxy_pass);
|
||||||
|
|
||||||
curl_multi_add_handle($mch ,$c);
|
curl_multi_add_handle($mch ,$c);
|
||||||
$running = null;
|
$running = null;
|
||||||
|
@ -237,7 +254,8 @@ function update_pandora_download_package() {
|
||||||
}
|
}
|
||||||
while($running > 0);
|
while($running > 0);
|
||||||
|
|
||||||
$return = array('correct' => 1);
|
if (curl_errno($c) == 0)
|
||||||
|
$return = array('correct' => 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +373,20 @@ function update_pandora_install_package() {
|
||||||
|
|
||||||
unlink("/tmp/$package.info.txt");
|
unlink("/tmp/$package.info.txt");
|
||||||
|
|
||||||
|
// check which tar is availble
|
||||||
|
exec('tar --version', $output, $status);
|
||||||
|
$tar_type = 'UNKNOWN';
|
||||||
|
foreach ($output as $line) {
|
||||||
|
if (preg_match('/GNU/', $line)) {
|
||||||
|
$tar_type = 'GNU';
|
||||||
|
break;
|
||||||
|
} else if (preg_match('/bsdtar/', $line)) {
|
||||||
|
$tar_type = 'BSD';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($output);
|
||||||
|
|
||||||
//Get total files
|
//Get total files
|
||||||
//The grep command is because the fucking tar don't apply
|
//The grep command is because the fucking tar don't apply
|
||||||
//strip-components in mode "t"
|
//strip-components in mode "t"
|
||||||
|
@ -368,6 +400,10 @@ function update_pandora_install_package() {
|
||||||
' --exclude="pandora_console/install.php" --exclude="pandora_console/include/config.php" ' .
|
' --exclude="pandora_console/install.php" --exclude="pandora_console/include/config.php" ' .
|
||||||
' --strip-components=1 -C ' . $config['homedir'] . ' 1>/tmp/' . $package . '.files.info.txt';
|
' --strip-components=1 -C ' . $config['homedir'] . ' 1>/tmp/' . $package . '.files.info.txt';
|
||||||
|
|
||||||
|
// bsdtar use stderr for verbose output
|
||||||
|
if ($tar_type === 'BSD')
|
||||||
|
$command .= ' 2>&1';
|
||||||
|
|
||||||
print_debug_message_trace($command);
|
print_debug_message_trace($command);
|
||||||
//html_debug_print($command, true);
|
//html_debug_print($command, true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue