<?php
namespace wcf\system\package;
use wcf\system\menu\acp\ACPMenu;
+use wcf\data\application\Application;
use wcf\data\application\ApplicationEditor;
use wcf\data\language\LanguageEditor;
use wcf\data\option\OptionEditor;
'packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir)
));
+ // parse domain path
+ $domainPath = FileUtil::getRelativePath(FileUtil::unifyDirSeperator($_SERVER['DOCUMENT_ROOT']), FileUtil::unifyDirSeperator($packageDir));
+ $domainPath = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash($domainPath));
+
+ // update application path
+ $application = new Application($this->getPackage()->packageID);
+ $applicationEditor = new ApplicationEditor($application);
+ $applicationEditor->update(array(
+ 'domainPath' => $domainPath
+ ));
+
// create directory and set permissions
@mkdir($packageDir, 0777, true);
@chmod($packageDir, 0777);
if (substr($path, -1) != '/') {
return $path.'/';
}
- else {
- return $path;
- }
+
+ return $path;
+ }
+
+ /**
+ * Adds a leading slash.
+ *
+ * @param string $path
+ * @return string $path
+ */
+ public static function addLeadingSlash($path) {
+ if (substr($path, 0, 1) != '/') {
+ return '/'.$path;
+ }
+
+ return $path;
}
/**