Skip to content

Remove the Ideas Bot#105

Merged
DavidIQ merged 6 commits intophpbb:masterfrom
iMattPro:ideas-bot
Mar 25, 2019
Merged

Remove the Ideas Bot#105
DavidIQ merged 6 commits intophpbb:masterfrom
iMattPro:ideas-bot

Conversation

@iMattPro
Copy link
Copy Markdown
Member

@iMattPro iMattPro commented Dec 23, 2018

When this gets implemented on dot-com, I suggest:

Backup ideas_ideas, posts and topics tables first
Afterwards, run Resynchronise post counts in the ACP

Closes #100

@paul999
Copy link
Copy Markdown
Member

paul999 commented Dec 25, 2018

How is the perfomance of the migration? Do we need to plan maintenance on .com if we run it, or is it just a few seconds? Otherwise looks good to me :)

@iMattPro
Copy link
Copy Markdown
Member Author

@paul999 Plan for maintenance. There are 427 Ideas on dot com right now, so 427 records to update in topics and then in posts. But also before updating Ideas on dot com, should make sure to backup DB and recount user posts. So best to do it during maintenance, just in case.

@paul999
Copy link
Copy Markdown
Member

paul999 commented Dec 25, 2018

Well, restoring backups is not something we want :P. We should first test it somewhere locally (Preferbly on a .com backup) before deplyoing it. cc/ @DavidIQ

@DavidIQ
Copy link
Copy Markdown
Member

DavidIQ commented Dec 26, 2018

I wouldn't expect this to run more than a minute. When you're saying to plan for maintenance what exactly are you referring to? Making an announcement?

Comment thread event/listener.php
@iMattPro
Copy link
Copy Markdown
Member Author

iMattPro commented Dec 26, 2018

I just say plan for maintenance because there may be some time intensive database updates.

@iMattPro
Copy link
Copy Markdown
Member Author

Bump

@DavidIQ
Copy link
Copy Markdown
Member

DavidIQ commented Jan 17, 2019

Working on getting a backup copy of the .com database so I can test this locally to see how this performs.

@iMattPro
Copy link
Copy Markdown
Member Author

@DavidIQ bump in the night

@DavidIQ
Copy link
Copy Markdown
Member

DavidIQ commented Mar 22, 2019

SQL ERROR [ mysqli ]

Column 'topic_first_poster_name' cannot be null [1048]

SQL

UPDATE community_topics SET topic_poster = '1375951', topic_first_poster_name = NULL, topic_first_poster_colour = NULL WHERE topic_id = 2205371

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 997
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/ext/phpbb/ideas/migrations/m9_remove_idea_bot.php
LINE: 96
CALL: phpbb\db\driver\factory->sql_query()

FILE: (not given by php)
LINE: (not given by php)
CALL: phpbb\ideas\migrations\m9_remove_idea_bot->update_topic_authors()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 714
CALL: call_user_func_array()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 661
CALL: phpbb\db\migrator->run_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 436
CALL: phpbb\db\migrator->process_data_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 288
CALL: phpbb\db\migrator->try_apply()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 241
CALL: phpbb\db\migrator->update_do()

FILE: [ROOT]/phpbb/extension/base.php
LINE: 78
CALL: phpbb\db\migrator->update()

FILE: [ROOT]/phpbb/extension/manager.php
LINE: 190
CALL: phpbb\extension\base->enable_step()

FILE: [ROOT]/includes/acp/acp_extensions.php
LINE: 213
CALL: phpbb\extension\manager->enable_step()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: acp_extensions->main()

FILE: [ROOT]/adm/index.php
LINE: 83
CALL: p_master->load_active()

Comment thread migrations/m9_remove_idea_bot.php Outdated
$topics[$row['topic_id']] = [
'topic_poster_id' => $row['idea_author'],
'topic_poster_name' => $row['username'],
'topic_poster_colour' => $row['user_colour'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The username and user_colour come back as NULL when the user does not exist (deleted) and these target columns don't allow nulls. You'll need to determine if that's the case and handle accordingly, assigning empty strings to topic_poster_name and topic_poster_colour and you'll also need to set topic_poster_id to the ANONYMOUS constant value (looks like it's 1 in the constants file).

Copy link
Copy Markdown
Member

@DavidIQ DavidIQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration fails due to NULL values because of deleted users.

@iMattPro
Copy link
Copy Markdown
Member Author

Updated

@DavidIQ
Copy link
Copy Markdown
Member

DavidIQ commented Mar 25, 2019

@paul999 the migration took somewhere between 10-20 seconds to run. All went well.

@DavidIQ DavidIQ merged commit 2a7c1af into phpbb:master Mar 25, 2019
@iMattPro iMattPro deleted the ideas-bot branch March 25, 2019 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants