onlyoffice_docspace-1.1.0/onlyoffice_docspace.install

onlyoffice_docspace.install
<?php

/**
 * @file
 * Install functions for the ONLYOFFICE DocSpace Connector module.
 */

/**
 * Copyright (c) Ascensio System SIA 2024.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

use Drupal\Core\Cache\Cache;

/**
 * Implements hook_install().
 */
function onlyoffice_docspace_install() {
  Cache::invalidateTags(['rendered']);

  $schema = \Drupal::database()->schema();
  if (!$schema->tableExists('users_docspace')) {
    $schema->createTable('users_docspace', [
      'fields' => [
        'uid' => [
          'description' => 'The {users}.uid this record affects.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ],
        'user_pass' => [
          'type' => 'varchar_ascii',
          'length' => 225,
          'not null' => TRUE,
          'default' => '',
        ],
      ],
      'primary key' => ['uid'],
      'indexes' => [
        'uid' => ['uid'],
      ],
      // For documentation purposes only; foreign keys are not created in the
      // database.
      'foreign keys' => [
        'users_docspace' => [
          'table' => 'users',
          'columns' => [
            'uid' => 'uid',
          ],
        ],
      ],
    ]);
  }
}

/**
 * Implements hook_uninstall().
 */
function onlyoffice_docspace_uninstall() {
  Cache::invalidateTags(['rendered']);

  $schema = \Drupal::database()->schema();
  if ($schema->tableExists('users_docspace')) {
    $schema->dropTable('users_docspace');
  }
}

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

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