Commit 6c3e0e6911bfd3bd12c39e7f1b2eb1695ef743c4
1 parent
713eeb8b
KTS-843: Removed Community Logo on Install Step
Committed by: Jarrett Jordaan Reviewed by: Damien Williams
Showing
6 changed files
with
850 additions
and
11 deletions
setup/migrate/steps/migrateServices.php
| @@ -116,6 +116,7 @@ class migrateServices extends Step | @@ -116,6 +116,7 @@ class migrateServices extends Step | ||
| 116 | 116 | ||
| 117 | protected $conf = array(); | 117 | protected $conf = array(); |
| 118 | 118 | ||
| 119 | + protected $mysqlServiceName = "KTMysql"; | ||
| 119 | /** | 120 | /** |
| 120 | * Main control of services setup | 121 | * Main control of services setup |
| 121 | * | 122 | * |
| @@ -186,9 +187,22 @@ class migrateServices extends Step | @@ -186,9 +187,22 @@ class migrateServices extends Step | ||
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | private function mysqlRunning() { | 189 | private function mysqlRunning() { |
| 189 | - $installation = $this->getDataFromSession("installation"); // Get installation directory | ||
| 190 | - $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; | ||
| 191 | - if(file_exists($mysqlPid)) { | 190 | + if(WINDOWS_OS) { |
| 191 | + $cmd = "sc query {$this->mysqlServiceName}"; | ||
| 192 | + $response = $this->util->pexec($cmd); | ||
| 193 | + if($response['out']) { | ||
| 194 | + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key | ||
| 195 | + } | ||
| 196 | + if($state == "STARTED") { | ||
| 197 | + return true; | ||
| 198 | + } | ||
| 199 | + } else { | ||
| 200 | + $installation = $this->getDataFromSession("installation"); // Get installation directory | ||
| 201 | + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; | ||
| 202 | + if(file_exists($mysqlPid)) | ||
| 203 | + $running = true; | ||
| 204 | + } | ||
| 205 | + if(file_exists($running)) { | ||
| 192 | return true; | 206 | return true; |
| 193 | } | 207 | } |
| 194 | return false; | 208 | return false; |
| @@ -247,6 +261,12 @@ class migrateServices extends Step | @@ -247,6 +261,12 @@ class migrateServices extends Step | ||
| 247 | $serv->uninstall(); | 261 | $serv->uninstall(); |
| 248 | } | 262 | } |
| 249 | } | 263 | } |
| 264 | + $this->shutdownMysql(); | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + private function shutdownMysql() { | ||
| 268 | + $cmd = "sc stop {$this->mysqlServiceName}"; | ||
| 269 | + $response = $this->util->pexec($cmd); | ||
| 250 | } | 270 | } |
| 251 | 271 | ||
| 252 | /** | 272 | /** |
| @@ -287,9 +307,23 @@ class migrateServices extends Step | @@ -287,9 +307,23 @@ class migrateServices extends Step | ||
| 287 | * | 307 | * |
| 288 | */ | 308 | */ |
| 289 | private function checkMysql() { | 309 | private function checkMysql() { |
| 290 | - $installation = $this->getDataFromSession("installation"); // Get installation directory | ||
| 291 | - $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; | ||
| 292 | - if(file_exists($mysqlPid)) { | 310 | + $running = false; |
| 311 | + if(WINDOWS_OS) { | ||
| 312 | + $cmd = "sc query {$this->mysqlServiceName}"; | ||
| 313 | + $response = $this->util->pexec($cmd); | ||
| 314 | + if($response['out']) { | ||
| 315 | + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key | ||
| 316 | + } | ||
| 317 | + if($state == "STARTED") { | ||
| 318 | + return true; | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + $installation = $this->getDataFromSession("installation"); // Get installation directory | ||
| 322 | + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; | ||
| 323 | + if(file_exists($mysqlPid)) | ||
| 324 | + $running = true; | ||
| 325 | + } | ||
| 326 | + if($running) { | ||
| 293 | $this->temp_variables['services']['KTMysql']['class'] = "cross"; | 327 | $this->temp_variables['services']['KTMysql']['class'] = "cross"; |
| 294 | $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; | 328 | $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; |
| 295 | $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; | 329 | $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; |
setup/wizard/installUtil.php
| @@ -727,7 +727,13 @@ class InstallUtil { | @@ -727,7 +727,13 @@ class InstallUtil { | ||
| 727 | return true; | 727 | return true; |
| 728 | return false; | 728 | return false; |
| 729 | } | 729 | } |
| 730 | - | 730 | + |
| 731 | + public function isCommunity() { | ||
| 732 | + if(INSTALL_TYPE == "community") | ||
| 733 | + return true; | ||
| 734 | + return false; | ||
| 735 | + } | ||
| 736 | + | ||
| 731 | /** | 737 | /** |
| 732 | * Determine type of installation | 738 | * Determine type of installation |
| 733 | * | 739 | * |
setup/wizard/lib/plugins/pluginutil.inc.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * KnowledgeTree Community Edition | ||
| 6 | + * Document Management Made Simple | ||
| 7 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | ||
| 8 | + * | ||
| 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 KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | + * California 94120-7775, 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 | +//require_once(KT_LIB_DIR . '/plugins/pluginentity.inc.php'); | ||
| 40 | +//require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); | ||
| 41 | +// | ||
| 42 | +//class KTPluginResourceRegistry { | ||
| 43 | +// var $aResources = array(); | ||
| 44 | +// | ||
| 45 | +// function &getSingleton() { | ||
| 46 | +// if (!KTUtil::arrayGet($GLOBALS, 'oKTPluginResourceRegistry')) { | ||
| 47 | +// $GLOBALS['oKTPluginResourceRegistry'] = new KTPluginResourceRegistry; | ||
| 48 | +// } | ||
| 49 | +// return $GLOBALS['oKTPluginResourceRegistry']; | ||
| 50 | +// } | ||
| 51 | +// | ||
| 52 | +// function registerResource($sPath) { | ||
| 53 | +// $this->aResources[$sPath] = true; | ||
| 54 | +// } | ||
| 55 | +// | ||
| 56 | +// function isRegistered($sPath) { | ||
| 57 | +// if (KTUtil::arrayGet($this->aResources, $sPath)) { | ||
| 58 | +// return true; | ||
| 59 | +// } | ||
| 60 | +// $sPath = dirname($sPath); | ||
| 61 | +// if (KTUtil::arrayGet($this->aResources, $sPath)) { | ||
| 62 | +// return true; | ||
| 63 | +// } | ||
| 64 | +// return false; | ||
| 65 | +// } | ||
| 66 | +//} | ||
| 67 | + | ||
| 68 | +class KTPluginUtil { | ||
| 69 | +// const CACHE_FILENAME = 'kt_plugins.cache'; | ||
| 70 | +// | ||
| 71 | +// /** | ||
| 72 | +// * Store the plugin cache in the cache directory. | ||
| 73 | +// * @deprecated | ||
| 74 | +// */ | ||
| 75 | +// static function savePluginCache($array) | ||
| 76 | +// { | ||
| 77 | +// $config = KTConfig::getSingleton(); | ||
| 78 | +// $cachePlugins = $config->get('cache/cachePlugins', false); | ||
| 79 | +// if (!$cachePlugins) | ||
| 80 | +// { | ||
| 81 | +// return false; | ||
| 82 | +// } | ||
| 83 | +// | ||
| 84 | +// $cacheDir = $config->get('cache/cacheDirectory'); | ||
| 85 | +// | ||
| 86 | +// $written = file_put_contents($cacheDir . '/' . KTPluginUtil::CACHE_FILENAME , serialize($array)); | ||
| 87 | +// | ||
| 88 | +// if (!$written) | ||
| 89 | +// { | ||
| 90 | +// global $default; | ||
| 91 | +// | ||
| 92 | +// $default->log->warn('savePluginCache - The cache did not write anything.'); | ||
| 93 | +// | ||
| 94 | +// // try unlink a zero size file - just in case | ||
| 95 | +// @unlink($cacheFile); | ||
| 96 | +// } | ||
| 97 | +// } | ||
| 98 | + | ||
| 99 | +// /** | ||
| 100 | +// * Remove the plugin cache. | ||
| 101 | +// * @deprecated | ||
| 102 | +// */ | ||
| 103 | +// static function removePluginCache() | ||
| 104 | +// { | ||
| 105 | +// $config = KTConfig::getSingleton(); | ||
| 106 | +// $cachePlugins = $config->get('cache/cachePlugins', false); | ||
| 107 | +// if (!$cachePlugins) | ||
| 108 | +// { | ||
| 109 | +// return false; | ||
| 110 | +// } | ||
| 111 | +// $cacheDir = $config->get('cache/cacheDirectory'); | ||
| 112 | +// | ||
| 113 | +// $cacheFile=$cacheDir . '/' . KTPluginUtil::CACHE_FILENAME; | ||
| 114 | +// @unlink($cacheFile); | ||
| 115 | +// } | ||
| 116 | + | ||
| 117 | +// /** | ||
| 118 | +// * Reads the plugin cache file. This must still be unserialised. | ||
| 119 | +// * @deprecated | ||
| 120 | +// * @return mixed Returns false on failure, or the serialised cache. | ||
| 121 | +// */ | ||
| 122 | +// static function readPluginCache() | ||
| 123 | +// { | ||
| 124 | +// $config = KTConfig::getSingleton(); | ||
| 125 | +// $cachePlugins = $config->get('cache/cachePlugins', false); | ||
| 126 | +// if (!$cachePlugins) | ||
| 127 | +// { | ||
| 128 | +// return false; | ||
| 129 | +// } | ||
| 130 | +// $cacheDir = $config->get('cache/cacheDirectory'); | ||
| 131 | +// | ||
| 132 | +// $cacheFile=$cacheDir . '/' . KTPluginUtil::CACHE_FILENAME; | ||
| 133 | +// if (!is_file($cacheFile)) | ||
| 134 | +// { | ||
| 135 | +// return false; | ||
| 136 | +// } | ||
| 137 | +// | ||
| 138 | +// $cache = file_get_contents($cacheFile); | ||
| 139 | +// | ||
| 140 | +// // we check for an empty cache in case there was a problem. We rather try and reload everything otherwise. | ||
| 141 | +// if (strlen($cache) == 0) | ||
| 142 | +// { | ||
| 143 | +// return false; | ||
| 144 | +// } | ||
| 145 | +// if (!class_exists('KTPluginEntityProxy')) { | ||
| 146 | +// KTEntityUtil::_proxyCreate('KTPluginEntity', 'KTPluginEntityProxy'); | ||
| 147 | +// } | ||
| 148 | +// | ||
| 149 | +// return unserialize($cache); | ||
| 150 | +// } | ||
| 151 | + | ||
| 152 | +// /** | ||
| 153 | +// * Load the plugins for the current page | ||
| 154 | +// * | ||
| 155 | +// * @param unknown_type $sType | ||
| 156 | +// */ | ||
| 157 | +// static function loadPlugins ($sType) { | ||
| 158 | +// | ||
| 159 | +// // Check the current page - can be extended. | ||
| 160 | +// // Currently we only distinguish between the dashboard and everything else. | ||
| 161 | +// if($sType != 'dashboard'){ | ||
| 162 | +// $sType = 'general'; | ||
| 163 | +// } | ||
| 164 | +// | ||
| 165 | +// $aPlugins = array(); | ||
| 166 | +// $aPluginHelpers = array(); | ||
| 167 | +// $aDisabled = array(); | ||
| 168 | +// | ||
| 169 | +// // Get the list of enabled plugins | ||
| 170 | +// $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h | ||
| 171 | +// INNER JOIN plugins p ON (p.namespace = h.plugin) | ||
| 172 | +// WHERE p.disabled = 0 AND h.classtype='plugin' ORDER BY p.orderby"; | ||
| 173 | +// $aPluginHelpers = DBUtil::getResultArray($query); | ||
| 174 | +// | ||
| 175 | +// if(PEAR::isError($aPluginHelpers)){ | ||
| 176 | +// global $default; | ||
| 177 | +// $default->log->debug('Error in pluginutil: '.$aPluginHelpers->getMessage()); | ||
| 178 | +// return false; | ||
| 179 | +// } | ||
| 180 | +// | ||
| 181 | +// // Check that there are plugins and if not, register them | ||
| 182 | +// if (empty($aPluginHelpers) || (isset($_POST['_force_plugin_truncate']))) { | ||
| 183 | +// DBUtil::startTransaction(); | ||
| 184 | +// KTPluginUtil::registerPlugins(); | ||
| 185 | +// DBUtil::commit(); | ||
| 186 | +// | ||
| 187 | +// $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h | ||
| 188 | +// INNER JOIN plugins p ON (p.namespace = h.plugin) | ||
| 189 | +// WHERE p.disabled = 0 AND h.classtype='plugin' ORDER BY p.orderby"; | ||
| 190 | +// $aPluginHelpers = DBUtil::getResultArray($query); | ||
| 191 | +// } | ||
| 192 | +// | ||
| 193 | +// // Create plugin objects | ||
| 194 | +// foreach ($aPluginHelpers as $aItem){ | ||
| 195 | +// $classname = $aItem['classname']; | ||
| 196 | +// $path = $aItem['pathname']; | ||
| 197 | +// | ||
| 198 | +// if (!empty($path)) { | ||
| 199 | +// $path = KT_DIR.'/'.$path; | ||
| 200 | +// require_once($path); | ||
| 201 | +// | ||
| 202 | +// $oPlugin = new $classname($path); | ||
| 203 | +// if($oPlugin->load()){ | ||
| 204 | +// $aPlugins[] = $oPlugin; | ||
| 205 | +// }else{ | ||
| 206 | +// $aDisabled[] = "'{$aItem['plugin']}'"; | ||
| 207 | +// } | ||
| 208 | +// } | ||
| 209 | +// } | ||
| 210 | +// | ||
| 211 | +// $sDisabled = implode(',', $aDisabled); | ||
| 212 | +// | ||
| 213 | +// // load plugin helpers into global space | ||
| 214 | +// $query = 'SELECT h.* FROM plugin_helper h | ||
| 215 | +// INNER JOIN plugins p ON (p.namespace = h.plugin) | ||
| 216 | +// WHERE p.disabled = 0 ';//WHERE viewtype='{$sType}'"; | ||
| 217 | +// if(!empty($sDisabled)){ | ||
| 218 | +// $query .= " AND h.plugin NOT IN ($sDisabled) "; | ||
| 219 | +// } | ||
| 220 | +// $query .= ' ORDER BY p.orderby'; | ||
| 221 | +// | ||
| 222 | +// $aPluginList = DBUtil::getResultArray($query); | ||
| 223 | +// | ||
| 224 | +// KTPluginUtil::load($aPluginList); | ||
| 225 | +// | ||
| 226 | +// // Load the template locations - ignore disabled plugins | ||
| 227 | +// // Allow for templates that don't correctly link to the plugin | ||
| 228 | +// $query = "SELECT * FROM plugin_helper h | ||
| 229 | +// LEFT JOIN plugins p ON (p.namespace = h.plugin) | ||
| 230 | +// WHERE h.classtype='locations' AND (disabled = 0 OR disabled IS NULL) AND unavailable = 0"; | ||
| 231 | +// | ||
| 232 | +// $aLocations = DBUtil::getResultArray($query); | ||
| 233 | +// | ||
| 234 | +// if(!empty($aLocations)){ | ||
| 235 | +// $oTemplating =& KTTemplating::getSingleton(); | ||
| 236 | +// foreach ($aLocations as $location){ | ||
| 237 | +// $aParams = explode('|', $location['object']); | ||
| 238 | +// call_user_func_array(array(&$oTemplating, 'addLocation2'), $aParams); | ||
| 239 | +// } | ||
| 240 | +// } | ||
| 241 | +// return true; | ||
| 242 | +// } | ||
| 243 | + | ||
| 244 | + /** | ||
| 245 | + * Load the plugins into the global space | ||
| 246 | + * | ||
| 247 | + * @param array $aPlugins | ||
| 248 | + */ | ||
| 249 | + function load($aPlugins) { | ||
| 250 | + | ||
| 251 | + require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php'); | ||
| 252 | + require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); | ||
| 253 | + require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); | ||
| 254 | + require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); | ||
| 255 | + require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); | ||
| 256 | + require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); | ||
| 257 | + require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); | ||
| 258 | + require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); | ||
| 259 | + require_once(KT_LIB_DIR . "/help/help.inc.php"); | ||
| 260 | + require_once(KT_LIB_DIR . "/workflow/workflowutil.inc.php"); | ||
| 261 | + require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); | ||
| 262 | + require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); | ||
| 263 | + require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php"); | ||
| 264 | + require_once(KT_LIB_DIR . "/browse/criteriaregistry.php"); | ||
| 265 | + require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php"); | ||
| 266 | + | ||
| 267 | + $oPRegistry =& KTPortletRegistry::getSingleton(); | ||
| 268 | + $oTRegistry =& KTTriggerRegistry::getSingleton(); | ||
| 269 | + $oARegistry =& KTActionRegistry::getSingleton(); | ||
| 270 | + $oPageRegistry =& KTPageRegistry::getSingleton(); | ||
| 271 | + $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); | ||
| 272 | + $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); | ||
| 273 | + $oDashletRegistry =& KTDashletRegistry::getSingleton(); | ||
| 274 | + $oi18nRegistry =& KTi18nRegistry::getSingleton(); | ||
| 275 | + $oKTHelpRegistry =& KTHelpRegistry::getSingleton(); | ||
| 276 | + $oWFTriggerRegistry =& KTWorkflowTriggerRegistry::getSingleton(); | ||
| 277 | + $oColumnRegistry =& KTColumnRegistry::getSingleton(); | ||
| 278 | + $oNotificationHandlerRegistry =& KTNotificationRegistry::getSingleton(); | ||
| 279 | + $oTemplating =& KTTemplating::getSingleton(); | ||
| 280 | + $oWidgetFactory =& KTWidgetFactory::getSingleton(); | ||
| 281 | + $oValidatorFactory =& KTValidatorFactory::getSingleton(); | ||
| 282 | + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); | ||
| 283 | + $oInterceptorRegistry =& KTInterceptorRegistry::getSingleton(); | ||
| 284 | + $oKTPluginRegistry =& KTPluginRegistry::getSingleton(); | ||
| 285 | + | ||
| 286 | + | ||
| 287 | + // Loop through the loaded plugins and register them for access | ||
| 288 | + foreach ($aPlugins as $plugin){ | ||
| 289 | + $sName = $plugin['namespace']; | ||
| 290 | + $sParams = $plugin['object']; | ||
| 291 | + $aParams = explode('|', $sParams); | ||
| 292 | + $sClassType = $plugin['classtype']; | ||
| 293 | + | ||
| 294 | + switch ($sClassType) { | ||
| 295 | + case 'portlet': | ||
| 296 | + $aLocation = unserialize($aParams[0]); | ||
| 297 | + if($aLocation != false){ | ||
| 298 | + $aParams[0] = $aLocation; | ||
| 299 | + } | ||
| 300 | + if(isset($aParams[3])){ | ||
| 301 | + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); | ||
| 302 | + } | ||
| 303 | + call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $aParams); | ||
| 304 | + break; | ||
| 305 | + | ||
| 306 | + case 'trigger': | ||
| 307 | + if(isset($aParams[4])){ | ||
| 308 | + $aParams[4] = KTPluginUtil::getFullPath($aParams[4]); | ||
| 309 | + } | ||
| 310 | + call_user_func_array(array(&$oTRegistry, 'registerTrigger'), $aParams); | ||
| 311 | + break; | ||
| 312 | + | ||
| 313 | + case 'action': | ||
| 314 | + if(isset($aParams[3])){ | ||
| 315 | + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); | ||
| 316 | + } | ||
| 317 | + call_user_func_array(array(&$oARegistry, 'registerAction'), $aParams); | ||
| 318 | + break; | ||
| 319 | + | ||
| 320 | + case 'page': | ||
| 321 | + if(isset($aParams[2])){ | ||
| 322 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 323 | + } | ||
| 324 | + call_user_func_array(array(&$oPageRegistry, 'registerPage'), $aParams); | ||
| 325 | + break; | ||
| 326 | + | ||
| 327 | + case 'authentication_provider': | ||
| 328 | + if(isset($aParams[3])){ | ||
| 329 | + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); | ||
| 330 | + } | ||
| 331 | + $aParams[0] = _kt($aParams[0]); | ||
| 332 | + call_user_func_array(array(&$oAPRegistry, 'registerAuthenticationProvider'), $aParams); | ||
| 333 | + break; | ||
| 334 | + | ||
| 335 | + case 'admin_category': | ||
| 336 | + $aParams[1] = _kt($aParams[1]); | ||
| 337 | + $aParams[2] = _kt($aParams[2]); | ||
| 338 | + call_user_func_array(array(&$oAdminRegistry, 'registerCategory'), $aParams); | ||
| 339 | + break; | ||
| 340 | + | ||
| 341 | + case 'admin_page': | ||
| 342 | + if(isset($aParams[5])){ | ||
| 343 | + $aParams[5] = KTPluginUtil::getFullPath($aParams[5]); | ||
| 344 | + } | ||
| 345 | + $aParams[3] = _kt($aParams[3]); | ||
| 346 | + $aParams[4] = _kt($aParams[4]); | ||
| 347 | + call_user_func_array(array(&$oAdminRegistry, 'registerLocation'), $aParams); | ||
| 348 | + break; | ||
| 349 | + | ||
| 350 | + case 'dashlet': | ||
| 351 | + if(isset($aParams[2])){ | ||
| 352 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 353 | + } | ||
| 354 | + call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $aParams); | ||
| 355 | + break; | ||
| 356 | + | ||
| 357 | + case 'i18nlang': | ||
| 358 | + if(isset($aParams[2]) && $aParams[2] != 'default'){ | ||
| 359 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 360 | + } | ||
| 361 | + call_user_func_array(array(&$oi18nRegistry, 'registeri18nLang'), $aParams); | ||
| 362 | + | ||
| 363 | + | ||
| 364 | + case 'i18n': | ||
| 365 | + if(isset($aParams[2])){ | ||
| 366 | + $aParams[1] = $aParams[2]; | ||
| 367 | + unset($aParams[2]); | ||
| 368 | + } else { | ||
| 369 | + $aParams[1] = KTPluginUtil::getFullPath($aParams[1]); | ||
| 370 | + } | ||
| 371 | + call_user_func_array(array(&$oi18nRegistry, 'registeri18n'), $aParams); | ||
| 372 | + break; | ||
| 373 | + | ||
| 374 | + case 'language': | ||
| 375 | + call_user_func_array(array(&$oi18nRegistry, 'registerLanguage'), $aParams); | ||
| 376 | + break; | ||
| 377 | + | ||
| 378 | + case 'help_language': | ||
| 379 | + if(isset($aParams[2])){ | ||
| 380 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 381 | + } | ||
| 382 | + call_user_func_array(array(&$oKTHelpRegistry, 'registerHelp'), $aParams); | ||
| 383 | + break; | ||
| 384 | + | ||
| 385 | + case 'workflow_trigger': | ||
| 386 | + if(isset($aParams[2])){ | ||
| 387 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 388 | + } | ||
| 389 | + call_user_func_array(array(&$oWFTriggerRegistry, 'registerWorkflowTrigger'), $aParams); | ||
| 390 | + break; | ||
| 391 | + | ||
| 392 | + case 'column': | ||
| 393 | + if(isset($aParams[3])){ | ||
| 394 | + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); | ||
| 395 | + } | ||
| 396 | + $aParams[0] = _kt($aParams[0]); | ||
| 397 | + call_user_func_array(array(&$oColumnRegistry, 'registerColumn'), $aParams); | ||
| 398 | + break; | ||
| 399 | + | ||
| 400 | + case 'view': | ||
| 401 | + $aParams[0] = _kt($aParams[0]); | ||
| 402 | + call_user_func_array(array(&$oColumnRegistry, 'registerView'), $aParams); | ||
| 403 | + break; | ||
| 404 | + | ||
| 405 | + case 'notification_handler': | ||
| 406 | + if(isset($aParams[2])){ | ||
| 407 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 408 | + } | ||
| 409 | + call_user_func_array(array(&$oNotificationHandlerRegistry, 'registerNotificationHandler'), $aParams); | ||
| 410 | + break; | ||
| 411 | + | ||
| 412 | + case 'template_location': | ||
| 413 | + if(isset($aParams[1])){ | ||
| 414 | + $aParams[1] = KTPluginUtil::getFullPath($aParams[1]); | ||
| 415 | + } | ||
| 416 | + call_user_func_array(array(&$oTemplating, 'addLocation2'), $aParams); | ||
| 417 | + break; | ||
| 418 | + | ||
| 419 | + case 'criterion': | ||
| 420 | + $aInit = unserialize($aParams[3]); | ||
| 421 | + if($aInit != false){ | ||
| 422 | + $aParams[3] = $aInit; | ||
| 423 | + } | ||
| 424 | + if(isset($aParams[2])){ | ||
| 425 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 426 | + } | ||
| 427 | + call_user_func_array(array(&$oCriteriaRegistry, 'registerCriterion'), $aParams); | ||
| 428 | + break; | ||
| 429 | + | ||
| 430 | + case 'widget': | ||
| 431 | + if(isset($aParams[2])){ | ||
| 432 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 433 | + } | ||
| 434 | + call_user_func_array(array(&$oWidgetFactory, 'registerWidget'), $aParams); | ||
| 435 | + break; | ||
| 436 | + | ||
| 437 | + case 'validator': | ||
| 438 | + if(isset($aParams[2])){ | ||
| 439 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 440 | + } | ||
| 441 | + call_user_func_array(array(&$oValidatorFactory, 'registerValidator'), $aParams); | ||
| 442 | + break; | ||
| 443 | + | ||
| 444 | + case 'interceptor': | ||
| 445 | + if(isset($aParams[2])){ | ||
| 446 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 447 | + } | ||
| 448 | + call_user_func_array(array(&$oInterceptorRegistry, 'registerInterceptor'), $aParams); | ||
| 449 | + break; | ||
| 450 | + | ||
| 451 | + case 'plugin': | ||
| 452 | + if(isset($aParams[2])){ | ||
| 453 | + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); | ||
| 454 | + } | ||
| 455 | + $oKTPluginRegistry->_aPluginDetails[$sName] = $aParams; | ||
| 456 | + break; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + /** | ||
| 462 | + * Get the absolute path | ||
| 463 | + */ | ||
| 464 | + function getFullPath($sPath = '') { | ||
| 465 | + if(empty($sPath)){ | ||
| 466 | + return ''; | ||
| 467 | + } | ||
| 468 | + $sPath = (KTUtil::isAbsolutePath($sPath)) ? $sPath : KT_DIR . '/' . $sPath; | ||
| 469 | + return $sPath; | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + /** | ||
| 473 | + * This loads the plugins in the plugins folder. It searches for files ending with 'Plugin.php'. | ||
| 474 | + * This is called by the 'Re-read plugins' action in the web interface. | ||
| 475 | + */ | ||
| 476 | + function registerPlugins () { | ||
| 477 | + global $default; | ||
| 478 | + | ||
| 479 | + // Path to lock file | ||
| 480 | + $cacheDir = $default->cacheDirectory . DIRECTORY_SEPARATOR; | ||
| 481 | + $lockFile = $cacheDir.'plugin_register.lock'; | ||
| 482 | + | ||
| 483 | + // Check if the lock file exists | ||
| 484 | + if(KTPluginUtil::doCheck($lockFile)){ | ||
| 485 | + return true; | ||
| 486 | + } | ||
| 487 | + | ||
| 488 | + // Create the lock file, run through the plugin registration and then delete the lock file | ||
| 489 | + touch($lockFile); | ||
| 490 | + KTPluginUtil::doPluginRegistration(); | ||
| 491 | + @unlink($lockFile); | ||
| 492 | + } | ||
| 493 | + | ||
| 494 | + /** | ||
| 495 | + * Check the lockfile | ||
| 496 | + */ | ||
| 497 | + function doCheck($lockFile) | ||
| 498 | + { | ||
| 499 | + if(file_exists($lockFile)){ | ||
| 500 | + // If it does exist, do a stat on it to check when it was created. | ||
| 501 | + // if it was accessed more than 5 minutes ago then delete it and proceed with the plugin registration | ||
| 502 | + // otherwise wait till lock file is deleted signalling that the registration is complete and return. | ||
| 503 | + | ||
| 504 | + $stat = stat($lockFile); | ||
| 505 | + | ||
| 506 | + $time = time() - (60 * 5); | ||
| 507 | + if($stat['mtime'] > $time){ | ||
| 508 | + | ||
| 509 | + $cnt = 0; | ||
| 510 | + | ||
| 511 | + while(file_exists($lockFile)){ | ||
| 512 | + $cnt++; | ||
| 513 | + sleep(2); | ||
| 514 | + | ||
| 515 | + // if we've been waiting too long - typically it should only take a few seconds so 2 mins is too much time. | ||
| 516 | + if($cnt > 60){ | ||
| 517 | + @unlink($lockFile); | ||
| 518 | + return false; | ||
| 519 | + } | ||
| 520 | + } | ||
| 521 | + return true; | ||
| 522 | + } | ||
| 523 | + @unlink($lockFile); | ||
| 524 | + } | ||
| 525 | + return false; | ||
| 526 | + } | ||
| 527 | + | ||
| 528 | + /* Get the priority of the plugin */ | ||
| 529 | + function getPluginPriority($sFile) { | ||
| 530 | + $defaultPriority = 10; | ||
| 531 | + $priority = array( | ||
| 532 | + "ktcore" => 1, | ||
| 533 | + "ktstandard" => 2, | ||
| 534 | + "i18n" => 3 | ||
| 535 | + ); | ||
| 536 | + foreach($priority as $pattern => $priority) { | ||
| 537 | + if(ereg($pattern, $sFile)) { | ||
| 538 | + return $priority; | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + return $defaultPriority; | ||
| 542 | + } | ||
| 543 | + | ||
| 544 | + /** | ||
| 545 | + * Read the plugins directory and register all plugins in the database. | ||
| 546 | + */ | ||
| 547 | + function doPluginRegistration() | ||
| 548 | + { | ||
| 549 | + global $default; | ||
| 550 | + | ||
| 551 | + KTPluginUtil::_deleteSmartyFiles(); | ||
| 552 | + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); | ||
| 553 | + $oCache =& KTCache::getSingleton(); | ||
| 554 | + $oCache->deleteAllCaches(); | ||
| 555 | + | ||
| 556 | + // Remove all entries from the plugin_helper table and refresh it. | ||
| 557 | + $query = "DELETE FROM plugin_helper"; | ||
| 558 | + $res = DBUtil::runQuery($query); | ||
| 559 | + | ||
| 560 | + $files = array(); | ||
| 561 | + $plugins = array(); | ||
| 562 | + | ||
| 563 | + KTPluginUtil::_walk(KT_DIR . '/plugins', $files); | ||
| 564 | + foreach ($files as $sFile) { | ||
| 565 | + $plugin_ending = "Plugin.php"; | ||
| 566 | + if (substr($sFile, -strlen($plugin_ending)) === $plugin_ending) { | ||
| 567 | + /* Set default priority */ | ||
| 568 | + $plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile); | ||
| 569 | + } | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + /* Sort the plugins by priority */ | ||
| 573 | + asort($plugins); | ||
| 574 | + | ||
| 575 | + /* | ||
| 576 | + Add a check to indicate that plugin registration is occuring. | ||
| 577 | + This check has been put in place to prevent the plugin being registered on every page load. | ||
| 578 | + */ | ||
| 579 | + $_SESSION['plugins_registerplugins'] = true; | ||
| 580 | + foreach($plugins as $sFile => $priority) { | ||
| 581 | + require_once($sFile); | ||
| 582 | + } | ||
| 583 | + $_SESSION['plugins_registerplugins'] = false; | ||
| 584 | + | ||
| 585 | + $oRegistry =& KTPluginRegistry::getSingleton(); | ||
| 586 | + $aRegistryList = $oRegistry->getPlugins(); | ||
| 587 | + foreach ($aRegistryList as $oPlugin) { | ||
| 588 | + $res = $oPlugin->register(); | ||
| 589 | + if (PEAR::isError($res)) { | ||
| 590 | + //var_dump($res); | ||
| 591 | + $default->log->debug('Register of plugin failed: ' . $res->getMessage()); | ||
| 592 | + } | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + $aPluginList = KTPluginEntity::getList(); | ||
| 596 | + foreach ($aPluginList as $oPluginEntity) { | ||
| 597 | + $sPath = $oPluginEntity->getPath(); | ||
| 598 | + if (!KTUtil::isAbsolutePath($sPath)) { | ||
| 599 | + $sPath = sprintf("%s/%s", KT_DIR, $sPath); | ||
| 600 | + } | ||
| 601 | + if (!file_exists($sPath)) { | ||
| 602 | + $oPluginEntity->setUnavailable(true); | ||
| 603 | + $oPluginEntity->setDisabled(true); | ||
| 604 | + $res = $oPluginEntity->update(); | ||
| 605 | + } | ||
| 606 | + } | ||
| 607 | + KTPluginEntity::clearAllCaches(); | ||
| 608 | + | ||
| 609 | + KTPluginUtil::_deleteSmartyFiles(); | ||
| 610 | + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); | ||
| 611 | + $oCache =& KTCache::getSingleton(); | ||
| 612 | + $oCache->deleteAllCaches(); | ||
| 613 | + | ||
| 614 | + //KTPluginUtil::removePluginCache(); | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + function _deleteSmartyFiles() { | ||
| 618 | + $oConfig =& KTConfig::getSingleton(); | ||
| 619 | + $dir = sprintf('%s/%s', $oConfig->get('urls/varDirectory'), 'tmp'); | ||
| 620 | + | ||
| 621 | + $dh = @opendir($dir); | ||
| 622 | + if (empty($dh)) { | ||
| 623 | + return; | ||
| 624 | + } | ||
| 625 | + $aFiles = array(); | ||
| 626 | + while (false !== ($sFilename = readdir($dh))) { | ||
| 627 | + if (substr($sFilename, -10) == "smarty.inc") { | ||
| 628 | + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); | ||
| 629 | + } | ||
| 630 | + if (substr($sFilename, -10) == "smarty.php") { | ||
| 631 | + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); | ||
| 632 | + } | ||
| 633 | + } | ||
| 634 | + foreach ($aFiles as $sFile) { | ||
| 635 | + @unlink($sFile); | ||
| 636 | + } | ||
| 637 | + } | ||
| 638 | + | ||
| 639 | + function _walk ($path, &$files) { | ||
| 640 | + if (!is_dir($path)) { | ||
| 641 | + return; | ||
| 642 | + } | ||
| 643 | + $dirh = opendir($path); | ||
| 644 | + while (($entry = readdir($dirh)) !== false) { | ||
| 645 | + if (in_array($entry, array('.', '..'))) { | ||
| 646 | + continue; | ||
| 647 | + } | ||
| 648 | + $newpath = $path . '/' . $entry; | ||
| 649 | + if (is_dir($newpath)) { | ||
| 650 | + KTPluginUtil::_walk($newpath, $files); | ||
| 651 | + } | ||
| 652 | + if (!is_file($newpath)) { | ||
| 653 | + continue; | ||
| 654 | + } | ||
| 655 | + $files[] = $newpath; | ||
| 656 | + } | ||
| 657 | + } | ||
| 658 | + | ||
| 659 | + function resourceIsRegistered($path) { | ||
| 660 | + $oRegistry =& KTPluginResourceRegistry::getSingleton(); | ||
| 661 | + return $oRegistry->isRegistered($path); | ||
| 662 | + } | ||
| 663 | + | ||
| 664 | + function registerResource($path) { | ||
| 665 | + $oRegistry =& KTPluginResourceRegistry::getSingleton(); | ||
| 666 | + $oRegistry->registerResource($path); | ||
| 667 | + } | ||
| 668 | + | ||
| 669 | + function readResource($sPath) { | ||
| 670 | + global $default; | ||
| 671 | + $php_file = ".php"; | ||
| 672 | + if (substr($sPath, -strlen($php_file)) === $php_file) { | ||
| 673 | + require_once($php_file); | ||
| 674 | + } else { | ||
| 675 | + $pi = pathinfo($sPath); | ||
| 676 | + $mime_type = ""; | ||
| 677 | + $sExtension = KTUtil::arrayGet($pi, 'extension'); | ||
| 678 | + if (!empty($sExtension)) { | ||
| 679 | + $mime_type = DBUtil::getOneResultKey(array("SELECT mimetypes FROM " . $default->mimetypes_table . " WHERE LOWER(filetypes) = ?", $sExtension), "mimetypes"); | ||
| 680 | + } | ||
| 681 | + if (empty($mime_type)) { | ||
| 682 | + $mime_type = "application/octet-stream"; | ||
| 683 | + } | ||
| 684 | + $sFullPath = KT_DIR . '/plugins' . $sPath; | ||
| 685 | + header("Content-Type: $mime_type"); | ||
| 686 | + header("Content-Length: " . filesize($sFullPath)); | ||
| 687 | + readfile($sFullPath); | ||
| 688 | + } | ||
| 689 | + } | ||
| 690 | + | ||
| 691 | + /** | ||
| 692 | + * Get the full path to the plugin | ||
| 693 | + * | ||
| 694 | + * @param string $sNamespace The namespace of the plugin | ||
| 695 | + * @param bool $relative Whether the path should be relative or full | ||
| 696 | + * @return string | ||
| 697 | + */ | ||
| 698 | + static function getPluginPath($sNamespace, $relative = false) | ||
| 699 | + { | ||
| 700 | + $oEntity = KTPluginEntity::getByNamespace($sNamespace); | ||
| 701 | + | ||
| 702 | + if(PEAR::isError($oEntity)){ | ||
| 703 | + return $oEntity; | ||
| 704 | + } | ||
| 705 | + $dir = dirname($oEntity->getPath()) . '/'; | ||
| 706 | + | ||
| 707 | + if(!$relative){ | ||
| 708 | + $dir = KT_DIR . '/' . $dir; | ||
| 709 | + } | ||
| 710 | + | ||
| 711 | + return $dir; | ||
| 712 | + } | ||
| 713 | + | ||
| 714 | + // utility function to detect if the plugin is loaded and active. | ||
| 715 | + static function pluginIsActive($sNamespace) { | ||
| 716 | + | ||
| 717 | + $oReg =& KTPluginRegistry::getSingleton(); | ||
| 718 | + $plugin = $oReg->getPlugin($sNamespace); | ||
| 719 | + | ||
| 720 | + if (is_null($plugin) || PEAR::isError($plugin)) { return false; } // no such plugin | ||
| 721 | + else { // check if its active | ||
| 722 | + $ent = KTPluginEntity::getByNamespace($sNamespace); | ||
| 723 | + | ||
| 724 | + if (PEAR::isError($ent)) { return false; } | ||
| 725 | + | ||
| 726 | + // we now can ask | ||
| 727 | + return (!$ent->getDisabled()); | ||
| 728 | + } | ||
| 729 | + } | ||
| 730 | +} | ||
| 731 | + | ||
| 732 | +?> |
setup/wizard/steps/complete.php
| @@ -69,10 +69,14 @@ class complete extends Step { | @@ -69,10 +69,14 @@ class complete extends Step { | ||
| 69 | $this->checkFileSystem(); // check filesystem (including location of document directory and logging) | 69 | $this->checkFileSystem(); // check filesystem (including location of document directory and logging) |
| 70 | $this->checkDb(); // check database | 70 | $this->checkDb(); // check database |
| 71 | $this->checkServices(); // check services | 71 | $this->checkServices(); // check services |
| 72 | - $this->checkInstallType();// Set silent mode variables | ||
| 73 | - $this->storeSilent();// Set silent mode variables | 72 | + $this->checkInstallType(); // Set silent mode variables |
| 73 | + $this->storeSilent(); // Set silent mode variables | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | + /** | ||
| 77 | + * Check all the system paths | ||
| 78 | + * | ||
| 79 | + */ | ||
| 76 | private function checkFileSystem() | 80 | private function checkFileSystem() |
| 77 | { | 81 | { |
| 78 | // defaults | 82 | // defaults |
| @@ -130,6 +134,10 @@ class complete extends Step { | @@ -130,6 +134,10 @@ class complete extends Step { | ||
| 130 | } | 134 | } |
| 131 | } | 135 | } |
| 132 | 136 | ||
| 137 | + /** | ||
| 138 | + * Check if a database connection can be made | ||
| 139 | + * | ||
| 140 | + */ | ||
| 133 | private function checkDb() | 141 | private function checkDb() |
| 134 | { | 142 | { |
| 135 | // defaults | 143 | // defaults |
| @@ -199,6 +207,10 @@ class complete extends Step { | @@ -199,6 +207,10 @@ class complete extends Step { | ||
| 199 | } | 207 | } |
| 200 | } | 208 | } |
| 201 | 209 | ||
| 210 | + /** | ||
| 211 | + * Check if all services are deactivated | ||
| 212 | + * | ||
| 213 | + */ | ||
| 202 | private function checkServices() | 214 | private function checkServices() |
| 203 | { | 215 | { |
| 204 | $services = new services(); | 216 | $services = new services(); |
| @@ -217,15 +229,41 @@ class complete extends Step { | @@ -217,15 +229,41 @@ class complete extends Step { | ||
| 217 | return true; | 229 | return true; |
| 218 | } | 230 | } |
| 219 | 231 | ||
| 232 | + /** | ||
| 233 | + * Check the install type and store | ||
| 234 | + * | ||
| 235 | + */ | ||
| 220 | function checkInstallType() { | 236 | function checkInstallType() { |
| 221 | if ($this->util->isMigration()) { | 237 | if ($this->util->isMigration()) { |
| 222 | $this->migrate_check = true; | 238 | $this->migrate_check = true; |
| 239 | + $this->registerPlugins(); // Set silent mode variables | ||
| 223 | } else { | 240 | } else { |
| 224 | $this->migrate_check = false; | 241 | $this->migrate_check = false; |
| 225 | } | 242 | } |
| 226 | } | 243 | } |
| 227 | 244 | ||
| 228 | /** | 245 | /** |
| 246 | + * Register extra commercial plugins | ||
| 247 | + * | ||
| 248 | + */ | ||
| 249 | + private function registerPlugins() { | ||
| 250 | +// define(KT_LIB_DIR, SYSTEM_DIR); | ||
| 251 | +// require_once(WIZARD_DIR . "lib" . DS . "plugins". DS . "pluginutil.inc.php"); | ||
| 252 | + KTPluginUtil::_walk(KT_DIR . '/plugins', $files); | ||
| 253 | + foreach ($files as $sFile) { | ||
| 254 | + $plugin_ending = "Plugin.php"; | ||
| 255 | + if (substr($sFile, -strlen($plugin_ending)) === $plugin_ending) { | ||
| 256 | + /* Set default priority */ | ||
| 257 | + $plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile); | ||
| 258 | + } | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + /* Sort the plugins by priority */ | ||
| 262 | + asort($plugins); | ||
| 263 | + print_r($plugins); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + /** | ||
| 229 | * Set all silent mode varibles | 267 | * Set all silent mode varibles |
| 230 | * | 268 | * |
| 231 | */ | 269 | */ |
| @@ -236,7 +274,6 @@ class complete extends Step { | @@ -236,7 +274,6 @@ class complete extends Step { | ||
| 236 | $this->temp_variables['database_check'] = $this->database_check; | 274 | $this->temp_variables['database_check'] = $this->database_check; |
| 237 | $this->temp_variables['migrate_check'] = $this->migrate_check; | 275 | $this->temp_variables['migrate_check'] = $this->migrate_check; |
| 238 | $this->temp_variables['servicesValidation'] = $this->servicesValidation; | 276 | $this->temp_variables['servicesValidation'] = $this->servicesValidation; |
| 239 | - //if(!$this->pathsSection) {die;} else {echo 'huh';} | ||
| 240 | $this->temp_variables['pathsSection'] = $this->pathsSection; | 277 | $this->temp_variables['pathsSection'] = $this->pathsSection; |
| 241 | $this->temp_variables['databaseSection'] = $this->databaseSection; | 278 | $this->temp_variables['databaseSection'] = $this->databaseSection; |
| 242 | $this->temp_variables['privilegesSection'] = $this->privilegesSection; | 279 | $this->temp_variables['privilegesSection'] = $this->privilegesSection; |
setup/wizard/steps/install.php
| @@ -60,6 +60,7 @@ class install extends step | @@ -60,6 +60,7 @@ class install extends step | ||
| 60 | * @var array | 60 | * @var array |
| 61 | */ | 61 | */ |
| 62 | protected $runInstall = true; | 62 | protected $runInstall = true; |
| 63 | + private $ce_check = false; | ||
| 63 | 64 | ||
| 64 | public function doStep() { | 65 | public function doStep() { |
| 65 | $this->temp_variables = array("step_name"=>"install"); | 66 | $this->temp_variables = array("step_name"=>"install"); |
| @@ -89,6 +90,7 @@ class install extends step | @@ -89,6 +90,7 @@ class install extends step | ||
| 89 | public function doRun() | 90 | public function doRun() |
| 90 | { | 91 | { |
| 91 | $value = 'disable'; | 92 | $value = 'disable'; |
| 93 | + $this->checkInstallType(); // Set silent mode variables | ||
| 92 | if(isset($_POST['Install'])) { | 94 | if(isset($_POST['Install'])) { |
| 93 | if(isset($_POST['call_home'])){ | 95 | if(isset($_POST['call_home'])){ |
| 94 | $value = $_POST['call_home']; | 96 | $value = $_POST['call_home']; |
| @@ -104,6 +106,24 @@ class install extends step | @@ -104,6 +106,24 @@ class install extends step | ||
| 104 | $this->callHome(); | 106 | $this->callHome(); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 109 | + /** | ||
| 110 | + * Check the install type and store | ||
| 111 | + * | ||
| 112 | + */ | ||
| 113 | + function checkInstallType() { | ||
| 114 | + if ($this->util->isCommunity()) { | ||
| 115 | + $this->ce_check = true; | ||
| 116 | + $this->registerPlugins(); // Set silent mode variables | ||
| 117 | + } else { | ||
| 118 | + $this->ce_check = false; | ||
| 119 | + } | ||
| 120 | + $this->temp_variables['ce_check'] = $this->ce_check; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + function registerPlugins() { | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + | ||
| 107 | public function callHome() { | 127 | public function callHome() { |
| 108 | $conf = $this->getDataFromSession("install"); // retrieve database information from session | 128 | $conf = $this->getDataFromSession("install"); // retrieve database information from session |
| 109 | $dbconf = $this->getDataFromSession("database"); | 129 | $dbconf = $this->getDataFromSession("database"); |
| @@ -116,5 +136,7 @@ class install extends step | @@ -116,5 +136,7 @@ class install extends step | ||
| 116 | $this->util->dbUtilities->query($query); | 136 | $this->util->dbUtilities->query($query); |
| 117 | $this->util->dbUtilities->close(); // close the database connection | 137 | $this->util->dbUtilities->close(); // close the database connection |
| 118 | } | 138 | } |
| 139 | + | ||
| 140 | + | ||
| 119 | } | 141 | } |
| 120 | ?> | 142 | ?> |
| 121 | \ No newline at end of file | 143 | \ No newline at end of file |
setup/wizard/templates/install.tpl
| 1 | <form id="registration_install_complete" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> | 1 | <form id="registration_install_complete" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> |
| 2 | <p class="title">Finalizing System Installation</p> | 2 | <p class="title">Finalizing System Installation</p> |
| 3 | - <div id="step_content_<?php echo $step_name; ?>" class="step"> | 3 | + <?php if(!$ce_check) { ?> |
| 4 | + <div id="step_content_<?php echo $step_name; ?>" class="step"> | ||
| 5 | + <?php } else { ?> | ||
| 6 | + <div id="step_content" class="step"> | ||
| 7 | + <?php } ?> | ||
| 4 | <p class="empty_space" style="font-size:11pt;"> The wizard will now complete the installation and run a final check on your system. </p> | 8 | <p class="empty_space" style="font-size:11pt;"> The wizard will now complete the installation and run a final check on your system. </p> |
| 5 | <!-- <br/>--> | 9 | <!-- <br/>--> |
| 10 | +<?php if(!$ce_check) { ?> | ||
| 6 | <p class="empty_space" style="font-size:11pt;" id="left_space"> | 11 | <p class="empty_space" style="font-size:11pt;" id="left_space"> |
| 7 | We would greatly appreciate it if you would allow us to collect anonymous usage statistics to help us provide a better quality product. | 12 | We would greatly appreciate it if you would allow us to collect anonymous usage statistics to help us provide a better quality product. |
| 8 | <br/> | 13 | <br/> |
| @@ -13,6 +18,9 @@ | @@ -13,6 +18,9 @@ | ||
| 13 | <!-- <br/><br/><br/><br/>--> | 18 | <!-- <br/><br/><br/><br/>--> |
| 14 | <p> <input type='checkbox' name='call_home' value='enable' checked style="float:left;"/> | 19 | <p> <input type='checkbox' name='call_home' value='enable' checked style="float:left;"/> |
| 15 | <label for='call_home'>Help to improve KnowledgeTree by providing anonymous usage statistics</label></p> | 20 | <label for='call_home'>Help to improve KnowledgeTree by providing anonymous usage statistics</label></p> |
| 21 | +<?php } else { ?> | ||
| 22 | + | ||
| 23 | +<?php } ?> | ||
| 16 | </div> | 24 | </div> |
| 17 | <input type="submit" name="Previous" value="Previous" class="button_previous"/> | 25 | <input type="submit" name="Previous" value="Previous" class="button_previous"/> |
| 18 | <input type="submit" name="Install" value="Install" class="button_next"/> | 26 | <input type="submit" name="Install" value="Install" class="button_next"/> |