From 7261ee56c6da2d7a622dc757c9c033769ff7c141 Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Fri, 18 Sep 2020 11:16:13 -0600
Subject: [PATCH] MR 1120 feedback

---
 .../lib/classes/cron.d/600-jailkit_maintenance.inc.php | 10 +---------
 server/plugins-available/apache2_plugin.inc.php        |  4 ++--
 server/plugins-available/nginx_plugin.inc.php          |  4 ++--
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php
index d04fd87cf6..3ddea13e99 100644
--- a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php
+++ b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php
@@ -53,15 +53,7 @@ class cronjob_jailkit_maintenance extends cronjob {
 	public function onRunJob() {
 		global $app, $conf;
 
-		$app->uses('system,getconf');
-
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		if(isset($server_config['migration_mode']) && $server_config['migration_mode'] == 'y') {
-			//$app->log('Migration mode active, not running Jailkit updates.', LOGLEVEL_DEBUG);
-			print "Migration mode active, not running Jailkit updates.\n";
-
-			return;
-		}
 
 		$jailkit_config = $app->getconf->get_server_config($conf['server_id'], 'jailkit');
 		if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
@@ -77,7 +69,7 @@ class cronjob_jailkit_maintenance extends cronjob {
 		// limit the number of jails we update at one time according to time of day
 		$num_jails_to_update = (date('H') < 6) ? 25 : 3;
 
-		$sql = "SELECT domain_id, domain, document_root, php_fpm_chroot, jailkit_chroot_app_sections, jailkit_chroot_app_programs, delete_unused_jailkit, last_jailkit_hash FROM web_domain WHERE type = 'vhost' AND last_jailkit_update < (NOW() - INTERVAL 24 HOUR) AND server_id = ? ORDER by last_jailkit_update LIMIT ?";
+		$sql = "SELECT domain_id, domain, document_root, php_fpm_chroot, jailkit_chroot_app_sections, jailkit_chroot_app_programs, delete_unused_jailkit, last_jailkit_hash FROM web_domain WHERE type = 'vhost' AND (last_jailkit_update IS NULL OR last_jailkit_update < (NOW() - INTERVAL 24 HOUR)) AND server_id = ? ORDER by last_jailkit_update LIMIT ?";
 		$records = $app->db->queryAllRecords($sql, $conf['server_id'], $num_jails_to_update);
 
 		foreach($records as $rec) {
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 424ac15e92..c9ed6508e0 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -3713,12 +3713,12 @@ class apache2_plugin {
 
 		if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
 			if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
-				$options = array( 'hardlink');
+				$options = array('hardlink');
 			} elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') {
 				$options = array();
 			}
 		} else {
-			$options = array( 'allow_hardlink');
+			$options = array('allow_hardlink');
 		}
 
 		// should move return here if $this->website['new_jailkit_hash'] == $this->website['last_jailkit_hash'] ?
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index d688ccc9e6..a2673b62a2 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -3485,12 +3485,12 @@ class nginx_plugin {
 
 		if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
 			if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
-				$options = array( 'hardlink');
+				$options = array('hardlink');
 			} elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') {
 				$options = array();
 			}
 		} else {
-			$options = array( 'allow_hardlink');
+			$options = array('allow_hardlink');
 		}
 
 		// should move return here if $this->website['new_jailkit_hash'] == $this->website['last_jailkit_hash'] ?
-- 
GitLab