/** * * @runInSeparateProcess */ function testInstall() { global $dataDir; //make sure it's not installed $config_file = $dataDir . '/data/_site/config.php'; self::AssertFileNotExists($config_file, 'Cannot test installation (Already Installed)'); //mimic POST $_POST = array(); $_POST['email'] = '*****@*****.**'; $_POST['username'] = '******'; $_POST['password'] = '******'; $_POST['password1'] = $_POST['password']; //attempt to install ob_start(); includeFile('tool/install.php'); $success = Install_Tools::Install_DataFiles_New(); ob_get_clean(); self::AssertTrue($success, 'Installation Failed'); //double check self::AssertFileExists($config_file); }
function Install_Normal() { global $langmessage, $install_language; echo '<h2>' . $langmessage['Installing'] . '</h2>'; echo '<ul class="install_status">'; $config = array(); $config['language'] = $install_language; $success = false; if (Install_Tools::gpInstall_Check()) { $success = Install_Tools::Install_DataFiles_New(false, $config); } echo '</ul>'; return $success; }
function NewCreate() { global $rootDir, $config, $checkFileIndex; global $dataDir; //for SaveTitle(), SaveConfig() includeFile('tool/install.php'); $_POST += array('themes' => array(), 'plugins' => array()); $destination = $_REQUEST['install']['folder']; $this->site_uniq_id = $this->NewId(); $checkFileIndex = false; //prevent reposting if (isset($this->siteData['sites'][$destination])) { message('Oops, there\'s already an installation in ' . htmlspecialchars($destination)); return false; } echo '<ul>'; echo '<li>Starting Installation</li>'; //check user values first if (!Install_Tools::gpInstall_Check()) { $this->Install_Aborted($destination); return false; } // Create index.php file echo '<li>Create index.php file</li>'; if (!$this->CreateIndex($destination, $this->site_uniq_id)) { echo '<li>Failed to save the index.php file</li>'; $this->Install_Aborted($destination); return false; } // Create /include symlink $target = $rootDir . '/include'; $name = $destination . '/include'; if (!$this->Create_Symlink($target, $name, 'main.php')) { $this->Install_Aborted($destination); return false; } // Create /themes folder if (!$this->CopyThemes($destination, $_REQUEST['install'])) { $this->Install_Aborted($destination); return false; } // Create /plugins folder if (!$this->CreatePlugins($destination, $_REQUEST['install'])) { $this->Install_Aborted($destination); return false; } // variable juggling $oldDir = $dataDir; $dataDir = $destination; $new_config = array(); $new_config['language'] = $config['language']; $new_config['gpuniq'] = $this->NewId(); if (!Install_Tools::Install_DataFiles_New($destination, $new_config, false)) { $this->Install_Aborted($destination); return false; } $dataDir = $oldDir; $this->siteData['sites'][$destination] = array(); $this->siteData['sites'][$destination]['unique'] = $this->site_uniq_id; $this->siteData['sites'][$destination]['gpuniq'] = $new_config['gpuniq']; $this->SaveSiteData(); $this->Install_Success(); return true; }