Skip to content

Commit

Permalink
Use file_root instead of web_base.
Browse files Browse the repository at this point in the history
web_base is too easy to confuse with web_root, and we already use file_root in
the registry.
  • Loading branch information
yunosh committed Jan 8, 2015
1 parent 6672b80 commit ef96580
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions horde/bin/dev/horde-dev-create-web
Expand Up @@ -37,7 +37,7 @@ Installation will *MOVE* the current file to a time-stamped backup.
- horde/config/registry.d/horde-dev.php
Installation will *DELETE* all contents of the 'web_base' directory defined
Installation will *DELETE* all contents of the 'file_root' directory defined
in the configuration file.
Perform install (Y to install, anything else to exit)?
Expand All @@ -57,11 +57,11 @@ if (!isset($dev_config)) {
exit("CONFIG ERROR: \$dev_config array not found in config file.\n");
}

if (empty($dev_config['web_base'])) {
exit("CONFIG ERROR: 'web_base' not defined in config file.\n");
if (empty($dev_config['file_root'])) {
exit("CONFIG ERROR: 'file_root' not defined in config file.\n");
}
$web_base = rtrim(trim($dev_config['web_base']), '/');
print "\tWeb base Horde directory: " . $web_base . "\n";
$file_root = rtrim(trim($dev_config['file_root']), '/');
print "\tWeb base Horde directory: " . $file_root . "\n";

$web_dir = isset($dev_config['web_dir'])
? rtrim(trim($dev_config['web_dir']), '/')
Expand All @@ -84,25 +84,25 @@ if (!isset($apps['horde'])) {
exit("CONFIG ERROR: Require at least 'horde' app to install.\n");
}

if (!file_exists($web_base)) {
if (!file_exists($file_root)) {
print "\tCreating new directory ... ";
if (!@mkdir($web_base)) {
exit("\nCONFIG ERROR: 'web_base' directory cannot be created.\n");
if (!@mkdir($file_root)) {
exit("\nCONFIG ERROR: 'file_root' directory cannot be created.\n");
}
print "DONE\n";
} else {
if (!is_dir($web_base)) {
exit("CONFIG ERROR: 'web_base' is not a directory.\n");
} elseif (!is_writable($web_base)) {
exit("CONFIG ERROR: 'web_base' is not a writable directory.\n");
if (!is_dir($file_root)) {
exit("CONFIG ERROR: 'file_root' is not a directory.\n");
} elseif (!is_writable($file_root)) {
exit("CONFIG ERROR: 'file_root' is not a writable directory.\n");
}

print "\tEmptying old directory ... ";

try {
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
$web_base,
$file_root,
// This does not follow symlinks.
FilesystemIterator::KEY_AS_PATHNAME |
FilesystemIterator::CURRENT_AS_FILEINFO |
Expand Down Expand Up @@ -137,7 +137,7 @@ foreach ($apps as $key => $val) {
print "FAILED!\n";
print "ERROR: Source directory does not exist. Skipping.\n";
} else {
$app_install = $web_base . '/' . $key;
$app_install = $file_root . '/' . $key;
if (!@symlink($val, $app_install)) {
print "FAILED!\n";
print "\tERROR: Could not link to source directory. Skipping.\n";
Expand Down
2 changes: 1 addition & 1 deletion horde/bin/dev/horde-dev-create-web.conf.dist
Expand Up @@ -7,7 +7,7 @@ $dev_config = array(

/* Location of the web-accessible base directory. ALL applications will
* be stored as first-level elements of this directory. */
'web_base' => null,
'file_root' => null,

/* Location of the web root directory. */
'web_root' => '/',
Expand Down

0 comments on commit ef96580

Please sign in to comment.