Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a crawl queue maintenance job #1223

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core-bundle/src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@
(
'callback' => array('Contao\Automator', 'purgeSystemLog'),
'affected' => array('tl_log')
),
'crawl_queue' => array
(
'callback' => array('Contao\Automator', 'purgeCrawlQueue'),
'affected' => array('tl_crawl_queue')
)
),
'folders' => array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
<trans-unit id="tl_maintenance_jobs.log.1">
<source>Truncates the &lt;code&gt;tl_log&lt;/code&gt; table which stores all the system log entries. This job permanently deletes these records.</source>
</trans-unit>
<trans-unit id="tl_maintenance_jobs.crawl_queue.0">
<source>Purge the crawl queue</source>
</trans-unit>
<trans-unit id="tl_maintenance_jobs.crawl_queue.1">
<source>Truncates the &lt;code&gt;tl_crawl_queue&lt;/code&gt; table which stores all the queue information from crawl processes. This job permanently deletes these records.</source>
</trans-unit>
<trans-unit id="tl_maintenance_jobs.images.0">
<source>Purge the image cache</source>
</trans-unit>
Expand Down
14 changes: 14 additions & 0 deletions core-bundle/src/Resources/contao/library/Contao/Automator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ public function purgeSystemLog()
$this->log('Purged the system log', __METHOD__, TL_CRON);
}

/**
* Purge the crawl queue
*/
public function purgeCrawlQueue()
{
$objDatabase = Database::getInstance();

// Truncate the table
$objDatabase->execute("TRUNCATE TABLE tl_crawl_queue");

// Add a log entry
$this->log('Purged the crawl queue', __METHOD__, TL_CRON);
}

/**
* Purge the image cache
*/
Expand Down