diff --git a/setup/migrate/config/commercial_config.xml b/setup/migrate/config/commercial_config.xml index a41216e..515155a 100644 --- a/setup/migrate/config/commercial_config.xml +++ b/setup/migrate/config/commercial_config.xml @@ -10,8 +10,8 @@ installation - database - services + database + services complete \ No newline at end of file diff --git a/setup/migrate/config/community_config.xml b/setup/migrate/config/community_config.xml index d4c6097..cef60c5 100644 --- a/setup/migrate/config/community_config.xml +++ b/setup/migrate/config/community_config.xml @@ -10,8 +10,8 @@ installation - database - services + database + services complete \ No newline at end of file diff --git a/setup/migrate/steps/migrateComplete.php b/setup/migrate/steps/migrateComplete.php index 1609660..65c20b7 100644 --- a/setup/migrate/steps/migrateComplete.php +++ b/setup/migrate/steps/migrateComplete.php @@ -53,7 +53,8 @@ class migrateComplete extends Step { private $database_check = 'tick'; protected $conf = array(); protected $silent = true; - + protected $mysqlServiceName = "KTMysql"; + function doStep() { $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); $this->doRun(); @@ -128,6 +129,9 @@ class migrateComplete extends Step { $this->temp_variables['services'][$serv->getName()]['class'] = $state; $this->temp_variables['services'][$serv->getName()]['name'] = $serv->getName(); } + if(!$this->checkMysql()) { + return false; + } if ($this->services_check != 'tick') { return false; } @@ -136,6 +140,41 @@ class migrateComplete extends Step { } /** + * Check if services are uninstall + * + */ + private function checkMysql() { + $running = false; + if(WINDOWS_OS) { + $cmd = "sc query {$this->mysqlServiceName}"; + $response = $this->util->pexec($cmd); + if($response['out']) { + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key + } + if($state == "STARTED") { + return true; + } + } else { + $installation = $this->getDataFromSession("installation"); // Get installation directory + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; + if(file_exists($mysqlPid)) + $running = true; + } + if($running) { + $this->temp_variables['services']['KTMysql']['class'] = "cross"; + $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; + $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; + $this->error[] = "Service : KTMysql running.
"; + return false; + } else { + $this->temp_variables['services']['KTMysql']['class'] = "tick"; + $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; + $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled"; + return true; + } + } + + /** * Set all silent mode varibles * */ diff --git a/setup/migrate/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php index 179d212..bd6746c 100644 --- a/setup/migrate/steps/migrateDatabase.php +++ b/setup/migrate/steps/migrateDatabase.php @@ -168,8 +168,8 @@ class migrateDatabase extends Step } $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; if($noFile) { - $this->error[]['error'] = "Could not connect to the KnowledgeTree Database"; - $this->error[]['msg'] = "Make sure all KnowledgeTree Services are running."; + $this->error[]['error'] = "The KnowledgeTree Setup Wizard was unable to connect to your KnowledgeTree 3.6.1 database"; + $this->error[]['msg'] = "Please ensure that all KnowledgeTree Services are running."; $this->error[]['cmd'] = "

Click Next after resolving the above errors.

"; $this->temp_variables['manual_export'] = ""; } else { diff --git a/setup/migrate/steps/migrateServices.php b/setup/migrate/steps/migrateServices.php index b1f0aed..a701639 100644 --- a/setup/migrate/steps/migrateServices.php +++ b/setup/migrate/steps/migrateServices.php @@ -116,6 +116,7 @@ class migrateServices extends Step protected $conf = array(); + protected $mysqlServiceName = "KTMysql"; /** * Main control of services setup * @@ -186,9 +187,23 @@ class migrateServices extends Step } private function mysqlRunning() { - $installation = $this->getDataFromSession("installation"); // Get installation directory - $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; - if(file_exists($mysqlPid)) { + $running = false; + if(WINDOWS_OS) { + $cmd = "sc query {$this->mysqlServiceName}"; + $response = $this->util->pexec($cmd); + if($response['out']) { + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key + } + if($state == "STARTED") { + return true; + } + } else { + $installation = $this->getDataFromSession("installation"); // Get installation directory + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; + if(file_exists($mysqlPid)) + $running = true; + } + if(file_exists($running)) { return true; } return false; @@ -247,6 +262,12 @@ class migrateServices extends Step $serv->uninstall(); } } + $this->shutdownMysql(); + } + + private function shutdownMysql() { + $cmd = "sc stop {$this->mysqlServiceName}"; + $response = $this->util->pexec($cmd); } /** @@ -287,9 +308,23 @@ class migrateServices extends Step * */ private function checkMysql() { - $installation = $this->getDataFromSession("installation"); // Get installation directory - $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; - if(file_exists($mysqlPid)) { + $running = false; + if(WINDOWS_OS) { + $cmd = "sc query {$this->mysqlServiceName}"; + $response = $this->util->pexec($cmd); + if($response['out']) { + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key + } + if($state == "STARTED") { + return true; + } + } else { + $installation = $this->getDataFromSession("installation"); // Get installation directory + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; + if(file_exists($mysqlPid)) + $running = true; + } + if($running) { $this->temp_variables['services']['KTMysql']['class'] = "cross"; $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; diff --git a/setup/migrate/templates/database.tpl b/setup/migrate/templates/database.tpl index da30653..bc2e993 100644 --- a/setup/migrate/templates/database.tpl +++ b/setup/migrate/templates/database.tpl @@ -11,8 +11,7 @@ //print_r($errors); ?> -

The Setup Wizard will now migrate your existing database to the new Zend Server stack. This process may take - several minutes to complete.


+

The Setup Wizard will now export your existing database in preparation for the migration to the new KnowledgeTree Stack.


Please ensure that your database is backed up before proceeding. If you need assistance with backing up see the  'Backing up and restoring KnowledgeTree'  wiki entry.

diff --git a/setup/migrate/templates/installation.tpl b/setup/migrate/templates/installation.tpl index 4bc960b..df6998b 100644 --- a/setup/migrate/templates/installation.tpl +++ b/setup/migrate/templates/installation.tpl @@ -4,9 +4,9 @@ -       + @@ -26,19 +26,18 @@

- Enter the full path of the installation you wish to upgrade: + The Setup Wizard will now prepare your current KnowledgeTree database for migration to the new KnowledgeTree Stack. +

+ +

+ Please enter the full path of the installation you wish to upgrade:

-

- The default is 'C:\Program Files\ktdms' on Windows and '/opt/ktdms' or '/home/username/ktdms/' on other operating systems. -

-

- - Make sure that the KnowledgeTree services are running. - -

-
+

+

+ (The default is 'C:\Program Files\ktdms' on Windows and '/opt/ktdms' or '/home/username/ktdms/' on other operating systems.) +

- + js('form.js'); } ?> \ No newline at end of file diff --git a/setup/replace.php b/setup/replace.php new file mode 100644 index 0000000..7ff7fd7 --- /dev/null +++ b/setup/replace.php @@ -0,0 +1,90 @@ +"; + $fileLines = array(); + $file_handle = fopen($path, "rb"); + while (!feof($file_handle) ) { + $line_of_text = fgets($file_handle); + $parts = explode('=', $line_of_text); + $fileLines[] = trim($line_of_text); + } + fclose($file_handle); + + return $fileLines; +} + +function scan_directory_recursively($directory, $filter=FALSE) +{ + if(substr($directory,-1) == '/') + { + $directory = substr($directory,0,-1); + } + if(!file_exists($directory) || !is_dir($directory)) + { + return FALSE; + }elseif(is_readable($directory)) + { + $directory_list = opendir($directory); + while($file = readdir($directory_list)) + { + if($file != '.' && $file != '..') + { + $path = $directory.'/'.$file; + if(is_readable($path)) + { + $subdirectories = explode('/',$path); + if(is_dir($path)) + { + $directory_tree[] = array( + 'path' => $path, + 'name' => end($subdirectories), + 'kind' => 'directory', + 'content' => scan_directory_recursively($path, $filter)); + }elseif(is_file($path)) + { + $extension = end(explode('.',end($subdirectories))); + if($filter === FALSE || $filter == $extension) + { + $directory_tree[] = array( + 'path' => $path, + 'name' => end($subdirectories), + 'extension' => $extension, + 'size' => filesize($path), + 'kind' => 'file'); + } + } + } + } + } + closedir($directory_list); + return $directory_tree; + }else{ + return FALSE; + } +} +?> \ No newline at end of file diff --git a/setup/upgrade/lib/UpgradeItems.inc.php b/setup/upgrade/lib/UpgradeItems.inc.php index 2e5e3fc..0aa4fe5 100644 --- a/setup/upgrade/lib/UpgradeItems.inc.php +++ b/setup/upgrade/lib/UpgradeItems.inc.php @@ -335,7 +335,7 @@ class SQLUpgradeItem extends UpgradeItem { $phase = 0; return array($fromVersion, $toVersion, $description, $phase); } - $matched = preg_match('#^([\d.]*)/(?:(\d*)-)?(.*)\.sql$#', $path, $matches); + $matched = preg_match('#^([\d\.-]*)/(?:(\d*)-)?(.*)\.sql$#', $path, $matches); //$matched = preg_match('#^([\d.]*)/(?:(\d*)-)?(.*):(?:(\d*))\.sql$#', $path, $matches); if ($matched != 0) { $fromVersion = $matches[1]; diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 0796d87..c684624 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -727,7 +727,13 @@ class InstallUtil { return true; return false; } - + + public function isCommunity() { + if(INSTALL_TYPE == "community") + return true; + return false; + } + /** * Determine type of installation * diff --git a/setup/wizard/lib/plugins/pluginutil.inc.php b/setup/wizard/lib/plugins/pluginutil.inc.php new file mode 100644 index 0000000..698b410 --- /dev/null +++ b/setup/wizard/lib/plugins/pluginutil.inc.php @@ -0,0 +1,732 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +//require_once(KT_LIB_DIR . '/plugins/pluginentity.inc.php'); +//require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); +// +//class KTPluginResourceRegistry { +// var $aResources = array(); +// +// function &getSingleton() { +// if (!KTUtil::arrayGet($GLOBALS, 'oKTPluginResourceRegistry')) { +// $GLOBALS['oKTPluginResourceRegistry'] = new KTPluginResourceRegistry; +// } +// return $GLOBALS['oKTPluginResourceRegistry']; +// } +// +// function registerResource($sPath) { +// $this->aResources[$sPath] = true; +// } +// +// function isRegistered($sPath) { +// if (KTUtil::arrayGet($this->aResources, $sPath)) { +// return true; +// } +// $sPath = dirname($sPath); +// if (KTUtil::arrayGet($this->aResources, $sPath)) { +// return true; +// } +// return false; +// } +//} + +class KTPluginUtil { +// const CACHE_FILENAME = 'kt_plugins.cache'; +// +// /** +// * Store the plugin cache in the cache directory. +// * @deprecated +// */ +// static function savePluginCache($array) +// { +// $config = KTConfig::getSingleton(); +// $cachePlugins = $config->get('cache/cachePlugins', false); +// if (!$cachePlugins) +// { +// return false; +// } +// +// $cacheDir = $config->get('cache/cacheDirectory'); +// +// $written = file_put_contents($cacheDir . '/' . KTPluginUtil::CACHE_FILENAME , serialize($array)); +// +// if (!$written) +// { +// global $default; +// +// $default->log->warn('savePluginCache - The cache did not write anything.'); +// +// // try unlink a zero size file - just in case +// @unlink($cacheFile); +// } +// } + +// /** +// * Remove the plugin cache. +// * @deprecated +// */ +// static function removePluginCache() +// { +// $config = KTConfig::getSingleton(); +// $cachePlugins = $config->get('cache/cachePlugins', false); +// if (!$cachePlugins) +// { +// return false; +// } +// $cacheDir = $config->get('cache/cacheDirectory'); +// +// $cacheFile=$cacheDir . '/' . KTPluginUtil::CACHE_FILENAME; +// @unlink($cacheFile); +// } + +// /** +// * Reads the plugin cache file. This must still be unserialised. +// * @deprecated +// * @return mixed Returns false on failure, or the serialised cache. +// */ +// static function readPluginCache() +// { +// $config = KTConfig::getSingleton(); +// $cachePlugins = $config->get('cache/cachePlugins', false); +// if (!$cachePlugins) +// { +// return false; +// } +// $cacheDir = $config->get('cache/cacheDirectory'); +// +// $cacheFile=$cacheDir . '/' . KTPluginUtil::CACHE_FILENAME; +// if (!is_file($cacheFile)) +// { +// return false; +// } +// +// $cache = file_get_contents($cacheFile); +// +// // we check for an empty cache in case there was a problem. We rather try and reload everything otherwise. +// if (strlen($cache) == 0) +// { +// return false; +// } +// if (!class_exists('KTPluginEntityProxy')) { +// KTEntityUtil::_proxyCreate('KTPluginEntity', 'KTPluginEntityProxy'); +// } +// +// return unserialize($cache); +// } + +// /** +// * Load the plugins for the current page +// * +// * @param unknown_type $sType +// */ +// static function loadPlugins ($sType) { +// +// // Check the current page - can be extended. +// // Currently we only distinguish between the dashboard and everything else. +// if($sType != 'dashboard'){ +// $sType = 'general'; +// } +// +// $aPlugins = array(); +// $aPluginHelpers = array(); +// $aDisabled = array(); +// +// // Get the list of enabled plugins +// $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h +// INNER JOIN plugins p ON (p.namespace = h.plugin) +// WHERE p.disabled = 0 AND h.classtype='plugin' ORDER BY p.orderby"; +// $aPluginHelpers = DBUtil::getResultArray($query); +// +// if(PEAR::isError($aPluginHelpers)){ +// global $default; +// $default->log->debug('Error in pluginutil: '.$aPluginHelpers->getMessage()); +// return false; +// } +// +// // Check that there are plugins and if not, register them +// if (empty($aPluginHelpers) || (isset($_POST['_force_plugin_truncate']))) { +// DBUtil::startTransaction(); +// KTPluginUtil::registerPlugins(); +// DBUtil::commit(); +// +// $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h +// INNER JOIN plugins p ON (p.namespace = h.plugin) +// WHERE p.disabled = 0 AND h.classtype='plugin' ORDER BY p.orderby"; +// $aPluginHelpers = DBUtil::getResultArray($query); +// } +// +// // Create plugin objects +// foreach ($aPluginHelpers as $aItem){ +// $classname = $aItem['classname']; +// $path = $aItem['pathname']; +// +// if (!empty($path)) { +// $path = KT_DIR.'/'.$path; +// require_once($path); +// +// $oPlugin = new $classname($path); +// if($oPlugin->load()){ +// $aPlugins[] = $oPlugin; +// }else{ +// $aDisabled[] = "'{$aItem['plugin']}'"; +// } +// } +// } +// +// $sDisabled = implode(',', $aDisabled); +// +// // load plugin helpers into global space +// $query = 'SELECT h.* FROM plugin_helper h +// INNER JOIN plugins p ON (p.namespace = h.plugin) +// WHERE p.disabled = 0 ';//WHERE viewtype='{$sType}'"; +// if(!empty($sDisabled)){ +// $query .= " AND h.plugin NOT IN ($sDisabled) "; +// } +// $query .= ' ORDER BY p.orderby'; +// +// $aPluginList = DBUtil::getResultArray($query); +// +// KTPluginUtil::load($aPluginList); +// +// // Load the template locations - ignore disabled plugins +// // Allow for templates that don't correctly link to the plugin +// $query = "SELECT * FROM plugin_helper h +// LEFT JOIN plugins p ON (p.namespace = h.plugin) +// WHERE h.classtype='locations' AND (disabled = 0 OR disabled IS NULL) AND unavailable = 0"; +// +// $aLocations = DBUtil::getResultArray($query); +// +// if(!empty($aLocations)){ +// $oTemplating =& KTTemplating::getSingleton(); +// foreach ($aLocations as $location){ +// $aParams = explode('|', $location['object']); +// call_user_func_array(array(&$oTemplating, 'addLocation2'), $aParams); +// } +// } +// return true; +// } + + /** + * Load the plugins into the global space + * + * @param array $aPlugins + */ + function load($aPlugins) { + + require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php'); + require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); + require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); + require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); + require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); + require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); + require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); + require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); + require_once(KT_LIB_DIR . "/help/help.inc.php"); + require_once(KT_LIB_DIR . "/workflow/workflowutil.inc.php"); + require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); + require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); + require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php"); + require_once(KT_LIB_DIR . "/browse/criteriaregistry.php"); + require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php"); + + $oPRegistry =& KTPortletRegistry::getSingleton(); + $oTRegistry =& KTTriggerRegistry::getSingleton(); + $oARegistry =& KTActionRegistry::getSingleton(); + $oPageRegistry =& KTPageRegistry::getSingleton(); + $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); + $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); + $oDashletRegistry =& KTDashletRegistry::getSingleton(); + $oi18nRegistry =& KTi18nRegistry::getSingleton(); + $oKTHelpRegistry =& KTHelpRegistry::getSingleton(); + $oWFTriggerRegistry =& KTWorkflowTriggerRegistry::getSingleton(); + $oColumnRegistry =& KTColumnRegistry::getSingleton(); + $oNotificationHandlerRegistry =& KTNotificationRegistry::getSingleton(); + $oTemplating =& KTTemplating::getSingleton(); + $oWidgetFactory =& KTWidgetFactory::getSingleton(); + $oValidatorFactory =& KTValidatorFactory::getSingleton(); + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); + $oInterceptorRegistry =& KTInterceptorRegistry::getSingleton(); + $oKTPluginRegistry =& KTPluginRegistry::getSingleton(); + + + // Loop through the loaded plugins and register them for access + foreach ($aPlugins as $plugin){ + $sName = $plugin['namespace']; + $sParams = $plugin['object']; + $aParams = explode('|', $sParams); + $sClassType = $plugin['classtype']; + + switch ($sClassType) { + case 'portlet': + $aLocation = unserialize($aParams[0]); + if($aLocation != false){ + $aParams[0] = $aLocation; + } + if(isset($aParams[3])){ + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); + } + call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $aParams); + break; + + case 'trigger': + if(isset($aParams[4])){ + $aParams[4] = KTPluginUtil::getFullPath($aParams[4]); + } + call_user_func_array(array(&$oTRegistry, 'registerTrigger'), $aParams); + break; + + case 'action': + if(isset($aParams[3])){ + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); + } + call_user_func_array(array(&$oARegistry, 'registerAction'), $aParams); + break; + + case 'page': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oPageRegistry, 'registerPage'), $aParams); + break; + + case 'authentication_provider': + if(isset($aParams[3])){ + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); + } + $aParams[0] = _kt($aParams[0]); + call_user_func_array(array(&$oAPRegistry, 'registerAuthenticationProvider'), $aParams); + break; + + case 'admin_category': + $aParams[1] = _kt($aParams[1]); + $aParams[2] = _kt($aParams[2]); + call_user_func_array(array(&$oAdminRegistry, 'registerCategory'), $aParams); + break; + + case 'admin_page': + if(isset($aParams[5])){ + $aParams[5] = KTPluginUtil::getFullPath($aParams[5]); + } + $aParams[3] = _kt($aParams[3]); + $aParams[4] = _kt($aParams[4]); + call_user_func_array(array(&$oAdminRegistry, 'registerLocation'), $aParams); + break; + + case 'dashlet': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $aParams); + break; + + case 'i18nlang': + if(isset($aParams[2]) && $aParams[2] != 'default'){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oi18nRegistry, 'registeri18nLang'), $aParams); + + + case 'i18n': + if(isset($aParams[2])){ + $aParams[1] = $aParams[2]; + unset($aParams[2]); + } else { + $aParams[1] = KTPluginUtil::getFullPath($aParams[1]); + } + call_user_func_array(array(&$oi18nRegistry, 'registeri18n'), $aParams); + break; + + case 'language': + call_user_func_array(array(&$oi18nRegistry, 'registerLanguage'), $aParams); + break; + + case 'help_language': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oKTHelpRegistry, 'registerHelp'), $aParams); + break; + + case 'workflow_trigger': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oWFTriggerRegistry, 'registerWorkflowTrigger'), $aParams); + break; + + case 'column': + if(isset($aParams[3])){ + $aParams[3] = KTPluginUtil::getFullPath($aParams[3]); + } + $aParams[0] = _kt($aParams[0]); + call_user_func_array(array(&$oColumnRegistry, 'registerColumn'), $aParams); + break; + + case 'view': + $aParams[0] = _kt($aParams[0]); + call_user_func_array(array(&$oColumnRegistry, 'registerView'), $aParams); + break; + + case 'notification_handler': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oNotificationHandlerRegistry, 'registerNotificationHandler'), $aParams); + break; + + case 'template_location': + if(isset($aParams[1])){ + $aParams[1] = KTPluginUtil::getFullPath($aParams[1]); + } + call_user_func_array(array(&$oTemplating, 'addLocation2'), $aParams); + break; + + case 'criterion': + $aInit = unserialize($aParams[3]); + if($aInit != false){ + $aParams[3] = $aInit; + } + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oCriteriaRegistry, 'registerCriterion'), $aParams); + break; + + case 'widget': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oWidgetFactory, 'registerWidget'), $aParams); + break; + + case 'validator': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oValidatorFactory, 'registerValidator'), $aParams); + break; + + case 'interceptor': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + call_user_func_array(array(&$oInterceptorRegistry, 'registerInterceptor'), $aParams); + break; + + case 'plugin': + if(isset($aParams[2])){ + $aParams[2] = KTPluginUtil::getFullPath($aParams[2]); + } + $oKTPluginRegistry->_aPluginDetails[$sName] = $aParams; + break; + } + } + } + + /** + * Get the absolute path + */ + function getFullPath($sPath = '') { + if(empty($sPath)){ + return ''; + } + $sPath = (KTUtil::isAbsolutePath($sPath)) ? $sPath : KT_DIR . '/' . $sPath; + return $sPath; + } + + /** + * This loads the plugins in the plugins folder. It searches for files ending with 'Plugin.php'. + * This is called by the 'Re-read plugins' action in the web interface. + */ + function registerPlugins () { + global $default; + + // Path to lock file + $cacheDir = $default->cacheDirectory . DIRECTORY_SEPARATOR; + $lockFile = $cacheDir.'plugin_register.lock'; + + // Check if the lock file exists + if(KTPluginUtil::doCheck($lockFile)){ + return true; + } + + // Create the lock file, run through the plugin registration and then delete the lock file + touch($lockFile); + KTPluginUtil::doPluginRegistration(); + @unlink($lockFile); + } + + /** + * Check the lockfile + */ + function doCheck($lockFile) + { + if(file_exists($lockFile)){ + // If it does exist, do a stat on it to check when it was created. + // if it was accessed more than 5 minutes ago then delete it and proceed with the plugin registration + // otherwise wait till lock file is deleted signalling that the registration is complete and return. + + $stat = stat($lockFile); + + $time = time() - (60 * 5); + if($stat['mtime'] > $time){ + + $cnt = 0; + + while(file_exists($lockFile)){ + $cnt++; + sleep(2); + + // if we've been waiting too long - typically it should only take a few seconds so 2 mins is too much time. + if($cnt > 60){ + @unlink($lockFile); + return false; + } + } + return true; + } + @unlink($lockFile); + } + return false; + } + + /* Get the priority of the plugin */ + function getPluginPriority($sFile) { + $defaultPriority = 10; + $priority = array( + "ktcore" => 1, + "ktstandard" => 2, + "i18n" => 3 + ); + foreach($priority as $pattern => $priority) { + if(ereg($pattern, $sFile)) { + return $priority; + } + } + return $defaultPriority; + } + + /** + * Read the plugins directory and register all plugins in the database. + */ + function doPluginRegistration() + { + global $default; + + KTPluginUtil::_deleteSmartyFiles(); + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); + $oCache =& KTCache::getSingleton(); + $oCache->deleteAllCaches(); + + // Remove all entries from the plugin_helper table and refresh it. + $query = "DELETE FROM plugin_helper"; + $res = DBUtil::runQuery($query); + + $files = array(); + $plugins = array(); + + KTPluginUtil::_walk(KT_DIR . '/plugins', $files); + foreach ($files as $sFile) { + $plugin_ending = "Plugin.php"; + if (substr($sFile, -strlen($plugin_ending)) === $plugin_ending) { + /* Set default priority */ + $plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile); + } + } + + /* Sort the plugins by priority */ + asort($plugins); + + /* + Add a check to indicate that plugin registration is occuring. + This check has been put in place to prevent the plugin being registered on every page load. + */ + $_SESSION['plugins_registerplugins'] = true; + foreach($plugins as $sFile => $priority) { + require_once($sFile); + } + $_SESSION['plugins_registerplugins'] = false; + + $oRegistry =& KTPluginRegistry::getSingleton(); + $aRegistryList = $oRegistry->getPlugins(); + foreach ($aRegistryList as $oPlugin) { + $res = $oPlugin->register(); + if (PEAR::isError($res)) { + //var_dump($res); + $default->log->debug('Register of plugin failed: ' . $res->getMessage()); + } + } + + $aPluginList = KTPluginEntity::getList(); + foreach ($aPluginList as $oPluginEntity) { + $sPath = $oPluginEntity->getPath(); + if (!KTUtil::isAbsolutePath($sPath)) { + $sPath = sprintf("%s/%s", KT_DIR, $sPath); + } + if (!file_exists($sPath)) { + $oPluginEntity->setUnavailable(true); + $oPluginEntity->setDisabled(true); + $res = $oPluginEntity->update(); + } + } + KTPluginEntity::clearAllCaches(); + + KTPluginUtil::_deleteSmartyFiles(); + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); + $oCache =& KTCache::getSingleton(); + $oCache->deleteAllCaches(); + + //KTPluginUtil::removePluginCache(); + } + + function _deleteSmartyFiles() { + $oConfig =& KTConfig::getSingleton(); + $dir = sprintf('%s/%s', $oConfig->get('urls/varDirectory'), 'tmp'); + + $dh = @opendir($dir); + if (empty($dh)) { + return; + } + $aFiles = array(); + while (false !== ($sFilename = readdir($dh))) { + if (substr($sFilename, -10) == "smarty.inc") { + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); + } + if (substr($sFilename, -10) == "smarty.php") { + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); + } + } + foreach ($aFiles as $sFile) { + @unlink($sFile); + } + } + + function _walk ($path, &$files) { + if (!is_dir($path)) { + return; + } + $dirh = opendir($path); + while (($entry = readdir($dirh)) !== false) { + if (in_array($entry, array('.', '..'))) { + continue; + } + $newpath = $path . '/' . $entry; + if (is_dir($newpath)) { + KTPluginUtil::_walk($newpath, $files); + } + if (!is_file($newpath)) { + continue; + } + $files[] = $newpath; + } + } + + function resourceIsRegistered($path) { + $oRegistry =& KTPluginResourceRegistry::getSingleton(); + return $oRegistry->isRegistered($path); + } + + function registerResource($path) { + $oRegistry =& KTPluginResourceRegistry::getSingleton(); + $oRegistry->registerResource($path); + } + + function readResource($sPath) { + global $default; + $php_file = ".php"; + if (substr($sPath, -strlen($php_file)) === $php_file) { + require_once($php_file); + } else { + $pi = pathinfo($sPath); + $mime_type = ""; + $sExtension = KTUtil::arrayGet($pi, 'extension'); + if (!empty($sExtension)) { + $mime_type = DBUtil::getOneResultKey(array("SELECT mimetypes FROM " . $default->mimetypes_table . " WHERE LOWER(filetypes) = ?", $sExtension), "mimetypes"); + } + if (empty($mime_type)) { + $mime_type = "application/octet-stream"; + } + $sFullPath = KT_DIR . '/plugins' . $sPath; + header("Content-Type: $mime_type"); + header("Content-Length: " . filesize($sFullPath)); + readfile($sFullPath); + } + } + + /** + * Get the full path to the plugin + * + * @param string $sNamespace The namespace of the plugin + * @param bool $relative Whether the path should be relative or full + * @return string + */ + static function getPluginPath($sNamespace, $relative = false) + { + $oEntity = KTPluginEntity::getByNamespace($sNamespace); + + if(PEAR::isError($oEntity)){ + return $oEntity; + } + $dir = dirname($oEntity->getPath()) . '/'; + + if(!$relative){ + $dir = KT_DIR . '/' . $dir; + } + + return $dir; + } + + // utility function to detect if the plugin is loaded and active. + static function pluginIsActive($sNamespace) { + + $oReg =& KTPluginRegistry::getSingleton(); + $plugin = $oReg->getPlugin($sNamespace); + + if (is_null($plugin) || PEAR::isError($plugin)) { return false; } // no such plugin + else { // check if its active + $ent = KTPluginEntity::getByNamespace($sNamespace); + + if (PEAR::isError($ent)) { return false; } + + // we now can ask + return (!$ent->getDisabled()); + } + } +} + +?> diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 3e6f299..eba0223 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -45,6 +45,8 @@ define('AGENT', 'IE6'); } else if(preg_match("/MSIE 7\.\d/", $browser)) { define('AGENT', 'IE7'); + } else if(preg_match("/MSIE 8\.\d/", $browser)) { + define('AGENT', 'IE8'); } else { define('AGENT', 'OTHER'); } @@ -64,7 +66,6 @@ } else { define('DS', '/'); } - $wizard = realpath(dirname(__FILE__)); // Define environment root $wizard = realpath(dirname(__FILE__)); $xdir = explode(DS, $wizard); diff --git a/setup/wizard/resources/css/ie7.css b/setup/wizard/resources/css/ie7.css index cbe9d70..d58c963 100644 --- a/setup/wizard/resources/css/ie7.css +++ b/setup/wizard/resources/css/ie7.css @@ -1,27 +1,3 @@ #logo { right:70%; } - -.onclick { - cursor: pointer; - color: #EC7725; - /*width: 150px;*/width:350px;padding-top:12px;position:static; -} - -.dependency_details { - padding-top:12px; - position:static; - width:650px; -} - -.dependencies { - position:static; - right:30%; - width:650px; -} - -.description_complete { - position:static; - right:35%; - width:100%; -} \ No newline at end of file diff --git a/setup/wizard/resources/css/ie8.css b/setup/wizard/resources/css/ie8.css new file mode 100644 index 0000000..947b34e --- /dev/null +++ b/setup/wizard/resources/css/ie8.css @@ -0,0 +1,3 @@ +#logo { + right:70%; +} \ No newline at end of file diff --git a/setup/wizard/resources/css/wizard.css b/setup/wizard/resources/css/wizard.css index 84adbf2..4c30e23 100644 --- a/setup/wizard/resources/css/wizard.css +++ b/setup/wizard/resources/css/wizard.css @@ -368,7 +368,7 @@ select { .onclick { cursor: pointer; color: #EC7725; - /*width: 150px;*/width:350px;top:12px;position:relative; + /*width: 150px;*//*width:350px;top:12px;position:relative;*/width:350px;padding-top:12px;position:static; } .description { @@ -563,15 +563,15 @@ td.dir_description { } .dependency_details { - top:12px; - position:relative; + /*top:12px;*/padding-top:12px; + /*position:relative;*/position:static; width:650px; } .dependencies { - position:relative; + /*position:relative;*/position:static; right:30%; - width:880px; + /*width:880px;*/width:650px; } .registration_template { @@ -583,7 +583,7 @@ td.dir_description { } .description_complete { - position:relative; + /*position:relative;*/position:static; right:35%; width:100%; } @@ -594,4 +594,11 @@ td.dir_description { .advoptions { top:0px; +} + +.description_1 { + color:#898989; + font-size:100%; + line-height:150%; + font-family:sans-serif; } \ No newline at end of file diff --git a/setup/wizard/steps/complete.php b/setup/wizard/steps/complete.php index bf7b214..6309b5f 100644 --- a/setup/wizard/steps/complete.php +++ b/setup/wizard/steps/complete.php @@ -61,6 +61,10 @@ class complete extends Step { function doStep() { $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); + $this->temp_variables['isCE'] = false; + $type = $this->util->getVersionType(); + if($type == "community") + $this->temp_variables['isCE'] = true; $this->doRun(); return 'landing'; } @@ -69,10 +73,14 @@ class complete extends Step { $this->checkFileSystem(); // check filesystem (including location of document directory and logging) $this->checkDb(); // check database $this->checkServices(); // check services - $this->checkInstallType();// Set silent mode variables - $this->storeSilent();// Set silent mode variables + $this->checkInstallType(); // Set silent mode variables + $this->storeSilent(); // Set silent mode variables } + /** + * Check all the system paths + * + */ private function checkFileSystem() { // defaults @@ -130,6 +138,10 @@ class complete extends Step { } } + /** + * Check if a database connection can be made + * + */ private function checkDb() { // defaults @@ -199,6 +211,10 @@ class complete extends Step { } } + /** + * Check if all services are deactivated + * + */ private function checkServices() { $services = new services(); @@ -217,15 +233,28 @@ class complete extends Step { return true; } + /** + * Check the install type and store + * + */ function checkInstallType() { if ($this->util->isMigration()) { $this->migrate_check = true; + $this->registerPlugins(); // Set silent mode variables } else { $this->migrate_check = false; } } /** + * Register extra commercial plugins + * + */ + private function registerPlugins() { + + } + + /** * Set all silent mode varibles * */ @@ -236,7 +265,6 @@ class complete extends Step { $this->temp_variables['database_check'] = $this->database_check; $this->temp_variables['migrate_check'] = $this->migrate_check; $this->temp_variables['servicesValidation'] = $this->servicesValidation; - //if(!$this->pathsSection) {die;} else {echo 'huh';} $this->temp_variables['pathsSection'] = $this->pathsSection; $this->temp_variables['databaseSection'] = $this->databaseSection; $this->temp_variables['privilegesSection'] = $this->privilegesSection; diff --git a/setup/wizard/steps/install.php b/setup/wizard/steps/install.php index 951e0af..0e4b78b 100644 --- a/setup/wizard/steps/install.php +++ b/setup/wizard/steps/install.php @@ -60,9 +60,11 @@ class install extends step * @var array */ protected $runInstall = true; + private $ce_check = false; public function doStep() { $this->temp_variables = array("step_name"=>"install"); + $this->checkInstallType(); // Set silent mode variables if(!$this->inStep("install")) { return 'landing'; } @@ -104,6 +106,24 @@ class install extends step $this->callHome(); } + /** + * Check the install type and store + * + */ + function checkInstallType() { + if ($this->util->isCommunity()) { + $this->ce_check = true; + $this->registerPlugins(); // Set silent mode variables + } else { + $this->ce_check = false; + } + $this->temp_variables['ce_check'] = $this->ce_check; + } + + function registerPlugins() { + + } + public function callHome() { $conf = $this->getDataFromSession("install"); // retrieve database information from session $dbconf = $this->getDataFromSession("database"); @@ -116,5 +136,7 @@ class install extends step $this->util->dbUtilities->query($query); $this->util->dbUtilities->close(); // close the database connection } + + } ?> \ No newline at end of file diff --git a/setup/wizard/steps/installtype.php b/setup/wizard/steps/installtype.php index 6932613..252845c 100644 --- a/setup/wizard/steps/installtype.php +++ b/setup/wizard/steps/installtype.php @@ -45,6 +45,10 @@ class installType extends step public function doStep() { $this->temp_variables = array("step_name"=>"installtype"); + $type = $this->util->getVersionType(); + $this->temp_variables['isCE'] = false; + if($type == "community") + $this->temp_variables['isCE'] = true; if(!$this->inStep("installtype")) { return 'landing'; } diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index 4f41431..8d27b8f 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -34,7 +34,11 @@ dmsctl.bat install
dmsctl.bat start - cd /usr/share/knowledgetree-ce
+ + cd /usr/share/knowledgetree-ce
+ + cd /usr/share/knowledgetree
+ sudo ./dmsctl.sh start

diff --git a/setup/wizard/templates/configuration.tpl b/setup/wizard/templates/configuration.tpl index 6f97ca1..c89d895 100644 --- a/setup/wizard/templates/configuration.tpl +++ b/setup/wizard/templates/configuration.tpl @@ -61,19 +61,19 @@
 
' /> - - -
 
- - - /> -     - - /> - - + + + + + + + + + + + - +

     "; ?>Paths and Permissions

Show Details
diff --git a/setup/wizard/templates/configuration_confirm.tpl b/setup/wizard/templates/configuration_confirm.tpl index d9f9382..7186405 100644 --- a/setup/wizard/templates/configuration_confirm.tpl +++ b/setup/wizard/templates/configuration_confirm.tpl @@ -49,11 +49,11 @@
 
- - Do you have SSL Enabled?: -
 
- - + + + + +

Paths and Permissions

diff --git a/setup/wizard/templates/install.tpl b/setup/wizard/templates/install.tpl index a24f755..e8ebdf9 100644 --- a/setup/wizard/templates/install.tpl +++ b/setup/wizard/templates/install.tpl @@ -1,8 +1,13 @@

Finalizing System Installation

-
+ +
+ +
+

The wizard will now complete the installation and run a final check on your system.

+

We would greatly appreciate it if you would allow us to collect anonymous usage statistics to help us provide a better quality product.
@@ -13,6 +18,21 @@

  

+ +

+ We would greatly appreciate it if you would allow us to collect anonymous usage statistics to help us provide a better quality product. +
+
+ The information includes a unique identification number, number of users you have created, your operating system type and your IP address. Your privacy is protected by the KnowledgeTree Privacy and Data Protection Agreements. +

+ +







+ +

+    + +

+
diff --git a/setup/wizard/templates/installtype.tpl b/setup/wizard/templates/installtype.tpl index e057e35..373219b 100644 --- a/setup/wizard/templates/installtype.tpl +++ b/setup/wizard/templates/installtype.tpl @@ -7,16 +7,18 @@ - + - + + - + +
diff --git a/setup/wizard/templates/license.tpl b/setup/wizard/templates/license.tpl index 0aba327..cb2caec 100644 --- a/setup/wizard/templates/license.tpl +++ b/setup/wizard/templates/license.tpl @@ -6,7 +6,7 @@ } //print_r($errors); }?> -

+

Please read and accept the license agreement below before continuing with the setup.

diff --git a/setup/wizard/templates/wizard.tpl b/setup/wizard/templates/wizard.tpl index 25b8730..603a523 100644 --- a/setup/wizard/templates/wizard.tpl +++ b/setup/wizard/templates/wizard.tpl @@ -11,6 +11,7 @@ css('wizard.css'); ?> css('ie6.css'); ?> css('ie7.css'); ?> + css('ie8.css'); ?>