Page 1 of 1

Help with SSEP cron script

Posted: 03 May 2019, 14:12
by mike406
Edit: I found the problem.
This line:

Code: Select all

$start_url = (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://'). $objci->domain;
I had to change it to

Code: Select all

$start_url = 'https://' . $objci->domain;
I assumed the point of this script is to execute this through the CLI or cronjob. $_SERVER is not available when running through the CLI.

============
Original Post

Could you help me with the ssep_cron script?
I'm not able to get it to re-index my site correctly. When I run the initial index through the admin panel, it stores 199 pages in ssep_url_x. When I run the ssep_cron.php script with reindex = 1 it drops the registered URL count to 89 pages. Checking the database table ssep_url_x shows that it deleted 110 URLs from the table. However if I use the admin panel and click the ReIndex checkbox under the "Crawl & Index tab" and do it there it works fine.

Code: Select all

if(isset($argv) && isset($argv[1])) $_GET['cron'] = $argv[1];
if(isset($_GET['cron']) && $_GET['cron'] == $admin_name){
  if(isset($_SESSION['ssep_dom_id'])) unset($_SESSION['ssep_dom_id']);
  $_SESSION['adminlogg'] = $admin_name .$admin_pass;
  set_time_limit(0);
  include 'php/crawlindex.php';
  $objci = new crawlIndex($obsql);
  $objci->reindex =1;  //sets to re-index existing registered pages (0 to not re-index)
  $objci->max_depth = 2;    //depth to index
  $objci->url_exclude = array('webapps', '/branch/', '/account/', '/account_', '/departments/pc', 'changeStyle.php');   //paths to exclude
  $_SESSION['ssep_dom_id'] = getDomainId($obsql, $objci->domain);  //gets $_SESSION['ssep_dom_id'] from database
  $start_url = (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://'). $objci->domain;
  $objci->run($start_url);  //starts indexing
}
else echo 'Invalid request';

Help with SSEP cron script

Posted: 03 May 2019, 14:46
by mike406
I ended up finding the issue - I added it to the top of the first post.

Help with SSEP cron script

Posted: 03 May 2019, 14:48
by Admin
I'm glad you found the problem and it works.
Thank you for posting the solution.