15 $prefix = $this->getAdapter()->getOption(
'table_prefix');
17 $duplicates = $this->fetchAll(
" 19 FROM {$prefix}datalists 20 WHERE name IN (SELECT name FROM {$prefix}config) 21 AND name NOT IN ('processed_upgrades', 'version') 25 if (!empty($duplicates)) {
26 $duplicates_array = [];
27 foreach ($duplicates as $duplicate) {
28 $duplicates_array[] = $duplicate[
'name'];
30 $duplicates = implode(
', ', $duplicates_array);
31 throw new InstallationException(
"Found names ({$duplicates}) in datalist that also exist in config. Don't know how to merge.");
39 public function up() {
41 if (!$this->hasTable(
'datalists') || !$this->hasTable(
'config')) {
45 $prefix = $this->getAdapter()->getOption(
'table_prefix');
46 $rows = $this->fetchAll(
" 47 SELECT * FROM {$prefix}datalists 48 WHERE name NOT IN ('version') 51 foreach (
$rows as $row) {
53 if ($row[
'name'] !==
'processed_upgrades') {
54 $value = serialize($row[
'value']);
58 'name' => $row[
'name'],
64 $this->dropTable(
'datalists');
81 if ($this->hasTable(
"datalists")) {
85 $table = $this->table(
"datalists", [
87 'primary_key' => [
"name"],
90 'collation' =>
"utf8_general_ci",
93 $table->addColumn(
'name',
'string', [
95 'limit' => MysqlAdapter::TEXT_SMALL,
98 $table->addColumn(
'value',
'text', [
100 'limit' => MysqlAdapter::TEXT_REGULAR,
up()
Migrates legacy 2.x datalists values to config table.
down()
Recreate datalists table.
elgg ElggPriorityList prototype insert
Inserts an element into the priority list at the priority specified.
validate()
Validates that there are no duplicate names in datalist and config tables.