11 if (!$this->hasTable(
'users_entity') || !$this->hasTable(
'metadata')) {
15 $prefix = $this->getAdapter()->getOption(
'table_prefix');
19 'password_hash' =>
'text',
24 'prev_last_action' =>
'integer',
25 'last_login' =>
'integer',
26 'prev_last_login' =>
'integer',
28 $col_names =
"'" .
implode(
"', '", array_keys($cols)) .
"'";
30 $users_query =
"SELECT * FROM {$prefix}users_entity LIMIT 100";
31 while (
$rows = $this->fetchAll($users_query)) {
33 foreach (
$rows as $row) {
41 DELETE FROM {$prefix}metadata 42 WHERE entity_guid IN ({$guids}) AND 43 name IN ({$col_names}) 46 $new_metadata_rows = [];
48 foreach (
$rows as $row) {
51 UPDATE {$prefix}entities SET last_action = {$row['last_action']} 52 WHERE guid = {$row['guid']} 55 foreach ($cols as $col =>
$type) {
61 $new_metadata_rows[] = [
62 'entity_guid' => $row[
'guid'],
65 'value_type' =>
$type,
68 'time_created' => time(),
74 if (!empty($new_metadata_rows)) {
75 $this->table(
'metadata')->insert($new_metadata_rows)->saveData();
80 DELETE FROM {$prefix}users_entity 81 WHERE guid IN ({$guids}) 86 $this->table(
'users_entity')->drop()->save();
up()
Move users_entity attributes to metadata.
$guids
Activates all specified installed and inactive plugins.