From 3158852bd4295ec91125f2b7dd897fa79cb78f08 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 22 Dec 2009 20:45:11 -0700 Subject: [PATCH] Add install_dev script --- .gitignore | 3 +- framework/bin/install_dev | 108 ++++++++++++++++++++++++++++++++++++ framework/bin/install_dev.conf.dist | 25 +++++++++ horde/lib/core.php | 19 ++----- 4 files changed, 141 insertions(+), 14 deletions(-) create mode 100755 framework/bin/install_dev create mode 100644 framework/bin/install_dev.conf.dist diff --git a/.gitignore b/.gitignore index 2b10cdff8..9cb8638c0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.orig *.rej -horde/lib/core.local.php horde/libs/ horde/static/*.* + +framework/bin/*.conf diff --git a/framework/bin/install_dev b/framework/bin/install_dev new file mode 100755 index 000000000..4b2c7aa23 --- /dev/null +++ b/framework/bin/install_dev @@ -0,0 +1,108 @@ +#!/usr/bin/env php + + */ + +require_once './install_dev.conf'; + +$horde_git = rtrim(ltrim($horde_git), '/ '); +$horde_hatchery = rtrim(ltrim($horde_hatchery), '/ '); +$web_dir = rtrim(ltrim($web_dir), '/ '); + +if ($debug) { + print "DELETING old web directory " . $web_dir . "\n"; +} +$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($web_dir), RecursiveIteratorIterator::CHILD_FIRST); +while ($it->valid()) { + if (!$it->isDot()) { + if ($it->isLink()) { + if ($debug) { + print "DELETING LINK: " . $it->key() . "\n"; + } + unlink($it->key()); + } elseif ($it->isDir()) { + if ($debug) { + print "DELETING DIR: " . $it->key() . "\n"; + } + rmdir($it->key()); + } elseif ($it->isFile()) { + if ($debug) { + print "DELETING FILE: " . $it->key() . "\n"; + } + unlink($it->key()); + } + } + $it->next(); +} + +if (!empty($git)) { + if ($debug) { + print "\nUPDATING repositories\n"; + } + system('cd ' . $horde_git . ';' . $git); + system('cd ' . $horde_hatchery . ';' . $git); +} + +if ($debug) { + print "\nLINKING horde\n"; +} +$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($horde_git . '/horde'), RecursiveIteratorIterator::SELF_FIRST); +while ($it->valid()) { + if (!$it->isDot()) { + if ($it->isDir()) { + if ($debug) { + print "CREATING DIR: " . $web_dir . '/' . $it->getSubPathName() . "\n"; + } + mkdir($web_dir . '/' . $it->getSubPathName()); + } else { + if ($debug) { + print "LINKING FILE: " . $web_dir . "/" . $it->getSubPathName() . "\n"; + } + symlink($it->key(), $web_dir . '/' . $it->getSubPathName()); + } + } + $it->next(); +} + +if (!empty($static_group)) { + if ($debug) { + print "\nCHGRP/CHMOD static directory\n"; + } + chgrp($web_dir . '/static', $static_group); + chmod($web_dir . '/static', $static_mode); +} + +if ($debug) { + print "\nLINKING framework\n"; +} +file_put_contents($web_dir . '/config/horde.local.php', "