vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Code Help with Time (two days ago) (https://vborg.vbsupport.ru/showthread.php?t=225783)

paul41598 10-22-2009 05:07 PM

Code Help with Time (two days ago)
 
I'm looking for a little help with my code ...I think I have the theory of it wrong here...

Basically I want from the start of the day (two days ago) till the end of the day (two days ago)

PHP Code:

$twodaysago TIMENOW - (48 60 60);  
$endoftwodaysago TIMENOW - (24 60 60); 


maybe its supposed to be similiar to this?
PHP Code:

$twodaysago TIMENOW - (48 60 60);  
$endoftwodaysago TIMENOW - (48 60 60) + something?; 


paul41598 10-27-2009 03:59 PM

anyone with some insight?

Lynne 10-27-2009 05:14 PM

Your code it for 48 hours ago to 24 hours ago. There is no 'end of the day' for it, you are just doing it for a 24 hour period. Is that what you want? If not, then you will have to decide what exactly is the 'end of the day'.

paul41598 10-27-2009 06:11 PM

I see..so I should have it right then eh? Its just weird, because the way my mod is coded (or cron job actually) is, it'll grab all threads whos expiration date was two days ago. So it would grab the 25th threads. However it also here and there grabs a few threads from the 26th, which doesnt make sense.

Lynne 10-27-2009 06:28 PM

Without seeing your full code, I really can't comment on what is going on.

paul41598 10-27-2009 06:49 PM

:)

PHP Code:

$twodaysago TIMENOW - (48 60 60);  
$endofday TIMENOW - (24 60 60);
 
$getthreadexpires $vbulletin->db->query_read("
    SELECT thread.* as thread, thread.threadid as tid, forum.forumid AS fid, forum.title AS ftitle, postlink.url as postlinkurl
    FROM " 
TABLE_PREFIX "thread AS thread
    LEFT JOIN " 
TABLE_PREFIX "postlink AS postlink ON (thread.firstpostid = postlink.postid)
    LEFT JOIN " 
TABLE_PREFIX "forum AS forum ON (thread.forumid = forum.forumid)
    WHERE forum.forumid IN(
$included_forums)
     AND thread.thread_expiry <> 0
    AND thread.thread_expiry >= 
$twodaysago 
    AND thread.thread_expiry <= 
$endofday
    
$adminwhere
    
"
);

//Check To See If Results 
if ($vbulletin->db->num_rows($getthreadexpires)) {

while (
$getthreadexpire $vbulletin->db->fetch_array($getthreadexpires))
{    


    
//Move Thread To Archive Forum
    
require_once(DIR '/includes/functions_databuild.php');
     
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_ARRAY'threadpost');    
    
$threadman->set_existing($getthreadexpire);
    
$threadman->set('forumid'$vbulletin->options['threadexpiration_forumarchive']);
    
$threadman->save();
    
build_forum_counters($getthreadexpire['forumid']);
    
build_forum_counters($archive_forum);




Lynne 10-27-2009 08:29 PM

Nothing really obvious stands out for me. However, there is no thread_expiry field in default vbulletin, so I can't really say whether anything to do with that field is correct.

paul41598 10-28-2009 09:52 AM

Well..no the codebase works fine. I just wasn't sure about the whole $twodaysago and $endofday variables. I was trying to pull threads that had an expiration starting with two days ago, and ending that same day. So to me it would seem right, 48 hours ago and then 24 hours ago?

Its just weird that it pulls the 48 hour ago threads, but some 24 hour ago ones...when really I just wanted the 48 hour ago ones. Its confusing I guess

ZeepySea 10-29-2009 03:14 AM

Try using just the < $endofday instead of <= $endofday

This way anything that equals 24 hours ago is ingored, but anything more than 24 hours ago is added.


All times are GMT. The time now is 09:43 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01021 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete