Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorStanley
    • CommentTimeJan 24th 2010 edited
     permalink
    Umm... I've managed to write some text files to the drafts folder, and they seem to be picked up ok when in the Entries management screen in the admin panel.

    My question is... how important is it to have the second part of the file name show the file creation time in hours, minutes & seconds? Can this be any random 6-digit number?

    The problem I hope to face (!) is that there will be times when two entries will be created at the exact same second (albeit maybe up to 59.9999 seconds apart), but there might be a case when two files will need to use the same file name. As a test I created on with it formatted as minutes then HOURS the seconds, and it still seemed to work. I know the date of the posting comes from the field inside the entry, and not from the entry file name itself, so I was wondering if the file name really needs to stick rigidly to what it is, or can I change the ending?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeJan 25th 2010 edited
     permalink
    Posted By: StanleyThe problem I hope to face (!) is that there will be times when two entries will be created at the exact same second (albeit maybe up to 59.9999 seconds apart), but there might be a case when two files will need to use the same file name.


    well, of course this problem exists, that's why FP is currently designed to be single-user only; unless you suffer from some bad case of split-personality (and you have the gift of ubiquity) you physically can't edit two posts and then publish them at same exact time.

    :p

    Of course if you are running a (unsupported) multi-user setup (IIRC, you do) this might happen.

    I don't remember if there was a reason for the timestamp and the ID to match (I'm thinking about the index right now, but I remember I hacked the files to allow non-matching pairs, since SPB-imported data could present such an inconsistency);

    I wouldn't suggest to rely on such behavior, but if you see it is consistently working, go on and maybe report your experience, for the sake of it.

    have fun! :)
    •  
      CommentAuthorStanley
    • CommentTimeJan 25th 2010
     permalink
    Posted By: NoWhereManOf course if you are running a (unsupported) multi-user setup (IIRC, you do) this might happen.

    I don't remember if there was a reason for the timestamp and the ID to match (I'm thinking about the index right now, but I remember I hacked the files to allow non-matching pairs, since SPB-imported data could present such an inconsistency);

    I wouldn't suggest to rely on such behavior, but if you see it is consistently working, go on and maybe report your experience, for the sake of it.


    Yes, it's for a multi-user thing, but not quite as I originally meant to be using it - but it seems to be feasible (and less prone to getting screwed up) if people can only post drafts and there remains one admin in charge of editing/publihing them.

    Ok, thanks for your help. Of course, I'll carry on and report back on how it goes. I've just got it on my test server at home right now, but I hope to put it on the web soon for a crash test.
    •  
      CommentAuthorStanley
    • CommentTimeJan 31st 2010
     permalink
    Posted By: NoWhereManI wouldn't suggest to rely on such behavior, but if you see it is consistently working, go on and maybe report your experience, for the sake of it.


    So far so good! Rather than check for an existing file by that name I just randomised the last 6 digits - obviously there's still a small risk if I get millions of visitors (lol!) but, if that happens, then I'll probably be more concerned about where to store all of my money.

    FYI, (and in case it gives you any ideas for future versions) my posting form is a copied and tweaked contact.php with a few extra fields on. I just added a new section with all the appropriate labels to lang.contact.php and added a bit of script to create the entry file in drafts. This is quite useful as it also still posts me an e-mail to let me know there's a new draft waiting for my attention. I just added a bit of script to make sure only members can access the posting form.
    •  
      CommentAuthorStanley
    • CommentTimeFeb 23rd 2010 edited
     permalink
    Posted By: NoWhereManI don't remember if there was a reason for the timestamp and the ID to match (I'm thinking about the index right now


    Just to let you know that I'm experiencing some weird behaviour with some posts appearing in place of others - i.e. you click the link to a post which physically exists, but another one shows in its place. I tried clearing out the cache and reindexing, but it still happened somehow.

    Another thing which was happening (perhaps related) was that I had lastentries shown as a sticky post with the date. Even though the published date (in the post itself) was correct the actual date shown in lastentries was sometimes 2, 3 or even 4 days later than the post date. I think this is somehow to do with the fact that I randomised the hour/mins/seconds part of the entry file name to a number between 100000 and 999999, so maybe a high number at the end was changing "$entry['date']" (which is what I was using to display the date in the lastentries list).

    As an example I have one post with the name "entry100222-990223" which showed the correct date in the post (22nd Feb) but which displayed as the 26th Feb in lastentries. Another one (posted about 5 minutes previously) showed up in lastentries as the 25th Feb, and the last bit of the file name on this one was 814986.

    I think maybe something is looking at "99" and dividing it by 24 hours, same with the "81", and adding the additional days onto "$entry['date']".

    It's a little hard to explain it better than that but I'm just going to revert the change I made and try to regulate the flood of posts another way, in case I get two at the same second - that's highly unlikely right now.

    I just thought you'd like to know in case someone else has a similar need to do this.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeFeb 23rd 2010 edited
     permalink
    lastentries uses the fullparse=false options, which means the internal database guesses the timestamp from the ID of the entry. of course weird issues comes up as invalid values for the timestamps are given (such as 99:00 ~ 4 days)

    that's one of the reasons you should save the entry with the CORRECT timestamp/name ($entry[date] => entryYYMMDD-hhmmss) and not random; the filename and the timestamp are supposed to match modulo a trivial conversion.

    as for the other "weird issues" [ i.e. you click the link to a post which physically exists, but another one shows in its place ] I can't really say at the moment; what was the IDs ? what about the title? are you using prettyurls?
    •  
      CommentAuthorStanley
    • CommentTimeFeb 23rd 2010
     permalink
    Posted By: NoWhereManwhat was the IDs ? what about the title? are you using prettyurls?


    I wasn't using prettyurls and the titles were quite normal and unique. I've just deleted and republished them normally now, and everything seems ok.

    Oh well, case closed - it seems it IS important is it to have the second part of the file name show the file creation time in hours, minutes & seconds, and not any random 6-digit number.

    Thanks for your time on this.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeFeb 23rd 2010
     permalink
    it's fine for drafts to have random names as long as published entries follow the correct convention
    •  
      CommentAuthorStanley
    • CommentTimeMar 5th 2010 edited
     permalink
    [sorry, little bit off my own topic here - but related]

    Just one peculiarity I've run into. I've noticed that if you have a single entry in your drafts folder, and you delete it, the drafts folder itself is deleted and is created again if you create a new draft entry. If you have a single entry but you publish it instead, then the drafts folder remains. My own script relies on the drafts folder existing, so I've left myself a warning message, for now, as a draft entry to remind me not to delete that entry. It's a bit of a crude solution until I get around to tweaking my script to create the folder if it's not there.

    I'm guessing that the folder getting deleted is just good housekeeping at work, but I just wondered whether there was some other reason why the folder is deleted when you delete the last entry in it, but doesn't get deleted if you publish the last entry.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 5th 2010
     permalink
    yes, there is: the delete routine deletes recursively all the parent directories, while the publish routing MOVES the draft to the entry dir (IIRC).
    •  
      CommentAuthorStanley
    • CommentTimeMar 5th 2010
     permalink
    Ok, thanks. I just thought I'd mention it in case anyone somehow follows what I've been doing and tries to do something similar.