Commit 8c2f1c51544f15bd9870f46a5d564e824771b51c
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
31 changed files
with
207 additions
and
242 deletions
config/cache-path
| 1 | -var/cache |
config/config-path
config/config.ini
| ... | ... | @@ -9,14 +9,14 @@ |
| 9 | 9 | dbType = mysql |
| 10 | 10 | |
| 11 | 11 | ; Database login details |
| 12 | -dbHost = localhost | |
| 13 | -dbName = dms | |
| 14 | -dbUser = dms | |
| 15 | -dbPass = djw9281js | |
| 16 | -dbPort = default | |
| 12 | +dbHost = localhost | |
| 13 | +dbName = dms_migrate | |
| 14 | +dbUser = dmsadmin | |
| 15 | +dbPass = js9281djw | |
| 16 | +dbPort = 3306 | |
| 17 | 17 | |
| 18 | -dbAdminUser = dmsadmin | |
| 19 | -dbAdminPass = js9281djw | |
| 18 | +dbAdminUser = dmsadmin | |
| 19 | +dbAdminPass = js9281djw | |
| 20 | 20 | |
| 21 | 21 | [KnowledgeTree] |
| 22 | 22 | |
| ... | ... | @@ -31,7 +31,7 @@ dbAdminPass = js9281djw |
| 31 | 31 | ; |
| 32 | 32 | ; Leave as default to have it automatically detected. |
| 33 | 33 | ; |
| 34 | -fileSystemRoot = default | |
| 34 | +fileSystemRoot = D:/Program Files/Zend/Apache2/htdocs/knowledgetree | |
| 35 | 35 | |
| 36 | 36 | ; Webserver name (host name) |
| 37 | 37 | ; |
| ... | ... | @@ -43,7 +43,7 @@ serverName = default |
| 43 | 43 | ; |
| 44 | 44 | ; Leave as default to have it automatically detected. |
| 45 | 45 | ; |
| 46 | -sslEnabled = default | |
| 46 | +sslEnabled = false | |
| 47 | 47 | |
| 48 | 48 | ; Path to the web application from the root of the web site. |
| 49 | 49 | ; If KT is at http://example.org/foo/, then rootUrl should be '/foo' |
| ... | ... | @@ -115,11 +115,11 @@ phpErrorLogFile = false |
| 115 | 115 | |
| 116 | 116 | [urls] |
| 117 | 117 | ; directories |
| 118 | -varDirectory = ${fileSystemRoot}/var | |
| 119 | -logDirectory = ${varDirectory}/log | |
| 120 | -documentRoot = ${varDirectory}/Documents | |
| 118 | +varDirectory = C:\Program Files\ktdms\var | |
| 119 | +logDirectory = C:\Program Files\ktdms\var\log | |
| 120 | +documentRoot = C:\Program Files\ktdms\var\Documents | |
| 121 | 121 | uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree |
| 122 | -tmpDirectory = ${varDirectory}/tmp | |
| 122 | +tmpDirectory = C:\Program Files\ktdms\var\tmp | |
| 123 | 123 | |
| 124 | 124 | ;dedicated feed url |
| 125 | 125 | ;dedicatedrsstitle = RSS Feed Title |
| ... | ... | @@ -146,4 +146,4 @@ encoding = default |
| 146 | 146 | ; |
| 147 | 147 | cacheEnabled = true |
| 148 | 148 | cacheDirectory = ${varDirectory}/cache |
| 149 | -cachePlugins = true | |
| 150 | 149 | \ No newline at end of file |
| 150 | +cachePlugins = true | ... | ... |
setup/migrate/migrateUtil.php
| ... | ... | @@ -63,14 +63,14 @@ class MigrateUtil extends InstallUtil { |
| 63 | 63 | $template_vars['error'] = $error; |
| 64 | 64 | $file = "templates/error.tpl"; |
| 65 | 65 | if (!file_exists($file)) { |
| 66 | - return false; | |
| 66 | + extract($template_vars); // Extract the vars to local namespace | |
| 67 | + ob_start(); | |
| 68 | + include($file); | |
| 69 | + $contents = ob_get_contents(); | |
| 70 | + ob_end_clean(); | |
| 71 | + echo $contents; | |
| 67 | 72 | } |
| 68 | - extract($template_vars); // Extract the vars to local namespace | |
| 69 | - ob_start(); | |
| 70 | - include($file); | |
| 71 | - $contents = ob_get_contents(); | |
| 72 | - ob_end_clean(); | |
| 73 | - echo $contents; | |
| 73 | + return false; | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| ... | ... | @@ -89,19 +89,10 @@ class MigrateUtil extends InstallUtil { |
| 89 | 89 | |
| 90 | 90 | return true; |
| 91 | 91 | } |
| 92 | - | |
| 93 | - public function loadInstallDBUtil() { | |
| 94 | - require_once("../wizard/dbUtilities.php"); | |
| 95 | - return new dbUtilities(); | |
| 96 | - } | |
| 97 | - | |
| 98 | - public function loadInstallUtil() { | |
| 99 | - require_once("../wizard/steps/services.php"); | |
| 100 | - return new services(); | |
| 101 | - } | |
| 102 | 92 | |
| 103 | 93 | public function loadInstallServices() { |
| 104 | - $s = $this->loadInstallUtil(); | |
| 94 | + require_once("../wizard/steps/services.php"); | |
| 95 | + $s = new services(); | |
| 105 | 96 | return $s->getServices(); |
| 106 | 97 | } |
| 107 | 98 | |
| ... | ... | @@ -112,11 +103,6 @@ class MigrateUtil extends InstallUtil { |
| 112 | 103 | return new $serviceName(); |
| 113 | 104 | } |
| 114 | 105 | |
| 115 | - public function loadInstallIni($path) { | |
| 116 | - require_once("../wizard/iniUtilities.php"); | |
| 117 | - return new iniUtilities($path); | |
| 118 | - } | |
| 119 | - | |
| 120 | 106 | public function getPort($location) { |
| 121 | 107 | if(WINDOWS_OS) { |
| 122 | 108 | $myIni = "my.ini"; |
| ... | ... | @@ -125,8 +111,8 @@ class MigrateUtil extends InstallUtil { |
| 125 | 111 | } |
| 126 | 112 | $dbConfigPath = $location.DS."mysql".DS."$myIni"; |
| 127 | 113 | if(file_exists($dbConfigPath)) { |
| 128 | - $ini = $this->loadInstallIni($dbConfigPath); | |
| 129 | - $dbSettings = $ini->getSection('mysqladmin'); | |
| 114 | + $this->iniUtilities->load($dbConfigPath); | |
| 115 | + $dbSettings = $this->iniUtilities->getSection('mysqladmin'); | |
| 130 | 116 | return $dbSettings['port']; |
| 131 | 117 | } |
| 132 | 118 | ... | ... |
setup/migrate/migrateWizard.php
| ... | ... | @@ -52,16 +52,14 @@ function __autoload($class) { // Attempt and autoload classes |
| 52 | 52 | if ($class == "template") { // Load existing templating classes |
| 53 | 53 | require_once("../wizard/template.php"); |
| 54 | 54 | require_once("../wizard/lib/helpers/htmlHelper.php"); |
| 55 | - return ; | |
| 56 | - } | |
| 57 | - if(file_exists(WIZARD_DIR."$class.php")) { | |
| 58 | - require_once(WIZARD_DIR."$class.php"); | |
| 59 | - } elseif (file_exists(STEP_DIR."$class.php")) { | |
| 60 | - require_once(STEP_DIR."$class.php"); | |
| 61 | - } elseif (file_exists(WIZARD_LIB."$class.php")) { | |
| 62 | - require_once(WIZARD_LIB."$class.php"); | |
| 63 | 55 | } else { |
| 64 | - return null; | |
| 56 | + if(file_exists(WIZARD_DIR."$class.php")) { | |
| 57 | + require_once(WIZARD_DIR."$class.php"); | |
| 58 | + } elseif (file_exists(STEP_DIR."$class.php")) { | |
| 59 | + require_once(STEP_DIR."$class.php"); | |
| 60 | + } elseif (file_exists(WIZARD_LIB."$class.php")) { | |
| 61 | + require_once(WIZARD_LIB."$class.php"); | |
| 62 | + } | |
| 65 | 63 | } |
| 66 | 64 | } |
| 67 | 65 | |
| ... | ... | @@ -233,8 +231,6 @@ class MigrateWizard { |
| 233 | 231 | return true; |
| 234 | 232 | break; |
| 235 | 233 | } |
| 236 | - | |
| 237 | - return $res; | |
| 238 | 234 | } |
| 239 | 235 | |
| 240 | 236 | /** | ... | ... |
setup/migrate/migrater.php
| ... | ... | @@ -157,7 +157,7 @@ class Migrater { |
| 157 | 157 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); |
| 158 | 158 | } catch (Exception $e) { |
| 159 | 159 | $util = new MigrateUtil(); |
| 160 | - $util->error("Error reading configuration file: $name"); | |
| 160 | + $util->error("Error reading configuration file: $e"); | |
| 161 | 161 | exit(); |
| 162 | 162 | } |
| 163 | 163 | } |
| ... | ... | @@ -431,8 +431,7 @@ class Migrater { |
| 431 | 431 | if($class->runMigrate()) { // Check if step needs to be migrated |
| 432 | 432 | $class->setDataFromSession($className); // Set Session Information |
| 433 | 433 | $class->setPostConfig(); // Set any posted variables |
| 434 | - $response = $class->migrateStep(); // Run migrate step | |
| 435 | - // TODO : Break on error response | |
| 434 | + $class->migrateStep(); // Run migrate step | |
| 436 | 435 | } |
| 437 | 436 | } else { |
| 438 | 437 | $util = new MigrateUtil(); | ... | ... |
setup/migrate/step.php
setup/migrate/stepAction.php
| ... | ... | @@ -224,17 +224,18 @@ class stepAction { |
| 224 | 224 | if($this->action->storeInSession()) { // Check if class values need to be stored in session |
| 225 | 225 | $this->_loadStepToSession($this->stepName); // Send class to session |
| 226 | 226 | } |
| 227 | - if ($response == 'error') { | |
| 228 | - $this->_handleErrors(); // Send Errors to session | |
| 229 | - } else { | |
| 230 | - $this->_clearErrors($this->stepName); // Send Errors to session | |
| 231 | - } | |
| 232 | - return $response; | |
| 233 | 227 | } else { |
| 234 | 228 | $this->stepName = 'errors'; |
| 235 | 229 | $this->action = $this->createStep(); |
| 236 | 230 | $this->action->error = array('Class File Missing in Step Directory'); |
| 231 | + | |
| 232 | + } | |
| 233 | + if ($response == 'error') { | |
| 234 | + $this->_handleErrors(); // Send Errors to session | |
| 235 | + } else { | |
| 236 | + $this->_clearErrors($this->stepName); // Send Errors to session | |
| 237 | 237 | } |
| 238 | + return $response; | |
| 238 | 239 | } |
| 239 | 240 | |
| 240 | 241 | /** |
| ... | ... | @@ -308,7 +309,7 @@ class stepAction { |
| 308 | 309 | $menu = ''; |
| 309 | 310 | $active = false; |
| 310 | 311 | if($this->stepClassNames) { |
| 311 | - foreach ($this->stepClassNames as $k=>$step) { | |
| 312 | + foreach ($this->stepClassNames as $step) { | |
| 312 | 313 | if($this->step_names[$step] != '') { |
| 313 | 314 | $item = $this->step_names[$step]; |
| 314 | 315 | } else { |
| ... | ... | @@ -452,7 +453,7 @@ class stepAction { |
| 452 | 453 | * @access private |
| 453 | 454 | * @return void |
| 454 | 455 | */ |
| 455 | - private function _loadValueToSession($class, $k, $v, $overwrite = false) { | |
| 456 | + private function _loadValueToSession($class, $k, $v) { | |
| 456 | 457 | if($this->session != null) { |
| 457 | 458 | $this->session->setClass($class, $k, $v); |
| 458 | 459 | } else { |
| ... | ... | @@ -502,8 +503,7 @@ class stepAction { |
| 502 | 503 | * @access private |
| 503 | 504 | * @return void |
| 504 | 505 | */ |
| 505 | - private function _loadErrorToSession($class, $k, $v, $overwrite = false) { | |
| 506 | - $k = "errors"; | |
| 506 | + private function _loadErrorToSession($class, $k = "errors", $v) { | |
| 507 | 507 | if($this->session != null) { |
| 508 | 508 | $this->session->setClassError($class, $k, $v); |
| 509 | 509 | } else { | ... | ... |
setup/migrate/steps/migrateDatabase.php
| ... | ... | @@ -122,16 +122,16 @@ class migrateDatabase extends Step |
| 122 | 122 | $manual = false; // If file was exported manually |
| 123 | 123 | $dbSettings = $installation['dbSettings']; |
| 124 | 124 | $location = $installation['location']; |
| 125 | - $uname = $this->temp_variables['duname']; | |
| 126 | - $pwrd = $this->temp_variables['dpassword']; | |
| 125 | +// $uname = $this->temp_variables['duname']; | |
| 126 | +// $pwrd = $this->temp_variables['dpassword']; | |
| 127 | 127 | $port = $this->util->getPort($location); |
| 128 | 128 | $tmpFolder = $this->resolveTempDir(); |
| 129 | 129 | if(WINDOWS_OS) { |
| 130 | 130 | $termOrBash = "command prompt window"; |
| 131 | - $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump | |
| 131 | + $exe = DS."$location".DS."mysql".DS."bin".DS."mysqldump.exe".DS; // Location of dump | |
| 132 | 132 | } else { |
| 133 | 133 | $termOrBash = "terminal window"; |
| 134 | - $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump | |
| 134 | + $exe = "'$location".DS."mysql".DS."bin".DS."mysqldump'"; // Location of dump | |
| 135 | 135 | } |
| 136 | 136 | $date = date('Y-m-d-H-i-s'); |
| 137 | 137 | if(isset($database['manual_export'])) { |
| ... | ... | @@ -147,7 +147,7 @@ class migrateDatabase extends Step |
| 147 | 147 | if(!$manual) { // Try to export database |
| 148 | 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; |
| 149 | 149 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; |
| 150 | - $response = $this->util->pexec($cmd); | |
| 150 | + $this->util->pexec($cmd); | |
| 151 | 151 | } |
| 152 | 152 | if(file_exists($sqlFile)) { |
| 153 | 153 | $fileContents = file_get_contents($sqlFile); | ... | ... |
setup/migrate/steps/migrateInstallation.php
| ... | ... | @@ -85,10 +85,6 @@ class migrateInstallation extends step |
| 85 | 85 | private $ktSettings = array(); |
| 86 | 86 | |
| 87 | 87 | private $urlPaths = array(); |
| 88 | - | |
| 89 | - private $knownWindowsLocations = array("C:\Program Files\ktdms"=>"C:\Program Files\ktdms\knowledgeTree\config\config-path","C:\Program Files x86\ktdms"=>"C:\Program Files x86\ktdms\knowledgeTree\config\config-path","C:\ktdms"=>"C:\ktdms\knowledgeTree\config\config-path"); | |
| 90 | - | |
| 91 | - private $knownUnixLocations = array("/opt/ktdms","/var/www/ktdms"); | |
| 92 | 88 | |
| 93 | 89 | /** |
| 94 | 90 | * Installation Settings |
| ... | ... | @@ -132,12 +128,14 @@ class migrateInstallation extends step |
| 132 | 128 | |
| 133 | 129 | public function detectInstallation() { |
| 134 | 130 | if(WINDOWS_OS) { |
| 135 | - foreach ($this->knownWindowsLocations as $loc=>$configPath) { | |
| 131 | + $knownWindowsLocations = array("C:\Program Files\ktdms"=>"C:\Program Files\ktdms\knowledgeTree\config\config-path","C:\Program Files x86\ktdms"=>"C:\Program Files x86\ktdms\knowledgeTree\config\config-path","C:\ktdms"=>"C:\ktdms\knowledgeTree\config\config-path"); | |
| 132 | + foreach ($knownWindowsLocations as $loc=>$configPath) { | |
| 136 | 133 | if(file_exists($configPath)) |
| 137 | 134 | $this->location = $loc; |
| 138 | 135 | } |
| 139 | 136 | } else { |
| 140 | - foreach ($this->knownUnixLocations as $loc=>$configPath) { | |
| 137 | + $knownUnixLocations = array("/opt/ktdms"=>"/opt/ktdms/knowledgeTree/config/config-path","/var/www/ktdms"=>"/var/www/ktdms/knowledgeTree/config/config-path"); | |
| 138 | + foreach ($knownUnixLocations as $loc=>$configPath) { | |
| 141 | 139 | if(file_exists($configPath)) |
| 142 | 140 | $this->location = $loc; |
| 143 | 141 | } |
| ... | ... | @@ -162,9 +160,10 @@ class migrateInstallation extends step |
| 162 | 160 | if($this->foundVersion < $this->supportedVersion) { |
| 163 | 161 | $this->versionError = true; |
| 164 | 162 | $this->error[] = "KT installation needs to be 3.6.1 or higher"; |
| 165 | - } else { | |
| 166 | - return true; | |
| 163 | + return false; | |
| 167 | 164 | } |
| 165 | + | |
| 166 | + return true; | |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | 169 | public function readVersion() { |
| ... | ... | @@ -222,11 +221,15 @@ class migrateInstallation extends step |
| 222 | 221 | } else { |
| 223 | 222 | $this->error[] = "Please Enter a Location"; |
| 224 | 223 | } |
| 224 | + | |
| 225 | + return false; | |
| 225 | 226 | } |
| 226 | 227 | |
| 227 | 228 | private function loadConfig($path) { |
| 228 | - $ini = $this->util->loadInstallIni($path); | |
| 229 | - $dbSettings = $ini->getSection('db'); | |
| 229 | +// $ini = $this->util->loadInstallIni($path); | |
| 230 | + $this->util->iniUtilities->load($path); | |
| 231 | +// $dbSettings = $ini->getSection('db'); | |
| 232 | + $dbSettings = $this->util->iniUtilities->getSection('db'); | |
| 230 | 233 | $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], |
| 231 | 234 | 'dbName'=> $dbSettings['dbName'], |
| 232 | 235 | 'dbUser'=> $dbSettings['dbUser'], |
| ... | ... | @@ -235,14 +238,16 @@ class migrateInstallation extends step |
| 235 | 238 | 'dbAdminUser'=> $dbSettings['dbAdminUser'], |
| 236 | 239 | 'dbAdminPass'=> $dbSettings['dbAdminPass'], |
| 237 | 240 | ); |
| 238 | - $ktSettings = $ini->getSection('KnowledgeTree'); | |
| 241 | + $ktSettings = $this->util->iniUtilities->getSection('KnowledgeTree'); | |
| 242 | +// $ktSettings = $ini->getSection('KnowledgeTree'); | |
| 239 | 243 | $froot = $ktSettings['fileSystemRoot']; |
| 240 | 244 | if ($froot == 'default') { |
| 241 | 245 | $froot = $this->location; |
| 242 | 246 | } |
| 243 | 247 | $this->ktSettings = array('fileSystemRoot'=> $froot, |
| 244 | 248 | ); |
| 245 | - $urlPaths = $ini->getSection('urls'); | |
| 249 | +// $urlPaths = $ini->getSection('urls'); | |
| 250 | +// $urlPaths = $this->util->iniUtilities->getSection('urls'); | |
| 246 | 251 | $varDir = $froot.DS.'var'; |
| 247 | 252 | $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), |
| 248 | 253 | array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), | ... | ... |
setup/migrate/steps/migrateServices.php
| ... | ... | @@ -127,7 +127,6 @@ class migrateServices extends Step |
| 127 | 127 | public function doStep() |
| 128 | 128 | { |
| 129 | 129 | $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent); |
| 130 | - $this->installServices = $this->util->loadInstallUtil(); // Use installer utility class | |
| 131 | 130 | $this->services = $this->util->loadInstallServices(); // Use installer services class |
| 132 | 131 | $this->storeSilent(); |
| 133 | 132 | if(!$this->inStep("services")) { |
| ... | ... | @@ -202,11 +201,11 @@ class migrateServices extends Step |
| 202 | 201 | */ |
| 203 | 202 | public function unixStop() { |
| 204 | 203 | $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; |
| 205 | - $res = $this->util->pexec($cmd); | |
| 204 | + $this->util->pexec($cmd); | |
| 206 | 205 | $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; |
| 207 | - $res = $this->util->pexec($cmd); | |
| 206 | + $this->util->pexec($cmd); | |
| 208 | 207 | $cmd = $this->conf['location']."/dmsctl.sh stop soffice"; |
| 209 | - $res = $this->util->pexec($cmd); | |
| 208 | + $this->util->pexec($cmd); | |
| 210 | 209 | } |
| 211 | 210 | |
| 212 | 211 | /** |
| ... | ... | @@ -215,11 +214,11 @@ class migrateServices extends Step |
| 215 | 214 | */ |
| 216 | 215 | public function windowsStop() { |
| 217 | 216 | $cmd = "sc delete KTLucene"; |
| 218 | - $res = $this->util->pexec($cmd); | |
| 217 | + $this->util->pexec($cmd); | |
| 219 | 218 | $cmd = "sc delete KTScheduler"; |
| 220 | - $res = $this->util->pexec($cmd); | |
| 219 | + $this->util->pexec($cmd); | |
| 221 | 220 | $cmd = "sc delete KTOpenoffice"; |
| 222 | - $res = $this->util->pexec($cmd); | |
| 221 | + $this->util->pexec($cmd); | |
| 223 | 222 | } |
| 224 | 223 | |
| 225 | 224 | /** |
| ... | ... | @@ -233,7 +232,7 @@ class migrateServices extends Step |
| 233 | 232 | $serv->load(); |
| 234 | 233 | $sStatus = $serv->status(); |
| 235 | 234 | if($sStatus != '') { |
| 236 | - $res = $serv->uninstall(); | |
| 235 | + $serv->uninstall(); | |
| 237 | 236 | } |
| 238 | 237 | } |
| 239 | 238 | } | ... | ... |
setup/upgrade/step.php
setup/upgrade/steps/upgradeDatabase.php
| ... | ... | @@ -242,7 +242,9 @@ class upgradeDatabase extends Step |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | private function readConfig($path) { |
| 245 | - $ini = $this->util->loadInstallIni($path); | |
| 245 | + //$ini = $this->util->loadInstallIni($path); | |
| 246 | + $ini = $this->util->iniUtilities; | |
| 247 | + $ini->load($path); | |
| 246 | 248 | $dbSettings = $ini->getSection('db'); |
| 247 | 249 | $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], |
| 248 | 250 | 'dbName'=> $dbSettings['dbName'], | ... | ... |
setup/upgrade/steps/upgradeWelcome.php
| ... | ... | @@ -40,6 +40,9 @@ |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | +//require_once('../../config/dmsDefaults.php'); | |
| 44 | +//require_once KT_LIB_DIR . '/authentication/authenticationutil.inc.php'; | |
| 45 | + | |
| 43 | 46 | class upgradeWelcome extends step { |
| 44 | 47 | |
| 45 | 48 | protected $silent = false; |
| ... | ... | @@ -91,15 +94,9 @@ class upgradeWelcome extends step { |
| 91 | 94 | $dconf = $ini->getSection('db'); |
| 92 | 95 | $this->dbhandler->load($dconf['dbHost'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); |
| 93 | 96 | } |
| 94 | - $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '$username' AND password = '".md5($password)."'"; | |
| 95 | - $res = $this->dbhandler->query($sQuery); | |
| 96 | - $ass = $this->dbhandler->fetchAssoc($res); | |
| 97 | - if(isset($ass[0]['match_count'])) { | |
| 98 | - if($ass[0]['match_count']) | |
| 99 | - return true; | |
| 100 | - } | |
| 101 | 97 | $this->error[] = 'Could Not Authenticate User'; |
| 102 | 98 | return false; |
| 99 | + | |
| 103 | 100 | } |
| 104 | 101 | |
| 105 | 102 | public function getErrors() { | ... | ... |
setup/upgrade/upgradeUtil.php
| ... | ... | @@ -40,10 +40,9 @@ |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | -//require_once('../../config/dmsDefaults.php'); | |
| 44 | 43 | require_once("../wizard/installUtil.php"); |
| 45 | 44 | |
| 46 | -class UpgradeUtil extends InstallUtil { | |
| 45 | +class UpgradeUtil extends InstallUtil { | |
| 47 | 46 | /** |
| 48 | 47 | * Check if system needs to be upgraded |
| 49 | 48 | * |
| ... | ... | @@ -75,16 +74,6 @@ class UpgradeUtil extends InstallUtil { |
| 75 | 74 | echo $contents; |
| 76 | 75 | } |
| 77 | 76 | |
| 78 | - public function loadInstallIni($path) { | |
| 79 | - require_once("../wizard/iniUtilities.php"); | |
| 80 | - return new iniUtilities($path); | |
| 81 | - } | |
| 82 | - | |
| 83 | - public function loadInstallDBUtil() { | |
| 84 | - require_once("../wizard/dbUtilities.php"); | |
| 85 | - return new dbUtilities(); | |
| 86 | - } | |
| 87 | - | |
| 88 | 77 | /** |
| 89 | 78 | * Function to send output to the browser prior to normal dynamic loading of a template after code execution |
| 90 | 79 | * | ... | ... |
setup/wizard/dbUtilities.php
| ... | ... | @@ -105,15 +105,13 @@ class dbUtilities { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function load($dhost = 'localhost', $duname, $dpassword, $dbname) { |
| 108 | - if($this->isConnected($dhost, $duname, $dpassword, $dbname)) return true; | |
| 109 | - $this->dbhost = $dhost; | |
| 110 | - $this->dbuname = $duname; | |
| 111 | - $this->dbpassword = $dpassword; | |
| 112 | - $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword); | |
| 113 | - if(!$this->dbconnection) { | |
| 114 | - $this->error[] = @mysql_error(); | |
| 108 | + if(!$this->isConnected($dhost, $duname, $dpassword, $dbname)) { | |
| 109 | + $this->dbhost = $dhost; | |
| 110 | + $this->dbuname = $duname; | |
| 111 | + $this->dbpassword = $dpassword; | |
| 112 | + $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword); | |
| 113 | + $this->dbname = $dbname; | |
| 115 | 114 | } |
| 116 | - $this->dbname = $dbname; | |
| 117 | 115 | } |
| 118 | 116 | |
| 119 | 117 | public function isConnected($dhost = 'localhost', $duname, $dpassword, $dbname) { |
| ... | ... | @@ -235,6 +233,9 @@ class dbUtilities { |
| 235 | 233 | * @return array. |
| 236 | 234 | */ |
| 237 | 235 | public function getErrors() { |
| 236 | + if(!$this->dbconnection) { | |
| 237 | + $this->error[] = @mysql_error(); | |
| 238 | + } | |
| 238 | 239 | return $this->error; |
| 239 | 240 | } |
| 240 | 241 | ... | ... |
setup/wizard/iniUtilities.php
| ... | ... | @@ -43,11 +43,8 @@ class iniUtilities { |
| 43 | 43 | private $lineNum = 0; |
| 44 | 44 | private $exists = ''; |
| 45 | 45 | |
| 46 | - function iniUtilities() { | |
| 47 | - $this->iniFile = ''; | |
| 48 | - } | |
| 49 | - | |
| 50 | - function load($iniFile) { | |
| 46 | + | |
| 47 | + function load($iniFile) { | |
| 51 | 48 | if($this->iniFile != $iniFile) { |
| 52 | 49 | $this->cleanArray = array(); |
| 53 | 50 | $this->lineNum = 0; |
| ... | ... | @@ -56,9 +53,11 @@ class iniUtilities { |
| 56 | 53 | $this->iniFile = $iniFile; |
| 57 | 54 | $this->backupIni($iniFile); |
| 58 | 55 | $this->read($iniFile); |
| 59 | - | |
| 60 | 56 | } |
| 61 | 57 | |
| 58 | + function __construct() { | |
| 59 | + } | |
| 60 | + | |
| 62 | 61 | /** |
| 63 | 62 | * Create a backup with the date as an extension in the same location as the original config.ini |
| 64 | 63 | * |
| ... | ... | @@ -68,23 +67,23 @@ class iniUtilities { |
| 68 | 67 | function backupIni($iniFile) |
| 69 | 68 | { |
| 70 | 69 | $content = file_get_contents($iniFile); |
| 71 | - if ($content === false) | |
| 70 | + if (!$content === false) | |
| 72 | 71 | { |
| 73 | - return false; | |
| 74 | - } | |
| 75 | - $date = date('YmdHis'); | |
| 76 | - | |
| 77 | - $backupFile = $iniFile . '.' .$date; | |
| 78 | - if (is_writeable($backupFile)) { | |
| 79 | - file_put_contents($backupFile, $content); | |
| 80 | - } | |
| 72 | + $date = date('YmdHis'); | |
| 73 | + | |
| 74 | + $backupFile = $iniFile . '.' .$date; | |
| 75 | + if (is_writeable($backupFile)) { | |
| 76 | + file_put_contents($backupFile, $content); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + return false; | |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | function read($iniFile) { |
| 84 | 83 | $iniArray = file($iniFile); |
| 85 | 84 | $section = ''; |
| 86 | 85 | foreach($iniArray as $iniLine) { |
| 87 | - $this->lineNum++; | |
| 86 | + ++$this->lineNum; | |
| 88 | 87 | $iniLine = trim($iniLine); |
| 89 | 88 | $firstChar = substr($iniLine, 0, 1); |
| 90 | 89 | if($firstChar == ';') { |
| ... | ... | @@ -164,12 +163,12 @@ class iniUtilities { |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | 165 | function itemExists($checkSection, $checkItem) { |
| 167 | - | |
| 168 | 166 | $this->exists = ''; |
| 169 | 167 | foreach($this->cleanArray as $section => $items) { |
| 170 | 168 | if($section == $checkSection) { |
| 171 | 169 | $this->exists = 'section'; |
| 172 | - foreach ($items as $key => $value) { | |
| 170 | + $items = array_flip($items); | |
| 171 | + foreach ($items as $key) { | |
| 173 | 172 | if($key == $checkItem) { |
| 174 | 173 | return true; |
| 175 | 174 | } | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -39,13 +39,14 @@ |
| 39 | 39 | * @package Installer |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | - | |
| 42 | +require_once("path.php"); // Include if util is loaded directly | |
| 43 | +require_once(WIZARD_DIR."iniUtilities.php"); | |
| 44 | +require_once(WIZARD_DIR."dbUtilities.php"); | |
| 43 | 45 | |
| 44 | 46 | class InstallUtil { |
| 45 | - | |
| 46 | 47 | private $salt = 'installers'; |
| 47 | - public $dbHandler = null; | |
| 48 | - public $iniHandler = null; | |
| 48 | + public $dbUtilities = null; | |
| 49 | + public $iniUtilities = null; | |
| 49 | 50 | |
| 50 | 51 | /** |
| 51 | 52 | * Constructs installation object |
| ... | ... | @@ -54,8 +55,8 @@ class InstallUtil { |
| 54 | 55 | * @access public |
| 55 | 56 | */ |
| 56 | 57 | public function __construct() { |
| 57 | - $this->dbHandler = new dbUtilities(); | |
| 58 | - $this->iniHandler = new iniUtilities(); | |
| 58 | + $this->dbUtilities = new dbUtilities(); | |
| 59 | + $this->iniUtilities = new iniUtilities(); | |
| 59 | 60 | } |
| 60 | 61 | |
| 61 | 62 | /** |
| ... | ... | @@ -76,15 +77,17 @@ class InstallUtil { |
| 76 | 77 | public function error($error) { |
| 77 | 78 | $template_vars['error'] = $error; |
| 78 | 79 | $file = "templates/error.tpl"; |
| 79 | - if (!file_exists($file)) { | |
| 80 | - return false; | |
| 80 | + if (file_exists($file)) { | |
| 81 | + extract($template_vars); // Extract the vars to local namespace | |
| 82 | + ob_start(); | |
| 83 | + include($file); | |
| 84 | + $contents = ob_get_contents(); | |
| 85 | + ob_end_clean(); | |
| 86 | + echo $contents; | |
| 81 | 87 | } |
| 82 | - extract($template_vars); // Extract the vars to local namespace | |
| 83 | - ob_start(); | |
| 84 | - include($file); | |
| 85 | - $contents = ob_get_contents(); | |
| 86 | - ob_end_clean(); | |
| 87 | - echo $contents; | |
| 88 | + | |
| 89 | + return false; | |
| 90 | + | |
| 88 | 91 | } |
| 89 | 92 | /** |
| 90 | 93 | * Check if system needs to be installed |
| ... | ... | @@ -171,7 +174,7 @@ class InstallUtil { |
| 171 | 174 | return $url; |
| 172 | 175 | } |
| 173 | 176 | if (!empty($protocol)) { |
| 174 | - $url = $protocol .':'. end($array = explode(':', $url, 2)); | |
| 177 | + $url = $protocol .':'. end(explode(':', $url, 2)); | |
| 175 | 178 | } |
| 176 | 179 | if (!empty($port)) { |
| 177 | 180 | $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', |
| ... | ... | @@ -331,9 +334,11 @@ class InstallUtil { |
| 331 | 334 | return false; |
| 332 | 335 | elseif(!is_dir($fullpath)) { |
| 333 | 336 | $perms = substr(sprintf('%o', fileperms($fullpath)), -4); |
| 334 | - if($perms != $filemode) | |
| 335 | - if (!chmod($fullpath, $filemode)) | |
| 337 | + if($perms != $filemode) { | |
| 338 | + if (!chmod($fullpath, $filemode)) { | |
| 336 | 339 | return false; |
| 340 | + } | |
| 341 | + } | |
| 337 | 342 | } elseif(!$this->chmodRecursive($fullpath, $filemode)) |
| 338 | 343 | return false; |
| 339 | 344 | } |
| ... | ... | @@ -360,7 +365,8 @@ class InstallUtil { |
| 360 | 365 | */ |
| 361 | 366 | public function canWriteFile($filename) { |
| 362 | 367 | $fh = fopen($filename, "w+"); |
| 363 | - if($fr = fwrite($fh, 'test') === false) { | |
| 368 | + $fr = fwrite($fh, 'test'); | |
| 369 | + if($fr === false) { | |
| 364 | 370 | return false; |
| 365 | 371 | } |
| 366 | 372 | |
| ... | ... | @@ -378,9 +384,9 @@ class InstallUtil { |
| 378 | 384 | */ |
| 379 | 385 | public function javaBridge() { |
| 380 | 386 | try { |
| 381 | - $javaSystem = new Java('java.lang.System'); | |
| 387 | + new Java('java.lang.System'); | |
| 382 | 388 | } catch (JavaException $e) { |
| 383 | - return false; | |
| 389 | + return $e; | |
| 384 | 390 | } |
| 385 | 391 | return true; |
| 386 | 392 | } |
| ... | ... | @@ -455,6 +461,8 @@ class InstallUtil { |
| 455 | 461 | return preg_replace('/java:/', '', $r); |
| 456 | 462 | } |
| 457 | 463 | } |
| 464 | + | |
| 465 | + return ''; | |
| 458 | 466 | } |
| 459 | 467 | |
| 460 | 468 | /** |
| ... | ... | @@ -732,6 +740,7 @@ class InstallUtil { |
| 732 | 740 | * @return string |
| 733 | 741 | */ |
| 734 | 742 | public function installEnvironment() { |
| 743 | + $matches = false; | |
| 735 | 744 | preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type |
| 736 | 745 | if($matches) { |
| 737 | 746 | return 'Zend'; |
| ... | ... | @@ -759,7 +768,7 @@ class InstallUtil { |
| 759 | 768 | array_pop($sysdir); |
| 760 | 769 | array_pop($sysdir); |
| 761 | 770 | $zendsys = ''; |
| 762 | - foreach ($sysdir as $k=>$v) { | |
| 771 | + foreach ($sysdir as $v) { | |
| 763 | 772 | $zendsys .= $v.DS; |
| 764 | 773 | } |
| 765 | 774 | $bin = $zendsys."ZendServer".DS."bin".DS; |
| ... | ... | @@ -784,15 +793,16 @@ class InstallUtil { |
| 784 | 793 | if(WINDOWS_OS) { // Mysql bin [Windows] |
| 785 | 794 | $serverPaths = explode(';',$_SERVER['PATH']); |
| 786 | 795 | foreach ($serverPaths as $apath) { |
| 796 | + $matches = false; | |
| 787 | 797 | preg_match('/mysql/i', $apath, $matches); |
| 788 | 798 | if($matches) { |
| 789 | 799 | return $apath.DS; |
| 790 | 800 | break; |
| 791 | 801 | } |
| 792 | 802 | } |
| 793 | - } else { | |
| 794 | - return "mysql"; // Assume its linux and can be executed from command line | |
| 795 | 803 | } |
| 804 | + | |
| 805 | + return "mysql"; // Assume its linux and can be executed from command line | |
| 796 | 806 | } |
| 797 | 807 | |
| 798 | 808 | public function sqlInstallDir() { | ... | ... |
setup/wizard/installWizard.php
| ... | ... | @@ -63,8 +63,8 @@ function __autoload($class) { // Attempt and autoload classes |
| 63 | 63 | if(preg_match('/Helper/', $class)) { |
| 64 | 64 | require_once(HELPER_DIR."$class.php"); |
| 65 | 65 | } |
| 66 | - return null; | |
| 67 | 66 | } |
| 67 | + return false; | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | class InstallWizard { |
| ... | ... | @@ -263,8 +263,6 @@ class InstallWizard { |
| 263 | 263 | return true; |
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | - | |
| 267 | - return $res; | |
| 268 | 266 | } |
| 269 | 267 | |
| 270 | 268 | /** | ... | ... |
setup/wizard/installer.php
| ... | ... | @@ -157,7 +157,7 @@ class Installer { |
| 157 | 157 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); |
| 158 | 158 | } catch (Exception $e) { |
| 159 | 159 | $util = new InstallUtil(); |
| 160 | - $util->error("Error reading configuration file: $name"); | |
| 160 | + $util->error("Error reading configuration file: $e"); | |
| 161 | 161 | exit(); |
| 162 | 162 | } |
| 163 | 163 | } |
| ... | ... | @@ -431,8 +431,7 @@ class Installer { |
| 431 | 431 | if($class->runInstall()) { // Check if step needs to be installed |
| 432 | 432 | $class->setDataFromSession($className); // Set Session Information |
| 433 | 433 | $class->setPostConfig(); // Set any posted variables |
| 434 | - $response = $class->installStep(); // Run install step | |
| 435 | - // TODO : Break on error response | |
| 434 | + $class->installStep(); // Run install step | |
| 436 | 435 | } |
| 437 | 436 | } else { |
| 438 | 437 | $util = new InstallUtil(); | ... | ... |
setup/wizard/lib/helpers/htmlHelper.php
setup/wizard/lib/services/unixLucene.php
| ... | ... | @@ -59,7 +59,7 @@ class unixLucene extends unixService { |
| 59 | 59 | * @param string |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | - public function load($options = null) { | |
| 62 | + public function load() { | |
| 63 | 63 | $this->setLuceneSource("ktlucene.jar"); |
| 64 | 64 | $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); |
| 65 | 65 | $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); |
| ... | ... | @@ -148,14 +148,13 @@ class unixLucene extends unixService { |
| 148 | 148 | * @return array |
| 149 | 149 | */ |
| 150 | 150 | public function stop() { |
| 151 | - // TODO: Breaks things | |
| 152 | 151 | $state = $this->status(); |
| 153 | 152 | if($state != '') { |
| 154 | 153 | $cmd = "pkill -f ".$this->getLuceneSource(); |
| 155 | 154 | $response = $this->util->pexec($cmd); |
| 156 | 155 | return $response; |
| 157 | 156 | } |
| 158 | - | |
| 157 | + return $state; | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | public function install() { |
| ... | ... | @@ -173,6 +172,7 @@ class unixLucene extends unixService { |
| 173 | 172 | if(is_array($response['out'])) { |
| 174 | 173 | if(count($response['out']) > 1) { |
| 175 | 174 | foreach ($response['out'] as $r) { |
| 175 | + $matches = false; | |
| 176 | 176 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 177 | 177 | if(!$matches) { |
| 178 | 178 | return 'STARTED'; |
| ... | ... | @@ -207,20 +207,14 @@ class unixLucene extends unixService { |
| 207 | 207 | $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; |
| 208 | 208 | if(DEBUG) { |
| 209 | 209 | echo "Command : $cmd<br/>"; |
| 210 | - return ; | |
| 210 | + return false; | |
| 211 | 211 | } |
| 212 | 212 | $response = $this->util->pexec($cmd); |
| 213 | 213 | |
| 214 | 214 | return $response; |
| 215 | - } elseif ($state == '') { | |
| 216 | - // Start Service | |
| 217 | - return true; | |
| 218 | - } else { | |
| 219 | - // Service Running Already | |
| 220 | - return true; | |
| 221 | 215 | } |
| 222 | 216 | |
| 223 | - return false; | |
| 217 | + return true; | |
| 224 | 218 | } |
| 225 | 219 | |
| 226 | 220 | public function getName() { | ... | ... |
setup/wizard/lib/services/unixOpenOffice.php
| ... | ... | @@ -106,13 +106,14 @@ class unixOpenOffice extends unixService { |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function status($updrade = false) { | |
| 109 | + public function status() { | |
| 110 | 110 | sleep(1); |
| 111 | 111 | $cmd = "ps ax | grep soffice"; |
| 112 | 112 | $response = $this->util->pexec($cmd); |
| 113 | 113 | if(is_array($response['out'])) { |
| 114 | 114 | if(count($response['out']) > 1) { |
| 115 | 115 | foreach ($response['out'] as $r) { |
| 116 | + $matches = false; | |
| 116 | 117 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 117 | 118 | if(!$matches) { |
| 118 | 119 | return 'STARTED'; |
| ... | ... | @@ -140,20 +141,13 @@ class unixOpenOffice extends unixService { |
| 140 | 141 | $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; |
| 141 | 142 | if(DEBUG) { |
| 142 | 143 | echo "Command : $cmd<br/>"; |
| 143 | - return ; | |
| 144 | + return false; | |
| 144 | 145 | } |
| 145 | - $response = $this->util->pexec($cmd); | |
| 146 | - | |
| 147 | - return $response; | |
| 148 | - } elseif ($state == '') { | |
| 149 | - // Start Service | |
| 150 | - return true; | |
| 151 | - } else { | |
| 152 | - // Service Running Already | |
| 153 | - return true; | |
| 146 | + | |
| 147 | + return $this->util->pexec($cmd); | |
| 154 | 148 | } |
| 155 | 149 | |
| 156 | - return false; | |
| 150 | + return true; | |
| 157 | 151 | } |
| 158 | 152 | |
| 159 | 153 | /** | ... | ... |
setup/wizard/lib/validation/openofficeValidation.php
| ... | ... | @@ -154,7 +154,7 @@ class openofficeValidation extends serviceValidation { |
| 154 | 154 | $bin = "soffice"; |
| 155 | 155 | } |
| 156 | 156 | foreach ($locations as $loc) { |
| 157 | - $pathToBinary = $loc.$bin; | |
| 157 | + $pathToBinary = $loc.DS.$bin; | |
| 158 | 158 | if(file_exists($pathToBinary)) { |
| 159 | 159 | return $pathToBinary; |
| 160 | 160 | } | ... | ... |
setup/wizard/step.php
setup/wizard/steps/complete.php
| ... | ... | @@ -142,8 +142,8 @@ class complete extends Step { |
| 142 | 142 | // retrieve database information from session |
| 143 | 143 | $dbconf = $this->getDataFromSession("database"); |
| 144 | 144 | // make db connection - admin |
| 145 | - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | |
| 146 | - $loaded = $this->util->dbHandler->getDatabaseLink(); | |
| 145 | + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | |
| 146 | + $loaded = $this->util->dbUtilities->getDatabaseLink(); | |
| 147 | 147 | if (!$loaded) { |
| 148 | 148 | $this->temp_variables['dbConnectAdmin'] .= '<td><div class="cross"></div></td>' |
| 149 | 149 | . '<td class="error">Unable to connect to database (user: ' |
| ... | ... | @@ -157,20 +157,20 @@ class complete extends Step { |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | // make db connection - user |
| 160 | - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']); | |
| 161 | - $loaded = $this->util->dbHandler->getDatabaseLink(); | |
| 160 | + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']); | |
| 161 | + $loaded = $this->util->dbUtilities->getDatabaseLink(); | |
| 162 | 162 | // if we can log in to the database, check access |
| 163 | 163 | // TODO check write access? |
| 164 | 164 | if ($loaded) |
| 165 | 165 | { |
| 166 | 166 | $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')'); |
| 167 | 167 | |
| 168 | - $qresult = $this->util->dbHandler->query('SELECT COUNT(id) FROM documents'); | |
| 168 | + $qresult = $this->util->dbUtilities->query('SELECT COUNT(id) FROM documents'); | |
| 169 | 169 | if (!$qresult) |
| 170 | 170 | { |
| 171 | 171 | $this->temp_variables['dbPrivileges'] .= '<td style="width:15px;"><div class="cross" style="float:left;"></div></td>' |
| 172 | 172 | . '<td class="error" style="width:500px;">' |
| 173 | - . 'Unable to do a basic database query. Error: ' . $this->util->dbHandler->getLastError() | |
| 173 | + . 'Unable to do a basic database query. Error: ' . $this->util->dbUtilities->getLastError() | |
| 174 | 174 | . '</td>'; |
| 175 | 175 | $this->privileges_check = 'cross'; |
| 176 | 176 | $this->privileges_check = 'cross'; |
| ... | ... | @@ -183,17 +183,17 @@ class complete extends Step { |
| 183 | 183 | |
| 184 | 184 | // check transaction support |
| 185 | 185 | $sTable = 'system_settings'; |
| 186 | - $this->util->dbHandler->startTransaction(); | |
| 187 | - $this->util->dbHandler->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")'); | |
| 188 | - $this->util->dbHandler->rollback(); | |
| 189 | - $res = $this->util->dbHandler->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1"); | |
| 186 | + $this->util->dbUtilities->startTransaction(); | |
| 187 | + $this->util->dbUtilities->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")'); | |
| 188 | + $this->util->dbUtilities->rollback(); | |
| 189 | + $res = $this->util->dbUtilities->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1"); | |
| 190 | 190 | if (!$res) { |
| 191 | 191 | $this->temp_variables['dbTransaction'] .= sprintf($html, 'cross', 'class="error"', 'Transaction support not available in database'); |
| 192 | 192 | $this->privileges_check = 'cross'; |
| 193 | 193 | } else { |
| 194 | 194 | $this->temp_variables['dbTransaction'] .= sprintf($html, 'tick', '', 'Database has transaction support'); |
| 195 | 195 | } |
| 196 | - $this->util->dbHandler->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"'); | |
| 196 | + $this->util->dbUtilities->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"'); | |
| 197 | 197 | } |
| 198 | 198 | else |
| 199 | 199 | { | ... | ... |
setup/wizard/steps/configuration.php
| ... | ... | @@ -307,26 +307,26 @@ class configuration extends Step |
| 307 | 307 | { |
| 308 | 308 | $conf = $this->getDataFromSession("configuration"); // get data from the server |
| 309 | 309 | $dbconf = $this->getDataFromSession("database"); |
| 310 | - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | |
| 310 | + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | |
| 311 | 311 | $server = $conf['server']; |
| 312 | 312 | $paths = $conf['paths']; |
| 313 | 313 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 314 | 314 | $this->readInstallation(); |
| 315 | - $configPath = $paths['configFile']['path']; | |
| 315 | + $this->confpaths['configIni'] = $paths['configFile']['path']; | |
| 316 | 316 | } else { |
| 317 | 317 | $this->readConfigPath(); // initialise writing to config.ini |
| 318 | 318 | } |
| 319 | 319 | $this->getFromConfigPath(); // Sets config Paths |
| 320 | 320 | if(file_exists($this->confpaths['configIni'])) { |
| 321 | - $this->util->iniHandler->load($this->confpaths['configIni']); | |
| 321 | + $this->util->iniUtilities->load($this->confpaths['configIni']); | |
| 322 | 322 | } |
| 323 | - if(!$this->util->iniHandler === false){ // write out the config.ini file | |
| 323 | + if(!$this->util->iniUtilities=== false){ // write out the config.ini file | |
| 324 | 324 | $this->writeUrlSection(); |
| 325 | 325 | $this->writeDBSection($server); |
| 326 | 326 | $this->writeDBPathSection($paths); |
| 327 | - $this->util->iniHandler->write(); | |
| 327 | + $this->util->iniUtilities->write(); | |
| 328 | 328 | } |
| 329 | - $this->util->dbHandler->close(); // close the database connection | |
| 329 | + $this->util->dbUtilities->close(); // close the database connection | |
| 330 | 330 | $this->writeCachePath($this->getCachePath(), $paths['cacheDirectory']['path']); // Write cache path file |
| 331 | 331 | $this->writeConfigPath($this->getContentPath(), $this->confpaths['configIni']); // Write config file |
| 332 | 332 | } |
| ... | ... | @@ -334,7 +334,7 @@ class configuration extends Step |
| 334 | 334 | private function writeUrlSection() { |
| 335 | 335 | $directories = $this->registerDirs(); |
| 336 | 336 | foreach($directories as $item) { // write server settings to config_settings table and config.ini |
| 337 | - $this->util->iniHandler->updateItem($item['section'], $item['setting'], $item['value']); | |
| 337 | + $this->util->iniUtilities->updateItem($item['section'], $item['setting'], $item['value']); | |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
| ... | ... | @@ -348,14 +348,14 @@ class configuration extends Step |
| 348 | 348 | $value = mysql_real_escape_string($item['path']); |
| 349 | 349 | $setting = mysql_real_escape_string($item['setting']); |
| 350 | 350 | $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; |
| 351 | - $this->util->dbHandler->query($sql); | |
| 351 | + $this->util->dbUtilities->query($sql); | |
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | private function writeDBSection($server) { |
| 357 | 357 | $dbconf = $this->getDataFromSession("database"); // retrieve database information from session |
| 358 | - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection | |
| 358 | + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection | |
| 359 | 359 | $server = $this->registerDBConfig($server, $dbconf); // add db config to server variables |
| 360 | 360 | $table = 'config_settings'; |
| 361 | 361 | foreach($server as $item) { // write server settings to config_settings table and config.ini |
| ... | ... | @@ -368,14 +368,14 @@ class configuration extends Step |
| 368 | 368 | if($value == 'no'){ |
| 369 | 369 | $value = 'false'; |
| 370 | 370 | } |
| 371 | - $this->util->iniHandler->updateItem($item['section'], $item['setting'], $value); | |
| 371 | + $this->util->iniUtilities->updateItem($item['section'], $item['setting'], $value); | |
| 372 | 372 | break; |
| 373 | 373 | case 'db': |
| 374 | 374 | $value = mysql_real_escape_string($item['value']); |
| 375 | 375 | $setting = mysql_real_escape_string($item['setting']); |
| 376 | 376 | |
| 377 | 377 | $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; |
| 378 | - $this->util->dbHandler->query($sql); | |
| 378 | + $this->util->dbUtilities->query($sql); | |
| 379 | 379 | break; |
| 380 | 380 | } |
| 381 | 381 | } |
| ... | ... | @@ -573,12 +573,13 @@ class configuration extends Step |
| 573 | 573 | |
| 574 | 574 | public function readConfigPathIni() { |
| 575 | 575 | if(isset($this->temp_variables['paths']['configFile']['path'])) { |
| 576 | - return $this->temp_variables['paths']['configFile']['path']; | |
| 576 | + if($this->temp_variables['paths']['configFile']['path'] != '') | |
| 577 | + return $this->temp_variables['paths']['configFile']['path']; | |
| 577 | 578 | } |
| 578 | 579 | $configPath = $this->getContentPath(); |
| 579 | 580 | if(!$configPath) return false; |
| 580 | - $this->util->iniHandler->load($configPath); | |
| 581 | - $data = $this->util->iniHandler->getFileByLine(); | |
| 581 | + $this->util->iniUtilities->load($configPath); | |
| 582 | + $data = $this->util->iniUtilities->getFileByLine(); | |
| 582 | 583 | $firstline = true; |
| 583 | 584 | foreach ($data as $k=>$v) { |
| 584 | 585 | if(preg_match('/config.ini/', $k)) { // Find config.ini |
| ... | ... | @@ -600,8 +601,8 @@ class configuration extends Step |
| 600 | 601 | private function readConfigPath() { |
| 601 | 602 | $configPath = $this->getContentPath(); |
| 602 | 603 | if(!$configPath) return false; |
| 603 | - $this->util->iniHandler->load($configPath); | |
| 604 | - $data = $this->util->iniHandler->getFileByLine(); | |
| 604 | + $this->util->iniUtilities->load($configPath); | |
| 605 | + $data = $this->util->iniUtilities->getFileByLine(); | |
| 605 | 606 | $firstline = true; |
| 606 | 607 | foreach ($data as $k=>$v) { |
| 607 | 608 | if($firstline) { // First line holds the var directory | ... | ... |
setup/wizard/steps/database.php
| ... | ... | @@ -320,11 +320,11 @@ class database extends Step |
| 320 | 320 | return false; |
| 321 | 321 | } |
| 322 | 322 | if($this->dport == '') { |
| 323 | - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 323 | + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 324 | 324 | } else { |
| 325 | - $this->util->dbHandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); | |
| 325 | + $this->util->dbUtilities->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); | |
| 326 | 326 | } |
| 327 | - if (!$this->util->dbHandler->getDatabaseLink()) { | |
| 327 | + if (!$this->util->dbUtilities->getDatabaseLink()) { | |
| 328 | 328 | $this->error['con'] = "Could not connect to the database, please check username and password"; |
| 329 | 329 | return false; |
| 330 | 330 | } else { |
| ... | ... | @@ -339,7 +339,7 @@ class database extends Step |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | public function dbExists() { |
| 342 | - return $this->util->dbHandler->useDb(); | |
| 342 | + return $this->util->dbUtilities->useDb(); | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | public function match($str1, $str2) { |
| ... | ... | @@ -500,7 +500,6 @@ class database extends Step |
| 500 | 500 | * @return object SimpleXmlObject |
| 501 | 501 | */ |
| 502 | 502 | public function readXml() { |
| 503 | -// echo CONF_DIR."databases.xml"; | |
| 504 | 503 | $simplexml = simplexml_load_file(CONF_DIR."databases.xml"); |
| 505 | 504 | |
| 506 | 505 | return $simplexml; |
| ... | ... | @@ -583,7 +582,7 @@ class database extends Step |
| 583 | 582 | * @return object mysql connection |
| 584 | 583 | */ |
| 585 | 584 | private function connectMysql() { |
| 586 | - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 585 | + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 587 | 586 | } |
| 588 | 587 | |
| 589 | 588 | /** |
| ... | ... | @@ -642,7 +641,7 @@ class database extends Step |
| 642 | 641 | $this->error['con'] = "Could not create database: "; |
| 643 | 642 | } |
| 644 | 643 | } |
| 645 | - $this->util->dbHandler->clearErrors(); | |
| 644 | + $this->util->dbUtilities->clearErrors(); | |
| 646 | 645 | if(!$this->createDmsUser()) { // Create dms users |
| 647 | 646 | $this->error['con'] = "Could not create database users "; |
| 648 | 647 | } |
| ... | ... | @@ -666,8 +665,7 @@ class database extends Step |
| 666 | 665 | */ |
| 667 | 666 | private function create() { |
| 668 | 667 | $sql = "CREATE DATABASE {$this->dname}"; |
| 669 | - if ($this->util->dbHandler->query($sql)) { | |
| 670 | - | |
| 668 | + if ($this->util->dbUtilities->query($sql)) { | |
| 671 | 669 | return true; |
| 672 | 670 | } |
| 673 | 671 | |
| ... | ... | @@ -683,7 +681,7 @@ class database extends Step |
| 683 | 681 | * @return boolean |
| 684 | 682 | */ |
| 685 | 683 | private function usedb() { |
| 686 | - if($this->util->dbHandler->useDb()) { | |
| 684 | + if($this->util->dbUtilities->useDb()) { | |
| 687 | 685 | return true; |
| 688 | 686 | } else { |
| 689 | 687 | $this->error['con'] = "Error using database: {$this->dname}"; |
| ... | ... | @@ -702,7 +700,7 @@ class database extends Step |
| 702 | 700 | private function dropdb() { |
| 703 | 701 | if($this->ddrop) { |
| 704 | 702 | $sql = "DROP DATABASE {$this->dname};"; |
| 705 | - if(!$this->util->dbHandler->query($sql)) { | |
| 703 | + if(!$this->util->dbUtilities->query($sql)) { | |
| 706 | 704 | $this->error['con'] = "Cannot drop database: {$this->dname}"; |
| 707 | 705 | return false; |
| 708 | 706 | } |
| ... | ... | @@ -724,7 +722,7 @@ class database extends Step |
| 724 | 722 | private function createDmsUser() { |
| 725 | 723 | $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; |
| 726 | 724 | $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; |
| 727 | - if ($this->util->dbHandler->query($user1) && $this->util->dbHandler->query($user2)) { | |
| 725 | + if ($this->util->dbUtilities->query($user1) && $this->util->dbUtilities->query($user2)) { | |
| 728 | 726 | return true; |
| 729 | 727 | } else { |
| 730 | 728 | $this->error['con'] = "Could not create users for database: {$this->dname}"; |
| ... | ... | @@ -751,7 +749,7 @@ class database extends Step |
| 751 | 749 | while (!feof($handle)) { |
| 752 | 750 | $query.= fgets($handle, 4096); |
| 753 | 751 | if (substr(rtrim($query), -1) == ';') { |
| 754 | - $this->util->dbHandler->query($query); | |
| 752 | + $this->util->dbUtilities->query($query); | |
| 755 | 753 | $query = ''; |
| 756 | 754 | } |
| 757 | 755 | } |
| ... | ... | @@ -778,9 +776,9 @@ class database extends Step |
| 778 | 776 | $sqlFile = $dbMigrate['dumpLocation']; |
| 779 | 777 | $this->parse_mysql_dump($sqlFile); |
| 780 | 778 | $dropPluginHelper = "TRUNCATE plugin_helper;"; |
| 781 | - $this->util->dbHandler->query($dropPluginHelper); | |
| 779 | + $this->util->dbUtilities->query($dropPluginHelper); | |
| 782 | 780 | $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";'; |
| 783 | - $this->util->dbHandler->query($updateUrls); | |
| 781 | + $this->util->dbUtilities->query($updateUrls); | |
| 784 | 782 | return true; |
| 785 | 783 | } |
| 786 | 784 | /** |
| ... | ... | @@ -793,7 +791,7 @@ class database extends Step |
| 793 | 791 | */ |
| 794 | 792 | private function closeMysql() { |
| 795 | 793 | try { |
| 796 | - $this->util->dbHandler->close(); | |
| 794 | + $this->util->dbUtilities->close(); | |
| 797 | 795 | } catch (Exeption $e) { |
| 798 | 796 | $this->error['con'] = "Could not close: " . $e; |
| 799 | 797 | } |
| ... | ... | @@ -844,7 +842,7 @@ class database extends Step |
| 844 | 842 | $this->dpassword = 'root'; |
| 845 | 843 | $this->dname = 'dms_install'; |
| 846 | 844 | $this->dbbinary = 'mysql'; |
| 847 | - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 845 | + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname); | |
| 848 | 846 | $this->createSchema(); |
| 849 | 847 | echo 'Schema loaded<br>'; |
| 850 | 848 | } | ... | ... |
setup/wizard/steps/install.php
| ... | ... | @@ -107,14 +107,14 @@ class install extends step |
| 107 | 107 | public function callHome() { |
| 108 | 108 | $conf = $this->getDataFromSession("install"); // retrieve database information from session |
| 109 | 109 | $dbconf = $this->getDataFromSession("database"); |
| 110 | - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection | |
| 110 | + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection | |
| 111 | 111 | $complete = 1; |
| 112 | 112 | if($conf['call_home'] == 'enable'){ |
| 113 | 113 | $complete = 0; |
| 114 | 114 | } |
| 115 | 115 | $query = "UPDATE scheduler_tasks SET is_complete = {$complete} WHERE task = 'Call Home'"; |
| 116 | - $this->util->dbHandler->query($query); | |
| 117 | - $this->util->dbHandler->close(); // close the database connection | |
| 116 | + $this->util->dbUtilities->query($query); | |
| 117 | + $this->util->dbUtilities->close(); // close the database connection | |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | ?> |
| 121 | 121 | \ No newline at end of file | ... | ... |
thirdparty/Smarty/internals/core.write_compiled_resource.php
| ... | ... | @@ -17,7 +17,7 @@ function smarty_core_write_compiled_resource($params, &$smarty) |
| 17 | 17 | if(!@is_writable($smarty->compile_dir)) { |
| 18 | 18 | // compile_dir not writable, see if it exists |
| 19 | 19 | if(!@is_dir($smarty->compile_dir)) { |
| 20 | - $smarty->trigger_error('the $compile_dir ' . $smarty->compile_dir . ' does not exist, or is not a directory.', E_USER_ERROR); | |
| 20 | + $smarty->trigger_error('the '.$compile_dir.' ' . $smarty->compile_dir . ' does not exist, or is not a directory.', E_USER_ERROR); | |
| 21 | 21 | return false; |
| 22 | 22 | } |
| 23 | 23 | $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); | ... | ... |