Changeset 3491371
- Timestamp:
- 03/26/2026 02:15:15 AM (7 days ago)
- Location:
- praison-file-content-git
- Files:
-
- 8 edited
- 1 copied
-
tags/1.6.1 (copied) (copied from praison-file-content-git/trunk)
-
tags/1.6.1/praisonpressgit.php (modified) (2 diffs)
-
tags/1.6.1/readme.txt (modified) (2 diffs)
-
tags/1.6.1/src/Admin/SettingsPage.php (modified) (4 diffs)
-
tags/1.6.1/src/Loaders/PostLoader.php (modified) (2 diffs)
-
trunk/praisonpressgit.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Admin/SettingsPage.php (modified) (4 diffs)
-
trunk/src/Loaders/PostLoader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
praison-file-content-git/tags/1.6.1/praisonpressgit.php
r3491360 r3491371 3 3 * Plugin Name: PraisonAI Git Posts 4 4 * Description: Load WordPress content from files (Markdown, JSON, YAML) without database writes, with Git-based version control 5 * Version: 1.6. 05 * Version: 1.6.1 6 6 * Author: MervinPraison 7 7 * Author URI: https://mer.vin … … 13 13 14 14 // Define constants 15 define('PRAISON_VERSION', '1.6. 0');15 define('PRAISON_VERSION', '1.6.1'); 16 16 define('PRAISON_PLUGIN_DIR', __DIR__); 17 17 define('PRAISON_PLUGIN_URL', trailingslashit(plugins_url('', __FILE__))); -
praison-file-content-git/tags/1.6.1/readme.txt
r3489866 r3491371 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1. 1.07 Stable tag: 1.6.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 187 187 == Changelog == 188 188 189 = 1.0.0 = 190 * Initial release 191 * File-based content management 192 * Markdown parser with YAML front matter support 193 * Dynamic custom post type discovery 194 * Custom URL routing 195 * Built-in caching system 196 * Git version control integration 197 * Admin interface with version history 198 * Auto-update detection for file changes 199 * WordPress filter compatibility 189 = 1.6.1 = 190 * CRITICAL FIX: Archive safeguard - refuses to scan >500 files without _index.json, preventing OOM 191 * Added WordPress Settings page admin notice for index rebuild feedback 192 * Removed disconnected content_dir settings field 193 * Fixed duplicate docblock on loadSinglePost 194 195 = 1.6.0 = 196 * NEW: WordPress Settings page for user-friendly configuration 197 * NEW: Index Status table with "Rebuild Index Now" button 198 * All settings stored in wp_options - no ini files or CLI needed 199 * Auto-generates _index.json on plugin activation 200 201 = 1.5.0 = 202 * PERFORMANCE: Lazy constructor - zero filesystem I/O at plugin load 203 * PERFORMANCE: loadFromIndex() creates WP_Post from index metadata only 204 * PERFORMANCE: loadSinglePost() direct slug lookup - 1 file read (was: full scan) 205 * NEW: content.enabled safety check - plugin does nothing unless enabled 206 * NEW: Cache stampede protection with wp_cache_add lock 200 207 201 208 = 1.0.9 = -
praison-file-content-git/tags/1.6.1/src/Admin/SettingsPage.php
r3491360 r3491371 75 75 ); 76 76 77 add_settings_field(78 'content_dir',79 'Content Directory',80 [$this, 'renderTextField'],81 'praison-settings',82 'praisonpress_content',83 [84 'field' => 'content_dir',85 'description' => 'Path to the content directory. Default: <code>' . esc_html(PRAISON_CONTENT_DIR) . '</code>',86 'placeholder' => PRAISON_CONTENT_DIR,87 ]88 );89 90 77 // ── Section: Performance ── 91 78 add_settings_section( … … 142 129 'content_enabled' => false, 143 130 'post_types' => ['lyrics', 'chords'], 144 'content_dir' => '',145 131 'cache_enabled' => true, 146 132 'cache_ttl' => 3600, … … 165 151 $sanitized['cache_enabled'] = !empty($input['cache_enabled']); 166 152 $sanitized['cache_ttl'] = absint($input['cache_ttl'] ?? 3600); 167 $sanitized['content_dir'] = sanitize_text_field($input['content_dir'] ?? '');168 153 169 154 // Post types: array of sanitized slugs … … 337 322 <?php settings_errors(); ?> 338 323 324 <?php 325 // Show index rebuild result notice 326 if (isset($_GET['index_rebuilt'])) { 327 $success = $_GET['index_rebuilt'] === '1'; 328 $class = $success ? 'notice-success' : 'notice-error'; 329 $msg = $success ? 'Content index rebuilt successfully.' : 'Index rebuild failed — check file permissions.'; 330 echo '<div class="notice ' . $class . ' is-dismissible"><p>' . esc_html($msg) . '</p></div>'; 331 } 332 ?> 333 339 334 <form method="post" action="options.php"> 340 335 <?php -
praison-file-content-git/tags/1.6.1/src/Loaders/PostLoader.php
r3490698 r3491371 133 133 134 134 if (empty($files)) { 135 return []; 136 } 137 138 // SAFETY: refuse to scan large directories without an index. 139 // Without _index.json, every file is read via file_get_contents(). 140 // For 18K+ files this causes OOM/timeout. 141 $max_scan = apply_filters('praisonpress_max_scan_files', 500); 142 if (count($files) > $max_scan) { 143 if (defined('WP_DEBUG') && WP_DEBUG) { 144 error_log(sprintf( 145 'PraisonPress: Refusing to scan %d files in %s without _index.json (limit: %d). Run "wp praison index" or use the Settings page to rebuild the index.', 146 count($files), 147 $this->postsDir, 148 $max_scan 149 )); 150 } 135 151 return []; 136 152 } … … 407 423 408 424 /** 409 * Get posts directly (for helper functions)410 *411 * @param array $args Query arguments412 * @return array Array of WP_Post objects413 */414 /**415 425 * Load a single post by slug. 416 * Checks _index.json first for an O(1) file lookup, then falls back to full scan.426 * Checks _index.json first for an O(1) file lookup, then falls back to direct file. 417 427 * 418 428 * @param string $slug Post slug -
praison-file-content-git/trunk/praisonpressgit.php
r3491360 r3491371 3 3 * Plugin Name: PraisonAI Git Posts 4 4 * Description: Load WordPress content from files (Markdown, JSON, YAML) without database writes, with Git-based version control 5 * Version: 1.6. 05 * Version: 1.6.1 6 6 * Author: MervinPraison 7 7 * Author URI: https://mer.vin … … 13 13 14 14 // Define constants 15 define('PRAISON_VERSION', '1.6. 0');15 define('PRAISON_VERSION', '1.6.1'); 16 16 define('PRAISON_PLUGIN_DIR', __DIR__); 17 17 define('PRAISON_PLUGIN_URL', trailingslashit(plugins_url('', __FILE__))); -
praison-file-content-git/trunk/readme.txt
r3489866 r3491371 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1. 1.07 Stable tag: 1.6.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 187 187 == Changelog == 188 188 189 = 1.0.0 = 190 * Initial release 191 * File-based content management 192 * Markdown parser with YAML front matter support 193 * Dynamic custom post type discovery 194 * Custom URL routing 195 * Built-in caching system 196 * Git version control integration 197 * Admin interface with version history 198 * Auto-update detection for file changes 199 * WordPress filter compatibility 189 = 1.6.1 = 190 * CRITICAL FIX: Archive safeguard - refuses to scan >500 files without _index.json, preventing OOM 191 * Added WordPress Settings page admin notice for index rebuild feedback 192 * Removed disconnected content_dir settings field 193 * Fixed duplicate docblock on loadSinglePost 194 195 = 1.6.0 = 196 * NEW: WordPress Settings page for user-friendly configuration 197 * NEW: Index Status table with "Rebuild Index Now" button 198 * All settings stored in wp_options - no ini files or CLI needed 199 * Auto-generates _index.json on plugin activation 200 201 = 1.5.0 = 202 * PERFORMANCE: Lazy constructor - zero filesystem I/O at plugin load 203 * PERFORMANCE: loadFromIndex() creates WP_Post from index metadata only 204 * PERFORMANCE: loadSinglePost() direct slug lookup - 1 file read (was: full scan) 205 * NEW: content.enabled safety check - plugin does nothing unless enabled 206 * NEW: Cache stampede protection with wp_cache_add lock 200 207 201 208 = 1.0.9 = -
praison-file-content-git/trunk/src/Admin/SettingsPage.php
r3491360 r3491371 75 75 ); 76 76 77 add_settings_field(78 'content_dir',79 'Content Directory',80 [$this, 'renderTextField'],81 'praison-settings',82 'praisonpress_content',83 [84 'field' => 'content_dir',85 'description' => 'Path to the content directory. Default: <code>' . esc_html(PRAISON_CONTENT_DIR) . '</code>',86 'placeholder' => PRAISON_CONTENT_DIR,87 ]88 );89 90 77 // ── Section: Performance ── 91 78 add_settings_section( … … 142 129 'content_enabled' => false, 143 130 'post_types' => ['lyrics', 'chords'], 144 'content_dir' => '',145 131 'cache_enabled' => true, 146 132 'cache_ttl' => 3600, … … 165 151 $sanitized['cache_enabled'] = !empty($input['cache_enabled']); 166 152 $sanitized['cache_ttl'] = absint($input['cache_ttl'] ?? 3600); 167 $sanitized['content_dir'] = sanitize_text_field($input['content_dir'] ?? '');168 153 169 154 // Post types: array of sanitized slugs … … 337 322 <?php settings_errors(); ?> 338 323 324 <?php 325 // Show index rebuild result notice 326 if (isset($_GET['index_rebuilt'])) { 327 $success = $_GET['index_rebuilt'] === '1'; 328 $class = $success ? 'notice-success' : 'notice-error'; 329 $msg = $success ? 'Content index rebuilt successfully.' : 'Index rebuild failed — check file permissions.'; 330 echo '<div class="notice ' . $class . ' is-dismissible"><p>' . esc_html($msg) . '</p></div>'; 331 } 332 ?> 333 339 334 <form method="post" action="options.php"> 340 335 <?php -
praison-file-content-git/trunk/src/Loaders/PostLoader.php
r3490698 r3491371 133 133 134 134 if (empty($files)) { 135 return []; 136 } 137 138 // SAFETY: refuse to scan large directories without an index. 139 // Without _index.json, every file is read via file_get_contents(). 140 // For 18K+ files this causes OOM/timeout. 141 $max_scan = apply_filters('praisonpress_max_scan_files', 500); 142 if (count($files) > $max_scan) { 143 if (defined('WP_DEBUG') && WP_DEBUG) { 144 error_log(sprintf( 145 'PraisonPress: Refusing to scan %d files in %s without _index.json (limit: %d). Run "wp praison index" or use the Settings page to rebuild the index.', 146 count($files), 147 $this->postsDir, 148 $max_scan 149 )); 150 } 135 151 return []; 136 152 } … … 407 423 408 424 /** 409 * Get posts directly (for helper functions)410 *411 * @param array $args Query arguments412 * @return array Array of WP_Post objects413 */414 /**415 425 * Load a single post by slug. 416 * Checks _index.json first for an O(1) file lookup, then falls back to full scan.426 * Checks _index.json first for an O(1) file lookup, then falls back to direct file. 417 427 * 418 428 * @param string $slug Post slug
Note: See TracChangeset
for help on using the changeset viewer.