mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
Update UPDATE query to use true table name, not assumed one
This commit is contained in:
parent
98dac9b314
commit
a52cb9209b
@ -7,11 +7,13 @@ use SilverStripe\ExternalLinks\Model\BrokenExternalPageTrack;
|
||||
use SilverStripe\ExternalLinks\Model\BrokenExternalPageTrackStatus;
|
||||
use SilverStripe\Dev\BuildTask;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\Dev\Debug;
|
||||
use DOMNode;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
|
||||
class CheckExternalLinksTask extends BuildTask
|
||||
{
|
||||
@ -188,9 +190,11 @@ class CheckExternalLinksTask extends BuildTask
|
||||
$count = $pageTrack->BrokenLinks()->count();
|
||||
$this->log("Found {$count} broken links");
|
||||
if ($count) {
|
||||
$siteTreeTable = DataObject::getSchema()->tableName(SiteTree::class);
|
||||
// Bypass the ORM as syncLinkTracking does not allow you to update HasBrokenLink to true
|
||||
DB::query(sprintf(
|
||||
'UPDATE "SiteTree" SET "HasBrokenLink" = 1 WHERE "ID" = \'%d\'',
|
||||
'UPDATE "%s" SET "HasBrokenLink" = 1 WHERE "ID" = \'%d\'',
|
||||
$siteTreeTable,
|
||||
intval($pageTrack->ID)
|
||||
));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user