data); } //System global $db_url; $report['System']['PHP']['Version'] = phpversion(); $report['System']['PHP']['Memory limit'] = ini_get('memory_limit'); $report['System']['PHP']['Safe mode'] = ini_get('safe_mode') ? 'On' : 'Off'; $database = is_array($db_url) ? $db_url : array('default' => $db_url); foreach ($database as $key => $value) { db_set_active($key); $db_info = parse_url($value); $report['System']['Database'][drupal_ucfirst($key)]['Type'] = urldecode(strtoupper($db_info['scheme'])); $report['System']['Database'][drupal_ucfirst($key)]['Version'] = db_version(); } db_set_active('default'); //Drupal $report['Drupal']['Version'] = VERSION; // Module $modules = drupal_system_listing('\.module$', 'modules', 'name', 0); system_get_files_database($modules, 'module'); foreach ($modules as $name => $module) { if (in_array($name, array('gallery', 'gallery_menu', 'gallery_content'))) { $info = _module_parse_info_file(dirname($module->filename) .'/'. $module->name .'.info'); $report['Module']['Version'][$info['name']] = array( 'Version' => $info['version'] ? $info['version'] : 'unknown', 'Schema Version' => $module->schema_version, 'Location' => dirname($module->filename), 'Status' => $module->status ); // extract detailed version info from cvsid $files = file_scan_directory(dirname($module->filename), '.*\.(inc|module)$', array('.', '..', 'CVS'), 0, FALSE); foreach ($files as $file) { if (preg_match('/\x24Id: '. $file->basename .',v ([^\\$]+) Exp \x24/i', file_get_contents($file->filename), $cvsid)) { $report['Module']['Version'][$info['name']]['Files'][$file->basename] = 'Rev. '. $cvsid[1]; } } } } // Fetch module-related variables $result = db_query('SELECT * FROM {variable} WHERE name LIKE \'gallery_%\''); while ($var = db_fetch_object($result)) { $report['Module']['Variables'][$var->name] = unserialize($var->value); } $status = gallery_get_status(); unset($status['version'], $status['gallery_valid']); $report['Module']['Variables']['gallery_status'] = array($status); // Gallery if (variable_get('gallery_valid', 0) && _gallery_init(FALSE, NULL, FALSE)) { $version = gallery_version(); $report['Gallery 2']['Version'] = array( 'Core API' => $version['core']['major'] .'.'. $version['core']['minor'], 'Embed API' => $version['embed']['major'] .'.'. $version['embed']['minor'], ); list($ret, $rewrite_api) = GalleryCoreApi::newFactoryInstance('RewriteApi'); if (!$ret && $rewrite_api) { list($ret, $rewrite_params) = $rewrite_api->fetchEmbedConfig(); $report['Gallery 2']['URL Rewrite'] = $rewrite_params; } // Get some basic information about G2 plugins list($ret, $plugins) = GalleryCoreApi::fetchPluginStatus('module'); foreach ($plugins as $name => $info) { $report['Gallery 2']['Active Plugins'][drupal_ucfirst($name)]['Version'] = $info['active'] ? $info['version'] : 'inactive'; } // Debug Logs if ($GLOBALS['gallery']->_debug == 'buffered' && !empty($GLOBALS['gallery']->_debugBuffer)) { $report['Gallery 2']['DebugBuffer'] = $GLOBALS['gallery']->_debugBuffer; } else if (!empty($GLOBALS['gallery']->_debugSnippet)) { $report['Gallery 2']['DebugSnippet'] = $GLOBALS['gallery']->_debugSnippet; } } else { $report['Gallery 2'] = 'Gallery2 not available'; } $content = theme('gallery_report', $report); if ($cache) { if ($cache_content = cache_get('gallery_report_'. session_id())) { $content .= $cache_content->data; } cache_set('gallery_report_'. session_id(), 'cache', $content, time()+600); } if ($download) { _gallery_report_download($content); } return $content; } /** * Function _gallery_report_download(). */ function _gallery_report_download($content) { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=gallery_report.html"); print "\n"; print "\n"; print " \n ". t('Gallery module : Report Generator') ."\n \n"; print " \n ". $content ."\n\n"; print ""; exit(); } /** * Theme function : theme_gallery_report(). */ function theme_gallery_report($report) { return '
'. _gallery_report_walk($report) ."\n".'
'; } /** * Function _gallery_report_walk(). */ function _gallery_report_walk($element, $level = 1, $sub = FALSE) { $html = ''; $element = is_object($element) ? get_object_vars($element) : $element; if (is_array($element)) { foreach ($element as $key => $value) { if (is_array($value) || is_object($value)) { $html .= "\n".' '; $html .= implode('', array_fill(0, $level, '')); $html .= ''. $key .''; $html .= _gallery_report_walk($value, $level+1, TRUE); } else { $html .= $sub ? '' : "\n".' '. implode('', array_fill(0, $level, '')); $html .= ''. $key .''. $value .''; $html .= ''; $sub = FALSE; } } } return $html; }