From 28593b8a1bfd6b64eb4e5ad4d5edb569ad2a4e0a Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 16 Nov 2025 12:04:48 +0700 Subject: [PATCH] feat: Add installation checker script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Created check-installation.php: - Comprehensive installation diagnostics - File structure verification - PHP configuration check - WordPress detection - Constants check (dev mode detection) - Namespace verification - Asset URL accessibility test - Quick actions (clear OPcache, phpinfo) - Actionable recommendations 🎯 Usage: 1. Upload to: wp-content/plugins/woonoow/check-installation.php 2. Visit: https://yoursite.com/wp-content/plugins/woonoow/check-installation.php 3. Review all checks 4. Follow recommendations 📋 Checks: - ✓ Required files exist - ✓ File sizes correct - ✓ PHP configuration - ✓ WordPress loaded - ✓ Plugin active - ✓ Dev mode disabled - ✓ Correct namespaces - ✓ Assets accessible 🚀 Helps diagnose: - Missing dist files - Wrong extraction path - Dev mode issues - Namespace problems - File permission issues - URL accessibility --- check-installation.php | 226 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 check-installation.php diff --git a/check-installation.php b/check-installation.php new file mode 100644 index 0000000..70717f4 --- /dev/null +++ b/check-installation.php @@ -0,0 +1,226 @@ + + + + + WooNooW Installation Check + + + +

WooNooW Installation Checker

+ +

1. File Structure

+ 'Main plugin file', + 'includes/Admin/Assets.php' => 'Assets handler', + 'includes/Api/Routes.php' => 'API routes', + 'admin-spa/dist/app.js' => 'SPA JavaScript', + 'admin-spa/dist/app.css' => 'SPA Stylesheet', + ]; + + foreach ($required_files as $file => $desc) { + $path = $plugin_dir . '/' . $file; + $exists = file_exists($path); + $size = $exists ? filesize($path) : 0; + $status = $exists ? '✓ PASS' : '✗ FAIL'; + + echo "
$status - $desc
"; + echo "
  Path: $file\n";
+        if ($exists) {
+            echo "  Size: " . number_format($size) . " bytes\n";
+            echo "  Modified: " . date('Y-m-d H:i:s', filemtime($path)) . "
"; + } else { + echo " FILE NOT FOUND!"; + } + } + ?> + +

2. PHP Configuration

+ phpversion(), + 'OPcache Enabled' => function_exists('opcache_get_status') && opcache_get_status() ? 'Yes' : 'No', + 'Memory Limit' => ini_get('memory_limit'), + 'Max Execution Time' => ini_get('max_execution_time') . 's', + 'Upload Max Filesize' => ini_get('upload_max_filesize'), + ]; + + foreach ($php_checks as $check => $value) { + echo "
INFO $check: $value
"; + } + ?> + +

3. WordPress Detection

+ ✓ PASS WordPress loaded"; + echo "
  WP Version: " . get_bloginfo('version') . "\n";
+        echo "  Site URL: " . home_url() . "\n";
+        echo "  Admin URL: " . admin_url() . "
"; + + // Check if plugin is active + if (function_exists('is_plugin_active')) { + $is_active = is_plugin_active('woonoow/woonoow.php'); + $status = $is_active ? '✓ ACTIVE' : '⚠ INACTIVE'; + echo "
$status - Plugin Status
"; + } + } else { + echo "
✗ FAIL WordPress not found
"; + } + ?> + +

4. Constants Check

+ ⚠ WARN' : '✓ PASS'; + echo "
$status - WOONOOW_ADMIN_DEV = " . ($dev_mode ? 'true (DEV MODE!)' : 'false') . "
"; + } else { + echo "
✓ PASS - WOONOOW_ADMIN_DEV not defined (production mode)
"; + } + + if (defined('WP_DEBUG')) { + $debug = WP_DEBUG; + $status = $debug ? '⚠ WARN' : '✓ PASS'; + echo "
$status - WP_DEBUG = " . ($debug ? 'true' : 'false') . "
"; + } + ?> + +

5. Namespace Check (Routes.php)

+ ✓ PASS - Correct namespace (WooNooW\\Api\\)"; + } elseif ($has_wrong_namespace) { + echo "
✗ FAIL - Wrong namespace (WooNooW\\API\\) - needs update!
"; + } else { + echo "
⚠ WARN - Could not detect namespace
"; + } + } + ?> + +

6. Asset URLs

+ CSS URL: $css_url\n"; + echo "JS URL: $js_url"; + + // Test if URLs are accessible + echo "
Testing URL accessibility...
"; + $ch = curl_init($css_url); + curl_setopt($ch, CURLOPT_NOBODY, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_exec($ch); + $css_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + $status = ($css_code == 200) ? '✓ PASS' : '✗ FAIL'; + echo "
$status - app.css (HTTP $css_code)
"; + + $ch = curl_init($js_url); + curl_setopt($ch, CURLOPT_NOBODY, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_exec($ch); + $js_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + $status = ($js_code == 200) ? '✓ PASS' : '✗ FAIL'; + echo "
$status - app.js (HTTP $js_code)
"; + } + ?> + +

7. Recommendations

+ ✓ All checks passed!"; + echo "
If SPA still not loading, try:
"; + echo "
1. Clear browser cache (Ctrl+Shift+R)\n";
+        echo "2. Clear OPcache: php -r \"opcache_reset();\"\n";
+        echo "3. Clear WordPress cache: wp cache flush
"; + } else { + echo "
Issues found:
"; + echo ""; + } + ?> + +

8. Quick Actions

+
+ Clear OPcache | + View PHP Info +
+ + ✓ OPcache cleared!"; + } elseif ($_GET['action'] == 'phpinfo') { + echo "
"; + phpinfo(); + echo "
"; + } + } + ?> + +
+ Generated: | + Server: +
+ +