123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <?php
- function fontyourface_7200_schema() {
- $schema = array();
- $schema['fontyourface_font'] = array(
- 'description' => 'Font information.',
- 'fields' => array(
- 'fid' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique font ID.',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The font name.',
- ),
- 'enabled' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Whether or not the font is enabled. (0 = disabled, 1 = enabled)',
- ),
- 'url' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'A URL for the font.',
- ),
- 'provider' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The module providing the font.',
- ),
- 'css_selector' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'size' => 'big',
- 'description' => 'CSS selector for applying the font.',
- ),
- 'css_family' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'CSS family for the font.',
- ),
- 'css_style' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'CSS style for the font.',
- ),
- 'css_weight' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'CSS weight for the font.',
- ),
- 'css_fallbacks' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'CSS fallbacks for the font.',
- ),
- 'foundry' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'Foundry for the font.',
- ),
- 'foundry_url' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'URL for foundry for the font.',
- ),
- 'license' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'License for the font.',
- ),
- 'license_url' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'URL for license for the font.',
- ),
- 'designer' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'Designer for the font.',
- ),
- 'designer_url' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'default' => '',
- 'description' => 'URL for designer for the font.',
- ),
- 'metadata' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'size' => 'big',
- 'description' => 'Additional serialized metadata about the font.',
- ),
- ),
- 'indexes' => array(
- 'enabled' => array('enabled'),
- ),
- 'unique keys' => array(
- 'url' => array('url'),
- ),
- 'primary key' => array('fid'),
- );
- $schema['fontyourface_tag'] = array(
- 'description' => 'Font tag information.',
- 'fields' => array(
- 'tid' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique tag ID.',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The font name.',
- ),
- 'type' => array(
- 'type' => 'varchar',
- 'length' => 10,
- 'not null' => TRUE,
- 'default' => 'tag',
- 'description' => 'Indicator that describes the type of tag (term, subset, etc).',
- ),
- ),
- 'primary key' => array('tid'),
- );
- $schema['fontyourface_tag_font'] = array(
- 'description' => 'Relationship information between fonts and tags.',
- 'fields' => array(
- 'fid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Foreign Key: the unique ID of the font.',
- ),
- 'tid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Foreign Key: the unique ID of the tag.',
- ),
- ),
- 'indexes' => array(
- 'fid' => array('fid'),
- 'tid' => array('tid'),
- ),
- 'primary key' => array('fid', 'tid'),
- );
- return $schema;
- }
- function fontyourface_schema() {
- return fontyourface_7200_schema();
- }
- function fontyourface_update_7200() {
-
- module_enable(array('fontyourface_ui'));
- views_invalidate_cache();
-
- $schema = fontyourface_7200_schema();
- db_add_field('fontyourface_font', 'css_fallbacks', $schema['fontyourface_font']['fields']['css_fallbacks']);
- db_add_field('fontyourface_font', 'designer', $schema['fontyourface_font']['fields']['designer']);
- db_add_field('fontyourface_font', 'designer_url', $schema['fontyourface_font']['fields']['designer_url']);
- }
- function fontyourface_update_7201() {
- views_invalidate_cache();
-
- $schema = fontyourface_7200_schema();
- db_add_field('fontyourface_tag', 'type', $schema['fontyourface_tag']['fields']['type']);
-
- $query = db_select('fontyourface_tag', 't');
- $query->innerJoin('fontyourface_tag_font', 'tf', 'tf.tid = t.tid');
- $query->innerJoin('fontyourface_font', 'f', 'f.fid = tf.fid');
- $query->distinct();
- $result = $query->fields('t', array('tid'))
- ->condition('f.provider', 'google_fonts_api')
- ->execute();
- foreach ($result as $font) {
- db_update('fontyourface_tag')
- ->fields(array('type' => 'subset'))
- ->condition('tid', $font->tid)
- ->execute();
- }
- }
- function fontyourface_update_7202() {
- $schema = fontyourface_7200_schema();
- try {
- db_add_unique_key('fontyourface_font', 'url', array('url'));
- }
- catch (DatabaseSchemaObjectExistsException $e) {
-
- }
- }
- function fontyourface_update_7203() {
-
-
- }
- function fontyourface_update_7204() {
- db_update('fontyourface_font')
- ->expression('css_family', "REPLACE(css_family, '''', '')")
- ->execute();
- }
- function fontyourface_uninstall() {
- variable_del('fontyourface_short_preview_text');
- variable_del('fontyourface_detailed_logging');
- variable_del('fontyourface_css_md5');
-
- }
|