php TYPO3-CMS-Core-Utility-CommandUtility类(方法)实例源码

下面列出了php TYPO3-CMS-Core-Utility-CommandUtility 类(方法)源码代码实例,从而了解它的用法。

作者:nicksergi    项目:TYPO3v4-Cor   
/**
  * This method actually does the processing of files locally
  *
  * takes the original file (on remote storages this will be fetched from the remote server)
  * does the IM magic on the local server by creating a temporary typo3temp/ file
  * copies the typo3temp/ file to the processing folder of the target storage
  * removes the typo3temp/ file
  *
  * @param TaskInterface $task
  * @return array
  */
 public function process(TaskInterface $task)
 {
     $targetFile = $task->getTargetFile();
     // Merge custom configuration with default configuration
     $configuration = array_merge(array('width' => 64, 'height' => 64), $task->getConfiguration());
     $configuration['width'] = Utility\MathUtility::forceIntegerInRange($configuration['width'], 1, 1000);
     $configuration['height'] = Utility\MathUtility::forceIntegerInRange($configuration['height'], 1, 1000);
     $originalFileName = $targetFile->getOriginalFile()->getForLocalProcessing(FALSE);
     // Create a temporary file in typo3temp/
     if ($targetFile->getOriginalFile()->getExtension() === 'jpg') {
         $targetFileExtension = '.jpg';
     } else {
         $targetFileExtension = '.png';
     }
     // Create the thumb filename in typo3temp/preview_....jpg
     $temporaryFileName = Utility\GeneralUtility::tempnam('preview_') . $targetFileExtension;
     // Check file extension
     if ($targetFile->getOriginalFile()->getType() != Resource\File::FILETYPE_IMAGE && !Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $targetFile->getOriginalFile()->getExtension())) {
         // Create a default image
         $this->processor->getTemporaryImageWithText($temporaryFileName, 'Not imagefile!', 'No ext!', $targetFile->getOriginalFile()->getName());
     } else {
         // Create the temporary file
         if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {
             $parameters = '-sample ' . $configuration['width'] . 'x' . $configuration['height'] . ' ' . $this->processor->wrapFileName($originalFileName) . '[0] ' . $this->processor->wrapFileName($temporaryFileName);
             $cmd = Utility\GeneralUtility::imageMagickCommand('convert', $parameters) . ' 2>&1';
             Utility\CommandUtility::exec($cmd);
             if (!file_exists($temporaryFileName)) {
                 // Create a error gif
                 $this->processor->getTemporaryImageWithText($temporaryFileName, 'No thumb', 'generated!', $targetFile->getOriginalFile()->getName());
             }
         }
     }
     return array('filePath' => $temporaryFileName);
 }

作者:netweise    项目:fontawesomeplu   
/**
  * create Font via Python with FontForge
  *
  * @param int $fontUid
  * @param object $currentFont
  * @return array
  */
 public static function createFont($fontUid, $currentFont)
 {
     // general vars
     $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fontawesomeplus']);
     $pathToPythonBin = escapeshellarg($extConf['pathToPython']);
     $pathToScript = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fontawesomeplus') . 'Resources/Private/Python/fontawesomeplus.py';
     $iconRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
     $iconReferences = $iconRepository->findByRelation('tx_fontawesomeplus_domain_model_font', 'icons', $fontUid);
     $svgArray = array();
     foreach ($iconReferences as $key => $value) {
         $svgArray[$key] = PATH_site . 'fileadmin' . $value->getIdentifier();
     }
     $unicodeArray = array();
     $i = hexdec(self::HEXADECIMAL);
     foreach ($svgArray as $key => $value) {
         $unicodeArray[$key] = $i . ',uni' . dechex($i);
         $i++;
     }
     $fontPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fontawesomeplus') . 'Resources/Public/Contrib/' . self::FACONTRIB . '/fonts/fontawesome-webfont.svg';
     $fontForgeArray = CommandUtility::escapeShellArgument(json_encode(array_combine($svgArray, $unicodeArray), JSON_UNESCAPED_SLASHES));
     $fontName = strtolower(preg_replace(array('/\\s+/', '/[^a-zA-Z0-9]/'), array('-', ''), $currentFont->getTitle()));
     $comment = CommandUtility::escapeShellArgument(str_replace(array("\r\n", "\n", "\r"), ' ', $currentFont->getDescription()));
     $copyright = CommandUtility::escapeShellArgument('netweiser');
     $version = CommandUtility::escapeShellArgument($currentFont->getVersion());
     GeneralUtility::mkdir_deep(PATH_site . 'fileadmin/' . $currentFont->getDestination(), $fontName . '/fonts/');
     $savedir = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $fontName . '/fonts/';
     CommandUtility::exec("{$pathToPythonBin} {$pathToScript} {$fontPath} {$fontForgeArray} {$fontName} {$comment} {$copyright} {$version} {$savedir} 2>&1", $feedback, $returnCode);
     if ((int) $returnCode !== 0) {
         return $feedback;
     }
 }

作者:fluidtypo    项目:vh   
/**
  * @param string $text
  * @param boolean $trim
  * @param boolean $htmlentities
  * @throws Exception
  * @return string
  */
 public function render($text = null, $trim = true, $htmlentities = false)
 {
     if (null === $text) {
         $text = $this->renderChildren();
     }
     if (null === $text) {
         return null;
     }
     $cacheIdentifier = sha1($text);
     if (true === $this->cache->has($cacheIdentifier)) {
         return $this->cache->get($cacheIdentifier);
     }
     $this->markdownExecutablePath = CommandUtility::getCommand('markdown');
     if (false === is_executable($this->markdownExecutablePath)) {
         throw new Exception('Use of Markdown requires the "markdown" shell utility to be installed and accessible; this binary ' . 'could not be found in any of your configured paths available to this script', 1350511561);
     }
     if (true === (bool) $trim) {
         $text = trim($text);
     }
     if (true === (bool) $htmlentities) {
         $text = htmlentities($text);
     }
     $transformed = $this->transform($text);
     $this->cache->set($cacheIdentifier, $transformed);
     return $transformed;
 }

作者:plan2ne    项目:TYPO3.CM   
/**
  * Search for GraphicsMagick executables in given paths.
  *
  * @param array $searchPaths List of paths to search for
  * @return bool TRUE if graphics magick was found in path
  */
 protected function findImageMagick6InPaths(array $searchPaths)
 {
     $result = FALSE;
     foreach ($searchPaths as $path) {
         if (TYPO3_OS === 'WIN') {
             $executable = 'identify.exe';
         } else {
             $executable = 'identify';
         }
         if (@is_file($path . $executable)) {
             $command = escapeshellarg($path . $executable) . ' -version';
             $executingResult = FALSE;
             \TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $executingResult);
             // First line of exec command should contain string GraphicsMagick
             $firstResultLine = array_shift($executingResult);
             // Example: "Version: ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org"
             if (strpos($firstResultLine, 'ImageMagick') !== FALSE) {
                 list(, $version) = explode('ImageMagick', $firstResultLine);
                 // Example: "6.6.0-4"
                 list($version) = explode(' ', trim($version));
                 if (version_compare($version, '6.0.0') >= 0) {
                     $this->foundPath = $path;
                     $result = TRUE;
                     break;
                 }
             }
         }
     }
     return $result;
 }

作者:jacobsen    项目:phpuni   
/**
  * Helper function to check for a working diff tool on a system.
  *
  * Tests same file to be sure there is not any error message.
  *
  * @return bool TRUE if a diff tool was found, FALSE otherwise
  */
 protected function isDiffToolAvailable()
 {
     $filePath = ExtensionManagementUtility::extPath('phpunit') . 'Tests/Unit/Backend/Fixtures/LoadMe.php';
     // Makes sure everything is sent to the stdOutput.
     $executeCommand = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' 2>&1 ' . $filePath . ' ' . $filePath;
     $result = array();
     CommandUtility::exec($executeCommand, $result);
     return empty($result);
 }

作者:rabe6    项目:ya   
/**
  * @param $filePath
  * @return array
  */
 public function parseCoreData($filePath)
 {
     $imageMagicCommand = \TYPO3\CMS\Core\Utility\GeneralUtility::imageMagickCommand('identify', '-verbose');
     $imageMagicCommand .= ' ' . $filePath;
     \TYPO3\CMS\Core\Utility\CommandUtility::exec($imageMagicCommand, $result);
     $data = array();
     foreach ($result as $resultLine) {
         $chunks = explode(':', $resultLine);
         $data[trim($chunks[0])] = trim($chunks[1]);
     }
     return array('colorSpace' => $this->parseColorSpace($data), 'dpi' => $this->parseDPI($data));
 }

作者:bauscha    项目:tik   
/**
  * Starts the Tika server
  *
  * @return void
  */
 public function startServerAction()
 {
     $command = CommandUtility::getCommand('java') . ' -jar ' . escapeshellarg(GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaServerPath'], FALSE)) . ' -p ' . escapeshellarg($this->tikaConfiguration['tikaServerPort']);
     $command = escapeshellcmd($command);
     $process = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Tika\\Process', $command);
     $pid = $process->getPid();
     $registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     $registry->set('tx_tika', 'server.pid', $pid);
     // wait for Tika to start so that when we return to indexAction
     // it shows Tika running
     sleep(2);
     $this->forwardToIndex();
 }

作者:smichaelse    项目:vh   
/**
  * @return string
  */
 public function render()
 {
     $path = GeneralUtility::getFileAbsFileName($this->arguments['path']);
     if (FALSE === file_exists($path)) {
         return NULL;
     }
     $density = $this->arguments['density'];
     $rotate = $this->arguments['rotate'];
     $page = intval($this->arguments['page']);
     $background = $this->arguments['background'];
     $forceOverwrite = (bool) $this->arguments['forceOverwrite'];
     $width = $this->arguments['width'];
     $height = $this->arguments['height'];
     $minWidth = $this->arguments['minWidth'];
     $minHeight = $this->arguments['minHeight'];
     $maxWidth = $this->arguments['maxWidth'];
     $maxHeight = $this->arguments['maxHeight'];
     $filename = basename($path);
     $pageArgument = $page > 0 ? $page - 1 : 0;
     $colorspace = TRUE === isset($GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace']) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'] : 'RGB';
     $destination = GeneralUtility::getFileAbsFileName('typo3temp/vhs-pdf-' . $filename . '-page' . $page . '.png');
     if (FALSE === file_exists($destination) || TRUE === $forceOverwrite) {
         $arguments = '-colorspace ' . $colorspace;
         if (0 < intval($density)) {
             $arguments .= ' -density ' . $density;
         }
         if (0 !== intval($rotate)) {
             $arguments .= ' -rotate ' . $rotate;
         }
         $arguments .= ' "' . $path . '"[' . $pageArgument . ']';
         if (NULL !== $background) {
             $arguments .= ' -background "' . $background . '" -flatten';
         }
         $arguments .= ' "' . $destination . '"';
         $command = CommandUtility::imageMagickCommand('convert', $arguments);
         CommandUtility::exec($command);
     }
     $image = substr($destination, strlen(PATH_site));
     return parent::render($image, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight);
 }

作者:fluidtypo    项目:vh   
/**
  * @return string
  */
 public function render()
 {
     $src = GeneralUtility::getFileAbsFileName($this->arguments['src']);
     if (false === file_exists($src)) {
         return null;
     }
     $density = $this->arguments['density'];
     $rotate = $this->arguments['rotate'];
     $page = (int) $this->arguments['page'];
     $background = $this->arguments['background'];
     $forceOverwrite = (bool) $this->arguments['forceOverwrite'];
     $filename = basename($src);
     $pageArgument = $page > 0 ? $page - 1 : 0;
     if (isset($GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'])) {
         $colorspace = $GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'];
     } else {
         $colorspace = 'RGB';
     }
     $path = GeneralUtility::getFileAbsFileName('typo3temp/vhs-pdf-' . $filename . '-page' . $page . '.png');
     if (false === file_exists($path) || true === $forceOverwrite) {
         $arguments = '-colorspace ' . $colorspace;
         if (0 < (int) $density) {
             $arguments .= ' -density ' . $density;
         }
         if (0 !== (int) $rotate) {
             $arguments .= ' -rotate ' . $rotate;
         }
         $arguments .= ' "' . $src . '"[' . $pageArgument . ']';
         if (null !== $background) {
             $arguments .= ' -background "' . $background . '" -flatten';
         }
         $arguments .= ' "' . $path . '"';
         $command = CommandUtility::imageMagickCommand('convert', $arguments);
         CommandUtility::exec($command);
     }
     $this->preprocessImage($path);
     return $this->renderTag();
 }

作者:khanhdeu    项目:typo3tes   
/**
  * Search for GraphicsMagick executables in given paths.
  *
  * @param array $searchPaths List of pathes to search for
  * @return boolean TRUE if graphics magick was found in path
  */
 protected function findGraphicsMagickInPaths(array $searchPaths)
 {
     $result = FALSE;
     foreach ($searchPaths as $path) {
         if (TYPO3_OS === 'WIN') {
             $executable = 'gm.exe';
         } else {
             $executable = 'gm';
         }
         if (@is_file($path . $executable)) {
             $command = escapeshellarg($path . $executable) . ' -version';
             $executingResult = FALSE;
             \TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $executingResult);
             // First line of exec command should contain string GraphicsMagick
             $firstResultLine = array_shift($executingResult);
             if (strpos($firstResultLine, 'GraphicsMagick') !== FALSE) {
                 $this->foundPath = $path;
                 $result = TRUE;
                 break;
             }
         }
     }
     return $result;
 }

作者:teaminmedias-pluswer    项目:ke_searc   
/**
  * get Content of DOC file
  * @param string $file
  * @return string The extracted content of the file
  */
 public function getContent($file)
 {
     // create the tempfile which will contain the content
     $tempFileName = GeneralUtility::tempnam('xls_files-Indexer');
     // Delete if exists, just to be safe.
     @unlink($tempFileName);
     // generate and execute the pdftotext commandline tool
     $fileEscaped = CommandUtility::escapeShellArgument($file);
     $cmd = "{$this->app['xls2csv']} -c ' ' -q 0 -s8859-1 -dutf-8 {$fileEscaped} > {$tempFileName}";
     CommandUtility::exec($cmd);
     // check if the tempFile was successfully created
     if (@is_file($tempFileName)) {
         $content = GeneralUtility::getUrl($tempFileName);
         unlink($tempFileName);
     } else {
         return false;
     }
     // check if content was found
     if (strlen($content)) {
         return $content;
     } else {
         return false;
     }
 }

作者:TYPO3Incubato    项目:TYPO3.CM   
/**
  * Returns filename of the png/gif version of the input file (which can be png or gif).
  * If input file type does not match the wanted output type a conversion is made and temp-filename returned.
  *
  * @param string $theFile Filepath of image file
  * @param bool $output_png If TRUE, then input file is converted to PNG, otherwise to GIF
  * @return string|NULL If the new image file exists, its filepath is returned
  */
 public static function readPngGif($theFile, $output_png = false)
 {
     if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'] || !@is_file($theFile)) {
         return null;
     }
     $ext = strtolower(substr($theFile, -4, 4));
     if ((string) $ext == '.png' && $output_png || (string) $ext == '.gif' && !$output_png) {
         return $theFile;
     }
     if (!@is_dir(PATH_site . 'typo3temp/assets/images/')) {
         GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/assets/images/');
     }
     $newFile = PATH_site . 'typo3temp/assets/images/' . md5($theFile . '|' . filemtime($theFile)) . ($output_png ? '.png' : '.gif');
     $cmd = GeneralUtility::imageMagickCommand('convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']);
     CommandUtility::exec($cmd);
     if (@is_file($newFile)) {
         GeneralUtility::fixPermissions($newFile);
         return $newFile;
     }
     return null;
 }

作者:khanhdeu    项目:typo3tes   
/**
  * check the availability of external programs
  *
  * @param string $progList Comma list of programs 'perl,python,pdftotext'
  * @return boolean Return FALSE if one program was not found
  * @todo Define visibility
  */
 public function checkExec($progList)
 {
     $ret = TRUE;
     $progList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $progList, TRUE);
     foreach ($progList as $prog) {
         if (!\TYPO3\CMS\Core\Utility\CommandUtility::checkCommand($prog)) {
             // Program not found
             $this->errorPush(T3_ERR_SV_PROG_NOT_FOUND, 'External program not found: ' . $prog);
             $ret = FALSE;
         }
     }
     return $ret;
 }

作者:plan2ne    项目:TYPO3.CM   
/**
  * Checks if command line version of the OpenSSL is available and can be
  * executed successfully.
  *
  * @return bool
  * @see \TYPO3\CMS\Rsaauth\Backend\AbstractBackend::isAvailable()
  */
 public function isAvailable()
 {
     $result = FALSE;
     if ($this->opensslPath) {
         // If path exists, test that command runs and can produce output
         $test = CommandUtility::exec($this->opensslPath . ' version');
         $result = substr($test, 0, 8) === 'OpenSSL ';
     }
     return $result;
 }

作者:noxlud    项目:TYPO3v4-Cor   
/**
  * Extracts the version number for ImageMagick
  *
  * @param string $file The program name to execute in order to find out the version number
  * @param string $path Path for the above program
  * @return string Version number of the found ImageMagick instance
  * @todo Define visibility
  */
 public function _checkImageMagick_getVersion($file, $path)
 {
     // Temporarily override some settings
     $im_version = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'];
     $combine_filename = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'];
     if ($file == 'gm') {
         $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'gm';
         // Work-around, preventing execution of "gm gm"
         $file = 'identify';
         // Work-around - GM doesn't like to be executed without any arguments
         $parameters = '-version';
     } else {
         $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'im5';
         // Override the combine_filename setting
         if ($file == 'combine' || $file == 'composite') {
             $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'] = $file;
         }
     }
     $cmd = \TYPO3\CMS\Core\Utility\GeneralUtility::imageMagickCommand($file, $parameters, $path);
     $retVal = FALSE;
     \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $retVal);
     $string = $retVal[0];
     list(, $ver) = explode('Magick', $string);
     list($ver) = explode(' ', trim($ver));
     // Restore the values
     $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = $im_version;
     $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'] = $combine_filename;
     return trim($ver);
 }

作者:KarlDennisMatthaei192    项目:PierraaDesig   
/**
  * Compile the command for running ImageMagick/GraphicsMagick.
  *
  * @param string $command Command to be run: identify, convert or combine/composite
  * @param string $parameters The parameters string
  * @param string $path Override the default path (e.g. used by the install tool)
  * @return string Compiled command that deals with IM6 & GraphicsMagick
  */
 public static function imageMagickCommand($command, $parameters, $path = '')
 {
     return \TYPO3\CMS\Core\Utility\CommandUtility::imageMagickCommand($command, $parameters, $path);
 }

作者:bauscha    项目:tik   
/**
  * Checks whether the extension is configured to use a local Tika
  * application, and if so whether it's correctly configured.
  *
  * @return boolean TRUE if the extension is configured to use a local Tika app and if it's correctly configured, FALSE otherwise
  */
 protected function hasCompleteLocalTikaConfiguration()
 {
     $localConfigurationComplete = FALSE;
     if ($this->tikaConfiguration['extractor'] == 'tika' && is_file(GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE)) && CommandUtility::checkCommand('java')) {
         $localConfigurationComplete = TRUE;
     }
     if ($this->tikaConfiguration['logging']) {
         $registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
         $registryStatus = $registry->get('Tx_Tika', 'available');
         GeneralUtility::devLog('Has complete local Tika configuration: ' . ($localConfigurationComplete == TRUE ? 'yes' : 'no'), 'tika', 0, array('configuration' => $this->tikaConfiguration, 'javaFound' => CommandUtility::checkCommand('java'), 'tikaPath' => $this->tikaConfiguration['tikaPath'], 'absoluteTikaPath' => GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE), 'absoluteTikaExists' => is_file(GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE)) == TRUE ? 'yes' : 'no', 'registryStatus' => $registryStatus));
     }
     return $localConfigurationComplete;
 }

作者:dachcom-digita    项目:TYPO3.CM   
/**
  * Gets the current GIT revision and branch
  *
  * @return void
  */
 protected function getGitRevision()
 {
     if (!StringUtility::endsWith(TYPO3_version, '-dev') || \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::isFunctionDisabled('exec')) {
         return;
     }
     // check if git exists
     CommandUtility::exec('git --version', $_, $returnCode);
     if ((int) $returnCode !== 0) {
         // git is not available
         return;
     }
     $revision = trim(CommandUtility::exec('git rev-parse --short HEAD'));
     $branch = trim(CommandUtility::exec('git rev-parse --abbrev-ref HEAD'));
     if (!empty($revision) && !empty($branch)) {
         $this->systemInformation[] = array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.gitrevision')), 'value' => sprintf('%s [%s]', $revision, $branch), 'icon' => $this->iconFactory->getIcon('sysinfo-git', Icon::SIZE_SMALL)->render());
     }
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * Schedule the next run of scheduler
  * For the moment only the "at"-daemon is used, and only if it is enabled
  *
  * @return bool Successfully scheduled next execution using "at"-daemon
  * @see tx_scheduler::fetchTask()
  */
 public function scheduleNextSchedulerRunUsingAtDaemon()
 {
     if ((int) $this->extConf['useAtdaemon'] !== 1) {
         return false;
     }
     /** @var $registry Registry */
     $registry = GeneralUtility::makeInstance(Registry::class);
     // Get at job id from registry and remove at job
     $atJobId = $registry->get('tx_scheduler', 'atJobId');
     if (MathUtility::canBeInterpretedAsInteger($atJobId)) {
         shell_exec('atrm ' . (int) $atJobId . ' 2>&1');
     }
     // Can not use fetchTask() here because if tasks have just executed
     // they are not in the list of next executions
     $tasks = $this->fetchTasksWithCondition('');
     $nextExecution = false;
     foreach ($tasks as $task) {
         try {
             /** @var $task Task\AbstractTask */
             $tempNextExecution = $task->getNextDueExecution();
             if ($nextExecution === false || $tempNextExecution < $nextExecution) {
                 $nextExecution = $tempNextExecution;
             }
         } catch (\OutOfBoundsException $e) {
             // The event will not be executed again or has already ended - we don't have to consider it for
             // scheduling the next "at" run
         }
     }
     if ($nextExecution !== false) {
         if ($nextExecution > $GLOBALS['EXEC_TIME']) {
             $startTime = strftime('%H:%M %F', $nextExecution);
         } else {
             $startTime = 'now+1minute';
         }
         $cliDispatchPath = PATH_site . 'typo3/cli_dispatch.phpsh';
         list($cliDispatchPathEscaped, $startTimeEscaped) = CommandUtility::escapeShellArguments(array($cliDispatchPath, $startTime));
         $cmd = 'echo ' . $cliDispatchPathEscaped . ' scheduler | at ' . $startTimeEscaped . ' 2>&1';
         $output = shell_exec($cmd);
         $outputParts = '';
         foreach (explode(LF, $output) as $outputLine) {
             if (GeneralUtility::isFirstPartOfStr($outputLine, 'job')) {
                 $outputParts = explode(' ', $outputLine, 3);
                 break;
             }
         }
         if ($outputParts[0] === 'job' && MathUtility::canBeInterpretedAsInteger($outputParts[1])) {
             $atJobId = (int) $outputParts[1];
             $registry->set('tx_scheduler', 'atJobId', $atJobId);
         }
     }
     return true;
 }

作者:plan2ne    项目:TYPO3.CM   
/**
     * This method assembles a list of all defined executables search paths
     *
     * @return string HTML to display
     */
    protected function renderExecutablesSearchPathList()
    {
        $searchPaths = CommandUtility::getPaths(TRUE);
        $content = '<h3>' . $this->getLanguageService()->getLL('search_paths') . '</h3>';
        if (empty($searchPaths)) {
            $content .= '<p>' . $this->getLanguageService()->getLL('no_search_paths') . '</p>';
        } else {
            $content .= '
			<table class="table table-striped table-hover tx_sv_reportlist">
				<thead>
					<tr>
						<td>' . $this->getLanguageService()->getLL('path') . '</td>
						<td>' . $this->getLanguageService()->getLL('valid') . '</td>
					</tr>
				</thead>
				<tbody>';
            foreach ($searchPaths as $path => $isValid) {
                $pathAccessibleClass = 'danger';
                $pathAccessible = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
                if ($isValid) {
                    $pathAccessibleClass = 'success';
                    $pathAccessible = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
                }
                $content .= '
					<tr class="' . $pathAccessibleClass . '">
						<td class="first-cell">' . GeneralUtility::fixWindowsFilePath($path) . '</td>
						<td class="last-cell">' . $pathAccessible . '</td>
					</tr>';
            }
            $content .= '
				</tbody>
			</table>';
        }
        return $content;
    }


问题


面经


文章

微信
公众号

扫码关注公众号