Skip to content
Snippets Groups Projects
Commit 9d267806 authored by Tim Steiner's avatar Tim Steiner
Browse files

Add a small amount of protection to prevent symlinks from being removed by the...

Add a small amount of protection to prevent symlinks from being removed by the site creation tool when a site is removed if it had sub-sites.

git-svn-id: file:///tmp/wdn_thm_drupal/trunk@238 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent f81bb477
No related branches found
No related tags found
No related merge requests found
...@@ -125,7 +125,7 @@ function unl_remove_site($site_path, $uri, $db_prefix) { ...@@ -125,7 +125,7 @@ function unl_remove_site($site_path, $uri, $db_prefix) {
if (strlen($sites_subdir) <= strlen(DRUPAL_ROOT . '/sites/')) { if (strlen($sites_subdir) <= strlen(DRUPAL_ROOT . '/sites/')) {
return FALSE; return FALSE;
} }
foreach ($tables as $table) { foreach ($tables as $table) {
$table = $db_prefix . $table; $table = $db_prefix . $table;
try { try {
...@@ -138,7 +138,19 @@ function unl_remove_site($site_path, $uri, $db_prefix) { ...@@ -138,7 +138,19 @@ function unl_remove_site($site_path, $uri, $db_prefix) {
shell_exec('chmod -R u+w ' . escapeshellarg($sites_subdir)); shell_exec('chmod -R u+w ' . escapeshellarg($sites_subdir));
shell_exec('rm -rf ' . escapeshellarg($sites_subdir)); shell_exec('rm -rf ' . escapeshellarg($sites_subdir));
// Check to see if this site had any sub-sites.
// If so, we don't want to remove any symlinks.
// TODO: instead, iterate over all sites and rebuild directories/symlinks if needed.
$results = db_select('unl_sites', 's')
->fields('s', array('uri'))
->condition('uri', $uri . '/%', 'LIKE')
->execute()
->fetchAll();
if (count($results) > 0) {
return TRUE;
}
// Remove the symlink to the drupal root for this site.
$subdir = explode('/', $site_path); $subdir = explode('/', $site_path);
$symlink_name = array_pop($subdir); $symlink_name = array_pop($subdir);
$subdir_levels = count($subdir); $subdir_levels = count($subdir);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment