Skip to content

Commit

Permalink
feat: added Facebook crawlers to botIgnoreList (#2997)
Browse files Browse the repository at this point in the history
  • Loading branch information
modelrailroader authored Jun 13, 2024
1 parent a8ee080 commit e485850
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Setup/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ class Installer extends Setup
'main.enableAskQuestions' => 'false',
'main.enableNotifications' => 'false',
'main.contactInformationHTML' => 'false',
'main.botIgnoreList' => 'nustcrape,webpost,GoogleBot,msnbot,crawler,scooter,bravobrian,archiver,
w3c,controler,wget,bot,spider,Yahoo! Slurp,htdig,gsa-crawler,AirControler,Uptime-Kuma',
'main.botIgnoreList' => 'nustcrape,webpost,GoogleBot,msnbot,crawler,scooter,bravobrian,archiver,' .
'w3c,controler,wget,bot,spider,Yahoo! Slurp,htdig,gsa-crawler,AirControler,Uptime-Kuma,facebookcatalog/1.0,' .
'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php),facebookexternalhit/1.1',
'main.enableCookieConsent' => 'true',

'records.numberOfRecordsPerPage' => '10',
Expand Down
16 changes: 16 additions & 0 deletions phpmyfaq/src/phpMyFAQ/Setup/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public function applyUpdates(callable $progressCallback): bool
// 4.0 updates
$this->applyUpdates400Alpha();
$this->applyUpdates400Alpha2();
$this->applyUpdates400Alpha3();

// Optimize the tables
$this->optimizeTables();
Expand Down Expand Up @@ -702,6 +703,21 @@ private function applyUpdates400Alpha2(): void
}
}

/**
* @throws Exception
* @throws \Exception
*/
private function applyUpdates400Alpha3(): void
{
if (version_compare($this->version, '4.0.0-alpha3', '<')) {
// Add Facebook crawlers to botIgoreList
$this->configuration->update(['main.botIgnoreList' => 'nustcrape,webpost,GoogleBot,msnbot,crawler,scooter,
bravobrian,archiver,w3c,controler,wget,bot,spider,Yahoo! Slurp,htdig,gsa-crawler,AirControler,Uptime-Kuma,
facebookcatalog/1.0,facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php),
facebookexternalhit/1.1']);
}
}

private function updateVersion(): void
{
$this->configuration->update(['main.currentApiVersion' => System::getApiVersion()]);
Expand Down

0 comments on commit e485850

Please sign in to comment.