Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Improvement suggestion of plugin version check in V1.7

+2 votes
392 views
asked Sep 1, 2014 in Q2A Core by sama55
edited Sep 1, 2014 by sama55

When many plugins are installed, "Admin" > "Plugins" page is very slow. In case of worst, we can not operate page.

This is caused by version check of plugins. I hope that check code is stoped by some admin option 

Example source (qa-include/qa-page-admin-plugins.php [around L151]):

if (strlen(@$metadata['version']) && strlen(@$metadata['update'])) {
  if(qa_opt('version_check')) {
    $elementid='version_check_'.md5($plugindirectory);
    $updatehtml='(<span id="'.$elementid.'">...</span>)';
    $qa_content['script_onloads'][]=array("qa_version_check(".qa_js($metadata['update']).", 'Plugin Version', ".qa_js($metadata['version'], true).", 'Plugin URI', ".qa_js($elementid).");"
  );
  }
} else
...
 
Q2A version: 1.6.3
commented Sep 5, 2014 by Scott
How many plugins do you have installed?
commented Sep 5, 2014 by sama55
I tested various plugins for FlexArmor2.
http://askive.cmsbox.jp/demo/flexarmor2/document-25-compatibility
Now, there is 37 plugins in my qa-plugin folder. 10 plugins of those do version check. They are plugins of you, Kai, NoarY and etc. My plugins do not check version. Therefore, when I remove these 10 plugins, phenomenon does not occur.

1 Answer

0 votes
answered Sep 1, 2014 by sama55

I will post hack source for the person who has been already troubled.

qa-include/qa-app-options.php (L360) : Add 1 line

'version_check' => 1, // Add ASKIVE
qa-include/qa-lang-options.php (L261) : Add 1 line
'version_check' => 'Version check', // Add ASKIVE
qa-include/qa-page-admin-default.php: Add 1 line (L217) , Replace 1 line (L281)
'version_check' => 'checkbox', // Add ASKIVE
//$showoptions=array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'tags_or_categories', 'site_maintenance');
$showoptions=array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'tags_or_categories', 'site_maintenance', 'version_check');  // Replace ASKIVE
qa-include/qa-page-admin-plugins.php: Add 2 line (L151 and L159)
if(qa_opt('version_check')) { // Add ASKIVE
  $elementid='version_check_'.md5($plugindirectory);
 
  $updatehtml='(<span id="'.$elementid.'">...</span>)';
 
  $qa_content['script_onloads'][]=array(
  "qa_version_check(".qa_js($metadata['update']).", 'Plugin Version', ".qa_js($metadata['version'], true).", 'Plugin URI', ".qa_js($elementid).");"
  );
} // Add ASKIVE
...