Commit e1088deb2c8d14b1426e557614e63ef9e4540897

Authored by Jarrett Jordaan
2 parents 83991846 822a0825

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

setup/wizard/installUtil.php
... ... @@ -765,16 +765,12 @@ class InstallUtil {
765 765 if($this->installEnvironment() == 'Zend') {
766 766 if(WINDOWS_OS) { // For Zend Installation only
767 767 $sysdir = explode(DS, SYSTEM_DIR);
768   - // pop until we find Zend, this should be our Zend root :)
769   - $current = array_pop($sysdir);
770   - while ($current != 'Zend') {
771   - $current = array_pop($sysdir);
772   - }
  768 + array_pop($sysdir);
  769 + array_pop($sysdir);
773 770 $zendsys = '';
774 771 foreach ($sysdir as $v) {
775 772 $zendsys .= $v.DS;
776 773 }
777   - $zendsys .= 'Zend'.DS;
778 774 $bin = $zendsys."ZendServer".DS."bin".DS;
779 775 if(file_exists($bin))
780 776 return $bin;
... ...
setup/wizard/steps/database.php
... ... @@ -787,24 +787,42 @@ class database extends Step
787 787 }
788 788 }
789 789  
790   - // if Windows, hard code (relative to SYSTEM_ROOT) where we expect the Zend MSI installer to have placed them
  790 + // if Windows, attempt to insert full paths to binaries
791 791 if (WINDOWS_OS) {
792 792 $winBinaries = array('php' => 'ZendServer\bin\php.exe', 'python' => 'openoffice\program\python.exe',
793 793 'java' => 'jre\bin\java.exe',
794 794 // since we don't know where convert is yet, let's just assume somewhere for now (manually test)
795   - 'convert' => 'imagick\convert.exe',
  795 + 'convert' => 'bin\imagemagick\convert.exe',
796 796 'zip' => 'bin\zip\zip.exe', 'unzip' => 'bin\unzip\unzip.exe');
797   - foreach ($winBinaries as $displayName => $bin) {
798   - // what about config settings which don't yet exist?
799   - // TODO make sure sql install/updates create these entries
800   - $updateBin = 'UPDATE config_settings c SET c.value = "'. str_replace('\\', '\\\\', SYSTEM_ROOT . $bin).'" '
  797 + foreach ($winBinaries as $displayName => $bin)
  798 + {
  799 + // ignore if we can't find the file
  800 + if (!file_exists(SYSTEM_ROOT . $bin)) continue;
  801 +
  802 + // thumbnails is a special case, being a plugin which won't have an entry on a new installation
  803 + if ($displayName == 'convert') {
  804 + // check if there is an entry, if not, insert and continue to next loop, else continue to update statement
  805 + $query = 'SELECT id FROM config_settings WHERE display_name = "' . $displayName . '"';
  806 + $this->util->dbUtilities->query($query);
  807 + $result = $this->util->dbUtilities->fetchAssoc();
  808 + if (is_null($result)) {
  809 + $query = "INSERT INTO `config_settings` "
  810 + . "(group_name, display_name, description, item, value, default_value, type, options, can_edit) "
  811 + . "VALUES ('externalBinary', 'convert', 'The path to the ImageMagick \"convert\" binary', 'convertPath', "
  812 + . "'" . str_replace('\\', '\\\\', SYSTEM_ROOT . $bin) . "', 'convert', 'string', NULL, 1);";
  813 + $this->util->dbUtilities->query($query);
  814 + continue;
  815 + }
  816 + }
  817 +
  818 + $updateBin = 'UPDATE config_settings c SET c.value = "'. str_replace('\\', '\\\\', SYSTEM_ROOT . $bin) . '" '
801 819 . 'where c.group_name = "externalBinary" and c.display_name = "'.$displayName.'";';
802 820 $this->util->dbUtilities->query($updateBin);
803 821 }
804 822 }
805 823 // if Linux?
806 824 else {
807   -
  825 + // TODO python binary
808 826 }
809 827 }
810 828  
... ...