View source
<?php
require_once 'opengraph_meta.common.inc';
function opengraph_meta_update_6001() {
$result = array();
db_add_field($result, OPENGRAPH_META_TABLE, OpenGraphMeta::TYPE, array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
));
return $result;
}
function opengraph_meta_update_6002() {
$result = array();
db_add_field($result, OPENGRAPH_META_TABLE, OpenGraphMeta::__OPTIONAL_DB_FIELD, array(
'type' => 'text',
'not null' => FALSE,
'serialize' => TRUE,
));
return $result;
}
function opengraph_meta_schema() {
$schema[OPENGRAPH_META_TABLE] = array(
'description' => 'Stores Open Graph meta tag info useful for when sharing nodes on social networking sites, e.g. Facebook.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
OpenGraphMeta::TITLE => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
OpenGraphMeta::DESCRIPTION => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
),
OpenGraphMeta::IMAGE => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
OpenGraphMeta::TYPE => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
OpenGraphMeta::__OPTIONAL_DB_FIELD => array(
'type' => 'text',
'not null' => FALSE,
'serialize' => TRUE,
),
),
'primary key' => array(
'nid',
),
);
return $schema;
}
function opengraph_meta_install() {
drupal_install_schema('opengraph_meta');
}
function opengraph_meta_uninstall() {
drupal_uninstall_schema('opengraph_meta');
variable_del(OPENGRAPH_META_VAR_CONTENT_TYPES_ENABLED);
variable_del(OPENGRAPH_META_VAR_SITE_NAME);
variable_del(OPENGRAPH_META_VAR_FALLBACK_IMG);
variable_del(OPENGRAPH_META_VAR_OPTIONAL_TAGS);
$types = node_get_types();
foreach ($types as $id => $d) {
variable_del(OPENGRAPH_META_VAR_CONTENT_TYPE_ . $id);
variable_del(OPENGRAPH_META_VAR_CONTENT_TYPE_CCK_ . $id);
}
}