MDL-18375 calendar: added condition to ensure calendar type exists before loading

This commit is contained in:
Mark Nelson 2013-08-15 16:39:22 +08:00
parent 5989677e0f
commit 2aefba53a5

View File

@ -40,6 +40,13 @@ class type_factory {
}
$class = "\\calendartype_$type\\structure";
// Ensure the calendar type exists. It may occur that a user has selected a calendar type, which was then
// deleted. If this happens we want to fall back on the Gregorian calendar type.
if (!class_exists($class)) {
$class = "\\calendartype_gregorian\\structure";
}
return new $class();
}