Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-22-2009, 05:07 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?; 
Reply With Quote
  #2  
Old 10-27-2009, 03:59 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone with some insight?
Reply With Quote
  #3  
Old 10-27-2009, 05:14 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'.
Reply With Quote
  #4  
Old 10-27-2009, 06:11 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 10-27-2009, 06:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Without seeing your full code, I really can't comment on what is going on.
Reply With Quote
  #6  
Old 10-27-2009, 06:49 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default



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);


Reply With Quote
  #7  
Old 10-27-2009, 08:29 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 10-28-2009, 09:52 AM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 10-29-2009, 03:14 AM
ZeepySea ZeepySea is offline
 
Join Date: Aug 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:13 AM.


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.12732 seconds
  • Memory Usage 2,256KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete