From 57fc7e35cb812aafcae40da53752b0ae466651f6 Mon Sep 17 00:00:00 2001
From: Mathias Brodala <mbrodala@pagemachine.de>
Date: Sat, 30 Jan 2016 13:33:44 +0100
Subject: [PATCH] [TASK] Move typo3/cli_dispatch.phpsh to backend extension

This moves the "typo3/cli_dispatch.phpsh" to the backend
extension as "cli.php". The "typo3/cli_dispatch.phpsh"
becomes a stub which includes the "cli.php".

Resolves: #73029
Releases: master
Change-Id: If5daea584291a9a89c4b805c98799945c424f65f
Reviewed-on: https://review.typo3.org/46394
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
---
 typo3/cli_dispatch.phpsh                      | 27 ++--------------
 .../backend/Resources/Private/Php/cli.php     | 32 +++++++++++++++++++
 2 files changed, 34 insertions(+), 25 deletions(-)
 create mode 100644 typo3/sysext/backend/Resources/Private/Php/cli.php

diff --git a/typo3/cli_dispatch.phpsh b/typo3/cli_dispatch.phpsh
index 08e41520023b..7b8acac0ed63 100755
--- a/typo3/cli_dispatch.phpsh
+++ b/typo3/cli_dispatch.phpsh
@@ -1,27 +1,4 @@
-#! /usr/bin/env php
+#!/usr/bin/env php
 <?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
 
-/**
- * Command Line Interface module dispatcher
- *
- * This script takes a "cliKey" as first argument and uses that to dispatch
- * the call to a registered script with that key.
- * Valid cliKeys must be registered in
- * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'].
- */
-call_user_func(function() {
-	$classLoader = require __DIR__ . '/../vendor/autoload.php';
-	(new \TYPO3\CMS\Backend\Console\Application($classLoader))->run();
-});
+require 'sysext/backend/Resources/Private/Php/cli.php';
diff --git a/typo3/sysext/backend/Resources/Private/Php/cli.php b/typo3/sysext/backend/Resources/Private/Php/cli.php
new file mode 100644
index 000000000000..051300335df6
--- /dev/null
+++ b/typo3/sysext/backend/Resources/Private/Php/cli.php
@@ -0,0 +1,32 @@
+<?php
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+// Exit early if php requirement is not satisfied.
+if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+    die('This version of TYPO3 CMS requires PHP 7.0 or above');
+}
+
+/**
+ * Command Line Interface module dispatcher
+ *
+ * This script takes a "cliKey" as first argument and uses that to dispatch
+ * the call to a registered script with that key.
+ * Valid cliKeys must be registered in
+ * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'].
+ */
+call_user_func(function() {
+    $classLoader = require __DIR__ . '/../../../../../../vendor/autoload.php';
+
+    (new \TYPO3\CMS\Backend\Console\Application($classLoader))->run();
+});
-- 
GitLab