Is the "Restart DNS Resolver" option same as running the command "pihole restartdns"?

In /usr/local/bin/pihole file there is a function called restartDNS that gets executed on running "pihole restartdns" in the terminal, I added a line "touch testfile" to this function just to verify so.
But when I hit the "Restart DNS Resolver" button (pihole via browser) looks like it doesn't execute this function, what function get executed then if it's not restartDNS?

I have Pi-hole v5.17.2 Installed in docker.

Thanks beforehand

This is the correct function:

root@pihole:/# pihole restartdns
  [✓] Restarting DNS server

I think maybe there is an issue in your test.

Did you add a path with correct permissions to testfile?

The testfile file get created in the root directory, I also tried with echo "test", no problem with "pihole restartdns" command. The issue comes with "Restart DNS Resolver", looks like it's working even reloads the page and a message shows up "FTL was restarted" but doesn't seem to execute restartDNS

When you click on the button, the function is executed by PHP page.
This happens inside a subshell using a different user and you won't be able to see any echo command, because there is no terminal window opened to show.

Why do you think the function is not executed?
Are you having issues with FTL after clicking on this button?

Same thing happen with "Flush logs (last 24 hours)" button and the command "pihole flush".
The graphical option doesn't create the test file, both flush the pihole.log file though.

My intention is to find the code where domains are compared and do something when a particular domain is found.

Tail the systemd journal live when restarting the daemon to check:

sudo journalctl --full --follow --unit pihole-FTL

What exactly do you mean by "where domains are compared"?
Do you mean when a domain gets queries by a client via DNS?
Thats handled by the pihole-FTL binary/daemon:

pi@ph5b:~ $ sudo ss -nltup sport = 53
Netid State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
udp   UNCONN 0      0            0.0.0.0:53        0.0.0.0:*    users:(("pihole-FTL",pid=11800,fd=4))
udp   UNCONN 0      0                  *:53              *:*    users:(("pihole-FTL",pid=11800,fd=6))
tcp   LISTEN 0      32           0.0.0.0:53        0.0.0.0:*    users:(("pihole-FTL",pid=11800,fd=5))
tcp   LISTEN 0      32              [::]:53           [::]:*    users:(("pihole-FTL",pid=11800,fd=7))
pi@ph5b:~ $ which pihole-FTL
/usr/bin/pihole-FTL
pi@ph5b:~ $ file /usr/bin/pihole-FTL
/usr/bin/pihole-FTL: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped

Thanks deHakkelaar, I'm running pihole in a docker container on Windows 10, cannot run those commands

I executed htop inside the container and clicked on the button.

This is what happens:

I hope this helps you understand this function.

Domains are compared to the gravity database in FTL engine, like deHakkelaar said.