I am working on a website with an extremely heavy database.
As a result, the command drush sql-cli < [db_filename]
takes more than default value of 14400 seconds.
I need to find a way how to change this value properly.
I found put that the function I need is setTimeout()
from the vendor/symfony/process/Process.php
.
I can use it directly in vendor/drush/drush/src/Commands/sql/SqlCommands.php
like this:
public function cli(InputInterface $input, $options = ['extra' => self::REQ])
{
$sql = SqlBase::create($options);
$process = $this->processManager()->shell($sql->connect(), null, $sql->getEnv());
// Set timeout here.
$process->setTimeout(36000);
if (!Tty::isTtySupported()) {
$process->setInput($this->stdin()->getStream());
} else {
$process->setTty($this->getConfig()->get('ssh.tty', $input->isInteractive()));
}
$process->mustRun($process->showRealtime());
}
However, I do not want to touch the vendor folder, I think that the better solution is to write a hook or to alter an existing functionality any other way in Drupal module.
But I cannot understand how it can be done.
Could you please give me an advice on how to do this?
Edit
I know that I can create a patch and include it in composer.json
of the project.
However, I would like to know if a better way exists.