public function execute() { $success = false; tx_caretaker_ExtensionManagerHelper::updateExtensionList(); $success = true; return $success; }
/** * CLI engine * * @param array Command line arguments * @return string */ public function cli_main($argv) { $task = (string) $this->cli_args['_DEFAULT'][1]; if (!$task) { $this->cli_validateArgs(); $this->cli_help(); exit; } if ($task == 'update' || $task == 'get' || $task == 'ack' || $task == 'due') { $force = (bool) $this->readArgument('--force', '-f'); $return_status = (bool) $this->readArgument('-r'); $options = array('forceUpdate' => $force); $options = array_merge($options, $this->parseOptions($this->readArgument('--options', '-o'))); $node = FALSE; $node_repository = tx_caretaker_NodeRepository::getInstance(); $nodeId = $this->readArgument('--node', '-N'); if ((bool) $this->readArgument('--root', '-R')) { $node = $node_repository->getRootNode(); } else { if ($nodeId) { $node = $node_repository->id2node($nodeId); } } if ($node) { $this->cli_echo('node ' . $node->getCaretakerNodeId() . chr(10)); $result = FALSE; if ($task == 'update' || $task == 'ack' || $task == 'due') { try { $lockObj = t3lib_div::makeInstance('t3lib_lock', 'tx_caretaker_update_' . $node->getCaretakerNodeId(), $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']); $lockIsAquired = $lockObj->acquire(); } catch (Exception $e) { $this->cli_echo('lock ' . 'tx_caretaker_update_' . $node->getCaretakerNodeId() . ' could not be aquired!' . chr(10) . $e->getMessage()); exit; } if ($lockIsAquired) { if ($task == 'update') { $result = $node->updateTestResult($options); } else { if ($task == 'ack' && is_a($node, 'tx_caretaker_TestNode')) { $result = $node->setModeAck(); } else { if ($task == 'due' && is_a($node, 'tx_caretaker_TestNode')) { $result = $node->setModeDue(); } } } $lockObj->release(); } else { $result = false; $this->cli_echo('node ' . $node->getCaretakerNodeId() . ' is locked because of other running update processes!' . chr(10)); exit; } } if ($task == 'get') { $result = $node->getTestResult(); $this->cli_echo($node->getTitle() . ' [' . $node->getCaretakerNodeId() . ']' . $infotext . ' ' . $event . chr(10)); $this->cli_echo($result->getLocallizedStateInfo() . ' ' . $event . ' [' . $node->getCaretakerNodeId() . ']' . chr(10)); } // send aggregated notifications $notificationServices = tx_caretaker_ServiceHelper::getAllCaretakerNotificationServices(); foreach ($notificationServices as $notificationService) { $notificationService->sendNotifications(); } if ($return_status) { exit((int) $result->getState()); } else { exit; } } else { $this->cli_echo('Node not found or inactive' . chr(10)); exit; } } elseif ($task == 'update-extension-list') { if (t3lib_div::int_from_ver(TYPO3_version) < t3lib_div::int_from_ver('4.5.0')) { $result = tx_caretaker_ExtensionManagerHelper::updateExtensionList(); $this->cli_echo('Extension list update result: ' . $result . chr(10)); exit; } else { $this->cli_echo('TYPO3 4.5.+ comes with a sceduler task for ter updates. The caretaker ter update is\'nt supportet any more.'); exit(2); } } elseif ($task == 'update-typo3-latest-version-list') { $result = tx_caretaker_LatestVersionsHelper::updateLatestTypo3VersionRegistry(); $this->cli_echo('TYPO3 latest version list update result: ' . $result . chr(10)); $versions = t3lib_div::makeInstance('t3lib_Registry')->get('tx_caretaker', 'TYPO3versions'); foreach ($versions as $key => $version) { $this->cli_echo($key . ' => ' . $version . chr(10)); } } if ($task == 'help') { $this->cli_validateArgs(); $this->cli_help(); exit; } }