Galorefitz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250055
Change subject: Make Git2Pages respect proxy using $wgHTTPProxy
......................................................................
Make Git2Pages respect proxy using $wgHTTPProxy
The functions in GitRepository.php that access the internet did not
respect proxy till now. Due to this, the extension was essentially
non-functional behind a proxy.
Bug: T115206
Change-Id: I3b4dffc782a4845047a7149c0349736bd17ebc8c
---
M GitRepository.php
1 file changed, 19 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Git2Pages
refs/changes/55/250055/1
diff --git a/GitRepository.php b/GitRepository.php
index fbcd518..abc61f5 100644
--- a/GitRepository.php
+++ b/GitRepository.php
@@ -21,8 +21,12 @@
* @param string $gitFolder path to local git repo where repo is cloned
*/
static function CloneGitRepo( $url, $gitFolder ) {
+ global $wgHTTPProxy;
if ( !file_exists( $gitFolder ) ) {
- wfShellExec( 'git clone ' . wfEscapeShellArg( $url ) .
' ' . $gitFolder );
+ wfShellExec( 'git clone ' . wfEscapeShellArg( $url ) .
' ' . $gitFolder, $retval, array(
+ "http_proxy" => $wgHTTPProxy,
+ "https_proxy" => $wgHTTPProxy
+ ) );
wfDebug( 'GitRepository: Cloned a git repository.' );
}
else {
@@ -37,6 +41,7 @@
* @param string $checkoutItem contains the file or directory to
checkout
*/
static function AddToSparseCheckout( $gitFolder, $checkoutItem ) {
+ global $wgHTTPProxy;
$oldDir = getcwd();
chdir( $gitFolder );
$sparseCheckoutFile = '.git/info/sparse-checkout';
@@ -54,7 +59,10 @@
' >> ' . wfEscapeShellArg( $sparseCheckoutFile )
);
}
- wfShellExec( 'git read-tree -mu HEAD' );
+ wfShellExec( 'git read-tree -mu HEAD', $retval, array(
+ "http_proxy" => $wgHTTPProxy,
+ "https_proxy" => $wgHTTPProxy
+ ) );
chdir( $oldDir );
}
/**
@@ -64,20 +72,27 @@
* @param string $gitFolder
*/
static function SparseCheckoutNewRepo( $url, $gitFolder, $checkoutItem,
$branch ) {
+ global $wgHTTPProxy;
$oldDir = getcwd();
if ( !file_exists( $gitFolder ) ) {
mkdir( $gitFolder );
chdir( $gitFolder );
$sparseCheckoutFile = '.git/info/sparse-checkout';
wfShellExec( 'git init' );
- wfShellExec( 'git remote add -f origin ' .
wfEscapeShellArg( $url ) );
+ wfShellExec( 'git remote add -f origin ' .
wfEscapeShellArg( $url ), $retval, array(
+ "http_proxy" => $wgHTTPProxy,
+ "https_proxy" => $wgHTTPProxy
+ ) );
wfShellExec( 'git config core.sparsecheckout true' );
wfShellExec( 'touch ' . wfEscapeShellArg(
$sparseCheckoutFile ) );
wfShellExec(
'echo ' . wfEscapeShellArg( $checkoutItem ) .
' >> ' . wfEscapeShellArg( $sparseCheckoutFile )
);
- wfShellExec( 'git pull ' . wfEscapeShellArg( $url ) . '
' . wfEscapeShellArg( $branch ) );
+ wfShellExec( 'git pull ' . wfEscapeShellArg( $url ) . '
' . wfEscapeShellArg( $branch ), $retval, array(
+ "http_proxy" => $wgHTTPProxy,
+ "https_proxy" => $wgHTTPProxy
+ ) );
wfDebug( 'GitRepository: Sparse checkout subdirectory'
);
chdir( $oldDir );
} else {
--
To view, visit https://gerrit.wikimedia.org/r/250055
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b4dffc782a4845047a7149c0349736bd17ebc8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Git2Pages
Gerrit-Branch: master
Gerrit-Owner: Galorefitz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits