* @return array $table=>$records
*/
protected static function get_tabledata() {
- global $CFG;
-
- $framework = self::get_framework();
+ if (!isset(self::$tabledata)) {
+ $framework = self::get_framework();
- $datafile = self::get_dataroot() . '/' . $framework . '/tabledata.ser';
- if (!file_exists($datafile)) {
- // Not initialised yet.
- return array();
- }
+ $datafile = self::get_dataroot() . '/' . $framework . '/tabledata.ser';
+ if (!file_exists($datafile)) {
+ // Not initialised yet.
+ return array();
+ }
- if (!isset(self::$tabledata)) {
$data = file_get_contents($datafile);
self::$tabledata = unserialize($data);
}
* @return array $table=>$records
*/
public static function get_tablestructure() {
- global $CFG;
-
- $framework = self::get_framework();
+ if (!isset(self::$tablestructure)) {
+ $framework = self::get_framework();
- $structurefile = self::get_dataroot() . '/' . $framework . '/tablestructure.ser';
- if (!file_exists($structurefile)) {
- // Not initialised yet.
- return array();
- }
+ $structurefile = self::get_dataroot() . '/' . $framework . '/tablestructure.ser';
+ if (!file_exists($structurefile)) {
+ // Not initialised yet.
+ return array();
+ }
- if (!isset(self::$tablestructure)) {
$data = file_get_contents($structurefile);
self::$tablestructure = unserialize($data);
}