Commit 099bee2f82c8c651924d34cdb108a709f662f9a5
1 parent
1dac1392
Merged in from DEV trunk...
KTS-2414 "Implement a dashlet for the scheduler" Updated. When no jobs have been run, it says they were last run 1974 weeks ago... Changed this! Committed by: Conrad Vermeulen Reviewed by: Kevin Fourie KTS-2414 "Implement a dashlet for the scheduler" Updated. Updated paths of scheduled tasks. Committed by: Conrad Vermeulen Reviewed by: Kevin Fourie KTS-673 "The search algorithm needs some work" Updated. Prevent multiple instances of indexer running which may lock the server under load Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie KTS-2568 "Add scheduler service to Linux" Updated sh file. Committed By: Kevin Fourie Reviewed By: Conrad Vermeulen KTS-673 "The search algorithm needs some work" Updated. Scheduler initialised when indexer is first run. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7539 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
24 additions
and
7 deletions
bin/taskrunner.sh
search2/indexing/indexerCore.inc.php
| ... | ... | @@ -635,13 +635,15 @@ abstract class Indexer |
| 635 | 635 | } |
| 636 | 636 | $default->log->info('checkForRegisteredTypes: start'); |
| 637 | 637 | |
| 638 | - $this->registerTypes(true); | |
| 638 | + $date = date('Y-m-d H:i'); | |
| 639 | + $sql = "UPDATE scheduler_tasks SET run_time='$date'"; | |
| 640 | + DBUtil::runQuery($sql); | |
| 639 | 641 | |
| 642 | + $this->registerTypes(true); | |
| 640 | 643 | |
| 641 | 644 | $disable = array( |
| 642 | 645 | OS_WINDOWS=>array('PSExtractor'), |
| 643 | 646 | OS_UNIX => array() |
| 644 | - | |
| 645 | 647 | ); |
| 646 | 648 | |
| 647 | 649 | foreach($disable[OS_WINDOWS] as $extractor) |
| ... | ... | @@ -664,16 +666,27 @@ abstract class Indexer |
| 664 | 666 | public function indexDocuments($max=null) |
| 665 | 667 | { |
| 666 | 668 | global $default; |
| 669 | + $config =& KTConfig::getSingleton(); | |
| 670 | + | |
| 671 | + $indexLockFile = $config->get('cache/cacheDirectory') . '/main.index.lock'; | |
| 672 | + if (is_file($indexLockFile)) | |
| 673 | + { | |
| 674 | + $default->log->info('indexDocuments: main.index.lock seems to exist. it could be that the indexing is still underway.'); | |
| 675 | + $default->log->info('indexDocuments: Remove "' . $indexLockFile . '" if the indexing is not running or extend the frequency at which the background task runs!'); | |
| 676 | + return; | |
| 677 | + } | |
| 678 | + touch($indexLockFile); | |
| 679 | + | |
| 667 | 680 | |
| 668 | 681 | $this->checkForRegisteredTypes(); |
| 669 | 682 | |
| 670 | 683 | $default->log->info('indexDocuments: start'); |
| 671 | 684 | if (!$this->doesDiagnosticsPass()) |
| 672 | 685 | { |
| 686 | + unlink($indexLockFile); | |
| 673 | 687 | return; |
| 674 | 688 | } |
| 675 | 689 | |
| 676 | - $config =& KTConfig::getSingleton(); | |
| 677 | 690 | if (is_null($max)) |
| 678 | 691 | { |
| 679 | 692 | $max = $config->get('indexer/batchDocuments',20); |
| ... | ... | @@ -702,12 +715,14 @@ abstract class Indexer |
| 702 | 715 | $result = DBUtil::getResultArray($sql); |
| 703 | 716 | if (PEAR::isError($result)) |
| 704 | 717 | { |
| 718 | + unlink($indexLockFile); | |
| 705 | 719 | return; |
| 706 | 720 | } |
| 707 | 721 | |
| 708 | 722 | // bail if no work to do |
| 709 | 723 | if (count($result) == 0) |
| 710 | 724 | { |
| 725 | + unlink($indexLockFile); | |
| 711 | 726 | return; |
| 712 | 727 | } |
| 713 | 728 | |
| ... | ... | @@ -915,6 +930,7 @@ abstract class Indexer |
| 915 | 930 | |
| 916 | 931 | } |
| 917 | 932 | $default->log->info('indexDocuments: done'); |
| 933 | + unlink($indexLockFile); | |
| 918 | 934 | } |
| 919 | 935 | |
| 920 | 936 | public function migrateDocuments($max=null) | ... | ... |
sql/mysql/install/data.sql
No preview for this file type
templates/ktcore/dashlets/scheduler.smarty
| ... | ... | @@ -8,11 +8,13 @@ |
| 8 | 8 | <span><a href="{$sAdmin}">Administration page</a></span> |
| 9 | 9 | |
| 10 | 10 | <p> |
| 11 | +{if !$lasttime} | |
| 11 | 12 | {if $isDue} |
| 12 | 13 | <span class="">{i18n arg_time=$timedif}The tasks were scheduled to be run #time# ago.{/i18n}</span> |
| 13 | 14 | {else} |
| 14 | 15 | <span class="">{i18n arg_time=$timedif}The tasks are scheduled to be run in #time#.{/i18n}</span> |
| 15 | 16 | {/if} |
| 17 | +{/if} | |
| 16 | 18 | </p> |
| 17 | 19 | |
| 18 | 20 | |
| ... | ... | @@ -42,7 +44,7 @@ |
| 42 | 44 | {i18n}Please ensure that the scheduler is listed in your cron jobs. The line to be added to the crontab to implement the cron job is: {/i18n} |
| 43 | 45 | <ul><li>*/5 * * * * {$sPath} > /dev/null</li></ul> |
| 44 | 46 | </p> |
| 45 | - | |
| 47 | + | |
| 46 | 48 | <p> |
| 47 | 49 | <strong><span onclick="{$onClick}"> |
| 48 | 50 | <img id="scheduler_icon" src="{$sImg}"/> | ... | ... |