Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #1098569

    For some reason the merging of stylesheets and scripts is not working when I select the Enable option under the Performance tab of the Theme settings.
    When I disable merging, all of the JS and CSS files are loaded individually. When I enable them, nothing changes.

    Looking in the database under the wp_options table I see three options:

    aviaAsset_avia-merged-styles
    "a:2:{s:51:""avia-merged-styles-8a8ca35c6fe58fc87e9d9bb3deebeadd"";s:21:""error-generating-file"";s:51:""avia-merged-styles-ba93e0f1159df5cfe1d5fa48d69977c7"";s:21:""error-generating-file"";}"
    
    aviaAsset_avia-merged-styles
    "a:2:{s:51:""avia-merged-styles-8a8ca35c6fe58fc87e9d9bb3deebeadd"";s:21:""error-generating-file"";s:51:""avia-merged-styles-ba93e0f1159df5cfe1d5fa48d69977c7"";s:21:""error-generating-file"";}"
    
    aviaAsset_avia-footer-scripts
    "a:2:{s:52:""avia-footer-scripts-01a4d3207943c902ca6293faf3c9c6b7"";s:21:""error-generating-file"";s:52:""avia-footer-scripts-730f76d9d70aa35ae3fe88e81b91943f"";s:21:""error-generating-file"";}"

    For some reason, they all say error-generating-file, which upon further investigation, the asset-manager.class.php can’t seem to generate the minified file.
    How can I determine why it can’t generate the file?

    #1099123

    Hey Michael,

    Could you check the file permissions for the uploads/dynamic_avia folder please?

    Best regards,
    Rikard

    #1099412

    File permissions are:

    rwx rwx r-x (775)
    user/group: apache apache

    What’s interesting is that the files end up getting generated.

    • This reply was modified 5 years, 7 months ago by Michael.
    #1100195

    Hi,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
      ( do be sure that we have enough time to debug ).
    5. Click ” Submit “.
    6. You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.

    When your issue is fixed, you can always remove the plugin!
    If you prefer to not use the plugin, you can manually create an admin user and post the login credentials in the “private data” field.

    Best regards,
    Basilis

    #1100214

    Unfortunately, we’re going to have to work interactively over some sort of chat session as I cannot provide you with access to our public website due to our corporate privacy policies.

    Please set up a time that works for you that I can coordinate chat via something like Discord or Skype.

    #1100762

    Hello?

    #1100767

    Well I’ve been looking at the theme code and I am seeing a variable naming conflict and conditional argument that should be refactored here as it is confusing, superfluous and doesn’t really handle the reasons for why the outcome wouldn’t occur in any sort of graceful manner except for failing altogether, especially if we’re going all the way to provide merging and compressing in the first place.

    In the following file (/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/asset-manager.class.php:416) I see this block of code:

    //create a new file if we got any content
    			if(trim($content) != "")
    			{
    				$file_path		= trailingslashit($stylesheet_dir).$data['hash'].".".$file_type;
    				$file_created 	= avia_backend_create_file($file_path, $content);
    				
    				//double check if the file can be accessed
    				if(is_readable($file_path))
    				{
    					$handle = fopen($file_path, "r");
    					$filecontent = fread($handle, filesize($file_path));
    					fclose( $handle );
    					
    					$file 		= $this->get_file_url($data, $file_type);
    					$request 	= wp_remote_get($file);
    					
    					$file_created = false;
    					if( ( ! $request instanceof WP_Error ) && is_array( $request ) && isset( $request['body'] ) )
    					{
    						$request['body'] = trim($request['body']);
    						$filecontent = trim($filecontent);
    					
    						//if the content does not match the file is not accessible
    						if($filecontent == $request['body'])
    						{
    							$file_created = true;
    						}
    					}
    				}
    			}
    			
    			//file creation failed
    			if(!$file_created) return false;
    

    If we look at lines 420, we have the variable $file_created, which should essentially always return true. Yet we later on line 432 re-assign the same variable $file_created to false, basically overriding the truthful result of the previous $file_created boolean state anyhow, regardless of it being true….???? That is a problem.

    I also have to ask, why in lines 424 to 444 do we even bother checking to see if the file can be accessed by comparing the local PHP access to the a HTTP GET response??!? If the code successfully generated the file in the earlier step, then the file should be there. It is not the theme’s responsibility to determine HTTP response issues, but most likely a larger problem with the server or redirections, which this entire theme code block attempts to sloppily circumvent, but fails miserably when the problem arises regardless.

    At the minimum, barring all of the other code issues, I would change the code to the following:

    //create a new file if we got any content
    			if(trim($content) != "")
    			{
    				$file_path		= trailingslashit($stylesheet_dir).$data['hash'].".".$file_type;
    				$file_created 	= avia_backend_create_file($file_path, $content);
    				
    				//double check if the file can be accessed
    				if(is_readable($file_path))
    				{
    					$handle = fopen($file_path, "r");
    					$filecontent = fread($handle, filesize($file_path));
    					fclose( $handle );
    					
    					$file 		= $this->get_file_url($data, $file_type);
    					$request 	= wp_remote_get($file);
    					
    					// don't overwrite the above assignment of the $file_created variable, and remove this assignment: $file_created = false;
    					if( ( ! $request instanceof WP_Error ) && is_array( $request ) && isset( $request['body'] ) )
    					{
    						$request['body'] = trim($request['body']);
    						$filecontent = trim($filecontent);
    					
    						// if the content does not match, the file is not accessible
    						if($filecontent != $request['body']) // if the file content DOES NOT equal the request body, then....
    						{
    							$file_created = false; // change from true to false
    						}
    					}
    				}
    			}
    			
    			//file creation failed, exit out of function
    			if(!$file_created) return false;
    
    • This reply was modified 5 years, 7 months ago by Michael.
    #1100768

    Oh and by the way, you should hire me on contract to fix your theme, or at least discount me.
    I see you guys are looking for developers, and it looks like you need all the help you can get.
    Contact me at (Email address hidden if logged out) .

    Thanks.

    #1114878

    Any updates from Enfold support? Seems like the most logical response to this issue.
    I think wp_remote_get() is failing when the site has a self-signed certificate.

    An entry in the Error log as to what is going on would be helpful.

    • This reply was modified 5 years, 5 months ago by Jason.
    #1114933

    Any updates from Enfold support? Seems like the most logical response to this issue.

    Ha, their support structure is extremely poor. I inherited this theme for a site I manage, but I would have never used it.

    I think wp_remote_get() is failing when the site has a self-signed certificate.

    That’s my case exactly as well. I’ve since replaced that function with the native PHP file_get_contents() function in my code with some affordances for ssl/tls scenarios specific to my case and stored it as a recurring patch job in my git repo.

    An entry in the Error log as to what is going on would be helpful.

    Amongst SO MANY OTHER THINGS.

    • This reply was modified 5 years, 5 months ago by Michael.
    #1115988

    Hi,

    @smartstartinc: Thank you for your contribution. We will certainly forward this to Kriesi and the team.

    Where are you hosting the site? We also notice that the compression doesn’t work on other servers while it’s fine in most. If it doesn’t really work in your installation, it can be easily replaced with Autoptimize or other minify tool from popular cache plugins like W3 Total Cache. Sorry for the delay.

    Best regards,
    Ismael

    #1116526

    Hi!


    @smartstartinc
    : We are still not sure why the compression doesn’t work on some servers, but one of our developers said that it might be related to the ssl certificate as discussed here.

    // https://wordpress.stackexchange.com/questions/167898/is-it-safe-to-use-sslverify-true-for-with-wp-remote-get-wp-remote-post#answer-167910

    Related thread: https://kriesi.at/support/topic/merge-and-compress-css-js-issue-avia_head_scripts/

    Best regards,
    Ismael

    #1116531

    @ismael to answer some of your questions:

    We are hosting our website on our own internal hardware with VMs running CentOS. We have a Kemp load-balancer between the server and the public. The CentOS server has self-signed certificates for SSL/TLS on it, and the Kemp load-balancer has the domain name certs that get replaced in the exchange passthrough.
    This is likely why it the theme fails on its verification of files using wp_remote_get() because it is accessing/referencing itself publicly through our local NAT and not hair-pinning out on the internet and then coming through the Kemp to get the certificates.

    Your resource regarding this: https://wordpress.stackexchange.com/questions/167898/is-it-safe-to-use-sslverify-true-for-with-wp-remote-get-wp-remote-post#answer-167910 states the following, which I think pretty much sums up what your team should do:

    If this is a publicly distributed plugin, then you might want to attach that to a simple option that the user can turn on or off. You could as well try the verified request first and if not (and if the user has opted in for a unsigned request), then switch to a potentially unsafe request.

    Your team should add a switch to the settings of the theme, to turn off verifying of the SSL certificates, should we have a setup where load-balancers exist or complicated SSL certificate setups cause these sorts of errors.

    • This reply was modified 5 years, 5 months ago by Michael.
    #1116701

    Hi,

    There will be a theme option “Http security level for checking readability of merged files” in Performace Tab in the next release.

    Best regards,
    Günter

    #1116721

    When is the next release scheduled?

    #1116726

    Hi,

    No ETA yet. See private content.

    Best regards,
    Günter

    #1116728

    If it’s going to take longer than a month, please let me know, or share the code blocks with the changes for this.

    #1117659

    Hi,

    You’ll find the updated files in the private field. This should add a new “Http security level for checking readability of merged files” option in the Performance panel.

    Best regards,
    Ismael

    • This reply was modified 5 years, 4 months ago by Ismael.
    #1123213

    These files are not found.

    #1123814

    Hey!

    Sorry about that. The new option is available in the beta version. Please check the private field. You may need an extractor software like WinRAR for Windows or something else for Mac.

    Cheers!
    Ismael

Viewing 20 posts - 1 through 20 (of 20 total)
  • You must be logged in to reply to this topic.