#!/usr/bin/python '''PHP5 Apport interface Copyright (C) 2010 Canonical Ltd. Author: Chuck Short This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' import os import subprocess from apport.hookutils import * def _add_my_conf_files(report, filename): if not os.path.exists(filename): return key = 'PHPConf' + path_to_key(filename) report[key] = "" for line in read_file(filename).split('\n'): try: if 'mysql.default_password ' in line.split('=')[0]: line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0]) if 'mysqli.default_pw ' in line.split('=')[0]: line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0]) if 'ifx.default_password ' in line.split('=')[0]: line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0]) report[key] += line + '\n' except IndexError: continue def add_info(report): _add_my_conf_files(report, '/etc/php5/apache2/php.ini') _add_my_conf_files(report, '/etc/php5/cli/php5.ini') # packages in main packages=['php5-lliurex', 'php-lliurex-common', 'libapache2-lliurex-mod-php5', 'libapache2-lliurex-mod-php5filter' 'php5-lliurex-cgi', 'php5-lliurex-cli', 'php5-lliurex-dev', 'php5-lliurex-dbg', 'php-lliurex-pear', 'php5-lliurex-curl', 'php5-lliurex-gd' 'php5-lliurex-gmp', 'php5-lliurex-ldap', 'php5-lliurex-mcrypt', 'php5-lliurex-mhash', 'php5-lliurex-mysql', 'php5-lliurex-odbc', 'php5-lliurex-pgsql', 'php5-lliurex-pspell', 'php5-lliurex-recode', 'php5-lliurex-snmp', 'php5-lliurex-sqlite', 'php5-lliurex-sybase', 'php5-lliurex-tidy', 'php5-lliurex-xmlrpc', 'php5-lliurex-xsl'] versions = '' for package in packages: try: version = packaging.get_version(package) except ValueError: version = 'N/A' if version is None: version = 'N/A' versions += '%s %s\n' %(package, version) report['PHPInstalledModules'] = versions