| | 36 | |
| | 37 | |
| | 38 | == From a downloaded rdfhomepage2-package to a working installation == |
| | 39 | |
| | 40 | These are the problems that occured and the ways how to solve them: |
| | 41 | |
| | 42 | * Checkout the rdfhomepage2 package to a folder of your choice |
| | 43 | * While first running the following error occurs:[[BR]] |
| | 44 | Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in rdfhomepage2/rdfapi-php-0.95/api/ontModel/RdfsVocabulary.php on line 127 |
| | 45 | * Cause: On line 127 there is a function named „NAMESPACE“ declared. This is an illegal name for a function since PHP 5.3 |
| | 46 | * Solution: Change the function's name to „RDFHNAMESPACE“, and every call of it in every PHP-script! [[BR]] |
| | 47 | Python Script for this task: |
| | 48 | {{{ |
| | 49 | |
| | 50 | import os |
| | 51 | import re |
| | 52 | |
| | 53 | startdir = "/opt/lampp/htdocs/rdfhomepage2/" |
| | 54 | for root, dirs, files in os.walk(startdir): |
| | 55 | for file in files: |
| | 56 | if file[-4:] == ".php": |
| | 57 | fopen = open(root+"/"+file,"r") |
| | 58 | read = fopen.read() |
| | 59 | oldread = read |
| | 60 | read = re.sub("([\W])*NAMESPACE[\W]*\([\W]*\)",r"\1"+"RDFHNAMESPACE()",read) |
| | 61 | fopen.close() |
| | 62 | if read != oldread: |
| | 63 | fopen = open(root+"/"+file,"w") |
| | 64 | fopen.write(read) |
| | 65 | fopen.close() |
| | 66 | print root+"/"+file |
| | 67 | |
| | 68 | }}} |