| Midgard 2.0 Reference Manual | ||||
|---|---|---|---|---|
typedef midgard_config; typedef MidgardConfig; typedef midgard_config; typedef MidgardConfigClass; MidgardConfigPrivate; enum MidgardDBType; MidgardConfig* midgard_config_new (void); gboolean midgard_config_read_file (MidgardConfig *self, const gchar *filename, gboolean user, GError **error); gchar** midgard_config_list_files (gboolean user); gboolean midgard_config_save_file (MidgardConfig *self, const gchar *name, gboolean user, GError **error); gboolean midgard_config_create_midgard_tables (MidgardConfig *self, MidgardConnection *mgd); gboolean midgard_config_create_class_table (MidgardConfig *self, MidgardObjectClass *klass, MidgardConnection *mgd); MidgardConfig* midgard_config_struct_new (void); MidgardConfig* midgard_config_struct2gobject (MidgardConfig *config); void midgard_config_struct_free (MidgardConfig *config);
"authtype" guint : Read / Write "blobdir" gchar* : Read / Write "database" gchar* : Read / Write "dbpass" gchar* : Read / Write "dbtype" gchar* : Read / Write "dbuser" gchar* : Read / Write "defaultlang" gchar* : Read / Write "host" gchar* : Read / Write "logfilename" gchar* : Read / Write "loglevel" gchar* : Read / Write "midgardpassword" gchar* : Read / Write "midgardusername" gchar* : Read / Write "pamfile" gchar* : Read / Write "schema" gchar* : Read / Write "tablecreate" gboolean : Read / Write "tableupdate" gboolean : Read / Write "testunit" gboolean : Read / Write "authtype" guint : Read / Write "blobdir" gchar* : Read / Write "database" gchar* : Read / Write "dbpass" gchar* : Read / Write "dbtype" gchar* : Read / Write "dbuser" gchar* : Read / Write "defaultlang" gchar* : Read / Write "host" gchar* : Read / Write "logfilename" gchar* : Read / Write "loglevel" gchar* : Read / Write "midgardpassword" gchar* : Read / Write "midgardusername" gchar* : Read / Write "pamfile" gchar* : Read / Write "schema" gchar* : Read / Write "tablecreate" gboolean : Read / Write "tableupdate" gboolean : Read / Write "testunit" gboolean : Read / Write
typedef enum {
MIDGARD_DB_TYPE_MYSQL = 1,
MIDGARD_DB_TYPE_POSTGRES,
MIDGARD_DB_TYPE_FREETDS,
MIDGARD_DB_TYPE_SQLITE,
MIDGARD_DB_TYPE_ODBC,
MIDGARD_DB_TYPE_ORACLE
} MidgardDBType;
MidgardConfig* midgard_config_new (void);
Initializes new instance of MidgardConfig object type. NULL is returned when object can not be initialized.
Returns : |
pointer to MidgardConfig object or NULL on failure.
|
gboolean midgard_config_read_file (MidgardConfig *self, const gchar *filename, gboolean user, GError **error);
This method reads configuration file from the given name and sets MidgardConfig object's properties. Such initialized MidgardConfig instance may be reused among midgard-core, midgard-apache module and midgard-php extension for example, without any need to re-read configuration file and without any need to re-initalize Midgard Config object instance.
Set TRUE as user boolean value to read files from user's home directory.
|
MidgardConfig object instance |
|
name of the file to read |
|
boolean switch for system or user's config files |
|
pointer to store error |
Returns : |
TRUE when file has been read , FALSE otherwise.
|
Since 1.9
gchar** midgard_config_list_files (gboolean user);
List all available configuration files.
If user value is set to TRUE, all available files from ~/.midgard/conf.d will be listed.
Only system files ( usually from /etc/midgard/conf.d ) will be listed if user value is set to FALSE.
Returned array should be freed when no longer needed.
|
boolean switch for system or user's config files |
Returns : |
newly allocated and NULL terminated array of file names.
|
gboolean midgard_config_save_file (MidgardConfig *self, const gchar *name, gboolean user, GError **error);
Saves configuration file for the given MidgardConfig.
This method saves configuration file with the given name.
If third user parameter is set to TRUE, then configuration file will
be saved in ~/.midgard/conf.d directory.
User's conf.d directory will be created if doesn't exist.
|
MidgardConfig instance |
|
configuration filename |
|
system or home directory switch |
|
|
Returns : |
TRUE on success or FALSE ( with propper warning message ) if system wide
directory doesn't exist or file can not be saved.
|
gboolean midgard_config_create_midgard_tables
(MidgardConfig *self,
MidgardConnection *mgd);
Creates basic Midgard database tables.
Tables created by this method: repligard, sitegroup, midgard_user
|
MidgardConfig instance |
|
MidgardConnection handler |
Returns : |
TRUE if tables has been created , FALSE otherwise
|
gboolean midgard_config_create_class_table (MidgardConfig *self, MidgardObjectClass *klass, MidgardConnection *mgd);
Creates table for the given MidgardObjectClass
This method creates table defined in MgdSchema xml file for the given class. Also all metadata columns are created.
Indexes are created if: - property is a link type - property is linked to another property
Auto increment field is created if property is defined as primaryproperty,
and it's integer ( or unsigned one ) type. In such case , field is also
a primary field. self parameter may be NULL if the purpose is to call static method.
|
MidgardConfig instance |
|
a pointer to MidgardObjectClass |
|
MidgardConnection pointer |
Returns : |
TRUE is table has been created, FALSE otherwise.
|
MidgardConfig* midgard_config_struct2gobject (MidgardConfig *config);
|
|
Returns : |
"authtype" property"authtype" guint : Read / Write
Authentication type used with connection.
Default value: 0
"blobdir" property"blobdir" gchar* : Read / Write
Location of the blobs directory.
Default value: ""
"database" property"database" gchar* : Read / Write
Name of the database.
Default value: "midgard"
"dbtype" property"dbtype" gchar* : Read / Write
Database type ( by default MySQL ).
Default value: "MySQL"
"dbuser" property"dbuser" gchar* : Read / Write
Username for user who is able to connect to database.
Default value: "midgard"
"host" property"host" gchar* : Read / Write
Database host ( 'localhost' by default ).
Default value: "localhost"
"logfilename" property"logfilename" gchar* : Read / Write
Location of the log file.
Default value: ""
"midgardpassword" property"midgardpassword" gchar* : Read / Write
Midgard sitegroup person's password.
Default value: ""
"midgardusername" property"midgardusername" gchar* : Read / Write
Midgard sitegroup person's username.
Default value: ""
"pamfile" property"pamfile" gchar* : Read / Write
Name of the file used with PAM authentication type.
Default value: ""
"tablecreate" property"tablecreate" gboolean : Read / Write
Database creation switch.
Default value: FALSE
"tableupdate" property"tableupdate" gboolean : Read / Write
Database update switch.
Default value: FALSE
"testunit" property"testunit" gboolean : Read / Write
Database and objects testing switch.
Default value: FALSE
"authtype" property"authtype" guint : Read / Write
Authentication type used with connection.
Default value: 0
"blobdir" property"blobdir" gchar* : Read / Write
Location of the blobs directory.
Default value: ""
"database" property"database" gchar* : Read / Write
Name of the database.
Default value: "midgard"
"dbtype" property"dbtype" gchar* : Read / Write
Database type ( by default MySQL ).
Default value: "MySQL"
"dbuser" property"dbuser" gchar* : Read / Write
Username for user who is able to connect to database.
Default value: "midgard"
"host" property"host" gchar* : Read / Write
Database host ( 'localhost' by default ).
Default value: "localhost"
"logfilename" property"logfilename" gchar* : Read / Write
Location of the log file.
Default value: ""
"midgardpassword" property"midgardpassword" gchar* : Read / Write
Midgard sitegroup person's password.
Default value: ""
"midgardusername" property"midgardusername" gchar* : Read / Write
Midgard sitegroup person's username.
Default value: ""
"pamfile" property"pamfile" gchar* : Read / Write
Name of the file used with PAM authentication type.
Default value: ""
"tablecreate" property"tablecreate" gboolean : Read / Write
Database creation switch.
Default value: FALSE
"tableupdate" property"tableupdate" gboolean : Read / Write
Database update switch.
Default value: FALSE