You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the Tripod changes were merged down, I needed to fix a couple of scripts I rely on for migrating comments from RL to Critic. I was trying to use the new MongoTripodConfig object to figure out how to get a handle to the Db object, the getConnStr method looked attractive because in principle I'd be able to get the connection string and create a mongo connection directly.
public function getConnStr($storeName, $podName = null)
{
if (array_key_exists($storeName,$this->dbConfig))
{
if(!$podName)
{
return $this->getConnStrForDataSource($this->dbConfig[$storeName]['data_source']);
}
$pods = $this->getPods($storeName);
if(array_key_exists($podName, $pods))
{
return $this->getConnStrForDataSource($pods[$podName]['data_source']);
}
throw new MongoTripodConfigException("Collection $podName does not exist for database $storeName");
}
else
{
throw new MongoTripodConfigException("Database $storeName does not exist in configuration");
}
}
The problem with this method is the array_key_exists check which will always return false, because $this->getPods($storeName) returns a simple array indexed by integer. So anytime you call getConnStr with a $podName set, it will throw a MongoTripodConfigException.
I'm also not sure if this method is actually used anywhere in the code, the fact that we have tripod-php in the lib directory and now also in the vendor directly is really confusing phpstorm.
The text was updated successfully, but these errors were encountered:
kiyanwang
changed the title
NMongoTripodConfig::getConnStr($storeName, $podName = null) always throws exception if podname is specified
MongoTripodConfig::getConnStr($storeName, $podName = null) always throws exception if podname is specified
Apr 1, 2015
There shouldn't be a tripod in /lib anymore: it's no longer installed via git submodules. Of course, there's no real way to have that affect historical instances. It will just need to be removed manually.
@rsinger@kiyanwang I assume your comments about lib and vendor apply to rl-app and not this repo - remember this is a public repo so any discussion should relate only to tripod and not apps that depend on it ;)
Since the Tripod changes were merged down, I needed to fix a couple of scripts I rely on for migrating comments from RL to Critic. I was trying to use the new MongoTripodConfig object to figure out how to get a handle to the Db object, the
getConnStr
method looked attractive because in principle I'd be able to get the connection string and create a mongo connection directly.The problem with this method is the
array_key_exists
check which will always return false, because$this->getPods($storeName)
returns a simple array indexed by integer. So anytime you callgetConnStr
with a$podName
set, it will throw aMongoTripodConfigException
.I'm also not sure if this method is actually used anywhere in the code, the fact that we have tripod-php in the
lib
directory and now also in thevendor
directly is really confusing phpstorm.The text was updated successfully, but these errors were encountered: