/** * */ public function run() { $command = isset($this->arguments[0]) ? $this->arguments[0] : 'help'; $arguments = array_splice($this->arguments, 1); if (empty($command)) { $command = 'help'; } $command = strtolower($command); if ($command != 'checkforupdate' && $command != 'selfupdate') { $this->checkForUpdateCommand(); } $success = FALSE; switch (strtolower($command)) { case 'upload': $success = $this->uploadCommand($arguments); break; case 'updateinfo': $controller = new \etobi\extensionUtils\Controller\TerController(); $success = $controller->updateAction(); break; case 'info': $success = $this->infoCommand($arguments); break; case 'fetch': $success = $this->fetchCommand($arguments); break; case 'create': $success = $this->createCommand($arguments); break; case 'extract': $success = $this->extractCommand($arguments); break; case 'listfiles': $success = $this->listFilesCommand($arguments); break; case 'checkforupdate': $success = $this->checkForUpdateCommand(); break; case 'selfupdate': $success = $this->selfUpdateCommand(); break; case 'version': $success = TRUE; if (@constant('T3XUTILS_VERSION')) { echo 'Version: ' . constant('T3XUTILS_VERSION') . ' ' . constant('T3XUTILS_TIMESTAMP') . chr(10); } else { echo 'Version: ?' . chr(10); } break; default: case 'help': $success = $this->helpCommand(isset($arguments[0]) ? $arguments[0] : NULL); break; } exit($success ? 0 : 2); }
/** * @param array $arguments * @return bool */ protected function updateinfoCommand($arguments) { $controller = new \etobi\extensionUtils\Controller\TerController(); $useCurl = false; if (isset($arguments[0]) && $arguments[0] == '--use-curl') { $useCurl = true; } return $controller->updateAction($useCurl); }