Bug #23091
closedUse TYPO3_REQUESTTYPE consistently for CLI calls detection
0%
Description
Throughout the core, a CLI call is identified using the following test:
defined('TYPO3_cliMode') && TYPO3_cliMode
although t3lib/config_default.php harmonizes all request types into a single constant called TYPO3_REQUESTTYPE. This means the above test can be replaced by:
TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI
to be consistent.
An exception is 2 t3lib_div methods, because we cannot be sure that t3lib/config_default.php has been called beforehand, so TYPO3_REQUESTTYPE may not be defined.
(issue imported from #M14989)
Updated by Francois Suter over 14 years ago
Here are all the possible scenarios to test the patch:
- call the CLI dispatcher with an invalid CLI key => should still fail
- create file typo3conf/LOCK_BACKEND and:
-- run a CLI script => should still run
-- access the BE => should still be locked
- set some $TYPO3_CONF_VARS['BE']['IPmaskList'] that does not match your IP and:
-- run a CLI script => should still run
-- access the BE => should still show an error
- set $TYPO3_CONF_VARS['BE']['lockSSL'] to 1, 2 or 3 and:
-- access to the BE => should redirect to HTTPS as expected
-- run a CLI script => should be unaffected
- run a CLI script => should not see any error about browser compatibility
- run a CLI script with the "status" argument added => should still display the status (in case anyone ever saw that in his life)
- run the scheduler from the command-line and:
-- it should still run :-)
-- check the BE module => the latest execution should be shown as being from "Cron"
- try to log into the BE with a cli* user => should still result in an exception
- set $GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] = 1 and try to run a CLI script => should still fail
- set $GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] = 2 and:
-- run a CLI script => should still be allowed
-- log into the BE with an admin user => should still be allowed
-- log into the BE with a non-admin user => should still fail
Updated by Thorsten Kahler over 14 years ago
I've run all mentioned tests successful.
Updated by Francois Suter over 14 years ago
Committed to trunk in revision 8084.