BlockLog/base/blocklog.php
2019-12-19 13:56:00 +01:00

92 lines
2.2 KiB
PHP
Executable file

<?php
/**
* Déclarations relatives à la base de données
*
* @plugin Block Log
* @copyright 2019
* @author tofulm
* @licence GNU/GPL
* @package SPIP\Blocklog\Pipelines
*/
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Déclaration des alias de tables et filtres automatiques de champs
*
* @pipeline declarer_tables_interfaces
* @param array $interfaces
* Déclarations d'interface pour le compilateur
* @return array
* Déclarations d'interface pour le compilateur
*/
function blocklog_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['blocklogs'] = 'blocklogs';
return $interfaces;
}
/**
* Déclaration des objets éditoriaux
*
* @pipeline declarer_tables_objets_sql
* @param array $tables
* Description des tables
* @return array
* Description complétée des tables
*/
function blocklog_declarer_tables_objets_sql($tables) {
$tables['spip_blocklogs'] = array(
'type' => 'blocklog',
'principale' => 'oui',
'field'=> array(
'id_blocklog' => 'bigint(21) NOT NULL',
'num' => 'bigint(21) NOT NULL DEFAULT 0',
'blockchaine' => 'text NOT NULL DEFAULT ""',
'chaine' => 'text NOT NULL DEFAULT ""',
'maj' => 'TIMESTAMP'
),
'key' => array(
'PRIMARY KEY' => 'id_blocklog',
),
'champs_editables' => array('num', 'blockchaine', 'chaine'),
'tables_jointures' => array('spip_blocklogs_liens'),
);
return $tables;
}
/**
* Déclaration des tables secondaires (liaisons)
*
* @pipeline declarer_tables_auxiliaires
* @param array $tables
* Description des tables
* @return array
* Description complétée des tables
*/
function blocklog_declarer_tables_auxiliaires($tables) {
$tables['spip_blocklogs_liens'] = array(
'field' => array(
'id_blocklog' => 'bigint(21) DEFAULT "0" NOT NULL',
'id_objet' => 'bigint(21) DEFAULT "0" NOT NULL',
'objet' => 'VARCHAR(25) DEFAULT "" NOT NULL',
'vu' => 'VARCHAR(6) DEFAULT "non" NOT NULL',
),
'key' => array(
'PRIMARY KEY' => 'id_blocklog,id_objet,objet',
'KEY id_blocklog' => 'id_blocklog',
)
);
return $tables;
}