Changeset 3409784
- Timestamp:
- 12/03/2025 03:56:01 PM (4 months ago)
- Location:
- instarank/trunk
- Files:
-
- 3 edited
-
api/endpoints.php (modified) (5 diffs)
-
instarank.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
instarank/trunk/api/endpoints.php
r3409755 r3409784 4623 4623 $include_content = $request->get_param('include_content') !== 'false'; 4624 4624 4625 // Limit to reasonable batch size for memory management 4626 // Increased from 100 to 200 for faster crawling 4627 $limit = min($limit, 200); 4625 // Adaptive memory-conscious batch size based on available PHP memory 4626 // Detect memory limit and adjust batch size accordingly 4627 $memory_limit = $this->get_memory_limit_bytes(); 4628 4629 if ($memory_limit <= 16 * 1024 * 1024) { 4630 // 16MB or less - very restrictive hosting (e.g., shared hosting) 4631 $max_batch = 3; 4632 $include_content = false; // Disable HTML content to save memory 4633 } elseif ($memory_limit <= 32 * 1024 * 1024) { 4634 // 32MB - basic shared hosting 4635 $max_batch = 5; 4636 } elseif ($memory_limit <= 64 * 1024 * 1024) { 4637 // 64MB - standard shared hosting 4638 $max_batch = 10; 4639 } elseif ($memory_limit <= 128 * 1024 * 1024) { 4640 // 128MB - typical WordPress hosting 4641 $max_batch = 15; 4642 } else { 4643 // 256MB+ - VPS/dedicated hosting 4644 $max_batch = 25; 4645 } 4646 4647 $limit = min($limit, $max_batch); 4628 4648 4629 4649 // Get post types … … 4726 4746 'schema' => $schema_data 4727 4747 ]; 4748 4749 // Free memory after each post to prevent exhaustion on large sites 4750 unset($html, $content, $meta, $internal_links, $content_images, $schema_data); 4728 4751 } 4729 4752 … … 4737 4760 $total_query = new WP_Query($count_args); 4738 4761 $total_pages = $total_query->found_posts; 4762 4763 // Free total query memory 4764 unset($total_query); 4739 4765 4740 4766 return rest_ensure_response([ … … 4752 4778 'wordpress_version' => get_bloginfo('version'), 4753 4779 'plugin_version' => INSTARANK_VERSION, 4754 'seo_plugin' => $detector->get_active_seo_plugin() 4780 'seo_plugin' => $detector->get_active_seo_plugin(), 4781 'memory_limit_mb' => round($memory_limit / (1024 * 1024)), 4782 'content_included' => $include_content 4755 4783 ] 4756 4784 ]); … … 4929 4957 4930 4958 /** 4959 * Get PHP memory limit in bytes 4960 * Parses the ini value and converts shorthand notation (e.g., 128M) to bytes 4961 * 4962 * @return int Memory limit in bytes (-1 if unlimited) 4963 */ 4964 private function get_memory_limit_bytes() { 4965 $memory_limit = ini_get('memory_limit'); 4966 4967 if ($memory_limit === '-1') { 4968 return PHP_INT_MAX; // Unlimited 4969 } 4970 4971 $memory_limit = trim($memory_limit); 4972 $last = strtolower($memory_limit[strlen($memory_limit) - 1]); 4973 $memory_limit = (int) $memory_limit; 4974 4975 switch ($last) { 4976 case 'g': 4977 $memory_limit *= 1024; 4978 // fall through 4979 case 'm': 4980 $memory_limit *= 1024; 4981 // fall through 4982 case 'k': 4983 $memory_limit *= 1024; 4984 } 4985 4986 return $memory_limit; 4987 } 4988 4989 /** 4931 4990 * Extract headings from content 4932 4991 */ -
instarank/trunk/instarank.php
r3409755 r3409784 4 4 * Plugin URI: https://instarank.com/wordpress-plugin 5 5 * Description: Connect your WordPress site to InstaRank for AI-powered SEO optimization, schema markup generation, and programmatic SEO. Create and sync custom post types, automatically apply SEO improvements, and generate structured data with InstaRank's AI engine. 6 * Version: 1.5. 76 * Version: 1.5.8 7 7 * Author: InstaRank 8 8 * Author URI: https://instarank.com … … 18 18 19 19 // Define plugin constants 20 define('INSTARANK_VERSION', '1.5. 7');20 define('INSTARANK_VERSION', '1.5.8'); 21 21 define('INSTARANK_PLUGIN_DIR', plugin_dir_path(__FILE__)); 22 22 define('INSTARANK_PLUGIN_URL', plugin_dir_url(__FILE__)); -
instarank/trunk/readme.txt
r3409755 r3409784 4 4 Requires at least: 5.6 5 5 Tested up to: 6.8 6 Stable tag: 1.5. 76 Stable tag: 1.5.8 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 159 159 == Changelog == 160 160 161 = 1.5.8 = 162 * Performance: Fixed memory exhaustion on large WordPress sites (1000+ pages) 163 * Performance: Reduced crawl batch size from 200 to 25 pages for better memory management 164 * Performance: Added aggressive memory cleanup after processing each page 165 * Compatibility: Improved support for hosts with limited PHP memory (16MB-128MB) 166 * Fix: Resolved "Allowed memory size exhausted" errors during crawl operations 167 161 168 = 1.5.7 = 162 169 * Enhancement: Improved Knowledge Base generation with comprehensive data extraction
Note: See TracChangeset
for help on using the changeset viewer.