to be sure that Magento is bootstrapped completely, you should start by creating a Magento shell script to try things like that.
Create a file under /shell/ with the following content:
<?php
require_once 'abstract.php';
class My_Shell_Script extends Mage_Shell_Abstract
{
public function run()
{
}
}
$shell = new My_Shell_Script();
$shell->run();
You can add your logic in the run method.
I'm not sure what you are exactly trying to do.
===UPDATE===
This does actually work (With Store ID 0):
<?php
require_once 'abstract.php';
class My_Shell_Script extends Mage_Shell_Abstract
{
public function run()
{
Mage::getModel('core/variable')->setCode('my_code')->setPlainValue('testTextValue')->save();
echo Mage::getModel('core/variable')->loadByCode('my_code')->getValue('text');
}
}
$shell = new My_Shell_Script();
$shell->run();
are you sure your variable is saved correctly in your database? You might want to look it up in the tables core_variable and core_variable_value
echo Mage::app()->getStore()->getId()
return and is the variable set for that store id?