dbconn = new DBConn(); parent::__construct(); } protected function configure() { $this->setName('aria2') ->setDescription('Aria2 hooks') ->addArgument( 'action', InputArgument::OPTIONAL, 'Aria2 hook names: start,complete,error' )->addArgument( 'gid', InputArgument::OPTIONAL, 'Aria2 gid' )->addArgument( 'path', InputArgument::OPTIONAL, 'Downloaded file path' )->addArgument( 'numFiles', InputArgument::OPTIONAL, 'Number of Files', 1 ); } protected function execute(InputInterface $input, OutputInterface $output): int { if (!$action = $input->getArgument('action')) { $action = 'start'; } $gid = $input->getArgument('gid'); if (!is_string($gid)) { return 0; } if (in_array($action, ['complete', 'error'])) { $status = strtoupper($action); $this->dbconn->updateStatus($gid, Helper::STATUS[$status]); } if ($action === 'start') { //Helper::log("$gid started"); } return 1; } }