Exemplo n.º 1
0
 /**
  * Loads the data identified by the parameters.
  * @param $classname Name of the class which is expected to be returned
  * @param $module_name Name of the module owning the entry to load
  * @param $entry_name If the module wants to manage several entries,
  * it's the name of the entry you want to load
  * @return ConfigData The loaded data
  */
 public static function load($classname, $module_name, $entry_name = '')
 {
     try {
         return CacheManager::try_load($classname, $module_name, $entry_name);
     } catch (CacheDataNotFoundException $ex) {
         $data = null;
         try {
             $data = self::load_in_db($module_name, $entry_name);
             CacheManager::save($data, $module_name, $entry_name);
         } catch (ConfigNotFoundException $ex) {
             $data = new $classname();
             $data->set_default_values();
             $name = self::compute_entry_name($module_name, $entry_name);
             self::save_in_db($name, $data);
             CacheManager::save($data, $module_name, $entry_name);
         } catch (PHPBoostNotInstalledException $ex) {
             $data = new $classname();
             $data->set_default_values();
         } catch (MySQLUnexistingDatabaseException $ex) {
             $data = new $classname();
             $data->set_default_values();
         } catch (MySQLQuerierException $ex) {
             $data = new $classname();
             $data->set_default_values();
         }
         return $data;
     }
 }