Пример #1
0
#!/usr/bin/env python

# Totara Test Script
#
# Test the results of all get_records() are checked
#
# Usage: php2json.py < input.php > output.json

import parser
import sys

files = []

for arg in sys.argv[1:]:
    files.append(parser.parsed_file(arg))

finding = parser.locate_checked_calls(
    [
        'get_records',
        'get_records_sql',
        'get_record',
        'get_record_sql',
        'get_records_select',
        'get_record_select'
    ]
)

print ''
print 'Checking calls to get_records() and other dml functions'
results = finding.locate(files)
print ''
Пример #2
0
#
# Test the results of all get_records() are checked
#
# Usage: php2json.py < input.php > output.json

import parser
import sys
import fnmatch
import os

files = []

for arg in sys.argv[1:]:
    print arg
    if arg.endswith('.php'):
        files.append(parser.parsed_file(arg))
    else:
        for root, dirnames, filenames in os.walk(arg):
            for filename in fnmatch.filter(filenames, '*.php'):
                print os.path.join(root, filename)
                pf = parser.parsed_file(os.path.join(root, filename))
                files.append(pf)

finding = parser.locate_global_vars(['$DB'])

print ''
#print 'Checking for all global variables'
results = finding.locate(files)
#print ''
#print 'Global calls found: %d' % len(results['globals'])
#print ''