RobotsTxt: specify more verbose classes
Summary: Using PhabricatorRobotsController overwrites robots.txt for blogs, URL shortener, and CDN domains. Using [PhabricatorRobotsPlatformController](https://we.phorge.it/book/dev/class/PhabricatorRobotsPlatformController/) should fix it. Signed-off-by: Yongmin Hong <revi@omglol.email> Test Plan: Reload personal-phorge.revicdn.net/robots.txt and it is not verbatim copy of issuetracker.revi.xyz/robots.txt Reviewers: #acl_sudoers, #blessed_reviewers, revi Reviewed By: #acl_sudoers, #blessed_reviewers, revi Differential Revision: https://issuetracker.revi.xyz/D9
This commit is contained in:
parent
0e1656da0c
commit
88946a7fe2
2 changed files with 6 additions and 2 deletions
4
.github/workflows/quicksyntaxcheck.yml
vendored
4
.github/workflows/quicksyntaxcheck.yml
vendored
|
@ -12,5 +12,7 @@ jobs:
|
||||||
phpsyntax:
|
phpsyntax:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: PHP Basic Syntax Check
|
- name: "PHP Basic Syntax Check [robots.txt]"
|
||||||
run: php -l PhabExt/PhabricatorCustomRobotsTxtController.php
|
run: php -l PhabExt/PhabricatorCustomRobotsTxtController.php
|
||||||
|
- name: "PHP Basic Syntax Check [time.php]"
|
||||||
|
run: php -l time.php
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class PhabricatorRobotsController extends PhabricatorController {
|
abstract class PhabricatorRobotsPlatformController extends PhabricatorRobotsController {
|
||||||
|
|
||||||
public function shouldRequireLogin() {
|
public function shouldRequireLogin() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,6 +103,8 @@ public function processRequest() {
|
||||||
|
|
||||||
$content = implode("\n", $out)."\n";
|
$content = implode("\n", $out)."\n";
|
||||||
|
|
||||||
|
// ToDo: Cloudflare does not cache the robots.txt due to the presence of Set-Cookie.
|
||||||
|
// T126
|
||||||
return id(new AphrontPlainTextResponse())
|
return id(new AphrontPlainTextResponse())
|
||||||
->setContent($content)
|
->setContent($content)
|
||||||
->setCacheDurationInSeconds(phutil_units('2 hours in seconds'))
|
->setCacheDurationInSeconds(phutil_units('2 hours in seconds'))
|
||||||
|
|
Loading…
Reference in a new issue