From 39651508549dec13febf6b8dc11079bbc07b68e3 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Sat, 12 Jan 2013 06:25:55 +0000
Subject: [PATCH] Better checks + always return FALSE on abort

---
 inc/extensions/ext-debug.php    | 2 +-
 inc/loader/load-                | 2 +-
 inc/loader/load-admins.php      | 4 ++--
 inc/loader/load-config.php      | 4 ++--
 inc/loader/load-earning.php     | 7 +++++--
 inc/loader/load-extension.php   | 4 ++--
 inc/loader/load-filter.php      | 4 ++--
 inc/loader/load-imprint.php     | 8 ++++----
 inc/loader/load-modules.php     | 4 ++--
 inc/loader/load-payments.php    | 4 ++--
 inc/loader/load-points_data.php | 7 +++++--
 inc/loader/load-refdepths.php   | 4 ++--
 inc/loader/load-refsystem.php   | 4 ++--
 inc/loader/load-themes.php      | 4 ++--
 14 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/inc/extensions/ext-debug.php b/inc/extensions/ext-debug.php
index 6db2f71dde..b5b25217c2 100644
--- a/inc/extensions/ext-debug.php
+++ b/inc/extensions/ext-debug.php
@@ -61,7 +61,7 @@ switch (getExtensionMode()) {
 `sender_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00',
 `file` VARCHAR(255) NOT NULL DEFAULT '',
-`line` MEDIUMINT NOT NOT NULL DEFAULT 0,
+`line` MEDIUMINT NOT NULL DEFAULT 0,
 `message` LONGTEXT NOT NULL,
 `comment` TINYTEXT NOT NULL,
 `status` ENUM('NEW','PENDING','ACCEPTED','FIXED','INVALID','DUBLICATE','SPAM') NOT NULL DEFAULT 'NEW',
diff --git a/inc/loader/load- b/inc/loader/load-
index eca6dfd929..aeedfc5dbe 100644
--- a/inc/loader/load-
+++ b/inc/loader/load-
@@ -40,7 +40,7 @@ if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
 	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-admins.php b/inc/loader/load-admins.php
index e3b5663ed2..d422c046f8 100644
--- a/inc/loader/load-admins.php
+++ b/inc/loader/load-admins.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-config.php b/inc/loader/load-config.php
index e6bb7580a5..384dbef0bc 100644
--- a/inc/loader/load-config.php
+++ b/inc/loader/load-config.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the configuration (config)...
diff --git a/inc/loader/load-earning.php b/inc/loader/load-earning.php
index 3a809ce0bd..18180aca1a 100644
--- a/inc/loader/load-earning.php
+++ b/inc/loader/load-earning.php
@@ -39,8 +39,11 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
+} elseif (!isExtensionInstalled('earning')) {
+	// Do not cache if not installed!
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php
index 791e647616..0a1f3c5726 100644
--- a/inc/loader/load-extension.php
+++ b/inc/loader/load-extension.php
@@ -41,8 +41,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the extension
diff --git a/inc/loader/load-filter.php b/inc/loader/load-filter.php
index 7789ef963b..37566647c2 100644
--- a/inc/loader/load-filter.php
+++ b/inc/loader/load-filter.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the filteruration (filter)...
diff --git a/inc/loader/load-imprint.php b/inc/loader/load-imprint.php
index ab2f389025..eb1d818d81 100644
--- a/inc/loader/load-imprint.php
+++ b/inc/loader/load-imprint.php
@@ -39,11 +39,11 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 } elseif (!isExtensionInstalled('imprint')) {
-	// Not not cache if not installed!
-	return;
+	// Do not cache if not installed!
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-modules.php b/inc/loader/load-modules.php
index 382bf52859..c6027de079 100644
--- a/inc/loader/load-modules.php
+++ b/inc/loader/load-modules.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the module registry (mod_reg)...
diff --git a/inc/loader/load-payments.php b/inc/loader/load-payments.php
index 8383a50411..6a6ce9d68c 100644
--- a/inc/loader/load-payments.php
+++ b/inc/loader/load-payments.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-points_data.php b/inc/loader/load-points_data.php
index 90fa77f52e..9d496e5ad1 100644
--- a/inc/loader/load-points_data.php
+++ b/inc/loader/load-points_data.php
@@ -39,8 +39,11 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
+} elseif (!isExtensionInstalledAndNewer('sql_patches', '0.8.0')) {
+	// Is not installed or recent enough
+	return FALSE;
 }
 
 // Let's start with the admins table...
diff --git a/inc/loader/load-refdepths.php b/inc/loader/load-refdepths.php
index 82522aad10..cff0a33e1f 100644
--- a/inc/loader/load-refdepths.php
+++ b/inc/loader/load-refdepths.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the referral system (refdepths)...
diff --git a/inc/loader/load-refsystem.php b/inc/loader/load-refsystem.php
index 9be26d6807..dab0a40d14 100644
--- a/inc/loader/load-refsystem.php
+++ b/inc/loader/load-refsystem.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 }
 
 // Next cached table is the referral system (refsystem)...
diff --git a/inc/loader/load-themes.php b/inc/loader/load-themes.php
index 3613f7232d..123d538d8d 100644
--- a/inc/loader/load-themes.php
+++ b/inc/loader/load-themes.php
@@ -39,8 +39,8 @@
 if (!defined('__SECURITY')) {
 	die();
 } elseif (isInstallationPhase()) {
-	// Use this code if you don't want to run this cache loader on installation phase
-	return;
+	// Do not run in installation phase
+	return FALSE;
 } elseif (!isExtensionActive('theme')) {
 	// Skip this loader
 	return FALSE;
-- 
2.39.5