modules_parts['hooks'])) { foreach ($conf->modules_parts['hooks'] as $module => $hooks) { if (strpos($module, 'filearchiv') !== false) { echo " Module: $module\n"; echo " Hooks: " . json_encode($hooks) . "\n"; } } if (!isset($conf->modules_parts['hooks']['filearchiv'])) { echo " WARNING: filearchiv not found in modules_parts hooks!\n"; echo " Available modules: " . implode(', ', array_keys($conf->modules_parts['hooks'])) . "\n"; } } else { echo " No hooks defined at all!\n"; } // Check if class file exists echo "\n3. Class file check:\n"; $path = '/filearchiv/class/actions_filearchiv.class.php'; $fullpath = dol_buildpath($path); echo " dol_buildpath('$path') = $fullpath\n"; echo " File exists: " . (file_exists($fullpath) ? "YES" : "NO") . "\n"; // Try custom path $customPath = DOL_DOCUMENT_ROOT . '/custom/filearchiv/class/actions_filearchiv.class.php'; echo " Custom path: $customPath\n"; echo " Custom exists: " . (file_exists($customPath) ? "YES" : "NO") . "\n"; // Check DOL_DOCUMENT_ROOT echo "\n4. DOL_DOCUMENT_ROOT: " . DOL_DOCUMENT_ROOT . "\n"; // Test initHooks echo "\n5. Testing initHooks('formfile'):\n"; global $hookmanager; $hookmanager->initHooks(array('formfile')); echo " Context array: " . implode(', ', $hookmanager->contextarray) . "\n"; echo " Hooks for formfile: " . (isset($hookmanager->hooks['formfile']) ? count($hookmanager->hooks['formfile']) : 0) . "\n"; if (isset($hookmanager->hooks['formfile'])) { foreach ($hookmanager->hooks['formfile'] as $module => $instance) { echo " - $module: " . get_class($instance) . "\n"; } } // Check if our class can be loaded manually echo "\n6. Manual class loading test:\n"; if (file_exists($customPath)) { include_once $customPath; if (class_exists('ActionsFilearchiv')) { echo " Class ActionsFilearchiv: EXISTS\n"; $test = new ActionsFilearchiv($db); echo " Instance created: " . get_class($test) . "\n"; } else { echo " Class ActionsFilearchiv: NOT FOUND after include\n"; } } else { echo " Cannot test - file not found\n"; } // Test writing to /tmp echo "\n7. Testing file write to /tmp:\n"; $testFile = '/tmp/filearchiv_test_' . time() . '.log'; $result = @file_put_contents($testFile, "Test write at " . date('Y-m-d H:i:s') . "\n"); echo " Write result: " . ($result !== false ? "SUCCESS ($result bytes)" : "FAILED") . "\n"; if (file_exists($testFile)) { echo " File exists: YES\n"; echo " Contents: " . file_get_contents($testFile) . "\n"; unlink($testFile); } // Check debug log echo "\n8. Checking debug log:\n"; $debugLog = '/tmp/filearchiv_debug.log'; if (file_exists($debugLog)) { echo " Debug log exists: YES\n"; echo " Size: " . filesize($debugLog) . " bytes\n"; echo " Last 5 lines:\n"; $lines = file($debugLog); foreach (array_slice($lines, -5) as $line) { echo " " . $line; } } else { echo " Debug log exists: NO\n"; } echo "\n=== Done ===\n";