protected function createCliBeUser()
 {
     $db = $this->getDatabaseConnection();
     $where = 'username = '******'_cli_lowlevel', 'be_users') . ' AND admin = 0';
     $user = $db->exec_SELECTgetSingleRow('*', 'be_users', $where);
     if ($user) {
         if ($user['deleted'] || $user['disable']) {
             $data = array('be_users' => array($user['uid'] => array('deleted' => 0, 'disable' => 0)));
             /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
             $dataHandler = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
             $dataHandler->stripslashes_values = FALSE;
             $dataHandler->start($data, array());
             $dataHandler->process_datamap();
         }
     } else {
         // Prepare necessary data for _cli_lowlevel user creation
         $password = uniqid('scheduler', TRUE);
         if (SaltedPasswordsUtility::isUsageEnabled()) {
             $objInstanceSaltedPW = SaltFactory::getSaltingInstance();
             $password = $objInstanceSaltedPW->getHashedPassword($password);
         }
         $data = array('be_users' => array('NEW' => array('username' => '_cli_lowlevel', 'password' => $password, 'pid' => 0)));
         /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
         $dataHandler = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
         $dataHandler->stripslashes_values = FALSE;
         $dataHandler->start($data, array());
         $dataHandler->process_datamap();
         // Check if a new uid was indeed generated (i.e. a new record was created)
         // (counting DataHandler errors doesn't work as some failures don't report errors)
         $numberOfNewIDs = count($dataHandler->substNEWwithIDs);
         if ((int) $numberOfNewIDs !== 1) {
             InstallerScripts::addFlashMessage('Failed to create _cli_lowlevel BE user.', 'BE user creation failed', AbstractMessage::WARNING);
         }
     }
 }
Пример #2
0
<?php

defined('TYPO3_MODE') or die('Access denied.');
call_user_func(function ($extensionKey) {
    if (defined('TYPO3_cliMode') && TYPO3_cliMode) {
        \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter('Helhum\\Typo3Console\\Property\\TypeConverter\\ArrayConverter');
    } elseif (TYPO3_MODE === 'BE' && isset($_GET['M']) && 'tools_ExtensionmanagerExtensionmanager' === $_GET['M']) {
        $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
        $signalSlotDispatcher->connect('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', 'hasInstalledExtensions', function ($keyOfInstalledExtension) use($extensionKey) {
            if ($extensionKey !== $keyOfInstalledExtension) {
                return;
            }
            \Helhum\Typo3Console\Composer\InstallerScripts::postInstallExtension();
        });
    }
}, $_EXTKEY);
 public function executeScripts()
 {
     $this->registerLoader();
     \Helhum\Typo3Console\Composer\InstallerScripts::setupConsole($this->event, true);
     $this->unRegisterLoader();
 }