Mage_Core_Model_Config_Options Class Reference

Inheritance diagram for Mage_Core_Model_Config_Options:

Varien_Object

List of all members.

Public Member Functions

 getDir ($type)
 getAppDir ()
 getBaseDir ()
 getCodeDir ()
 getDesignDir ()
 getEtcDir ()
 getLibDir ()
 getLocaleDir ()
 getMediaDir ()
 getSkinDir ()
 getSysTmpDir ()
 getVarDir ()
 getTmpDir ()
 getCacheDir ()
 getLogDir ()
 getSessionDir ()
 getUploadDir ()
 getExportDir ()
 createDirIfNotExists ($dir)

Protected Member Functions

 _construct ()

Protected Attributes

 $_dirExists = array()


Detailed Description

Definition at line 34 of file Options.php.


Member Function Documentation

_construct (  )  [protected]

Initialize default values of the options

Reimplemented from Varien_Object.

Definition at line 46 of file Options.php.

00047     {
00048         $appRoot= Mage::getRoot();
00049         $root   = dirname($appRoot);
00050 
00051         $this->_data['app_dir']     = $appRoot;
00052         $this->_data['base_dir']    = $root;
00053         $this->_data['code_dir']    = $appRoot.DS.'code';
00054         $this->_data['design_dir']  = $appRoot.DS.'design';
00055         $this->_data['etc_dir']     = $appRoot.DS.'etc';
00056         $this->_data['lib_dir']     = $root.DS.'lib';
00057         $this->_data['locale_dir']  = $appRoot.DS.'locale';
00058         $this->_data['media_dir']   = $root.DS.'media';
00059         $this->_data['skin_dir']    = $root.DS.'skin';
00060         $this->_data['var_dir']     = $this->getVarDir();
00061         $this->_data['tmp_dir']     = $this->_data['var_dir'].DS.'tmp';
00062         $this->_data['cache_dir']   = $this->_data['var_dir'].DS.'cache';
00063         $this->_data['log_dir']     = $this->_data['var_dir'].DS.'log';
00064         $this->_data['session_dir'] = $this->_data['var_dir'].DS.'session';
00065         $this->_data['upload_dir']  = $this->_data['media_dir'].DS.'upload';
00066         $this->_data['export_dir']  = $this->_data['var_dir'].DS.'export';
00067     }

createDirIfNotExists ( dir  ) 

Definition at line 205 of file Options.php.

00206     {
00207         if (!empty($this->_dirExists[$dir])) {
00208             return true;
00209         }
00210         if (file_exists($dir)) {
00211             if (!is_dir($dir)) {
00212                 return false;
00213             }
00214             if (!is_dir_writeable($dir)) {
00215                 return false;
00216             }
00217         } else {
00218             if (!@mkdir($dir, 0777, true)) {
00219                 return false;
00220             }
00221         }
00222         $this->_dirExists[$dir] = true;
00223         return true;
00224     }

getAppDir (  ) 

Definition at line 80 of file Options.php.

00081     {
00082         //return $this->getDataSetDefault('app_dir', Mage::getRoot());
00083         return $this->_data['app_dir'];
00084     }

getBaseDir (  ) 

Definition at line 86 of file Options.php.

00087     {
00088         //return $this->getDataSetDefault('base_dir', dirname($this->getAppDir()));
00089         return $this->_data['base_dir'];
00090     }

getCacheDir (  ) 

Definition at line 165 of file Options.php.

00166     {
00167         //$dir = $this->getDataSetDefault('cache_dir', $this->getVarDir().DS.'cache');
00168         $dir = $this->_data['cache_dir'];
00169         $this->createDirIfNotExists($dir);
00170         return $dir;
00171     }

getCodeDir (  ) 

Definition at line 92 of file Options.php.

00093     {
00094         //return $this->getDataSetDefault('code_dir', $this->getAppDir().DS.'code');
00095         return $this->_data['code_dir'];
00096     }

getDesignDir (  ) 

Definition at line 98 of file Options.php.

00099     {
00100         //return $this->getDataSetDefault('design_dir', $this->getAppDir().DS.'design');
00101         return $this->_data['design_dir'];
00102     }

getDir ( type  ) 

Definition at line 69 of file Options.php.

00070     {
00071         $this->_construct();
00072         $method = 'get'.ucwords($type).'Dir';
00073         $dir = $this->$method();
00074         if (!$dir) {
00075             throw Mage::exception('Mage_Core', 'Invalid dir type requested: '.$type);
00076         }
00077         return $dir;
00078     }

getEtcDir (  ) 

Definition at line 104 of file Options.php.

00105     {
00106         //return $this->getDataSetDefault('etc_dir', $this->getAppDir().DS.'etc');
00107         return $this->_data['etc_dir'];
00108     }

getExportDir (  ) 

Definition at line 197 of file Options.php.

00198     {
00199         //$dir = $this->getDataSetDefault('export_dir', $this->getVarDir().DS.'export');
00200         $dir = $this->_data['export_dir'];
00201         $this->createDirIfNotExists($dir);
00202         return $dir;
00203     }

getLibDir (  ) 

Definition at line 110 of file Options.php.

00111     {
00112         //return $this->getDataSetDefault('lib_dir', $this->getBaseDir().DS.'lib');
00113         return $this->_data['lib_dir'];
00114     }

getLocaleDir (  ) 

Definition at line 116 of file Options.php.

00117     {
00118         //return $this->getDataSetDefault('locale_dir', $this->getAppDir().DS.'locale');
00119         return $this->_data['locale_dir'];
00120     }

getLogDir (  ) 

Definition at line 173 of file Options.php.

00174     {
00175         //$dir = $this->getDataSetDefault('log_dir', $this->getVarDir().DS.'log');
00176         $dir = $this->_data['log_dir'];
00177         $this->createDirIfNotExists($dir);
00178         return $dir;
00179     }

getMediaDir (  ) 

Definition at line 122 of file Options.php.

00123     {
00124         //return $this->getDataSetDefault('media_dir', $this->getBaseDir().DS.'media');
00125         return $this->_data['media_dir'];
00126     }

getSessionDir (  ) 

Definition at line 181 of file Options.php.

00182     {
00183         //$dir = $this->getDataSetDefault('session_dir', $this->getVarDir().DS.'session');
00184         $dir = $this->_data['session_dir'];
00185         $this->createDirIfNotExists($dir);
00186         return $dir;
00187     }

getSkinDir (  ) 

Definition at line 128 of file Options.php.

00129     {
00130         //return $this->getDataSetDefault('skin_dir', $this->getBaseDir().DS.'skin');
00131         return $this->_data['skin_dir'];
00132     }

getSysTmpDir (  ) 

Definition at line 134 of file Options.php.

00135     {
00136         return sys_get_temp_dir();
00137     }

getTmpDir (  ) 

Definition at line 152 of file Options.php.

00153     {
00154         //$dir = $this->getDataSetDefault('tmp_dir', $this->getVarDir().DS.'tmp');
00155         $dir = $this->_data['tmp_dir'];
00156         if (!$this->createDirIfNotExists($dir)) {
00157             $dir = $this->getSysTmpDir().DS.'magento'.DS.'tmp';
00158             if (!$this->createDirIfNotExists($dir)) {
00159                 throw new Mage_Core_Exception('Unable to find writable tmp_dir');
00160             }
00161         }
00162         return $dir;
00163     }

getUploadDir (  ) 

Definition at line 189 of file Options.php.

00190     {
00191         //$dir = $this->getDataSetDefault('upload_dir', $this->getMediaDir().DS.'upload');
00192         $dir = $this->_data['upload_dir'];
00193         $this->createDirIfNotExists($dir);
00194         return $dir;
00195     }

getVarDir (  ) 

Definition at line 139 of file Options.php.

00140     {
00141         //$dir = $this->getDataSetDefault('var_dir', $this->getBaseDir().DS.'var');
00142         $dir = isset($this->_data['var_dir']) ? $this->_data['var_dir'] : $this->_data['base_dir'].DS.'var';
00143         if (!$this->createDirIfNotExists($dir)) {
00144             $dir = $this->getSysTmpDir().DS.'magento'.DS.'var';
00145             if (!$this->createDirIfNotExists($dir)) {
00146                 throw new Mage_Core_Exception('Unable to find writable var_dir');
00147             }
00148         }
00149         return $dir;
00150     }


Member Data Documentation

$_dirExists = array() [protected]

Definition at line 41 of file Options.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:56 2009 for Magento by  doxygen 1.5.8