Cron

Setting up the Cron is a critical part of the JReviews setup because it ensures that maintenance tasks can be run periodically. While some of these can run on site visits, not all of them can.

Setup

To get the Cron URL for your site, go to JReviews → Configuration → Cron.

Cron setup in JReviews
Cron setup in JReviews

Copy the Cron Secret value and replace it in the Cron URL value so the result looks something like this:

https://my-jreviews-site/index.php?option=com_jreviews&format=raw&url=cron&secret=01d55412345c27ca28a4caf1fc6
CMS Specific URLs
The URL format shown above, and in the code snippets below, is the format for Joomla. If you are using JReviews WordPress, make sure to copy the URL from your WP dashboard and replace the cron key with your site's key

To test if the cron is working correctly, you can copy the above URL to your browser where you should be presented with a Cron ran successfully message.

On your hosting panel or your server, you will use the above URL to setup the crontab to run every minute. Below you can find an example of what this looks like. For assistance setting up the cron on your server, please contact your host.

* * * * * wget -O /dev/null --no-check-certificate https://my-jreviews-site/index.php?option=com_jreviews&format=raw&url=cron&secret=01d55412345c27ca28a4caf1fc6

Alternate Cron Setup

Some servers don't allow the cron to make a request to a URL. If this is your situation, there's an easy fix. Create a file and place it in the root of your website. You can name it anything you want, but for this example, we are using jreviews-cron.php.

Add the following code to the file and make sure you replace the URL with your previously tested, and working, Cron URL

<?php
file_get_contents('https://my-jreviews-site/index.php?option=com_jreviews&format=raw&url=cron&secret=01d55412345c27ca28a4caf1fc6');

If your server has disabled file_get_contents, then you can also try using the code below:

<?php
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'https://my-jreviews-site/index.php?option=com_jreviews&format=raw&url=cron&secret=01d55412345c27ca28a4caf1fc6'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
curl_setopt($ch, CURLOPT_TIMEOUT, 2); 
$response = curl_exec($ch);
curl_close($ch);

Finally, setup the cron as shown below to make the request directly to jreviews-cron.php file

* * * * * /usr/local/bin/php /path/to/site/jreviews-cron.php > /dev/null 2>&1

Disable On Site Visits

Once you setup the cron, disable run on site visits. The run on site visits functionality can only handle certain tasks, so it's important to set up a real cron to ensure that all maintenance tasks run periodically.