services.install in Services 5
Same filename and directory in other branches
This install creates the tables which are required by the services module
File
services.installView source
<?php
/**
* @file
* This install creates the tables which are required by the services module
*/
/**
* Implementation of hook_install().
*/
function services_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {services_keys} (\n kid varchar(32) NOT NULL default '',\n title varchar(255) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n PRIMARY KEY (kid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
db_query("CREATE TABLE {services_timestamp_nonce} (\n timestamp varchar(32) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n nonce varchar(32) NOT NULL default ''\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
break;
case 'pgsql':
db_query("CREATE TABLE {services_keys} (\n kid varchar(32) NOT NULL default '',\n title varchar(255) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n PRIMARY KEY (kid)\n )");
db_query("CREATE TABLE {services_timestamp_nonce} (\n timestamp varchar(32) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n nonce varchar(32) NOT NULL default ''\n )");
break;
}
}
function services_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("CREATE TABLE {services_timestamp_nonce} (\n timestamp varchar(32) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n nonce varchar(32) NOT NULL default ''\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
break;
case 'pgsql':
$ret[] = update_sql("CREATE TABLE {services_timestamp_nonce} (\n timestamp varchar(32) NOT NULL default '',\n domain varchar(255) NOT NULL default '',\n nonce varchar(32) NOT NULL default ''\n )");
break;
}
return $ret;
}
/**
* Implementation of hook_uninstall().
*/
function services_uninstall() {
db_query('DROP TABLE {services_keys}');
variable_del('services_use_key');
variable_del('services_use_sessid');
variable_del('services_debug');
}
Functions
Name | Description |
---|---|
services_install | Implementation of hook_install(). |
services_uninstall | Implementation of hook_uninstall(). |
services_update_1 |