Poll

Recycle bin or inline moderation?

recycle
22 (50%)
inline
12 (27.3%)
Don't care
7 (15.9%)
Don't know
3 (6.8%)
Total Members Voted: 42

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #30, on February 14th, 2011, 09:35 PM »
Ah, now I remember. The issue comes on insertion, on an auto increment column, using 0 normally makes it insert the next value. The flag disables that so passing NULL is the only way to do so.

We'd have to make sure that DB backup+restore took care of this, but that is the only time AFAIK.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,063

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #32, on February 14th, 2011, 10:28 PM »
We can use 0 provided we're careful. Note there'd have to be a call at the start of install to use that parameter.

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #33, on February 14th, 2011, 10:36 PM »
Yup...

I'm just worried that people using mysqldump on an older version of MySQL would get issues.
Fact is -- the help file doesn't say WHEN it started behaving correctly for it.

Ah, well.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #35, on February 14th, 2011, 10:50 PM »
It's just that id 0 is so well suited to a trashcan... See what I mean?

Well, I've implemented this code and it works:

Code: [Select]
ALTER TABLE {$db_prefix}boards AUTO_INCREMENT = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT INTO {$db_prefix}boards
(id_board, id_cat, board_order, id_last_msg, id_msg_updated, name, description, url, urllen, num_topics, num_posts, member_groups)
VALUES (0, 1, 2, 0, 0, '{$default_recycling_board_name}', '{$default_recycling_board_description}', '{$default_recycling_board_url}', CHAR_LENGTH('{$default_recycling_board_url}'), 0, 0, '2');
SET sql_mode = '';

Now I have a board=0.0 for the recycle bin. However:
- it still shows up first in the list, even though it has order set to 2 (and the main board set to 1)
- anything that tests for $_GET['board'] needs to be double-checked to make sure they don't test for empty() or (int)==0... Because right now,
(a) can't even view the recycle bin board, it just redirects me to the homepage... (with "board=0.0" in the URL)
(b) can't move topics to there with the dedicated function -- it just does nothing after I confirm.

Let me do a big "siiiigh".

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #36, on February 14th, 2011, 10:53 PM »
Argh, so many things that interplay here :( Not sure what to suggest.

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #37, on February 14th, 2011, 11:13 PM »
I've always hated the recycle bin...
Having one by default, well, never been excited with the idea obviously.
But it has to have a special ID. I suppose something like id=100 would be acceptable, considering all the trouble that id=0 would bring. I'm not fond of having a "gap" but...
Posted: February 14th, 2011, 10:57 PM

Holy schmoly...

Create recycle bin = 100;
(Ok)
ALTER wedge_board SET AUTO_INCREMENT = 2;
(Ok)

Then I create a new board and I get..................... id_board = 101??????!!!!!
Headache...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #38, on February 14th, 2011, 11:15 PM »
Oh FFS, I forgot about that. Boards runs a couple of reorder table ops when adding a new board, which likely nukes the increment counter.

:edit: My temper here is related to the fact that we change one thing and two others break in an unexpected fashion.

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #39, on February 14th, 2011, 11:19 PM »
So, you mean that's SMF doing its little thing right...?
I thought of that and I was looking into the code to find the culprit...
I guess I'll keep lookin'.
Posted: February 14th, 2011, 11:17 PM

Sorry, no can find.... :-/
It doesn't seem to be touching the board ID at creation time. Maybe later..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #40, on February 14th, 2011, 11:23 PM »
Prior to creation, it reorders all the boards. Incidentally it's broken on PGSQL and InnoDB for this reason and is an occasional support query, the answer to which is to stop relying on MyISAM behaviour and order it properly (the side effect of the ordering the do is to ensure rows are physically in the table in the right order, so order by null still gets you the correct order)

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #41, on February 14th, 2011, 11:39 PM »
I do see that createBoard() calls modifyBoard(), which itself reassigns 'order' values to the boards, but it doesn't touch id_board values at all... I think the id_board=101 is a MySQL thing. Basically, if AUTO_INCREMENT <= MAX(auto_increment_column), it resets it to MAX(auto_increment_column) + 1. Now, maybe there's a SQL option somewhere to avoid that... Or we could just as well drop the AUTO_INCREMENT thingy and simply add our id_board manually for each new board -- at worst it's only an extra query to do.

Okay I've committed my latest changes, hopefully you'll like them... (I really do, but I understand it's a matter of taste.)

Unrelated, but I have to go to bed so I can't bother to look for the right topic -- I'm thinking of renaming the 'css' folder to something that doesn't say 'css' really. Or rename 'scripts' to 'js' because that'd make more sense. But I'd rather rename 'css' to either 'styles' or 'stylings', so that themers aren't frightened at the idea of putting their graphic files into their styling subfolders. (Which I'd recommend doing, if only because it's easier to manage for themers, as well as users who have plenty of stylings.) Any ideas on your side?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #42, on February 15th, 2011, 12:03 AM »
Quote
simply add our id_board manually for each new board -- at worst it's only an extra query to do.
Hmm, I can just see that causing issues with forums where two admins are trying to add new boards at the same time.
Quote
(Which I'd recommend doing, if only because it's easier to manage for themers, as well as users who have plenty of stylings.) Any ideas on your side?
Styles or stylings works for me, it's certainly more accurate than css.

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: Recycling board by default
« Reply #43, on February 15th, 2011, 07:47 AM »
Quote from Arantor on February 15th, 2011, 12:03 AM
Quote
simply add our id_board manually for each new board -- at worst it's only an extra query to do.
Hmm, I can just see that causing issues with forums where two admins are trying to add new boards at the same time.
Then... What do we do? :-/
Quote
Styles or stylings works for me, it's certainly more accurate than css.
Okay. Anyone else? Would you rather have a 'styles' or 'stylings' folder?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Recycling board by default
« Reply #44, on February 15th, 2011, 09:19 AM »
Quote
Then... What do we do?
Maybe this is a sign that we have to rethink how recycled topics need to be handled. Or we accept that having board 2 as-is isn't an entirely bad thing.
Quote
Okay. Anyone else? Would you rather have a 'styles' or 'stylings' folder?
FWIW, I'd rather have styles, it's shorter and easier to remember.