Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Author: Daniel Frett <daniel.frett@gmail.com>
License: http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
File Size: 440 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CAS_PGTStorage_Db:: (15 methods):
  _getPdo()
  _getTable()
  getStorageType()
  getStorageInfo()
  __construct()
  init()
  _setErrorMode()
  _resetErrorMode()
  createTableSql()
  storePgtSql()
  retrievePgtSql()
  deletePgtSql()
  createTable()
  write()
  read()


Class: CAS_PGTStorage_Db  - X-Ref

Basic class for PGT database storage
The CAS_PGTStorage_Db class is a class for PGT database storage.

_getPdo()   X-Ref
This method returns the PDO object to use for database interactions.

return: PDO object

_getTable()   X-Ref
This method returns the table to use when storing/retrieving PGT's

return: string the name of the pgt storage table.

getStorageType()   X-Ref
This method returns an informational string giving the type of storage
used by the object (used for debugging purposes).

return: string an informational string.

getStorageInfo()   X-Ref
This method returns an informational string giving informations on the
parameters of the storage.(used for debugging purposes).

return: string an informational string.

__construct($cas_parent, $dsn_or_pdo, $username='', $password='', $table='',$driver_options=null)   X-Ref
The class constructor.

param: CAS_Client $cas_parent     the CAS_Client instance that creates
param: string     $dsn_or_pdo     a dsn string to use for creating a PDO
param: string     $username       the username to use when connecting to
param: string     $password       the password to use when connecting to
param: string     $table          the table to use for storing and
param: string     $driver_options any driver options to use when

init()   X-Ref
This method is used to initialize the storage. Halts on error.

return: void

_setErrorMode()   X-Ref
This method will enable the Exception error mode on the PDO object

return: void

_resetErrorMode()   X-Ref
this method will reset the error mode on the PDO object

return: void

createTableSql()   X-Ref
This method returns the query used to create a pgt storage table

return: string the create table SQL, no bind params in query

storePgtSql()   X-Ref
This method returns the query used to store a pgt

return: string the store PGT SQL, :pgt and :pgt_iou are the bind params contained

retrievePgtSql()   X-Ref
This method returns the query used to retrieve a pgt. the first column
of the first row should contain the pgt

return: string the retrieve PGT SQL, :pgt_iou is the only bind param contained

deletePgtSql()   X-Ref
This method returns the query used to delete a pgt.

return: string the delete PGT SQL, :pgt_iou is the only bind param contained in

createTable()   X-Ref
This method creates the database table used to store pgt's and pgtiou's

return: void

write($pgt, $pgt_iou)   X-Ref
This method stores a PGT and its corresponding PGT Iou in the database.
Echoes a warning on error.

param: string $pgt     the PGT
param: string $pgt_iou the PGT iou
return: void

read($pgt_iou)   X-Ref
This method reads a PGT corresponding to a PGT Iou and deletes the
corresponding db entry.

param: string $pgt_iou the PGT iou
return: string|false the corresponding PGT, or FALSE on error