monster_menus-9.0.x-dev/modules/rss_page/rss_page.install

modules/rss_page/rss_page.install
<?php

/**
 * @file
 * Installation operations for the rss_page module.
 */

/**
 * Implements hook_schema().
 */
function rss_page_schema() {
  $schema['rss_page_last_read'] = [
    'fields' => [
      'fid' => [
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'uid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'atime' => [
        'type' => 'int',
        'not null' => TRUE,
      ],
    ],
    'primary key' => ['fid', 'uid'],
    'foreign keys' => [
      'users' => [
        'table' => 'users',
        'columns' => [
          'uid' => 'uid',
        ],
      ],
      'rss_page_feed' => [
        'table' => 'rss_page_feed',
        'columns' => [
          'fid' => 'fid',
        ],
      ],
    ],
  ];

  $schema['rss_page_feed'] = [
    'fields' => [
      'fid' => [
        'type' => 'serial',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'nid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'vid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'type' => [
        'type' => 'varchar',
        'length' => 5,
        'not null' => TRUE,
      ],
      'data' => [
        'type' => 'varchar',
        'length' => 512,
      ],
      'name_isset' => [
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'tiny',
        'default' => 0,
      ],
      'name' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
      'weight' => [
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
      ],
    ],
    'primary key' => ['fid'],
    'foreign keys' => [
      'node' => [
        'table' => 'node',
        'columns' => [
          'nid' => 'nid',
          'vid' => 'vid',
        ],
      ],
    ],
    'indexes' => [
      'name' => ['name'],
      'weight' => ['weight'],
      'nid' => ['nid'],
      'vid' => ['vid'],
    ],
  ];

  return $schema;
}

/**
 * Implements hook_mm_verify_integrity()
 */
function rss_page_mm_verify_integrity() {
  return array('RSS Page' => [
    (string) t('rss_page.nid refers to missing node.nid') =>
      "{rss_page} x LEFT JOIN {node} n ON n.nid=x.nid WHERE n.nid IS NULL",

    (string) t('rss_page_feed.nid refers to missing node.nid') =>
      "{rss_page_feed} x LEFT JOIN {node} n ON n.nid=x.nid WHERE n.nid IS NULL",
    (string) t('rss_page_feed.data refers to missing mm_tree.mmtid (type=cat or inter)') =>
      "{rss_page_feed} x LEFT JOIN {mm_tree} t ON t.mmtid=x.data WHERE t.mmtid IS NULL AND (x.type='cat' OR x.type='inter')",
    (string) t('rss_page_feed.data refers to missing taxonomy_term_data.tid (type=taxon)') =>
      "{rss_page_feed} x LEFT JOIN {taxonomy_term_data} t ON t.tid=x.data WHERE t.tid IS NULL AND x.type='taxon'",

    (string) t('rss_page_last_read.fid refers to missing rss_page_feed.fid') =>
      "{rss_page_last_read} x LEFT JOIN {rss_page_feed} f ON f.fid=x.fid WHERE f.fid IS NULL",
    (string) t('rss_page_last_read.uid refers to missing users.uid') =>
      "{rss_page_last_read} x LEFT JOIN {users} u ON u.uid=x.uid WHERE u.uid IS NULL AND x.uid>0",
  ]);
}

function rss_page_install() {
  \Drupal::service('config.factory')
    ->getEditable('monster_menus.settings')
    ->set('rss_page.show_node_permalink', FALSE)
    ->save();
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc