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

Reply
 
Thread Tools Display Modes
  #11  
Old 11-19-2012, 09:56 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Kevin,

Just getting a chance to do this now, been so busy.

Should I just keep my cron to run rssposter and do it for each minute and keep the limit to 1?
What would happen if the previous feed is taking more than 1 minute to retrieve, should it cause an error?

Thanks again Kevin!

--------------- Added [DATE]1353368318[/DATE] at [TIME]1353368318[/TIME] ---------------

Sorry Kevin, I just noticed I have this in the vb4 forum!

I am using vb3 - This was the only thing I wanted to upgrade to vb4 but it didn't change.

I am not sure, but I think this is the code from vb3 that has been changed for vb4:

Code:
// #############################################################################
if ($_POST['do'] == 'updatestatus')
{
	$vbulletin->input->clean_gpc('p', 'enabled', TYPE_ARRAY_UINT);

	$feeds_result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "rssfeed ORDER BY title");
	while ($feed = $db->fetch_array($feeds_result))
	{
		$old = ($feed['options'] & $vbulletin->bf_misc_feedoptions['enabled'] ? 1 : 0);
		$new = ($vbulletin->GPC['enabled']["$feed[rssfeedid]"] ? 1 : 0);

		if ($old != $new)
		{
			$feeddata =& datamanager_init('RSSFeed', $vbulletin, ERRTYPE_ARRAY);
			$feeddata->set_existing($feed);
			$feeddata->set_bitfield('options', 'enabled', $new);
			$feeddata->save();
		}
	}

	exec_header_redirect('rssposter.php');
}

print_cp_header($vbphrase['rss_feed_manager']);
I will try to get it working through this and post it in the vb3 forum if it will help any other users.
Reply With Quote
  #12  
Old 11-20-2012, 10:47 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by John Diver View Post
Should I just keep my cron to run rssposter and do it for each minute and keep the limit to 1?
I think that should work.


Quote:
What would happen if the previous feed is taking more than 1 minute to retrieve, should it cause an error?
I'm not sure, but I think it should work. But if you have one feed taking longer than 1 minute it might time out because there's usually a time limit set for how long a php script can run. If that happens I suppose you could limit the number of items for that feed. If you have one feed that continually has so many items that it takes more than 1 minute to run every time, then I'm not sure what you could do, you might need to figure out a way to rewrite rssposter.php.


I did a diff of the vb3 and vb4 rssposter.php and there are only minor differences, so I wouldn't worry about that issue.
Reply With Quote
  #13  
Old 11-20-2012, 11:11 AM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Kevin

I don't think it should take more than 1 minute to run the feeds, I am going to try it now.

Should the code be changed like this:

Code:
// #############################################################################
if ($_POST['do'] == 'updatestatus')
{
	$vbulletin->input->clean_gpc('p', 'enabled', TYPE_ARRAY_UINT);

	$feeds_result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "rssfeed ORDER BY title");
	while ($feed = $db->fetch_array($feeds_result))
	{
		$old = ($feed['options'] & $vbulletin->bf_misc_feedoptions['enabled'] ? 1 : 0);
		$new = ($vbulletin->GPC['enabled']["$feed[rssfeedid]"] ? 1 : 0);

		if ($old != $new)
		{
			$feeddata =& datamanager_init('RSSFeed', $vbulletin, ERRTYPE_ARRAY);
			$feeddata->set_existing($feed);
			$feeddata->set_bitfield('options', 'enabled', $new);
ORDER BY lastrun ASC LIMIT 1
			$feeddata->save();
		}
	}

	exec_header_redirect('rssposter.php');
}

print_cp_header($vbphrase['rss_feed_manager']);
As you can see, I am obviously useless at PHP

Thanks Kevin for all the help
Reply With Quote
  #14  
Old 11-20-2012, 11:35 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's the wrong file: you want to change includes/cron/rssposter.php. It should look just like what I posted above.
Reply With Quote
  #15  
Old 11-20-2012, 12:03 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Opps...Red face...

Thanks Kevin.

Just doing this now

--------------- Added [DATE]1353448949[/DATE] at [TIME]1353448949[/TIME] ---------------

Hey Kevin,

Been working with this all day - The code you posted works

I changed the limit to 10 because my feeds weren't updating enough - It worked for a while but then suddenly stopped.

Even by running the RSS feeds manually, nothing updated - When I unchecked all feeds, then checked a few and run the update manually, they worked.

Not sure why it would be doing this..

When I run manually with the code included at a limit of 10 it never gets an error or times out, it just shows the page after checking feeds but with no feeds retrieved, I'm not sure why it would be happening.
Reply With Quote
  #16  
Old 12-03-2012, 11:18 AM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey,

Just wanted to know if anyone can help please, still having the same problem
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 02:45 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04059 seconds
  • Memory Usage 2,218KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete