public function init()
    {
        parent::init();
        $db = $this->getDbConnection();
        $db->setActive(true);
        if ($this->autoCreateTokenTable) {
            $sql = "DELETE FROM {$this->tokenTableName} WHERE (expires>0 AND expires<" . time() . ") OR (uses_allowed>0 AND uses_remaining<1)";
            try {
                $db->createCommand($sql)->execute();
            } catch (Exception $e) {
                $this->createTokenTable($db, $this->tokenTableName);
            }
        }
    }
public function init()
    {
        parent::init();
        $db = $this->getDbConnection();
        $db->setActive(true);
        if ($this->autoCreateTokenTable) {
            $sql = "DELETE FROM {$this->tokenTableName} WHERE (expires>0 AND expires<" . time() . ") OR (uses_allowed>0 AND uses_remaining<1)";
            try {
                $db->createCommand($sql)->execute();
            } catch (Exception $e) {
                $this->createTokenTable($db, $this->tokenTableName);
            }
        }
    }
public function init ( ) { parent :: init ( ) ; $ db = $ this -> getDbConnection ( ) ; $ db -> setActive ( true ) ; if ( $ this -> autoCreateTokenTable ) { $ sql = "DELETE FROM {$this->tokenTableName} WHERE (expires>0 AND expires<" . time ( ) . ") OR (uses_allowed>0 AND uses_remaining<1)" ; try { $ db -> createCommand ( $ sql ) -> execute ( ) ; } catch ( Exception $ e ) { $ this -> createTokenTable ( $ db , $ this -> tokenTableName ) ; } } }
Initializes this application component.

This method is required by the {@link IApplicationComponent} interface.
It ensures the existence of the token DB table.
It also removes expired data items from the table.
Initializes this application component .