Skip to content

Commit

Permalink
Add WCF_UUID option
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWolla committed Nov 6, 2014
1 parent 602dbd4 commit 18dea1d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
7 changes: 7 additions & 0 deletions com.woltlab.wcf/option.xml
Expand Up @@ -235,6 +235,13 @@
<hidden>1</hidden>
</option>

<option name="wcf_uuid">
<categoryname>general</categoryname>
<optiontype>string</optiontype>
<defaultvalue>bd096261-15f4-5dc1-9767-01ce08d7c80b</defaultvalue> <!-- automatically replaced during WCFSetup -->
<hidden>1</hidden>
</option>

<option name="module_master_password">
<categoryname>module.system</categoryname>
<optiontype>boolean</optiontype>
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/system/WCFSetup.class.php
Expand Up @@ -667,7 +667,7 @@ protected function configureDB() {
$this->gotoNextStep('createDB');
exit;
}
// show configure temnplate again
// show configure template again
else {
WCF::getTPL()->assign(array('conflictedTables' => $conflictedTables));
}
Expand Down
Expand Up @@ -185,19 +185,25 @@ public function install($node) {
if (!PACKAGE_ID) {
CacheHandler::getInstance()->flushAll();

$sql = "UPDATE wcf".WCF_N."_option
SET optionValue = ?
WHERE optionName = ?";
$statement = WCF::getDB()->prepareStatement($sql);

$statement->execute(array(
StringUtil::getUUID(),
'wcf_uuid'
));

if (WCF::getSession()->getVar('__wcfSetup_developerMode')) {
$sql = "UPDATE wcf".WCF_N."_option
SET optionValue = ?
WHERE optionName = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
1,
'enable_debug_mode'
));

// update options.inc.php
OptionEditor::resetCache();
}

// update options.inc.php
OptionEditor::resetCache();
}

// rebuild application paths
Expand Down
9 changes: 9 additions & 0 deletions wcfsetup/install/files/lib/util/StringUtil.class.php
Expand Up @@ -52,6 +52,15 @@ public static function getRandomID() {
return self::getHash(microtime() . uniqid(mt_rand(), true));
}

/**
* Creates an UUID.
*
* @return string
*/
public static function getUUID() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}

/**
* Converts dos to unix newlines.
*
Expand Down

0 comments on commit 18dea1d

Please sign in to comment.