Jump to content

Required?


Recommended Posts

Is any of the following required for any features in particular, for content items?

'author', 'updated', 'ip_address' in $databaseColumnMap.

I see if updated is set, it updates the time and when author is used, it can use it for built in generic edit permission checks, but anything I am not thinking of that would need those?

And ip address, I haven't noticed an issue from not storing that, at this point, but was thinking I saw somewhere that it was required for something...

Link to comment
Share on other sites

1 hour ago, CodingJungle said:

 

And? That does not say if they are required. It only says that $databaseColumnMap itself is. Also there are some inaccuracies in documentation, where it says such and such is required and it isn't. So far, with limited testing I haven't run into an issue with commenting out the 3 I mentioned above, but wanted to be sure.

Link to comment
Share on other sites

Just now, Midnight Modding said:

And? That does not say if they are required. It only says that $databaseColumnMap itself is. Also there are some inaccuracies in documentation, where it says such and such is required and it isn't. So far, with limited testing I haven't run into an issue with commenting out the 3 I mentioned above, but wanted to be sure.

Quote
public static $databaseColumnMap = array();

Required. Features provided by the higher classes your model extends will examine this array to find out what columns certain things are stored as in your database. The following elements are required, and in all cases the value is with the $databasePrefix omitted:

  • author
    Should contain the name of the column which contains the ID number of the member who posted the content.
  • title
    Should contain the name of the column which contains the title of the content.
  • date
    Should contain the name of the column which contains a unix timestamp of when the content item was created.
  • ip_address
    Should contain the name of the column (without the $databasePrefix) which contains the IP address of the user who posted the item.

maybe you should read it first before claiming it doesn't say they are, as it clearly does. as for inaccuracies, the items/nodes ones are pretty accurate.

Link to comment
Share on other sites

I did read it.

15 minutes ago, Midnight Modding said:

And? That does not say if they are required. It only says that $databaseColumnMap itself is. Also there are some inaccuracies in documentation, where it says such and such is required and it isn't. So far, with limited testing I haven't run into an issue with commenting out the 3 I mentioned above, but wanted to be sure.

As for it being accurate... well I have all 3 of those I mentioned commented out and have added and edited the content item with no problems. Was just asking in case someone ahs a concrete example of them being necessary. If I am not mistaken, somewhere else in documentation it says "if you" have content items set to have an author, which implies it's optional.

Also, in some cases it may say something is required because of an assumption on you implementing a certain feature. I can't think of a feature I am implementing that would need it to check the ip address... I've probably overwritten wahtever checks would ahve done that.

Link to comment
Share on other sites

Just now, Midnight Modding said:

I did read it. Maybe you should read my post before saying I didn't read it.

i'm gonna go out on a limb and say your 30 seconds of rudimentary testing to stick it to the man, isn't enough to rule out that what says in the docs is required, isn't really required. ip_address is used by the IP tool to find content added by a specific user, author is used in various things like activity stream, profile, etc, and so is updated, but hey do what you do.

Link to comment
Share on other sites

Yep, because me posting a question asking about it means I "ruled it out", of course.

The examples you gave seem to fit into my previous comment that it depends what you are implementing. Doesn't activity stream require actually being set up, ie not automatic? I don't like that so much is automatically enabled on its own without clear documentation saying so because I am left and right having to figure out how to disable features I didn't enable myself. For instance, had to figure out about canCopy() and other such methods to try to disable some functionality.

I haven't looked far into this, but I "think" if you don't set author it just won't have certain features enabled because I think I saw in docs that not all content items have to have authors. (unless I am mixing it up with nodes.... and that those can have authors).

Link to comment
Share on other sites

The bottom line here is that this content item is not a type that really has an author. Sure I can consider the creator the author, but for the particular use of it by this client, it's kind of awkward even to have it listed on a profile or activity stream, really... and I thought I saw that it's optional, but, again, maybe it was nodes/containers I saw that can have an optional author.

This app had a lot of situations not like those of typical apps. Not really an author for content items, a content item type that needed a dummy container, one content item type can be edited on the front end and acp end, while another only on the acp side, whereas most apps have only the front end. i've had to work around a lot of stuff because it's easier, obviously, than not using the content item setup at all.

Link to comment
Share on other sites

The documentation says it is required, so you should consider it required. I think that's fairly straightforward. The details can be used in other areas of the software you may not even realize (e.g. the IP address lookup tools may expect an IP address column inherently and not supplying one could cause an error there...not saying that's the case presently, just that if we mark something as required we are free to assume all content items will have that something).

Link to comment
Share on other sites

ok, but it's just that this isn't a typical content item. But it still won't hurt anything using an author for it, though, I guess. As for docs saying it's required, a lot of what I read in docs has slipped my mind because I'm already at several hundred hours working on the app. But, also, some listed as required are really only required in certain situations. Permission map isn't because permissions itself doesn't have to be implemented. So I was asking just to be sure, since the creator of these content items is irrelevant in the usage of this app. This isn't even a content item where one would need to be looking up anything about who created it and I am not using moderator permissions at all. Speaking of which.,.. I noticed moderator permissions use generic keys instead of per-app keys, so now I am worried somewhere in the app it will be allowing moderator abilities I don't want used.

Link to comment
Share on other sites

Skip logging the IP at all.. You'll confuse yourself in 1 month once you notice the ongoing GDPR talk and you have to create a topic about skipping and not logging IP addresses ?

My 0.02$

 

But if you still want to handle this..
Yes, you'll have to update the IP address.
IPS 4.3.3 includes a new method for this, which you could utilize ?

 

Content\Item::changeIpAddress()

Link to comment
Share on other sites

45 minutes ago, Fosters said:

Skip logging the IP at all.. You'll confuse yourself in 1 month once you notice the ongoing GDPR talk and you have to create a topic about skipping and not logging IP addresses ?

My 0.02$

 

But if you still want to handle this..
Yes, you'll have to update the IP address.
IPS 4.3.3 includes a new method for this, which you could utilize ?

 

Content\Item::changeIpAddress()

All I did was ask if it is required. I did not say I refused to use it if required, as jungle implied.

Anyway, thanks. The client is not using 4.3 with this, but good to know for whenever he does or when I make a public version. I guess I will look at it to see if it does more than update author or ip address, but really since this isn't a content item that is a typical owned one, it's going to be awkward regardless.

Link to comment
Share on other sites

Also, where would they even do a member lookup in regard to my items? Like I mentioned, I don't even want moderator abilities. There aren't many actions that I want done on these. One content item has a dummy container, so no moving needed. And in many cases they are to not be deleted. I have no real need for moderator permissions. I have a setting that acts similar to moderator permissions, but would be different than typical moderator permissions and wouldn't be done in the moderator cp. I hope I don't have to work around some automatic functionality somewhere.

Link to comment
Share on other sites

2 hours ago, Midnight Modding said:

All I did was ask if it is required. I did not say I refused to use it if required, as jungle implied.

never implied that, you asked if they were required, i pointed you to documentation. then you do what you normally do, want to argue, so i pointed out, as farber did, to assume they are required, as other parts of the software will assume that a  content items class will contain those mappings. and then you continued to argue...

4 hours ago, Midnight Modding said:

Speaking of which.,.. I noticed moderator permissions use generic keys instead of per-app keys, so now I am worried somewhere in the app it will be allowing moderator abilities I don't want used.

they aren't generic, and yes global moderators will have those abilities in all the apps that use content items. each of the mod permissions can be overriden in your content item class, by overloading the appropriate can<perm> method.

Link to comment
Share on other sites

26 minutes ago, CodingJungle said:

never implied that, you asked if they were required, i pointed you to documentation. then you do what you normally do, want to argue, so i pointed out, as farber did, to assume they are required, as other parts of the software will assume that a  content items class will contain those mappings. and then you continued to argue...

they aren't generic, and yes global moderators will have those abilities in all the apps that use content items. each of the mod permissions can be overriden in your content item class, by overloading the appropriate can<perm> method.

Eh, you're getting me mixed up with yourself, I think.

So, basically in the moderator cp itself it will automatically have something related to my content items in there? Am I going to have to make a moderator account and see for myself, or is it simple to explain what's going on there? this is frustrating because I'm like a day from being done with the app overall, but there are some situations like this where I may overlook automatic features I haven't seen for myself. I've never used moderators myself so don't even have an idea on how it's set up.

By generic, what i meant, is I looked at the code and saw that it uses the same keys for multiple apps. It doesn't check something like someApp_edit, for instance. So if i create no keys at all, it's still going to be checking them.

Another thing you need to keep in mind is not everything in documentation is cut and dry. For instance, gallery has albums used as both nodes and content items. Not every feature fits into this simple mold, and that is nothing wrong on my part, as even first party usage is different in some cases than others. I'm using content items for the built in search functionality mostly.

So, bottom line, is the moderator cp the only area where anything is automatically there in relation to our content items? Like I said in another topic, I noticed function edit() in Content\Controller.pphp, too, so even editing would automatically have shown up had I not noticed that and that I need to disable it through canEdit() or by overriding the method.

Link to comment
Share on other sites

6 minutes ago, Midnight Modding said:

Eh, you're getting me mixed up with yourself, I think.

yawn....i see it is still the same song and dance with you. I should know better by now, not to engage or try to help you.

7 minutes ago, Midnight Modding said:

Another thing you need to keep in mind is not everything in documentation is cut and dry.

exactly, its not, however that is where being an actual developer comes into play. nodes/content items/reviews/comments/controllers/etc are just boilerplate, a foundation to build from. a developer will see what is being done, and what needs to change, and what they can add. it is why i've always told you the best thing to do is to look at the stack and follow the flow (translation, open up a file and see what it is doing and whatever classes/methods it is using), and understand it from there. the documentation in most cases is at best gonna teach you how to at the very minimum how the boilerplate works, looking at the code is going to tell you what it is doing, how it is doing it and where it can go from there.

i will bid you farewell, and remember to loose your big but (yes but, not the other one ? )

Link to comment
Share on other sites

43 minutes ago, CodingJungle said:

yawn....i see it is still the same song and dance with you. I should know better by now, not to engage or try to help you.

exactly, its not, however that is where being an actual developer comes into play. nodes/content items/reviews/comments/controllers/etc are just boilerplate, a foundation to build from. a developer will see what is being done, and what needs to change, and what they can add. it is why i've always told you the best thing to do is to look at the stack and follow the flow (translation, open up a file and see what it is doing and whatever classes/methods it is using), and understand it from there. the documentation in most cases is at best gonna teach you how to at the very minimum how the boilerplate works, looking at the code is going to tell you what it is doing, how it is doing it and where it can go from there.

i will bid you farewell, and remember to loose your big but (yes but, not the other one ? )

edit: nvm,. not wasting my time other than to say if you had read, you'd know I DO go through the stack of files, usually, but I don't have limitless time and this was a quick, easy question, which Brandon answered, professionally.

Link to comment
Share on other sites

8 minutes ago, Aiwa said:

Dear Lord, stop arguing with yourself and just do what you're told. 

5B908DE8-55BF-49B6-87BB-287A26D79F66.thumb.png.ead073595c8063b57f01ee2a0f80dbd8.png

lol. 1. none of this had anything to do with me not doing as told. Had you read, you'd have seen I said I was adding it in if it was required. 2. I am adding it in because Brandon said to. I know you and jungle would love for someone to do as you tell them, but you have no authority. 3. follow your own advice. you're always saying IPS should do this or that instead of accepting how the software currently is. 4. doing something without questioning why is the way to be extra sure to "not" learn something.

Link to comment
Share on other sites

You two need to chill. I said many times I want to do it the right way, as I have gone out of my way in other areas trying to do things the right way, as well. Nowhere did I would ignore advice..... (since Brandon gave it ? )

Again, I was just being sure because some other areas are only required in specific situations and I've spent more time looking up answers in files than most have on coding an app, itself.

note:  aiwa thinks I am talking to myself because this is a q&a and so it's not ordered chronologically, so I have a ton of posts in a row, which were not written in a row. ?

Link to comment
Share on other sites

2 minutes ago, Midnight Modding said:

You two need to chill. I said many times I want to do it the right way, as I have gone out of my way in other areas trying to do things the right way, as well. Nowhere did I would ignore advice..... (since Brandon gave it ? )

Again, I was just being sure because some other areas are only required in specific situations and I've spent more time looking up answers in files than most have on coding an app, itself.

I gave you the same advice as farber, 7 hours before he did and you did IGNORE IT. i said that if they say it is required then you should assume it is, that removing them (like you said you had in your OP) and doing a few test wasn't enough to assume they aren't required.

 

but any way, going back to lurker mode:

2.gif.cc163f50550fec50bdbc6a053cfcac16.gif

Link to comment
Share on other sites

OK, so I'm going to throw in something constructive here, just because I think I've basically ripped up the suite every which way by now, so....

author - this one actually is required, particularly if you're doing anything related to searching. I have in very rare instances left this out, but I've always had to circle back and add it in eventually.

ip_address - I personally rarely use this and have yet to have any issues with omitting it.

updated - if you leave this one out, you are asking for trouble. The default sorting method for \IPS\Content\Item::getItemsWithPermission is to sort by updated, and it doesn't check to see if it exists. Same deal if you set up any feed widgets for your content items. I've also seen it cause problems with search (your index_created and index_updated columns are simply blank, so your results never show up). There was another area that caused issues, but my kids are screaming right now and have driven all rational thought from my brain. Let's just leave it as "put that one in, or else".

Link to comment
Share on other sites

1 hour ago, HeadStand said:

OK, so I'm going to throw in something constructive here, just because I think I've basically ripped up the suite every which way by now, so....

author - this one actually is required, particularly if you're doing anything related to searching. I have in very rare instances left this out, but I've always had to circle back and add it in eventually.

ip_address - I personally rarely use this and have yet to have any issues with omitting it.

updated - if you leave this one out, you are asking for trouble. The default sorting method for \IPS\Content\Item::getItemsWithPermission is to sort by updated, and it doesn't check to see if it exists. Same deal if you set up any feed widgets for your content items. I've also seen it cause problems with search (your index_created and index_updated columns are simply blank, so your results never show up). There was another area that caused issues, but my kids are screaming right now and have driven all rational thought from my brain. Let's just leave it as "put that one in, or else".

ok thanks very much. I sort of kind of had author and updated already in, anyway, but never used ip address. i will likely put ip address in, anyway, but the thing is... since it wasn't used in the past, I'd have to go through all past rows during the upgrade routine and put in members' ip addresses.... So that is going to suck, but I guess it's no big deal, since I'm already going to have to be moving data around during the upgrade, anyway.

(by that sort of kind of comment, I mean I had already been storing something similar, but I had them commented out in the mapping because I thought at least author would be optional, but yeah it makes sense they would use that for search results).

edit: sigh. actually I don't think I did keep an updated column in the past versions. And to make jungle happy, I looked into the files and see even on creation of an item it stores a timestamp. I had hoped it starts with no timestamp and just automatically use the date field for the last updated if the last updated is 0. SO now I have to go through setting updated values on past rows that didn't even USE updated times?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...