| Next: fPanel::Domain | Previous: fPanel::CrossPlatform | [Table of Contents] |
fPanel::Database - fPanel database handler
This module is your frontend to the fPanel database. It has only been tested with MySQL as of now, but you can insert your own DSN, if you wish, so compatible data sources might work as well.
This method creates a new fPanel::Database object. It does not load configuration nor connect to the database. This happens automatically when you request information, if it hasn't been done yet. This is because now you can give alternative configuration before connecting. For example, you might give your own fPanel::Config compatible object and fPanel::Database will be happy to work with it.
This method is called automatically to load a default fPanel::Config object. If you want an alternative configuration object, call this object yourself and give the object as the first argument.
This method is called automatically to connect to the database, after loading the configuration.
This method gets all domains from the database and returns them as fPanel::Domain objects.
This method gets a specific domain from the database based on its FQDN and returns it as an fPanel::Domain object. If no domain exists with this fqdn, undef is returned.
This method gets a specific domain from the database based on its ID and returns it as an fPanel::Domain object. If no domain exists with this domainid, undef is returned.
This method removes a domain from the database.
This method gets all users from the database and returns them as fPanel::User objects.
This method gets a specific user from the database and returns it as an fPanel::User object. If no user exists with this username, undef is returned.
This method gets a specific user from the database and returns it as an fPanel::User object. If no user exists with this userid, undef is returned.
This method removes a user from the database.
This method inserts $domain which is an fPanel::Domain object, to the database.
This method as of now inserts to both the vhosts table and the domains table for backwards compatibility.
After inserting the domain, the id in the object will be set to the inserted id. Also, the user as pointed to by the 'userid', should already exist, so call insertUser first. The inserted id will be returned.
This method inserts $user which is an fPanel::User object, to the database.
Disconnect from the database.
You may of course call these, but you are definitely not recommended to do so.
This method runs a SELECT query (or similar, such as SHOW) and returns the rows as an array. @blanks are inserted in the parameters ('?'). Leave empty if you have none.
This method runs a non-SELECT query and returns the result.
This method turns raw domain data from the database into an fPanel::Domain object.
This method turns raw user data from the database into an fPanel::User object.
Written by Sjors Gielen, <dazjorz@dazjorz.com>.