I don't have a solution, but I can explain why/when this is happening.
TL;DR: In your case the model admin/session
is not instantiated or does not exist and Mage::getModel('admin/session')
returns false
Full explanation
There is a bug (or better yet an inconsistency) in the Mage::getSingleton
method.
It has been there for ages.
The method looks like this:
public static function getSingleton($modelClass='', array $arguments=array())
{
$registryKey = '_singleton/'.$modelClass;
if (!self::registry($registryKey)) {
self::register($registryKey, self::getModel($modelClass, $arguments));
}
return self::registry($registryKey);
}
Now let's take a look at the Mage::register
method
public static function register($key, $value, $graceful = false)
{
if (isset(self::$_registry[$key])) {
if ($graceful) {
return;
}
self::throwException('Mage registry key "'.$key.'" already exists');
}
self::$_registry[$key] = $value;
}
Notice the throwException
. It is exactly what you see as error message. If there is already a value in the registry for a certain key, you get an error.
In your case you get this error because there is already a value for key _singleton/admin/session
. This happens in one case.
Going back to the getSingleton
method, this is the bug/inconsistency:
if (!self::registry($registryKey)) {
This condition will return true
when the value you registered for a specific key is null, false, 0
.
This happens when getModel
returns false
. (when a model class is not found).
You should check if you have extensions rewriting the admin session class, or you can debug starting from the methods above to see why you are getting this error.
You need to check your database in core_config_data
table settings. Make sure that BOTH entries for your domain are set to the proper domain name.
The entries you must look for are:
web/unsecure/base_url
and
web/secure/base_url
Change both to be your new domain name. Then clear the var/session
and var/cache
folders.
That should fix the problem. If not, restart apache. If that does not work, then make sure to clear whatever caching system you are using (redis, etc..)
Note: I'd highly recommend re-configuring to use something other than /admin for security reasons.
Best Answer
I think you are confusing 2 concepts.
Session and Registry.
Session values are carried over from request to request until the session expires or until you remove them.
Registry values are some kind of global values but all in the same request.
As soon as the request is over your registry values are not available anymore.
I think you need