MDL-35238 Warn the admin if they are about to overwrite a SCM checkout

This commit is contained in:
David Mudrák
2012-11-08 22:33:07 +01:00
parent 292dbeac9b
commit 08c3bc006d
4 changed files with 40 additions and 5 deletions
+27
View File
@@ -1543,6 +1543,33 @@ class available_update_deployer {
return true;
}
/**
* Check to see if the current version of the plugin seems to be a checkout of an external repository.
*
* @param available_update_info $info
* @return false|string
*/
public function plugin_external_source(available_update_info $info) {
$paths = get_plugin_types(true);
list($plugintype, $pluginname) = normalize_component($info->component);
$pluginroot = $paths[$plugintype].'/'.$pluginname;
if (is_dir($pluginroot.'/.git')) {
return 'git';
}
if (is_dir($pluginroot.'/CVS')) {
return 'cvs';
}
if (is_dir($pluginroot.'/.svn')) {
return 'svn';
}
return false;
}
/**
* Prepares a renderable widget to confirm installation of an available update.
*