Commit 9c062ee22e38876d8f23d0723b487c9e5c841ba9

Authored by Conrad Vermeulen
1 parent 70084ac2

KTS-3165

"Remove background task permissions problems by making web server user deal with background tasks"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8261 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/util/ktutil.inc
@@ -53,8 +53,22 @@ class KTUtil { @@ -53,8 +53,22 @@ class KTUtil {
53 { 53 {
54 global $default; 54 global $default;
55 55
56 - return ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'] . $default->rootUrl; 56 + $config = KTConfig::getSingleton();
  57 + $serverName = $config->get('knowledgeTree/serverName', $_SERVER['HTTP_HOST']);
57 58
  59 + return ($default->sslEnabled ? 'https' : 'http') .'://'.$serverName . $default->rootUrl;
  60 +
  61 + }
  62 +
  63 + static function call_page($path)
  64 + {
  65 + $kt_url = KTUtil::kt_url();
  66 +
  67 + $full_url = $kt_url . '/' . $path;
  68 +
  69 + $ch = curl_init($full_url);
  70 + curl_exec($ch);
  71 + curl_close($ch);
58 } 72 }
59 73
60 static function computePeriod($diff, $suffix = null, $returnArray=false) 74 static function computePeriod($diff, $suffix = null, $returnArray=false)
search2/bin/cronIndexer.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/cronIndexer.php');
  43 +
  44 +
  45 +?>
0 \ No newline at end of file 46 \ No newline at end of file
search2/bin/cronMigration.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/cronMigration.php');
  43 +
  44 +?>
0 \ No newline at end of file 45 \ No newline at end of file
search2/bin/optimise.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id:$
  5 + *
  6 + * KnowledgeTree Open Source Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  23 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +chdir(dirname(__FILE__));
  40 +require_once(realpath('../../config/dmsDefaults.php'));
  41 +
  42 +KTUtil::call_page('search2/indexing/bin/optimise.php');
  43 +
  44 +
  45 +?>
0 \ No newline at end of file 46 \ No newline at end of file
sql/mysql/install/data.sql
@@ -804,9 +804,9 @@ UNLOCK TABLES; @@ -804,9 +804,9 @@ UNLOCK TABLES;
804 LOCK TABLES `scheduler_tasks` WRITE; 804 LOCK TABLES `scheduler_tasks` WRITE;
805 /*!40000 ALTER TABLE `scheduler_tasks` DISABLE KEYS */; 805 /*!40000 ALTER TABLE `scheduler_tasks` DISABLE KEYS */;
806 INSERT INTO `scheduler_tasks` VALUES 806 INSERT INTO `scheduler_tasks` VALUES
807 -(1,'Indexing','search2/indexing/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),  
808 -(2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),  
809 -(3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'), 807 +(1,'Indexing','search2/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),
  808 +(2,'Index Migration','search2/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
  809 +(3,'Index Optimisation','search2/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
810 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'), 810 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
811 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'), 811 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
812 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'); 812 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled');
sql/mysql/upgrade/3.5.2/scheduler_permissions.sql 0 โ†’ 100644
  1 +UPDATE scheduler_tasks SET script_url='search2/bin/cronIndexer.php' WHERE task='Indexing';
  2 +UPDATE scheduler_tasks SET script_url='search2/bin/cronMigration.php' WHERE task='Index Migration';
  3 +UPDATE scheduler_tasks SET script_url='search2/bin/optimise.php' WHERE task='Index Optimisation';
0 \ No newline at end of file 4 \ No newline at end of file