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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-30-2009, 10:57 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default recalculation picture counts

I have an external program which runs outside of vb adding records to the pictures tables and it also updates the album, albumpicture and albumupdate tables.

it's working great except that vb is not recalculating the number of of pictures in the album (well - vb is not displaying the correct number of pictures in the album on it's screens). I've looked through the code and found the function which does this in class_dm_album.php but there does not appear to an update statement at the end of the function. so where is this information stored?

PHP Code:
     Rebuilds counts for an album
     
*
     */
    function 
rebuild_counts()
    {
        if (!
$this->fetch_field('albumid'))
        {
            return;
        }

        
$counts $this->registry->db->query_first("
            SELECT
                SUM(IF(picture.state = 'visible', 1, 0)) AS visible,
                SUM(IF(picture.state = 'moderation', 1, 0)) AS moderation,
                MAX(IF(picture.state = 'visible', albumpicture.dateline, 0)) AS lastpicturedate
            FROM " 
TABLE_PREFIX "albumpicture AS albumpicture
            INNER JOIN " 
TABLE_PREFIX "picture AS picture ON (albumpicture.pictureid = picture.pictureid)
            WHERE albumpicture.albumid = " 
$this->fetch_field('albumid') . "

        "
);

        
$this->set('visible'$counts['visible']);
        
$this->set('moderation'$counts['moderation']);
        
$this->set('lastpicturedate'$counts['lastpicturedate']);
    } 
so - how do I get the count of pictures in an album to get updated properly outside of vb?

thanks in advance.

I suppose I could take all of my code and move it inside of a vbulletin module (or at least create a new module and just run that module and attempt to figure out how this function is called, but that's clearly not my prerference.

thanks in advance for any help you can give or direction.
Reply With Quote
  #2  
Old 11-30-2009, 11:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That class extends vB_DataManager, which means some of the functions are in class_dm.php.

I think you could probably do the query like it's done in the code above, then use the results to update the album table 'visible', 'moderation', and 'lastpicturedate' fields for that albumid using an UPDATE query.
Reply With Quote
  #3  
Old 12-01-2009, 02:46 AM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
That class extends vB_DataManager, which means some of the functions are in class_dm.php.

I think you could probably do the query like it's done in the code above, then use the results to update the album table 'visible', 'moderation', and 'lastpicturedate' fields for that albumid using an UPDATE query.
yes, but I already do that in my code. all tables are updated properly.

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

found it - fixed it.

cool
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:57 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.03251 seconds
  • Memory Usage 2,189KB
  • 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
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete