Skip to content

Add REST API to update pages settings

What does this MR do and why?

This MR adds a new REST API to update pages settings. Only allow update on 2 attributes: pages_unique_domain_enabled & pages_https_only

Testing

curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" --url "https://gitlab.example.com/api/v4/projects/:id/pages" \ --form 'pages_unique_domain_enabled=true' --form 'pages_https_only=true'

Query plans

Raw query:

UPDATE "project_settings" SET "pages_unique_domain_enabled" = FALSE, "updated_at" = '2024-03-27 16:06:47.409250' WHERE "project_settings"."project_id" = 278964

Query plan

https://explain.depesz.com/s/oYy3#html

Summary

Time: 24.630 ms  
  - planning: 0.946 ms  
  - execution: 23.684 ms  
    - I/O read: 22.766 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 20 (~160.00 KiB) from the buffer pool  
  - reads: 22 (~176.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 7 (~56.00 KiB)  
  - writes: 0 

https://console.postgres.ai/gitlab/gitlab-production-main/sessions/27253/commands/84751

UPDATE "projects" SET "updated_at" = '2024-03-27 16:17:58.932903', "cached_markdown_version" = 2162688, "pages_https_only" = FALSE WHERE "projects"."id" = 278964

Query plan

https://explain.depesz.com/s/lSD1

Summary

Time: 224.127 ms  
  - planning: 4.588 ms  
  - execution: 219.539 ms  
    - I/O read: 193.876 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 646 (~5.00 MiB) from the buffer pool  
  - reads: 150 (~1.20 MiB) from the OS file cache, including disk I/O  
  - dirtied: 43 (~344.00 KiB)  
  - writes: 0  
  

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/27253/commands/84755

Related to #437783 (closed)

Edited by Nikola Milojevic

Merge request reports