ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
config-scanner.php File Reference

Scans HTML Purifier source code for $config tokens and records the directive being used; configdoc can use this info later. More...

Go to the source code of this file.

Functions

foreach( $raw_files as $file) consumeWhitespace ($tokens, &$i)
 Moves the $i cursor to the next non-whitespace token. More...
 
 testToken ($token, $value_or_token, $value=null)
 Tests whether or not a token is a particular type. More...
 

Variables

 $FS = new FSTools()
 
 $raw_files = $FS->globr('.', '*.php')
 
 $files = array()
 
 $counter = 0
 
 $full_counter = 0
 
 $tracker = array()
 
 foreach ( $files as $file) = "appid=YahooDemo"
 
 $xw = new XMLWriter()
 

Detailed Description

Scans HTML Purifier source code for $config tokens and records the directive being used; configdoc can use this info later.

Currently, this just dumps all the info onto the console. Eventually, it will create an XML file that our XSLT transform can use.

Definition in file config-scanner.php.

Function Documentation

◆ consumeWhitespace()

foreach($raw_files as $file) consumeWhitespace (   $tokens,
$i 
)

Moves the $i cursor to the next non-whitespace token.

Definition at line 37 of file config-scanner.php.

38{
39 do {$i++;} while (is_array($tokens[$i]) && $tokens[$i][0] === T_WHITESPACE);
40}
$i
Definition: disco.tpl.php:19

References $i.

◆ testToken()

testToken (   $token,
  $value_or_token,
  $value = null 
)

Tests whether or not a token is a particular type.

There are three run-cases:

  • ($token, $expect_token): tests if the token is $expect_token type;
  • ($token, $expect_value): tests if the token is the string $expect_value;
  • ($token, $expect_token, $expect_value): tests if token is $expect_token type, and its string representation is $expect_value

Definition at line 49 of file config-scanner.php.

50{
51 if (is_null($value)) {
52 if (is_int($value_or_token)) return is_array($token) && $token[0] === $value_or_token;
53 else return $token === $value_or_token;
54 } else {
55 return is_array($token) && $token[0] === $value_or_token && $token[1] === $value;
56 }
57}
58
59$counter = 0;
61$tracker = array();
62
63foreach ($files as $file) {
64 $tokens = token_get_all(file_get_contents($file));
65 $file = str_replace('\\', '/', $file);
66 for ($i = 0, $c = count($tokens); $i < $c; $i++) {
67 $ok = false;
68 // Match $config
69 if (!$ok && testToken($tokens[$i], T_VARIABLE, '$config')) $ok = true;
70 // Match $this->config
71 while (!$ok && testToken($tokens[$i], T_VARIABLE, '$this')) {
72 consumeWhitespace($tokens, $i);
73 if (!testToken($tokens[$i], T_OBJECT_OPERATOR)) break;
74 consumeWhitespace($tokens, $i);
75 if (testToken($tokens[$i], T_STRING, 'config')) $ok = true;
76 break;
77 }
78 if (!$ok) continue;
79
80 $ok = false;
81 for($i++; $i < $c; $i++) {
82 if ($tokens[$i] === ',' || $tokens[$i] === ')' || $tokens[$i] === ';') {
83 break;
84 }
85 if (is_string($tokens[$i])) continue;
86 if ($tokens[$i][0] === T_OBJECT_OPERATOR) {
87 $ok = true;
88 break;
89 }
90 }
91 if (!$ok) continue;
92
93 $line = $tokens[$i][2];
94
95 consumeWhitespace($tokens, $i);
96 if (!testToken($tokens[$i], T_STRING, 'get')) continue;
97
98 consumeWhitespace($tokens, $i);
99 if (!testToken($tokens[$i], '(')) continue;
100
102
103 $matched = false;
104 do {
105
106 // What we currently don't match are batch retrievals, and
107 // wildcard retrievals. This data might be useful in the future,
108 // which is why we have a do {} while loop that doesn't actually
109 // do anything.
110
111 consumeWhitespace($tokens, $i);
112 if (!testToken($tokens[$i], T_CONSTANT_ENCAPSED_STRING)) continue;
113 $id = substr($tokens[$i][1], 1, -1);
114
115 $counter++;
116 $matched = true;
117
118 if (!isset($tracker[$id])) $tracker[$id] = array();
119 if (!isset($tracker[$id][$file])) $tracker[$id][$file] = array();
120 $tracker[$id][$file][] = $line;
121
122 } while (0);
123
124 //echo "$file:$line uses $namespace.$directive\n";
125 }
126}
127
128echo "\n$counter/$full_counter instances of \$config or \$this->config found in source code.\n";
129
130echo "Generating XML... ";
131
132$xw = new XMLWriter();
133$xw->openURI('../configdoc/usage.xml');
134$xw->setIndent(true);
135$xw->startDocument('1.0', 'UTF-8');
136$xw->startElement('usage');
137foreach ($tracker as $id => $files) {
138 $xw->startElement('directive');
139 $xw->writeAttribute('id', $id);
140 foreach ($files as $file => $lines) {
141 $xw->startElement('file');
142 $xw->writeAttribute('name', $file);
143 foreach ($lines as $line) {
144 $xw->writeElement('line', $line);
145 }
146 $xw->endElement();
147 }
148 $xw->endElement();
149}
$full_counter
$tracker
$files
testToken($token, $value_or_token, $value=null)
Tests whether or not a token is a particular type.
$counter
foreach( $raw_files as $file) consumeWhitespace($tokens, &$i)
Moves the $i cursor to the next non-whitespace token.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

Variable Documentation

◆ $counter

$counter = 0

Definition at line 59 of file config-scanner.php.

Referenced by ilUserSearchOptions\__appendUserDefinedFields(), ilCourseContentGUI\__buildPath(), ilTree\__checkDelete(), ilLikeMediaPoolSearch\__createAndCondition(), ilAdvancedSearch\__createClassificationWhere(), ilLikeMetaDataSearch\__createContributeWhereCondition(), ilLikeAdvancedSearch\__createCoverageAndCondition(), ilLikeMetaDataSearch\__createDescriptionWhereCondition(), ilAdvancedSearch\__createEducationalWhere(), ilLikeAdvancedSearch\__createEntityWhereCondition(), ilLikeMediaPoolSearch\__createKeywordAndCondition(), ilLikeAdvancedSearch\__createKeywordWhereCondition(), ilLikeMetaDataSearch\__createKeywordWhereCondition(), ilLikeAdvancedSearch\__createLifecycleWhereCondition(), ilAbstractSearch\__createLocateString(), ilLikeForumSearch\__createPostAndCondition(), ilAdvancedSearch\__createRequirementWhere(), ilAdvancedSearch\__createRightsWhere(), ilLikeAdvancedSearch\__createTaxonWhereCondition(), ilLikeAdvancedSearch\__createTitleDescriptionWhereCondition(), ilLikeMetaDataSearch\__createTitleWhereCondition(), ilLikeForumSearch\__createTopicAndCondition(), ilLikeExerciseSearch\__createWhereCondition(), ilLikeGlossaryDefinitionSearch\__createWhereCondition(), ilLikeLMContentSearch\__createWhereCondition(), ilLikeMediaCastSearch\__createWhereCondition(), ilLikeObjectSearch\__createWhereCondition(), ilLikeTestSearch\__createWhereCondition(), ilLikeUserDefinedFieldSearch\__createWhereCondition(), ilLikeUserMultiFieldSearch\__createWhereCondition(), ilLikeUserOrgUnitSearch\__createWhereCondition(), ilLikeUserSearch\__createWhereCondition(), ilLikeWebresourceSearch\__createWhereCondition(), ilLikeWikiContentSearch\__createWhereCondition(), ilCourseGroupingAssignmentTableGUI\__formatPath(), ilAdvancedSearch\__getDifference(), ilTree\__getSubTreeByParentRelation(), ilLearningProgressBaseGUI\__insertPath(), ilAbstractSearch\__prepareFound(), ilMDSearch\__searchKeywordsOnly(), ilLinkChecker\__sendMail(), ilContainerGUI\_buildPath(), ilLPStatusCollection\_getCompleted(), ilLPStatusCollectionManual\_getCompleted(), ilLPStatusCollectionTLT\_getCompleted(), ilLPStatusSCORM\_getCompleted(), ilLPStatusCollection\_getFailed(), ilObjQuestionPool\_getFullPathToQpl(), ilMailBoxQuery\_getMailBoxListData(), ilUtil\_getObjectsByOperations(), ilUserSearchOptions\_getSearchableFieldsInfo(), ilChangeEvent\_lookupReadEvents(), _tree_struct\_reconstruct(), ilMDKeyword\_searchKeywords(), ilSearchResult\addEntry(), ilCalendarWeekGUI\addFullDayEvents(), ilCalendarBlockGUI\addMiniMonth(), ilMiniCalendarGUI\addMiniMonth(), getid3_ogg\Analyze(), ilObjRoleGUI\askDeleteDesktopItemObject(), ilCourseObjectivesGUI\askDeleteObjective(), ilLocalUserGUI\assignRoles(), ilObjCategoryGUI\assignRolesObject(), ilParticipants\autoFillSubscribers(), ilAssLongMenuFeedback\buildAnswerOptionLabel(), ilSessionStatisticsGUI\buildData(), ilCalendarCategoryTableGUI\buildPath(), ilCalendarSelectionBlockGUI\buildPath(), ilObjectOwnershipManagementTableGUI\buildPath(), ilSurveySyncTableGUI\buildPath(), ilLPTableBaseGUI\buildPath(), PHPExcel_Cell\buildRange(), ilSearchBaseGUI\buildSearchAreaPath(), ilCalendarSchedule\calculate(), ilCalendarRecurrenceCalculator\calculateDateList(), assClozeTest\calculateReachedPointsForSolution(), SurveyMatrixQuestion\checkUserInput(), ilCourseArchivesGUI\confirmDeleteArchives(), ilMemberExportGUI\confirmDeleteExportFile(), ilObjBookingPoolGUI\confirmedBookingNumbersObject(), ilObjBookingPoolGUI\confirmedBookingObject(), ilObjSurveyQuestionPool\copyQuestion(), ilObjQuestionPool\copyQuestion(), ilObjTestGUI\copyQuestionToPool(), assErrorText\createErrorTextExport(), assErrorText\createErrorTextOutput(), ilObjTestGUI\createRandomSelectionObject(), ilObjSessionGUI\createRecurringSessions(), ilMemberExportGUI\deleteExportFile(), ilUserDefinedFields\deleteValue(), ilTestEvaluationGUI\detailedEvaluation(), ilBookingObjectGUI\displayPostInfo(), ilObjQuestionPool\duplicateQuestion(), ilObjSurveyQuestionPool\duplicateQuestion(), ilRegistrationSettingsGUI\editEmailAssignments(), ilRegistrationSettingsGUI\editRoleAccessLimitations(), ilRegistrationSettingsGUI\editRoles(), ilCourseContentGUI\editTimings(), ilForum\enableForumNotification(), ilObjTest\evalTotalStartedAverageTime(), ilObjSessionGUI\eventsListObject(), ilSurveyEvaluationGUI\exportResultsDetailsExcel(), ilTestExport\exportToCSV(), ilTestExport\exportToExcel(), ilMailFolderTableGUI\fetchTableData(), ilObjectRolePermissionTableGUI\fillRow(), ilSearchResult\filter(), ilLuceneSearchResultFilter\filter(), ilRoleDesktopItemsTableGUI\formatPath(), assTextSubsetImport\fromXML(), ilObjectPermissionStatusGUI\getAccessPermissionTableData(), ilObjTest\getAggregatedResultsData(), ilMailingLists\getAll(), ilMailingList\getAssignedEntries(), ilDateList\getAtPosition(), ilBookingReservation\getAvailableObject(), ilObjectPermissionStatusGUI\getAvailableRolesTableData(), assErrorText\getBestSelection(), ilCalendarSchedule\getByDay(), ilMathJax\getCacheSize(), ilSCORMCertificateAdapter\getCertificateVariablesDescription(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilMail\getCountRecipient(), ilECSMappingUtils\getCourseMappingFieldInfo(), ilECSParticipantSettings\getExportableParticipants(), ilLPObjectStatisticsLPTableGUI\getGraph(), ilCalendarAppointmentPanelGUI\getHTML(), ilBlockGUI\getHTML(), ilCourseGroupingAssignmentTableGUI\getItems(), ilContainerStartObjectsContentTableGUI\getItems(), ilTrSummaryTableGUI\getItemsPercentages(), ilObjBlogGUI\getKeywords(), SurveyMatrixQuestionGUI\getLayoutRow(), ilBookingReservation\getList(), ilRoleAutoComplete\getList(), ilRoleAutoComplete\getListByObject(), ilQueryParser\getLuceneQueryString(), ilMailMemberCourseRoles\getMailRoles(), ilMailMemberGroupRoles\getMailRoles(), assTextSubset\getMaximumPoints(), ilForumTopic\getNestedSetPostChildren(), ilCourseObjectiveQuestion\getNumberOfQuestionsByTest(), ilRbacReview\getOperationAssignment(), ilSurveyPageGUI\getPageNodes(), ilAdvancedMDSubstitution\getParsedSubstitutions(), ilTestServiceGUI\getPassListOfAnswers(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), assErrorText\getPointsForSelectedPositions(), assMatchingQuestionGUI\getPreview(), ilObjSurvey\getQuestionblockQuestions(), ilObjSurvey\getQuestionblocksTable(), assJavaApplet\getReachedInformation(), ilSCORMTrackingItems\getScormTrackingValueForInteractionsOrObjectives(), ilMailingLists\getSelected(), ilECSSetting\getServerURI(), ilContainerStartObjectsTableGUI\getStartObjects(), ilLOUserResults\getSummarizedObjectiveStatusForLP(), ilObjSurvey\getSurveyPages(), assMatchingQuestionGUI\getTestOutput(), ilForumSettingsGUI\getUserNotificationTableData(), ilForum\getUserStatistic(), ilObjSessionGUI\handleFileUpload(), ilRepUtilGUI\handleMultiReferences(), ilMDConvert(), ilObjAuthSettingsGUI\initAuthModeDetermination(), ilObjBookingPoolGUI\initBookingNumbersForm(), ilConditionHandlerGUI\initFormCondition(), ilAdvancedMDSettingsGUI\initFormSubstitutions(), SurveyConstraintsTableGUI\initItems(), ilMatchingPairWizardInputGUI\insert(), ilImagemapFileInputGUI\insert(), ilDclGenericMultiInputGUI\insert(), assErrorText\isTokenSelected(), ilObjRoleGUI\listUsersRoleObject(), ilMySQLQueryUtils\lock(), ilPostgresQueryUtils\lock(), ilDBMySQL\lockTables(), ilDBOracle\lockTables(), ilDBPostgreSQL\lockTables(), ilDBPdoPostgreSQL\lockTables(), ilMail\markRead(), ilMail\markUnread(), ilMail\moveMailsToFolder(), ilObjTest\moveQuestions(), ilObjForumGUI\moveThreadsObject(), ilRoleTableGUI\parse(), ilSessionParticipantsTableGUI\parse(), ilWebResourceLinkTableGUI\parse(), ilObjectRolePermissionTableGUI\parse(), ilAuthLoginPageEditorTableGUI\parse(), ilConsultationHoursTableGUI\parse(), ilDidacticTemplateSettingsTableGUI\parse(), ilLTIProviderReleasedObjectsTableGUI\parse(), ilObjectCopyProgressTableGUI\parse(), ilObjectTableGUI\parse(), ilECSNodeMappingTreeTableGUI\parse(), ilConsultationHourBookingTableGUI\parse(), ilConsultationHourGroupTableGUI\parse(), ilAdvancedMDFieldTableGUI\parseDefinitions(), ilSearchResultPresentation\parseResultReferences(), ilExerciseSubmissionTableGUI\parseRow(), ilRepositoryUserResultTableGUI\parseUserIds(), ilECSCategoryMappingRule\participantsToString(), ilMailingListsGUI\performDelete(), ilSearch\performObjectSearch(), ilObjTestGUI\printobject(), ilWaitingList\read(), ilECSEventQueueReader\read(), ilAssQuestionHintList\reIndex(), ilSurveyEditorGUI\removeQuestionsForm(), ilTaggingClassificationProvider\render(), ILIAS\UI\Implementation\Component\Glyph\Renderer\render(), ilMultipleNestedOrderingElementsInputGUI\renderMainList(), ilObjBlogGUI\renderNavigationByDate(), ilObjBlogGUI\renderNavigationByKeywords(), ilForumExportGUI\renderPostHtml(), ilObjBookingPoolGUI\renderSlots(), ilObjTestGUI\reviewobject(), ilObjUserGUI\roleassignmentObject(), ilLearningModuleCronLinkCheck\run(), ilWebResourceCronLinkCheck\run(), ilConsultationHourCron\run(), ilCronDeleteInactivatedUserAccounts\run(), ilAuthModeDetermination\save(), ilRadiusSettings\save(), SurveyMatrixQuestion\savePhrase(), SurveySingleChoiceQuestion\savePhrase(), ilSurveyPhrases\savePhrase(), ilCourseObjectivesGUI\saveSorting(), ilLOEditorGUI\saveSorting(), ilContainerStartObjectsGUI\saveSortingObject(), ilSoapObjectAdministration\searchObjects(), ilDiskQuotaSummaryNotification\send(), ilMembershipCronNotifications\sendMail(), ilWorkspaceFolderExplorer\setOutput(), ilExplorer\setOutput(), ilParticipants\setRoleOrderPosition(), ilLDAPServer\setUrl(), ilCalendarWeekGUI\show(), ilMailAttachmentGUI\showAttachments(), ilInfoScreenGUI\showLDAPRoleGroupMappingInfo(), ilTestPlayerAbstractGUI\showListOfAnswers(), ilMailingListsGUI\showMailingLists(), ilMailingListsGUI\showMembersList(), ilMailSearchGUI\showResults(), ilRepositorySearchGUI\showSearchResults(), ilCourseContentGUI\showStartObjects(), ilObjForumGUI\showStatisticsObject(), ilTestEvaluationGUI\singleResults(), PHPExcel_Cell\splitRange(), ilICalParser\storeItems(), ilDatabaseAtomBaseTest\testQueryWithFiveException(), ilDatabaseAtomBaseTest\testQueryWithTenException(), assOrderingQuestion\toJSON(), assTextSubsetExport\toXML(), ilAdvancedMDSubstitution\update(), ilObjAuthSettingsGUI\updateAuthModeDeterminationObject(), ilSurveyPhrases\updatePhrase(), ilAdvancedMDSettingsGUI\updateSubstitutions(), ilObjTestGUI\uploadTstObject(), ilWikiStatGUI\view(), ilCourseArchivesGUI\view(), and ILIAS\UI\Implementation\Component\Glyph\Glyph\withCounter().

◆ $files

$files = array()

Definition at line 26 of file config-scanner.php.

◆ $FS

$FS = new FSTools()

Definition at line 23 of file config-scanner.php.

◆ $full_counter

$full_counter = 0

Definition at line 60 of file config-scanner.php.

◆ $raw_files

$raw_files = $FS->globr('.', '*.php')

Definition at line 25 of file config-scanner.php.

◆ $tracker

◆ $xw

$xw = new XMLWriter()

Definition at line 132 of file config-scanner.php.

◆ foreach

foreach (   $files as = = 0) = "appid=YahooDemo"

Definition at line 63 of file config-scanner.php.

Referenced by Gettext\Languages\Exporter\Php\toStringDo().