Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: themavesite on January 16, 2018, 05:28:57 AM

Title: Would it be a bad idea to add a second user to the smf database?
Post by: themavesite on January 16, 2018, 05:28:57 AM
I was thinking of adding a second user to the smf database (read only rights) to automatically generate a website outside of SMF. (same server of course)
Let's say for example I post cars daily in a thread, it would be great to display all the replies made by me (sql query shouldn't be too hard) from that topic from new to old.

I'm kinda doing the same thing already but just by using the recent_posts template: https://themavesite.com/cars/ to generate posts from http://forums.themavesite.com/index.php?topic=6476.new#new
Only problem is that I'm limited to 100 results and I don't get as much freedom as I want.

If adding a second read-only user to the database is safe, I could generate content with some sql queries, and cache that content to only scrape once every 30mins.

Thoughts?
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Arantor on January 16, 2018, 05:38:17 AM
SMF actually provides for this itself, see the ssi_db_user configuration, for using SSI with that.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: themavesite on January 16, 2018, 06:20:32 AM
Quote from: Arantor on January 16, 2018, 05:38:17 AM
SMF actually provides for this itself, see the ssi_db_user configuration, for using SSI with that.
But say I don't want to use SSI, would it be a bad idea to simply add another user to the database with read-only rights?

Or are you saying I don't have to use SSI, but can use the database user used for SSI functionality?
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Arantor on January 16, 2018, 06:35:19 AM
I'm saying that SMF is completely fine with it, that it isn't a bad idea and that the system already does this in places.

Though doing it across servers implies granting access to the DB directly (bad idea normally unless you control the cluster) which is why using APIs like SSI are a much better idea.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Kindred on January 16, 2018, 06:38:58 AM
As Arantor says...   SSI can already do exactly what you asked for.
No need to write any SQL...  especially since, invariably, such SQL would not be hardened.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: themavesite on January 16, 2018, 08:20:31 AM
Quote from: Kindred on January 16, 2018, 06:38:58 AM
As Arantor says...   SSI can already do exactly what you asked for.
No need to write any SQL...  especially since, invariably, such SQL would not be hardened.

Getting topics from a board category is easy with SSI, the sample code is out there.

<?php

ssi_boardNews
($board 5.0$limit 500$start null$length 250$output_method 'echo');

?>



But I want to show ALL topics (no limit, let me worry about paging and caching) and only if they were made by a specific user. To my knowledge this is not possible with SSI currently?
While in SQL I could write this up rather quickly.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Aleksi "Lex" Kilpinen on January 16, 2018, 12:27:52 PM
Quote from: themavesite on January 16, 2018, 08:20:31 AM
But I want to show ALL topics (no limit, let me worry about paging and caching) and only if they were made by a specific user. To my knowledge this is not possible with SSI currently?
I'd say you don't really want to be doing that - not with the same database the forum is actively using. I am curious, why would you want this?
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Arantor on January 16, 2018, 01:07:14 PM
Quote from: Aleksi "Lex" Kilpinen on January 16, 2018, 12:27:52 PM
I'd say you don't really want to be doing that - not with the same database the forum is actively using. I am curious, why would you want this?

I long ago learned to stop worrying if users were going to shoot themselves in the foot.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Aleksi "Lex" Kilpinen on January 16, 2018, 01:10:51 PM
Quote from: Arantor on January 16, 2018, 01:07:14 PM
Quote from: Aleksi "Lex" Kilpinen on January 16, 2018, 12:27:52 PM
I'd say you don't really want to be doing that - not with the same database the forum is actively using. I am curious, why would you want this?

I long ago learned to stop worrying if users were going to shoot themselves in the foot.

I guess that comes with the 50K posts you have more than me. :P
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: themavesite on January 17, 2018, 04:06:22 AM
Quote from: Arantor on January 16, 2018, 01:07:14 PM
Quote from: Aleksi "Lex" Kilpinen on January 16, 2018, 12:27:52 PM
I'd say you don't really want to be doing that - not with the same database the forum is actively using. I am curious, why would you want this?

I long ago learned to stop worrying if users were going to shoot themselves in the foot.

You said that to me probably like 5 times already in the past. Fortunately you were never right  ;D
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Arantor on January 17, 2018, 04:11:42 AM
Thanks for the confidence booster, really appreciate that.

I'm sorry for trying to be useful and will stop doing that in future.
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Pipke on January 17, 2018, 06:16:48 AM
Quote from: Arantor on January 17, 2018, 04:11:42 AM
Thanks for the confidence booster, really appreciate that.

I'm sorry for trying to be useful and will stop doing that in future.

lol
Title: Re: Would it be a bad idea to add a second user to the smf database?
Post by: Aleksi "Lex" Kilpinen on January 17, 2018, 11:01:27 AM
This is the answer though. No, multiple users is not a problem in itself.

Quote from: Arantor on January 16, 2018, 06:35:19 AM
I'm saying that SMF is completely fine with it, that it isn't a bad idea and that the system already does this in places.

Though doing it across servers implies granting access to the DB directly (bad idea normally unless you control the cluster) which is why using APIs like SSI are a much better idea.