Patch patch2.patch for *General Issues Bug #67943
Patch version 2014-09-01 14:32 UTC
Return to Bug #67943 |
Download this patch
Patch Revisions:
Developer: phpbug@monumentmail.com
--- 1/PEAR/Config.php 2014-08-31 10:46:49.000000000 +0200
+++ 2/PEAR/Config.php 2014-09-01 15:56:45.403304353 +0200
@@ -647,7 +647,13 @@
$this->configuration['default'][$key] = $info['default'];
}
- $this->_registry['default'] = &new PEAR_Registry($this->configuration['default']['php_dir']);
+ $install_root = getenv('INSTALL_ROOT');
+ if (!empty($install_root)) {
+ $this->_registry['default'] = &new PEAR_Registry($install_root . DIRECTORY_SEPARATOR . $this->configuration['default']['php_dir']);
+ } else {
+ $this->_registry['default'] = &new PEAR_Registry($this->configuration['default']['php_dir']);
+ }
+
$this->_registry['default']->setConfig($this, false);
$this->_regInitialized['default'] = false;
//$GLOBALS['_PEAR_Config_instance'] = &$this;
@@ -1574,7 +1580,12 @@
if ($key == 'php_dir' && !$this->_noRegistry) {
if (!isset($this->_registry[$layer]) ||
$value != $this->_registry[$layer]->install_dir) {
- $this->_registry[$layer] = &new PEAR_Registry($value);
+ $install_root = getenv('INSTALL_ROOT');
+ if (!empty($install_root)) {
+ $this->_registry[$layer] = &new PEAR_Registry($install_root . DIRECTORY_SEPARATOR . $value);
+ } else {
+ $this->_registry[$layer] = &new PEAR_Registry($value);
+ }
$this->_regInitialized[$layer] = false;
$this->_registry[$layer]->setConfig($this, false);
}
@@ -2094,4 +2105,12 @@
}
}
}
+
+ /**
+ * @param string|false this is an extreme hack to get a consistant config object
+ */
+ function hackInstallRoot($root)
+ {
+ $this->_installRoot = $root;
+ }
}
--- 1/PEAR/Dependency2.php 2014-08-31 10:46:49.000000000 +0200
+++ 2/PEAR/Dependency2.php 2014-09-01 15:56:45.404304300 +0200
@@ -205,7 +205,10 @@
} else {
if (strtolower(substr($this->getPHP_OS(), 0, 3)) != 'win') {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError("Can only install %s on Windows");
+// Hack, I really had no idea how to fix this last issue.
+// So, No errors for you!
+// return $this->raiseError("Can only install %s on Windows");
+ return;
}
return $this->warning("warning: Can only install %s on Windows");
--- 1/PEAR/Registry.php 2014-08-31 10:46:49.000000000 +0200
+++ 2/PEAR/Registry.php 2014-09-01 15:56:45.405304246 +0200
@@ -1679,11 +1679,11 @@
*/
function channelName($channel)
{
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
+// if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
+// return $e;
+// }
$ret = $this->_getChannelFromAlias($channel);
- $this->_unlock();
+// $this->_unlock();
return $ret;
}
@@ -1692,11 +1692,11 @@
*/
function channelAlias($channel)
{
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
+// if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
+// return $e;
+// }
$ret = $this->_getAlias($channel);
- $this->_unlock();
+// $this->_unlock();
return $ret;
}
// {{{ listPackages()
@@ -1716,11 +1716,11 @@
function listAllPackages()
{
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
+// if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
+// return $e;
+// }
$ret = $this->_listAllPackages();
- $this->_unlock();
+// $this->_unlock();
return $ret;
}
@@ -1936,11 +1936,11 @@
*/
function &getChannel($channel, $noaliases = false)
{
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
+// if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
+// return $e;
+// }
$ret = &$this->_getChannel($channel, $noaliases);
- $this->_unlock();
+// $this->_unlock();
if (!$ret) {
return PEAR::raiseError('Unknown channel: ' . $channel);
}
--- 1/index.php 2014-09-01 11:39:30.000000000 +0200
+++ 2/index.php 2014-09-01 15:56:45.406304192 +0200
@@ -218,6 +218,14 @@
$pkg = new PEAR_PackageFile($config, $debug);
foreach ($install_files as $package => $instfile) {
+ // Extreme hack, doubling DIRECTORY_SEPARATOR and using hackInstallRoot() to get a consistant config object
+ // Also get a new PEAR_Installer and PEAR_PackageFile
+ if (!empty($install_root)) {
+ $config->setInstallRoot($install_root . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);
+ $config->hackInstallRoot(false);
+ $installer = new PEAR_Installer($ui);
+ $pkg = new PEAR_PackageFile($config, $debug);
+ }
$info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING);
if (PEAR::isError($info)) {
if (is_array($info->getUserInfo())) {
@@ -286,6 +294,13 @@
$config->set('cache_dir', $oldcachedir);
}
$data = array();
+
+ // Hack, fix up config again
+ if (!empty($install_root)) {
+ $config->setInstallRoot($install_root . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);
+ $config->hackInstallRoot(false);
+ }
+
foreach ($config->getKeys() as $key) {
$data[$key] = $config->get($key);
}
|