Skip to content

Lexicon check for the core#14940

Closed
Jako wants to merge 11 commits intomodxcms:2.xfrom
Jako:check-lexicon
Closed

Lexicon check for the core#14940
Jako wants to merge 11 commits intomodxcms:2.xfrom
Jako:check-lexicon

Conversation

@Jako
Copy link
Copy Markdown
Contributor

@Jako Jako commented Dec 28, 2019

What does it do?

Add a lexicon check for the core. Cross check the core files with the existing lexicon entries for the usage of a lexicon entry.

Why is it needed?

To detect easier, which lexicon entries are used.

The script creates 3 files in the _build/lexicon folder. The files are containing missing and superfluous entries and the third one collects usages of the lexicon with variable generated keys (not all are currently collected - only the ones starting with a single/double quote key). The lexicon with variable generated keys can't be copied to a lexicon, so this generated code does not have to be valid - the other ones could be copied.

Related issue(s)/PR(s)

#14512

@Jako Jako marked this pull request as ready for review December 29, 2019 15:19
@Jako Jako requested review from Mark-H and opengeek as code owners December 29, 2019 15:19
@Jako
Copy link
Copy Markdown
Contributor Author

Jako commented Dec 29, 2019

At the moment the variable object type errors of the core processors are not cross checked i.e. created by $this->objectType.'_err_ns' code. The used object types of the core processors could be collected and the the lexicon entries could be cross checked afterwards.

@Jako
Copy link
Copy Markdown
Contributor Author

Jako commented Dec 29, 2019

The check is currently created on 2.x. It should be valid for 3.x too with a few changes.

@Jako Jako added this to the v2.7.3 milestone Dec 29, 2019
@JoshuaLuckers
Copy link
Copy Markdown
Contributor

If connecting to the database fails the script will continue to execute. I don't think this is supposed to happen.
Afterwards 3 new files are created:

  • _missing.php
  • _superfluous.php
  • _variable.php

It's a bit unclear to me what the content of each file means. The syntax of the generated content of _variable.php is invalid:

<?php
$_lang['area_'.$object->get('area'] = '';
$_lang['area_'.$object->get('area'] = '';
$_lang['db_info_' + MODx.config.dbtype)+'</p>'] = '';
$_lang['refresh_' . $partition) . ': ' . $this->modx->lexicon('refresh_' . ($result ? 'success' : 'failure'] = '';
$_lang['refresh_' . ( $result ? 'success' : 'failure'] = '';
$_lang['refresh_' . ($ctxResult ? 'success' : 'failure'] = '';

@Jako
Copy link
Copy Markdown
Contributor Author

Jako commented Jan 1, 2020

The script crosschecks only files, so there is no need for a DB connection.

The three files are containing missing and superfluous entries and the third one collects usages of the lexicon with variable generated keys (not all are currently collected - only the ones starting with a single/double quote key). The lexicon with variable generated keys can't be copied to a lexicon, so this generated code does not have to be valid - the other ones could be copied.

@JoshuaLuckers
Copy link
Copy Markdown
Contributor

It would be nice to have this documented in the script and/or files it generates.

@Mark-H
Copy link
Copy Markdown
Collaborator

Mark-H commented Jan 22, 2020

@cla-bot check

@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Jan 22, 2020
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Jan 22, 2020

The cla-bot has been summoned, and re-checked this pull request!

@Jako Jako closed this Jan 29, 2020
@Jako Jako deleted the check-lexicon branch January 29, 2020 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-core cla-signed CLA confirmed for contributors to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants