fail("pgsql returned with error code ($iReturn)");
}
}
+
+function setupHTTPProxy()
+{
+ if (!CONST_HTTP_Proxy) {
+ return;
+ }
+
+ $sProxy = 'tcp://'.CONST_HTTP_Proxy_Host.':'.CONST_HTTP_Proxy_Port;
+ $aHeaders = array();
+
+ if (CONST_HTTP_Proxy_Login != null
+ && CONST_HTTP_Proxy_Login != ''
+ && CONST_HTTP_Proxy_Password != null
+ && CONST_HTTP_Proxy_Password != ''
+ ) {
+ $sAuth = base64_encode(CONST_HTTP_Proxy_Login.':'.CONST_HTTP_Proxy_Password);
+ $aHeaders = array('Proxy-Authorization: Basic '.$sAuth);
+ }
+
+ $aProxyHeader = array(
+ 'proxy' => $sProxy,
+ 'request_fulluri' => true,
+ 'header' => $aHeaders
+ );
+
+ $aContext = array('http' => $aProxyHeader, 'https' => $aProxyHeader);
+ stream_context_set_default($aContext);
+}
require_once('init.php');
require_once('cmd.php');
require_once('DebugNone.php');
-
-// handle http proxy when using file_get_contents
-if (CONST_HTTP_Proxy) {
- $proxy = 'tcp://' . CONST_HTTP_Proxy_Host . ':' . CONST_HTTP_Proxy_Port;
- $aHeaders = array();
- if (CONST_HTTP_Proxy_Login != null && CONST_HTTP_Proxy_Login != '' && CONST_HTTP_Proxy_Password != null && CONST_HTTP_Proxy_Password != '') {
- $auth = base64_encode(CONST_HTTP_Proxy_Login . ':' . CONST_HTTP_Proxy_Password);
- $aHeaders = array("Proxy-Authorization: Basic $auth");
- }
- $aContext = array(
- 'http' => array(
- 'proxy' => $proxy,
- 'request_fulluri' => true,
- 'header' => $aHeaders
- ),
- 'https' => array(
- 'proxy' => $proxy,
- 'request_fulluri' => true,
- 'header' => $aHeaders
- )
- );
- stream_context_set_default($aContext);
-}
);
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
+setupHTTPProxy();
+
include(CONST_Phrase_Config);
if (true) {
// $aCMDOptions passed to getCmdOpt by reference
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
+setupHTTPProxy();
+
$bDidSomething = false;
//*******************************************************
);
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
+setupHTTPProxy();
+
include(CONST_Phrase_Config);
if ($aCMDResult['wiki-import']) {
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
+setupHTTPProxy();
+
if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;