• Resolved antonyvk

    (@antonyvk)


    Hi !

    My front seems to infinitly wait when I access to any page having a call to an album (granted album, for your information there are 9k granted albums for the moment, goal is to have 36k).
    I looked into my mysql processlist and found it continually make queries like this one :
    SELECT COUNT(*) FROMwp_wppa_albumsWHEREowner= 'admin' ANDa_parent= '2564'

    a_parent is allways changing, probably to check all albums ? How to limit that ?
    Could it be due to autocreating user’s personal album ?

    Thanks for your help !

Viewing 15 replies - 46 through 60 (of 60 total)
  • Thread Starter antonyvk

    (@antonyvk)

    ooops ??

    On my side, I looked again to wppa_album_select_a() (I’m probably angry against it XD), because, as you said :

    So, – as i understood earlier – if you have on a page or post
    [wppa type=”upload” parent=”{a page specific parent album id}”][/wppa]
    the user will:
    – create his child under this album at the first pageload, and
    – see his album in the selection the second time. (If this must show up immediately after creation, so also on first pageload, pls tell me)

    Then if there are several albums to display, the wppa_album_select_a() is called, with an array containing all eligible albums.
    So the query near line 1622 may look like this :

    if ( $args['array'] ) {
            $albonly = implode( ',', $args['array']);
            $albums = $wpdb->get_results(
                    "SELECT * FROM <code>&quot; . WPPA_ALBUMS . &quot;</code> WHERE id in (".$albonly .") " . wppa_get_album_order( $args['root'] ), ARRAY_A
                    );
    }
    else {
            $albums = $wpdb->get_results(
                    "SELECT * FROM <code>&quot; . WPPA_ALBUMS . &quot;</code> " . wppa_get_album_order( $args['root'] ), ARRAY_A
                    );
    }

    What do you think about that ? Perhaps it needs more args to control in the if condition (like addpleaseselect is true or not, etc…).

    • This reply was modified 8 years, 4 months ago by antonyvk. Reason: implode, not explode ;)
    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Fixed this. Version is now 6.6.00.17
    Fixed in the top of wppa_get_user_upload_html():

    
    	// Create granted albums only if not done yet and an album id is given not being '0'
    	if ( wppa_is_int( $xalb ) && $xalb > '0' ) {
    		if ( ! in_array( $xalb, (array) $albums_granted, true ) ) {
    
    			// This function will check if $xalb is a grant parent,
    			// and make my subalbum if it does not already exist.
    			wppa_grant_albums( $xalb );
    
    			// Remember we 've been here
    			$albums_granted[] = $xalb;
    		}
    	}
    	// Check all albums in an enumeration and mark them checked in $albums_granted
    	elseif( wppa_is_enum( $xalb ) ) {
    		$temp = explode( '.', wppa_expand_enum( $xalb ) );
    		foreach( $temp as $t ) {
    			if ( ! in_array( $t, (array) $albums_granted, true ) ) {
    				wppa_grant_albums( $t );
    				$albums_granted[] = $t;
    			}
    		}
    	}
    

    This refers to my previous reply, it works again.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    So the query near line 1622 may look like this :

    Your concern is that "SELECT * FROM ".WPPA_ALBUMS gives a result that is too big?

    I will change it, tomorrow, with a fresh mind, not to overlook side-effects.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I made substantial progress. Dev version is now 6.6.00.019

    • The pre-selection array is now integrated in the query in wppa_album_select_a() as you suggested.
    • The check on ownership ( album owner is user or album owner is — public — ) is also integrated in the query in wppa_album_select_a(), but this only helps for non-administrators.
    • The granted member album shows up immediately in the upload dialog where it is created. In other possible upload dialogs on the same page, it shows up in the next pageload, but i expect that this will be no problem in the practice. This is caused by internal caching in wppa_alb_to_enum_children(), required for speedy finding all (grand)children of any album.

    Do you have plugin Query Monitor installed? It is very good for finding expensive queries.

    Also, do you have define( 'WP_DEBUG', true ); in wp-config.php? This displays php errors, but not when Query Monitor is active, this plugin shows them, except for fatal errors unfortunately…

    Pls try 6.6.00.019. If still capacity issues, pls tell me.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I think i know why you could not activate the plugin earlier.

    On activation of 6.6.00.xx a .htaccess file is re-generated for photo file permalinks. Default in …/wp-content/wppa-pl/

    content is something like:

    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wp-content/albums
    RewriteRule ^Jape/(.*) /wp-content/uploads/wppa-source/album-68/$1 [NC]
    RewriteRule ^Year_2010/(.*) /wp-content/uploads/wppa-source/album-213/$1 [NC]
    RewriteRule ^wp-media-opajaap/(.*) /wp-content/uploads/wppa-source/album-205/$1 [NC]
    RewriteRule ^Tina/(.*) /wp-content/uploads/wppa-source/album-462/$1 [NC]
    RewriteRule ^The-admin/(.*) /wp-content/uploads/wppa-source/album-481/$1 [NC]
    RewriteRule ^Stereo-fotos/(.*) /wp-content/uploads/wppa-source/album-120/$1 [NC]
    RewriteRule ^Stereo/(.*) /wp-content/uploads/wppa-source/album-301/$1 [NC]
    . 
    . 
    etc
    

    For each album one line written, but also 2 db queries required.

    Pls update to 6.6.00.021 (or later, if i have more brilliant ideas today) and make Table IX-H14: Permalink root blank. This disbales the feature and causes the .htaccess file no longer to be created.

    Thread Starter antonyvk

    (@antonyvk)

    “This value can’t be blank” when I try to clear it.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    That is why you have to ftp the current dev version over the installation, than you can make it blank.

    Thread Starter antonyvk

    (@antonyvk)

    >.< I did it on dev (and didn’t verify if all was working), then I didn’t write my cp correctly to push it on beta (because database on beta is more similar to my prod)…

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Does it work now?

    Thread Starter antonyvk

    (@antonyvk)

    Yes, I pushed it in production (because I have more albums and users in production).
    Now I have to look (again !) at loading process (I still have around 6-8 seconds of loading), but at first look it’s very very better !

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Great. Did you see my remark about QueryMonitor?

    Thread Starter antonyvk

    (@antonyvk)

    Yes and I activated it. Don’t see anything for the moment about wppa, it looks working like a charm ??
    (Not the case for an other plugin huhuuu)

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Pls keep me informed. I would like to state in the docs that the biggest runnung wppa site has … albums and … photos ( the max so far is 450.000 photos and 3500 albums ).

    Thread Starter antonyvk

    (@antonyvk)

    Of course I’ll inform you ?? I finish to optimize an other plugin and then I’ll be able to run traffic on it and say you how many photos I’ll receive !

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    If you have updated to the release version 6.6.00 or later ( dev version 6.6.01.001 or later ) you should be able to activate photo permalinks again. Set Table IX-H14 to the name of the folder in wp-content, e.g. wppa-pl ( is the default ) or albums

Viewing 15 replies - 46 through 60 (of 60 total)
  • The topic ‘lot of count when accessing an album page’ is closed to new replies.