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 $fileconsumeWhitespace ($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.

References $i.

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

◆ 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;
60 $full_counter = 0;
61 $tracker = array();
62 
63 foreach ($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 
101  $full_counter++;
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 
128 echo "\n$counter/$full_counter instances of \$config or \$this->config found in source code.\n";
129 
130 echo "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');
137 foreach ($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 }
$files
if(!array_key_exists('StateId', $_REQUEST)) $id
$full_counter
$counter
Create styles array
The data for the language used.
foreach($raw_files as $file) consumeWhitespace($tokens, &$i)
Moves the $i cursor to the next non-whitespace token.
$i
Definition: disco.tpl.php:19
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$tracker
testToken($token, $value_or_token, $value=null)
Tests whether or not a token is a particular type.

Variable Documentation

◆ $counter

$counter = 0

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

Referenced by ilUserSearchOptions\__appendUserDefinedFields(), ilCourseContentGUI\__buildPath(), ilTree\__checkDelete(), ilMailSummaryNotification\__construct(), ilLikeMediaPoolSearch\__createAndCondition(), ilAdvancedSearch\__createClassificationWhere(), ilLikeMetaDataSearch\__createContributeWhereCondition(), ilLikeAdvancedSearch\__createCoverageAndCondition(), ilLikeMetaDataSearch\__createDescriptionWhereCondition(), ilAdvancedSearch\__createEducationalWhere(), ilLikeAdvancedSearch\__createEntityWhereCondition(), ilLikeMediaPoolSearch\__createKeywordAndCondition(), ilLikeMetaDataSearch\__createKeywordWhereCondition(), ilLikeAdvancedSearch\__createKeywordWhereCondition(), ilLikeAdvancedSearch\__createLifecycleWhereCondition(), ilAbstractSearch\__createLocateString(), ilLikeForumSearch\__createPostAndCondition(), ilAdvancedSearch\__createRequirementWhere(), ilAdvancedSearch\__createRightsWhere(), ilLikeAdvancedSearch\__createTaxonWhereCondition(), ilLikeAdvancedSearch\__createTitleDescriptionWhereCondition(), ilLikeMetaDataSearch\__createTitleWhereCondition(), ilLikeForumSearch\__createTopicAndCondition(), ilLikeUserDefinedFieldSearch\__createWhereCondition(), ilLikeMediaCastSearch\__createWhereCondition(), ilLikeExerciseSearch\__createWhereCondition(), ilLikeLMContentSearch\__createWhereCondition(), ilLikeGlossaryDefinitionSearch\__createWhereCondition(), ilLikeObjectSearch\__createWhereCondition(), ilLikeTestSearch\__createWhereCondition(), ilLikeUserSearch\__createWhereCondition(), ilLikeWikiContentSearch\__createWhereCondition(), ilLikeWebresourceSearch\__createWhereCondition(), ilLikeUserOrgUnitSearch\__createWhereCondition(), ilLikeUserMultiFieldSearch\__createWhereCondition(), ilCourseGroupingAssignmentTableGUI\__formatPath(), ilAdvancedSearch\__getDifference(), ilTree\__getSubTreeByParentRelation(), ilLearningProgressBaseGUI\__insertPath(), ilAbstractSearch\__prepareFound(), ilMDSearch\__searchKeywordsOnly(), ilLinkChecker\__sendMail(), ilContainerGUI\_buildPath(), ilLPStatusCollectionTLT\_getCompleted(), ilLPStatusCollectionManual\_getCompleted(), ilLPStatusSCORM\_getCompleted(), ilLPStatusCollection\_getCompleted(), ilLPStatusCollection\_getFailed(), ilObjQuestionPool\_getFullPathToQpl(), ilMailBoxQuery\_getMailBoxListData(), ilUtil\_getObjectsByOperations(), ilUserSearchOptions\_getSearchableFieldsInfo(), ilChangeEvent\_lookupReadEvents(), _tree_struct\_reconstruct(), ilMDKeyword\_searchKeywords(), ilSearchResult\addEntry(), ilCalendarWeekGUI\addFullDayEvents(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarMonthGUI\addScheduleFilter(), getid3_ogg\Analyze(), ilObjRoleGUI\askDeleteDesktopItemObject(), ilCourseObjectivesGUI\askDeleteObjective(), ilLocalUserGUI\assignRoles(), ilObjCategoryGUI\assignRolesObject(), ilParticipants\autoFillSubscribers(), ilAssLongMenuFeedback\buildAnswerOptionLabel(), ilSessionStatisticsGUI\buildData(), ilSurveySyncTableGUI\buildPath(), ilCalendarCategoryTableGUI\buildPath(), ilObjectOwnershipManagementTableGUI\buildPath(), ilCalendarSelectionBlockGUI\buildPath(), ilLPTableBaseGUI\buildPath(), PHPExcel_Cell\buildRange(), ilSearchBaseGUI\buildSearchAreaPath(), ilCalendarSchedule\calculate(), ilCalendarRecurrenceCalculator\calculateDateList(), assClozeTest\calculateReachedPointsForSolution(), ilMailSearchGroupsGUI\cancel(), ilMailSearchCoursesGUI\cancel(), 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(), ilTestEvaluationGUI\exportFileUploadsForAllParticipants(), ilSurveyEvaluationGUI\exportResultsDetailsExcel(), ilTestExport\exportToCSV(), ilTestExport\exportToExcel(), ilMailFolderTableGUI\fetchTableData(), ilObjectRolePermissionTableGUI\fillRow(), ilLuceneSearchResultFilter\filter(), ilSearchResult\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(), ilRoleAutoComplete\getList(), ilBookingReservation\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(), ilObjUserGUI\getValues(), ilObjSessionGUI\handleFileUpload(), ilRepUtilGUI\handleMultiReferences(), ilCronDeleteInactiveUserAccounts\hasCustomSettings(), 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(), ilDBPdoPostgreSQL\lockTables(), ilDBPostgreSQL\lockTables(), ilDBOracle\lockTables(), ilDBMySQL\lockTables(), ilMail\markRead(), ilMail\markUnread(), ilMail\moveMailsToFolder(), ilObjTest\moveQuestions(), ilObjForumGUI\moveThreadsObject(), ilAuthLoginPageEditorTableGUI\parse(), ilLTIProviderReleasedObjectsTableGUI\parse(), ilDidacticTemplateSettingsTableGUI\parse(), ilWebResourceLinkTableGUI\parse(), ilConsultationHourGroupTableGUI\parse(), ilObjectCopyProgressTableGUI\parse(), ilConsultationHourBookingTableGUI\parse(), ilECSNodeMappingTreeTableGUI\parse(), ilObjectTableGUI\parse(), ilConsultationHoursTableGUI\parse(), ilSessionParticipantsTableGUI\parse(), ilRoleTableGUI\parse(), ilObjectRolePermissionTableGUI\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(), ILIAS\UI\Implementation\Component\Glyph\Renderer\render(), ilTaggingClassificationProvider\render(), ilMultipleNestedOrderingElementsInputGUI\renderMainList(), ilObjBlogGUI\renderNavigationByDate(), ilObjBlogGUI\renderNavigationByKeywords(), ilForumExportGUI\renderPostHtml(), ilObjBookingPoolGUI\renderSlots(), ilTestEvaluationGUI\resetfilterEvaluation(), ilObjTestGUI\reviewobject(), ilObjUserGUI\roleassignmentObject(), ilWebResourceCronLinkCheck\run(), ilConsultationHourCron\run(), ilLearningModuleCronLinkCheck\run(), ilCronDeleteInactivatedUserAccounts\run(), ilAuthModeDetermination\save(), ilRadiusSettings\save(), ilSurveyPhrases\savePhrase(), SurveySingleChoiceQuestion\savePhrase(), SurveyMatrixQuestion\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(), ilCourseArchivesGUI\view(), ilWikiStatGUI\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 = "appid=YahooDemo"

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