Warning: main(/www/templates/gt/content/www/rss/carp/plugins/../examplemenu.php) [
function.main]: failed to open stream: No such file or directory in
/www/templates/gt/content/www/rss/carp/plugins/mysql.php on line
3
Warning: main() [
function.include]: Failed opening '/www/templates/gt/content/www/rss/carp/plugins/../examplemenu.php' for inclusion (include_path='.:/usr/local/lib/php') in
/www/templates/gt/content/www/rss/carp/plugins/mysql.php on line
3
mySQL
mySQL is a plugin bundled with CaRP Evolution.
It stores parsed RSS newsfeed items in a mySQL database for use by other programs.
Note that the data is not processed before being stored (HTML tags are not removed, it is not truncated to any specific length, etc.)
The application using the data must handle such functions as required.
Installation:
- Put mysql.php into the "plugins" folder inside the folder containing carp.php.
(If no plugins folder exists, create one.)
- Follow the instructions at the top of the file mysql_setup.php, which is included in the CaRP Evolution archive, to set up your database tables.
Use:
To use this plugin, do the following:
- Enter the following command into your webpage after "require_once '/path/to/carp.php';":
CarpLoadPlugin('mysql.php');
- If necessary, use the functions listed below to change the plugin's configuration.
Functions:
- MysqlCarpConf($field, $value);
Sets a configuration setting to the specified value (see below for more details).
- MysqlCarpRegisterField($internal_name, $database_field);
Use the function to indicate which RSS fields to store in the database, and the name of database field in which to store them.
The plugin already lists a default set of fields to store, so you may not need to use this function.
$internal_name is the same CaRP internal name for the field that you would specify in CarpConf('iorder','[field names]');
Use the CarpMapField function to set up new internal names for fields if you wish to store fields not automatically processed by CaRP.
- MysqlCarpUnRegisterField($internal_name);
Use this function to tell the plugin not to store a field which it is either configured to store by default, or which you told it to store using MysqlCarpRegisterField.
- MysqlCarpReset();
Resets the plugin's settings.
Configuration Settings:
- connect: 1 to have the plugin open a connection to mySQL, 0 to have it use an existing connection (which you must set up).
- username: The username to use in connecting to mySQL (if 'connect' is 0, leave this blank).
- password: The password to use in connecting to mySQL (if 'connect' is 0, leave this blank).
- host: The hostname, possibly incuding a port number, to use in connecting to mySQL.
If the mySQL is running on your webserver, the appropriate value is likely to be 'localhost'.
Ask your server administrator if you are unsure.
(If 'connect' is 0, leave this blank).
- dbname: The name of the database in which to store the newsfeed data.
If you will set up a mySQL connection and select the appropriate database before executing CaRP, you may leave this blank.
- closeconnection: 1 to have the plugin close the mySQL connection when it's done, 0 to leave the connection open.
- connection: A mySQL connection identifier, or FALSE if no connection is open.
You only need to specify this if you will open the connection in advance and you want to tell the plugin to use a specific connection.
If it may use the last connection opened, you don't need to set this.
- feedtable: The name of the database table where the plugin will store newsfeed id numbers and an MD5 hash of the URL to the feed.
The following configuration settings will only need to be changed if you wish to customize how the plugin stores the newsfeed data.
- itemtable: The name of the database field where the plugin will store the newsfeed items.
- savefields: A list of fields to store in the database.
The key is CaRP's internal field name, and the value is the name of the database field.
- datefields: The names of any database fields which will contain UNIX timestamps.
Any fields listed here are converted from text dates to UNIX timestamp numbers before being stored.
- numberfields: A list of fields which should only contain digits.
Any fields listed here are ensured to be numbers (and are set to zero if blank) before they are stored.
- checksumfields: A list of fields to create an MD5 hash of to determine whether an item has been modified since it was first stored.
- duplicatefields: A list of lists of fields to use in determining whether two newsfeed items are duplicates of each other.
Only one of the lists is used, as follows:
The first list for which the newsfeed contains an item for all of the fields listed is used, if any.
Otherwise, the last list is used.
- auxfields: This is a list similar to 'savefields', but used for internal operation rather than determining which fields to store.
The key should not be changed, but if you use non-standard database field names, you will need to change the values to match.