Changeset 523 for trunk/lib/Lock.inc.php


Ignore:
Timestamp:
May 24, 2015 3:01:42 PM (9 years ago)
Author:
anonymous
Message:

First set of changes towards 2.2.0. Improved functinoality with integration in wordpress; bugs fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Lock.inc.php

    r502 r523  
    3131class Lock
    3232{
    33 
    3433    // A place to keep an object instance for the singleton pattern.
    3534    protected static $instance = null;
     
    5150
    5251    // Auth_SQL object from which to access a current user_id.
    53     protected $_auth;
     52    protected $_auth = null;
    5453
    5554    /**
     
    6059     * @static
    6160     */
    62     public static function &getInstance($auth_object)
     61    public static function &getInstance($auth_object=null)
    6362    {
    6463        if (self::$instance === null) {
     
    7473     * @param mixed  $auth_object  An Auth_SQL or Auth_FILE object.
    7574     */
    76     public function __construct($auth_object)
    77     {
    78         $app =& App::getInstance();
    79 
    80         if (!method_exists($auth_object, 'get') || !method_exists($auth_object, 'getUsername')) {
    81             trigger_error('Constructor not provided a valid Auth_* object.', E_USER_ERROR);
    82         }
    83 
    84         $this->_auth = $auth_object;
     75    public function __construct($auth_object=null)
     76    {
     77        $app =& App::getInstance();
     78
     79        if (!is_null($auth_object) || is_null($this->_auth)) {
     80            if (!method_exists($auth_object, 'get') || !method_exists($auth_object, 'getUsername')) {
     81                trigger_error('Constructor not provided a valid Auth_* object.', E_USER_ERROR);
     82            }
     83
     84            $this->_auth = $auth_object;
     85        }
    8586
    8687        // Get create tables config from global context.
Note: See TracChangeset for help on using the changeset viewer.