/** * Executes installation based upon nodes. */ protected function stepInstall() { $step = $this->installation->install($this->node); $queueID = $this->installation->nodeBuilder->getQueueByNode($this->installation->queue->processNo, $step->getNode()); if ($step->hasDocument()) { $this->data = array('currentAction' => $this->getCurrentAction($queueID), 'innerTemplate' => $step->getTemplate(), 'node' => $step->getNode(), 'progress' => $this->installation->nodeBuilder->calculateProgress($this->node), 'step' => 'install', 'queueID' => $queueID); } else { if ($step->getNode() == '') { // perform final actions $this->installation->completeSetup(); $this->finalize(); switch (PACKAGE_ID) { // redirect to application if not already within one case 0: // during WCFSetup // during WCFSetup case 1: // select first installed application $sql = "SELECT\t\tpackageID\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_package\n\t\t\t\t\t\t\tWHERE\t\tpackageID <> 1\n\t\t\t\t\t\t\t\t\tAND isApplication = 1\n\t\t\t\t\t\t\tORDER BY\tinstallDate ASC"; $statement = WCF::getDB()->prepareStatement($sql, 1); $statement->execute(); $row = $statement->fetchArray(); $packageID = $row === false ? 1 : $row['packageID']; break; default: $packageID = PACKAGE_ID; break; } // get domain path $sql = "SELECT\t*\n\t\t\t\t\tFROM\twcf" . WCF_N . "_application\n\t\t\t\t\tWHERE\tpackageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($packageID)); $application = $statement->fetchObject('wcf\\data\\application\\Application'); // build redirect location $location = $application->getPageURL() . 'acp/index.php?package-list/' . SID_ARG_2ND_NOT_ENCODED; WCF::resetZendOpcache(); // show success $this->data = array('currentAction' => $this->getCurrentAction(null), 'progress' => 100, 'redirectLocation' => $location, 'step' => 'success'); return; } WCF::resetZendOpcache(); // continue with next node $this->data = array('currentAction' => $this->getCurrentAction($queueID), 'step' => 'install', 'node' => $step->getNode(), 'progress' => $this->installation->nodeBuilder->calculateProgress($this->node), 'queueID' => $queueID); } }
/** * Rebuilds the option file. */ public static function rebuild() { $writer = new AtomicWriter(WCF_DIR . 'options.inc.php'); // file header $writer->write("<?php\n/**\n* generated at " . gmdate('r') . "\n*/\n"); // get all options $options = Option::getOptions(); foreach ($options as $optionName => $option) { $writer->write("if (!defined('" . $optionName . "')) define('" . $optionName . "', " . ($option->optionType == 'boolean' || $option->optionType == 'integer' ? intval($option->optionValue) : "'" . addcslashes($option->optionValue, "'\\") . "'") . ");\n"); } unset($options); // file footer $writer->write("\n"); $writer->flush(); $writer->close(); FileUtil::makeWritable(WCF_DIR . 'options.inc.php'); WCF::resetZendOpcache(WCF_DIR . 'options.inc.php'); }
/** * Removes files matching given pattern. * * @param string $pattern */ protected function removeFiles($pattern) { $directory = FileUtil::unifyDirSeparator(WCF_DIR . 'cache/'); $pattern = str_replace('*', '.*', str_replace('.', '\\.', $pattern)); $this->getDirectoryUtil()->executeCallback(new Callback(function ($filename) { if (!@touch($filename, 1)) { @unlink($filename); WCF::resetZendOpcache($filename); } }), new Regex('^' . $directory . $pattern . '$', Regex::CASE_INSENSITIVE)); }