From d25b042d8e8001a7c4f12f53181632bf9099cbb7 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Tue, 26 Feb 2013 15:14:17 -0500 Subject: [PATCH] Revert "Reworked Database stuff to be Datastore stuff" This reverts commit ebd00184734771ac48e8d75a5334a70a9ee4c84e. --- classes/{Datastore.php => Database.php} | 37 ++-- classes/{Datastore => Database}/Common.php | 43 +++-- .../{Datastore => Database}/PDO/Common.php | 23 +-- classes/{Datastore => Database}/PDO/MySQL.php | 4 +- .../PDO/PostgreSQL.php | 2 +- .../{Datastore => Database}/PDO/SQLite.php | 2 +- classes/Datastore/Memcached.php | 0 classes/Datastore/Redis.php | 0 classes/Model.php | 2 +- classes/Module.php | 60 +++--- classes/Session.php | 2 +- jar.php | 175 +++++++++--------- 12 files changed, 180 insertions(+), 170 deletions(-) rename classes/{Datastore.php => Database.php} (71%) rename classes/{Datastore => Database}/Common.php (63%) rename classes/{Datastore => Database}/PDO/Common.php (92%) rename classes/{Datastore => Database}/PDO/MySQL.php (87%) rename classes/{Datastore => Database}/PDO/PostgreSQL.php (92%) rename classes/{Datastore => Database}/PDO/SQLite.php (91%) delete mode 100644 classes/Datastore/Memcached.php delete mode 100644 classes/Datastore/Redis.php diff --git a/classes/Datastore.php b/classes/Database.php similarity index 71% rename from classes/Datastore.php rename to classes/Database.php index 85994ee..c31f46a 100644 --- a/classes/Datastore.php +++ b/classes/Database.php @@ -1,7 +1,7 @@ - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles */ /** - * Datastore Factory + * Database Factory * - * Generic class to simplify connecting to a datastore. + * Generic class to simplify connecting to a database. All database objects + * should be created by this class to future proof against any internal changes + * to PICKLES. */ -class Datastore extends Object +class Database extends Object { /** * Constructor * - * Attempts to get an instance of the passed datastore name or attempts - * to use a default specified in the config. + * Attempts to get an instance of the passed database type or attempts to + * use a default specified in the config. * * @param string $name optional name of the connection to use */ @@ -34,17 +36,16 @@ class Datastore extends Object { parent::__construct(); - return Datastore::getInstance($name); + return Database::getInstance($name); } /** * Get Instance * - * Looks up the datasource using the passed name and gets an instance - * of it. Allows for easy sharing of certain classes within the system - * to avoid the extra overhead of creating new objects each time. Also - * avoids the hassle of passing around variables (yeah I know, very - * global-ish, don't just me). + * Looks up the datasource using the passed name and gets an instance of + * it. Allows for easy sharing of certain classes within the system to + * avoid the extra overhead of creating new objects each time. Also avoids + * the hassle of passing around variables (yeah I know, very global-ish) * * @static * @param string $name name of the datasource @@ -84,7 +85,7 @@ class Datastore extends Object $datasource['driver'] = strtolower($datasource['driver']); - if (!isset(self::$instances[$name])) + if (!isset(self::$instances['Database'][$name])) { // Checks the driver is legit and scrubs the name switch ($datasource['driver']) @@ -98,8 +99,8 @@ class Datastore extends Object break; } - // Instantiates our datastore class - $class = 'Datastore_' . $class; + // Instantiates our database class + $class = 'Database_' . $class; $instance = new $class(); // Sets our database parameters @@ -115,11 +116,11 @@ class Datastore extends Object // Caches the instance for possible reuse later if (isset($instance)) { - self::$instances[$name] = $instance; + self::$instances['Database'][$name] = $instance; } // Returns the instance - return self::$instances[$name]; + return self::$instances['Database'][$name]; } } diff --git a/classes/Datastore/Common.php b/classes/Database/Common.php similarity index 63% rename from classes/Datastore/Common.php rename to classes/Database/Common.php index 31871e9..c962abd 100644 --- a/classes/Datastore/Common.php +++ b/classes/Database/Common.php @@ -1,7 +1,7 @@ - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles */ /** - * Common Datastore Abstraction Layer + * Common Database Abstraction Layer * - * Parent class that our datastore classes should be extending. - * Contains basic functionality for instantiation and interfacing. + * Parent class that our database driver classes should be extending. Contains + * basic functionality for instantiation and interfacing. */ -abstract class Datastore_Common extends Object +abstract class Database_Common extends Object { /** * Driver @@ -66,9 +66,9 @@ abstract class Datastore_Common extends Object public $password = null; /** - * Database name (or number) for the server + * Database name for the server * - * @var string or integer + * @var string */ public $database = null; @@ -94,9 +94,30 @@ abstract class Datastore_Common extends Object public $results = null; /** - * Open Connection + * Constructor + */ + public function __construct() + { + parent::__construct(); + + // Checks the driver is set and available + if ($this->driver == null) + { + throw new Exception('Driver name is not set'); + } + else + { + if (extension_loaded($this->driver) == false) + { + throw new Exception('Driver "' . $this->driver . '" is not loaded'); + } + } + } + + /** + * Open Database Connection * - * Establishes a connection to the datastore based on the configuration + * Establishes a connection to the MySQL database based on the configuration * options that are available in the Config object. * * @abstract @@ -105,7 +126,7 @@ abstract class Datastore_Common extends Object abstract public function open(); /** - * Close Connection + * Close Database Connection * * Sets the connection to null regardless of state. * diff --git a/classes/Datastore/PDO/Common.php b/classes/Database/PDO/Common.php similarity index 92% rename from classes/Datastore/PDO/Common.php rename to classes/Database/PDO/Common.php index 95cf360..1cfdc09 100644 --- a/classes/Datastore/PDO/Common.php +++ b/classes/Database/PDO/Common.php @@ -20,7 +20,7 @@ * * Parent class for any of our database classes that use PDO. */ -class Datastore_PDO_Common extends Datastore_Common +class Database_PDO_Common extends Database_Common { /** * DSN format @@ -49,19 +49,6 @@ class Datastore_PDO_Common extends Datastore_Common { parent::__construct(); - // Checks the driver is set and available - if ($this->driver == null) - { - throw new Exception('Driver name is not set'); - } - else - { - if (extension_loaded($this->driver) == false) - { - throw new Exception('Driver "' . $this->driver . '" is not loaded'); - } - } - // Checks that the prefix is set if ($this->dsn == null) { @@ -81,8 +68,8 @@ class Datastore_PDO_Common extends Datastore_Common /** * Opens database connection * - * Establishes a connection to the database based on the set - * configuration options. + * Establishes a connection to the database based on the set configuration + * options. * * @return boolean true on success, throws an exception overwise */ @@ -138,8 +125,8 @@ class Datastore_PDO_Common extends Datastore_Common /** * Executes an SQL Statement * - * Executes a standard or prepared query based on passed parameters. - * All queries are logged to a file as well as timed and logged in the + * Executes a standard or prepared query based on passed parameters. All + * queries are logged to a file as well as timed and logged in the * execution time is over 1 second. * * @param string $sql statement to execute diff --git a/classes/Datastore/PDO/MySQL.php b/classes/Database/PDO/MySQL.php similarity index 87% rename from classes/Datastore/PDO/MySQL.php rename to classes/Database/PDO/MySQL.php index 58ff659..d6ee07d 100644 --- a/classes/Datastore/PDO/MySQL.php +++ b/classes/Database/PDO/MySQL.php @@ -9,7 +9,7 @@ * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles @@ -18,7 +18,7 @@ /** * MySQL Database Abstraction Layer */ -class Datastore_PDO_MySQL extends Datastore_PDO_Common +class Database_PDO_MySQL extends Database_PDO_Common { /** * Driver diff --git a/classes/Datastore/PDO/PostgreSQL.php b/classes/Database/PDO/PostgreSQL.php similarity index 92% rename from classes/Datastore/PDO/PostgreSQL.php rename to classes/Database/PDO/PostgreSQL.php index ba5ae99..fd8930b 100644 --- a/classes/Datastore/PDO/PostgreSQL.php +++ b/classes/Database/PDO/PostgreSQL.php @@ -18,7 +18,7 @@ /** * PostgreSQL Database Abstraction Layer */ -class Datastore_PDO_PostgreSQL extends Datastore_PDO_Common +class Database_PDO_PostgreSQL extends Database_PDO_Common { /** * Driver diff --git a/classes/Datastore/PDO/SQLite.php b/classes/Database/PDO/SQLite.php similarity index 91% rename from classes/Datastore/PDO/SQLite.php rename to classes/Database/PDO/SQLite.php index e554cb0..16efd14 100644 --- a/classes/Datastore/PDO/SQLite.php +++ b/classes/Database/PDO/SQLite.php @@ -18,7 +18,7 @@ /** * SQLite Database Abstraction Layer */ -class Datastore_PDO_SQLite extends Datastore_PDO_Common +class Database_PDO_SQLite extends Database_PDO_Common { /** * Driver diff --git a/classes/Datastore/Memcached.php b/classes/Datastore/Memcached.php deleted file mode 100644 index e69de29..0000000 diff --git a/classes/Datastore/Redis.php b/classes/Datastore/Redis.php deleted file mode 100644 index e69de29..0000000 diff --git a/classes/Model.php b/classes/Model.php index 7bd4d2f..51f2e70 100644 --- a/classes/Model.php +++ b/classes/Model.php @@ -310,7 +310,7 @@ class Model extends Object parent::__construct(); // Gets an instance of the database and check which it is - $this->db = Datastore::getInstance(); + $this->db = Database::getInstance(); $this->use_cache = $this->db->cache; $this->mysql = ($this->db->driver == 'pdo_mysql'); $this->postgresql = ($this->db->driver == 'pdo_pgsql'); diff --git a/classes/Module.php b/classes/Module.php index e072235..3fdf255 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -9,7 +9,7 @@ * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles @@ -18,13 +18,12 @@ /** * Module Class * - * This is a parent class that all PICKLES modules should be extending. - * Each module can specify it's own meta data and whether or not a user - * must be properly authenticated to view the page. Currently any pages - * without a template are treated as pages being requested via AJAX and the - * return will be JSON encoded. In the future this may need to be changed - * out for logic that allows the requested module to specify what display - * type(s) it can use. + * This is a parent class that all PICKLES modules should be extending. Each + * module can specify it's own meta data and whether or not a user must be + * properly authenticated to view the page. Currently any pages without a + * template are treated as pages being requested via AJAX and the return will + * be JSON encoded. In the future this may need to be changed out for logic + * that allows the requested module to specify what display type(s) it can use. */ class Module extends Object { @@ -127,9 +126,9 @@ class Module extends Object /** * Hash * - * Whether or not to validate the security hash. Boolean true will - * indicate using the name of the module as the hash, a string value - * will use the value instead. + * Whether or not to validate the security hash. Boolean true will indicate + * using the name of the module as the hash, a string value will use the + * value instead. * * @access protected * @var string or boolean, null by default @@ -150,10 +149,9 @@ class Module extends Object /** * Default Template * - * Defaults to null but could be set to any valid template basename. - * The value is overwritten by the config value if not set by the - * module. The display engine determines what the file extension should - * be. + * Defaults to null but could be set to any valid template basename. The + * value is overwritten by the config value if not set by the module. The + * display engine determines what the file extension should be. * * @access protected * @var string, 'index' by default @@ -165,8 +163,8 @@ class Module extends Object * * Array that is returned to the template in the case of the module not * returning anything itself. This is somewhat of a one way trip as you - * cannot get the variable unless you reference the return array - * explicitly $this->return['variable'] + * cannot get the variable unless you reference the return array explicitly + * $this->return['variable'] * * @access protected * @var array @@ -177,10 +175,9 @@ class Module extends Object * Constructor * * The constructor does nothing by default but can be passed a boolean - * variable to tell it to automatically run the __default() method. - * This is typically used when a module is called outside of the scope - * of the controller (the registration page calls the login page in - * this manner). + * variable to tell it to automatically run the __default() method. This is + * typically used when a module is called outside of the scope of the + * controller (the registration page calls the login page in this manner. * * @param boolean $autorun optional flag to autorun __default() */ @@ -189,7 +186,7 @@ class Module extends Object parent::__construct(); $this->cache = Cache::getInstance(); - $this->db = Datastore::getInstance(); + $this->db = Database::getInstance(); if ($autorun === true) { @@ -201,10 +198,10 @@ class Module extends Object * Default "Magic" Method * * This function is overloaded by the module. The __default() method is - * where you want to place any code that needs to be executed at - * runtime. The reason the code isn't in the constructor is because the - * module must be instantiated before the code is executed so that the - * controller script is aware of the authentication requirements. + * where you want to place any code that needs to be executed at runtime. + * The reason the code isn't in the constructor is because the module must + * be instantiated before the code is executed so that the controller + * script is aware of the authentication requirements. */ public function __default() { @@ -214,10 +211,9 @@ class Module extends Object /** * Magic Setter Method * - * Places the variables that are being modified in the return array - * that is returned if nothing is returned by the module itself. This - * also prohibits the direct modification of module variables which - * could cause issues. + * Places the variables that are being modified in the return array that is + * returned if nothing is returned by the module itself. This also prohibits + * the direct modification of module variables which could cause issues. * * @param string $name name of the variable to be set * @param mixed $value value of the variable to be set @@ -230,8 +226,8 @@ class Module extends Object /** * Magic Getter Method * - * Attempts to load the module variable. If it's not set, will attempt - * to load from the config. + * Attempts to load the module variable. If it's not set, will attempt to + * load from the config. * * @param string $name name of the variable requested * @return mixed value of the variable or boolean false diff --git a/classes/Session.php b/classes/Session.php index d237e5c..0ff1547 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -179,7 +179,7 @@ class Session extends Object $this->table = $table; // Gets a database instance - $this->db = Datastore::getInstance($this->datasource); + $this->db = Database::getInstance($this->datasource); // Initializes the session $this->initialize(); diff --git a/jar.php b/jar.php index 896a284..a9f56e0 100755 --- a/jar.php +++ b/jar.php @@ -1781,7 +1781,7 @@ class Convert } /** - * Common Datastore Class File for PICKLES + * Common Database Class File for PICKLES * * PHP version 5 * @@ -1789,19 +1789,19 @@ class Convert * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles */ /** - * Common Datastore Abstraction Layer + * Common Database Abstraction Layer * - * Parent class that our datastore classes should be extending. - * Contains basic functionality for instantiation and interfacing. + * Parent class that our database driver classes should be extending. Contains + * basic functionality for instantiation and interfacing. */ -abstract class Datastore_Common extends Object +abstract class Database_Common extends Object { /** * Driver @@ -1846,9 +1846,9 @@ abstract class Datastore_Common extends Object public $password = null; /** - * Database name (or number) for the server + * Database name for the server * - * @var string or integer + * @var string */ public $database = null; @@ -1874,9 +1874,30 @@ abstract class Datastore_Common extends Object public $results = null; /** - * Open Connection + * Constructor + */ + public function __construct() + { + parent::__construct(); + + // Checks the driver is set and available + if ($this->driver == null) + { + throw new Exception('Driver name is not set'); + } + else + { + if (extension_loaded($this->driver) == false) + { + throw new Exception('Driver "' . $this->driver . '" is not loaded'); + } + } + } + + /** + * Open Database Connection * - * Establishes a connection to the datastore based on the configuration + * Establishes a connection to the MySQL database based on the configuration * options that are available in the Config object. * * @abstract @@ -1885,7 +1906,7 @@ abstract class Datastore_Common extends Object abstract public function open(); /** - * Close Connection + * Close Database Connection * * Sets the connection to null regardless of state. * @@ -1915,7 +1936,7 @@ abstract class Datastore_Common extends Object * * Parent class for any of our database classes that use PDO. */ -class Datastore_PDO_Common extends Datastore_Common +class Database_PDO_Common extends Database_Common { /** * DSN format @@ -1944,19 +1965,6 @@ class Datastore_PDO_Common extends Datastore_Common { parent::__construct(); - // Checks the driver is set and available - if ($this->driver == null) - { - throw new Exception('Driver name is not set'); - } - else - { - if (extension_loaded($this->driver) == false) - { - throw new Exception('Driver "' . $this->driver . '" is not loaded'); - } - } - // Checks that the prefix is set if ($this->dsn == null) { @@ -1976,8 +1984,8 @@ class Datastore_PDO_Common extends Datastore_Common /** * Opens database connection * - * Establishes a connection to the database based on the set - * configuration options. + * Establishes a connection to the database based on the set configuration + * options. * * @return boolean true on success, throws an exception overwise */ @@ -2033,8 +2041,8 @@ class Datastore_PDO_Common extends Datastore_Common /** * Executes an SQL Statement * - * Executes a standard or prepared query based on passed parameters. - * All queries are logged to a file as well as timed and logged in the + * Executes a standard or prepared query based on passed parameters. All + * queries are logged to a file as well as timed and logged in the * execution time is over 1 second. * * @param string $sql statement to execute @@ -2183,7 +2191,7 @@ class Datastore_PDO_Common extends Datastore_Common * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles @@ -2192,7 +2200,7 @@ class Datastore_PDO_Common extends Datastore_Common /** * MySQL Database Abstraction Layer */ -class Datastore_PDO_MySQL extends Datastore_PDO_Common +class Database_PDO_MySQL extends Database_PDO_Common { /** * Driver @@ -2234,7 +2242,7 @@ class Datastore_PDO_MySQL extends Datastore_PDO_Common /** * PostgreSQL Database Abstraction Layer */ -class Datastore_PDO_PostgreSQL extends Datastore_PDO_Common +class Database_PDO_PostgreSQL extends Database_PDO_Common { /** * Driver @@ -2276,7 +2284,7 @@ class Datastore_PDO_PostgreSQL extends Datastore_PDO_Common /** * SQLite Database Abstraction Layer */ -class Datastore_PDO_SQLite extends Datastore_PDO_Common +class Database_PDO_SQLite extends Database_PDO_Common { /** * Driver @@ -2294,7 +2302,7 @@ class Datastore_PDO_SQLite extends Datastore_PDO_Common } /** - * Datastore Class File for PICKLES + * Database Class File for PICKLES * * PHP version 5 * @@ -2302,24 +2310,26 @@ class Datastore_PDO_SQLite extends Datastore_PDO_Common * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles */ /** - * Datastore Factory + * Database Factory * - * Generic class to simplify connecting to a datastore. + * Generic class to simplify connecting to a database. All database objects + * should be created by this class to future proof against any internal changes + * to PICKLES. */ -class Datastore extends Object +class Database extends Object { /** * Constructor * - * Attempts to get an instance of the passed datastore name or attempts - * to use a default specified in the config. + * Attempts to get an instance of the passed database type or attempts to + * use a default specified in the config. * * @param string $name optional name of the connection to use */ @@ -2327,17 +2337,16 @@ class Datastore extends Object { parent::__construct(); - return Datastore::getInstance($name); + return Database::getInstance($name); } /** * Get Instance * - * Looks up the datasource using the passed name and gets an instance - * of it. Allows for easy sharing of certain classes within the system - * to avoid the extra overhead of creating new objects each time. Also - * avoids the hassle of passing around variables (yeah I know, very - * global-ish, don't just me). + * Looks up the datasource using the passed name and gets an instance of + * it. Allows for easy sharing of certain classes within the system to + * avoid the extra overhead of creating new objects each time. Also avoids + * the hassle of passing around variables (yeah I know, very global-ish) * * @static * @param string $name name of the datasource @@ -2377,7 +2386,7 @@ class Datastore extends Object $datasource['driver'] = strtolower($datasource['driver']); - if (!isset(self::$instances[$name])) + if (!isset(self::$instances['Database'][$name])) { // Checks the driver is legit and scrubs the name switch ($datasource['driver']) @@ -2391,8 +2400,8 @@ class Datastore extends Object break; } - // Instantiates our datastore class - $class = 'Datastore_' . $class; + // Instantiates our database class + $class = 'Database_' . $class; $instance = new $class(); // Sets our database parameters @@ -2408,11 +2417,11 @@ class Datastore extends Object // Caches the instance for possible reuse later if (isset($instance)) { - self::$instances[$name] = $instance; + self::$instances['Database'][$name] = $instance; } // Returns the instance - return self::$instances[$name]; + return self::$instances['Database'][$name]; } } @@ -4876,7 +4885,7 @@ class Model extends Object parent::__construct(); // Gets an instance of the database and check which it is - $this->db = Datastore::getInstance(); + $this->db = Database::getInstance(); $this->use_cache = $this->db->cache; $this->mysql = ($this->db->driver == 'pdo_mysql'); $this->postgresql = ($this->db->driver == 'pdo_pgsql'); @@ -6095,7 +6104,7 @@ class Model extends Object * Redistribution of these files must retain the above copyright notice. * * @author Josh Sherman - * @copyright Copyright 2007-2013, Josh Sherman + * @copyright Copyright 2007-2012, Josh Sherman * @license http://www.opensource.org/licenses/mit-license.html * @package PICKLES * @link https://github.com/joshtronic/pickles @@ -6104,13 +6113,12 @@ class Model extends Object /** * Module Class * - * This is a parent class that all PICKLES modules should be extending. - * Each module can specify it's own meta data and whether or not a user - * must be properly authenticated to view the page. Currently any pages - * without a template are treated as pages being requested via AJAX and the - * return will be JSON encoded. In the future this may need to be changed - * out for logic that allows the requested module to specify what display - * type(s) it can use. + * This is a parent class that all PICKLES modules should be extending. Each + * module can specify it's own meta data and whether or not a user must be + * properly authenticated to view the page. Currently any pages without a + * template are treated as pages being requested via AJAX and the return will + * be JSON encoded. In the future this may need to be changed out for logic + * that allows the requested module to specify what display type(s) it can use. */ class Module extends Object { @@ -6213,9 +6221,9 @@ class Module extends Object /** * Hash * - * Whether or not to validate the security hash. Boolean true will - * indicate using the name of the module as the hash, a string value - * will use the value instead. + * Whether or not to validate the security hash. Boolean true will indicate + * using the name of the module as the hash, a string value will use the + * value instead. * * @access protected * @var string or boolean, null by default @@ -6236,10 +6244,9 @@ class Module extends Object /** * Default Template * - * Defaults to null but could be set to any valid template basename. - * The value is overwritten by the config value if not set by the - * module. The display engine determines what the file extension should - * be. + * Defaults to null but could be set to any valid template basename. The + * value is overwritten by the config value if not set by the module. The + * display engine determines what the file extension should be. * * @access protected * @var string, 'index' by default @@ -6251,8 +6258,8 @@ class Module extends Object * * Array that is returned to the template in the case of the module not * returning anything itself. This is somewhat of a one way trip as you - * cannot get the variable unless you reference the return array - * explicitly $this->return['variable'] + * cannot get the variable unless you reference the return array explicitly + * $this->return['variable'] * * @access protected * @var array @@ -6263,10 +6270,9 @@ class Module extends Object * Constructor * * The constructor does nothing by default but can be passed a boolean - * variable to tell it to automatically run the __default() method. - * This is typically used when a module is called outside of the scope - * of the controller (the registration page calls the login page in - * this manner). + * variable to tell it to automatically run the __default() method. This is + * typically used when a module is called outside of the scope of the + * controller (the registration page calls the login page in this manner. * * @param boolean $autorun optional flag to autorun __default() */ @@ -6275,7 +6281,7 @@ class Module extends Object parent::__construct(); $this->cache = Cache::getInstance(); - $this->db = Datastore::getInstance(); + $this->db = Database::getInstance(); if ($autorun === true) { @@ -6287,10 +6293,10 @@ class Module extends Object * Default "Magic" Method * * This function is overloaded by the module. The __default() method is - * where you want to place any code that needs to be executed at - * runtime. The reason the code isn't in the constructor is because the - * module must be instantiated before the code is executed so that the - * controller script is aware of the authentication requirements. + * where you want to place any code that needs to be executed at runtime. + * The reason the code isn't in the constructor is because the module must + * be instantiated before the code is executed so that the controller + * script is aware of the authentication requirements. */ public function __default() { @@ -6300,10 +6306,9 @@ class Module extends Object /** * Magic Setter Method * - * Places the variables that are being modified in the return array - * that is returned if nothing is returned by the module itself. This - * also prohibits the direct modification of module variables which - * could cause issues. + * Places the variables that are being modified in the return array that is + * returned if nothing is returned by the module itself. This also prohibits + * the direct modification of module variables which could cause issues. * * @param string $name name of the variable to be set * @param mixed $value value of the variable to be set @@ -6316,8 +6321,8 @@ class Module extends Object /** * Magic Getter Method * - * Attempts to load the module variable. If it's not set, will attempt - * to load from the config. + * Attempts to load the module variable. If it's not set, will attempt to + * load from the config. * * @param string $name name of the variable requested * @return mixed value of the variable or boolean false @@ -7558,7 +7563,7 @@ class Session extends Object $this->table = $table; // Gets a database instance - $this->db = Datastore::getInstance($this->datasource); + $this->db = Database::getInstance($this->datasource); // Initializes the session $this->initialize();