11 if (!$this->hasTable(
'objects_entity') || !$this->hasTable(
'metadata')) {
15 $prefix = $this->getAdapter()->getOption(
'table_prefix');
16 $cols = [
'title',
'description'];
17 $col_names =
"'" .
implode(
"', '", $cols) .
"'";
19 $objects_query =
"SELECT * FROM {$prefix}objects_entity LIMIT 100";
20 while (
$rows = $this->fetchAll($objects_query)) {
22 foreach (
$rows as $row) {
30 DELETE FROM {$prefix}metadata 31 WHERE entity_guid IN ({$guids}) AND 32 name IN ({$col_names}) 35 $new_metadata_rows = [];
36 foreach (
$rows as $row) {
37 foreach ($cols as $col) {
43 $new_metadata_rows[] = [
44 'entity_guid' => $row[
'guid'],
47 'value_type' =>
'text',
50 'time_created' => time(),
56 if (!empty($new_metadata_rows)) {
57 $this->table(
'metadata')->insert($new_metadata_rows)->saveData();
62 DELETE FROM {$prefix}objects_entity 63 WHERE guid IN ({$guids}) 68 $this->table(
'objects_entity')->drop()->save();
up()
Move objects_entity attributes to metadata.
$guids
Activates all specified installed and inactive plugins.