Skip to content
Snippets Groups Projects
Commit a98dfbbf authored by Robin Appelman's avatar Robin Appelman
Browse files

plugin manager and plugin installer

parent 494d88a4
No related branches found
No related tags found
No related merge requests found
...@@ -456,15 +456,16 @@ div.moreActionsList tr:hover{ ...@@ -456,15 +456,16 @@ div.moreActionsList tr:hover{
height:100%; height:100%;
} }
table.userlist{ table.userlist, table.pluginlist{
margin:0px; margin:0px;
padding:0px; padding:0px;
width:100%; width:100%;
border-spacing:0px; border-spacing:0px;
} }
table.userlist>thead{ table.userlist>thead, table.pluginlist>thead{
background-color:#DDD; background-color:#DDD;
font-weight:bold;
} }
table.userlist td.sellect{ table.userlist td.sellect{
...@@ -490,7 +491,7 @@ p.description{ ...@@ -490,7 +491,7 @@ p.description{
padding-bottom:3px; padding-bottom:3px;
} }
#settingsContent_user_managment{ div.settingsContent{
background-color:#F2F2F2; background-color:#F2F2F2;
min-height:100%; min-height:100%;
} }
...@@ -504,4 +505,17 @@ p.description{ ...@@ -504,4 +505,17 @@ p.description{
text-align:left; text-align:left;
background-color:#DDD; background-color:#DDD;
width:100%; width:100%;
}
table.pluginlist td.name{
width:150px;
}
table.pluginlist td.disable{
width:50px;
}
table.pluginlist td.version{
width:60px;
text-align:center
} }
\ No newline at end of file
...@@ -306,6 +306,24 @@ function zipAddDir($dir,$zip,$internalDir=''){ ...@@ -306,6 +306,24 @@ function zipAddDir($dir,$zip,$internalDir=''){
} }
} }
//remove a dir and it's content
function delTree($dir) {
if (!file_exists($dir)) return true;
if (!is_dir($dir) || is_link($dir)) return unlink($dir);
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') continue;
if(is_file($dir.'/'.$item)){
unlink($dir.'/'.$item);
}elseif(is_dir($dir.'/'.$item)){
if (!delTree($dir. "/" . $item)){
return false;
};
}
}
$return=rmdir($dir);
return $return;
}
if(!function_exists('sys_get_temp_dir')) { if(!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() { function sys_get_temp_dir() {
if( $temp=getenv('TMP') ) return $temp; if( $temp=getenv('TMP') ) return $temp;
...@@ -320,6 +338,22 @@ if(!function_exists('sys_get_temp_dir')) { ...@@ -320,6 +338,22 @@ if(!function_exists('sys_get_temp_dir')) {
} }
} }
function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
recursive_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
global $FAKEDIRS; global $FAKEDIRS;
$FAKEDIRS=array(); $FAKEDIRS=array();
......
...@@ -175,13 +175,8 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ ...@@ -175,13 +175,8 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
} }
$source=substr($path1,strrpos($path1,'/')+1); $source=substr($path1,strrpos($path1,'/')+1);
$path2.=$source; $path2.=$source;
// sleep(30);
}else{
error_log('isfile');
} }
error_log("copy $path1 to {$this->datadir}$path2");
if($return=copy($this->datadir.$path1,$this->datadir.$path2)){ if($return=copy($this->datadir.$path1,$this->datadir.$path2)){
error_log('success');
$this->notifyObservers($path2,OC_FILEACTION_CREATE); $this->notifyObservers($path2,OC_FILEACTION_CREATE);
} }
return $return; return $return;
......
...@@ -175,11 +175,12 @@ class OC_PLUGIN{ ...@@ -175,11 +175,12 @@ class OC_PLUGIN{
global $SERVERROOT; global $SERVERROOT;
if(is_file($id)){ if(is_file($id)){
$file=$id; $file=$id;
}
if(!is_dir($SERVERROOT.'/plugins/'.$id) or !is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
return false;
}else{ }else{
$file=$SERVERROOT.'/plugins/'.$id.'/plugin.xml'; if(!is_dir($SERVERROOT.'/plugins/'.$id) or !is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
return false;
}else{
$file=$SERVERROOT.'/plugins/'.$id.'/plugin.xml';
}
} }
$data=array(); $data=array();
$plugin=new DOMDocument(); $plugin=new DOMDocument();
...@@ -345,6 +346,34 @@ class OC_PLUGIN{ ...@@ -345,6 +346,34 @@ class OC_PLUGIN{
self::savePluginData($id,$data); self::savePluginData($id,$data);
return true; return true;
} }
public static function installPlugin($path){
global $SERVERROOT;
if(is_file($path)){
$zip = new ZipArchive;
if($zip->open($path)===TRUE){
$folder=sys_get_temp_dir().'/OC_PLUGIN_INSTALL/';
mkdir($folder);
$zip->extractTo($folder);
if(is_file($folder.'/plugin.xml')){
$pluginData=self::getPluginData($folder.'/plugin.xml');
if(array_search($pluginData['info']['id'],self::listPlugins())===false){
if(isset($pluginData['install'])){
foreach($pluginData['install']['database'] as $db){
OC_DB::createDbFromStructure($folder.'/'.$db);
$pluginData['install']['database_installed'][$db]=true;
}
foreach($pluginData['install']['include'] as $include){
include($folder.'/'.$include);
}
}
recursive_copy($folder,$SERVERROOT.'/plugins/'.$pluginData['info']['id']);
self::savePluginData($SERVERROOT.'/plugins/'.$pluginData['info']['id'].'/plugin.xml',$pluginData);
}
}
delTree($folder);
}
}
}
} }
?> ?>
...@@ -34,6 +34,7 @@ OC_CONFIG::addForm('User Settings','/inc/templates/configform.php'); ...@@ -34,6 +34,7 @@ OC_CONFIG::addForm('User Settings','/inc/templates/configform.php');
if(OC_USER::ingroup($_SESSION['username'],'admin')){ if(OC_USER::ingroup($_SESSION['username'],'admin')){
OC_CONFIG::addForm('System Settings','/inc/templates/adminform.php'); OC_CONFIG::addForm('System Settings','/inc/templates/adminform.php');
OC_CONFIG::addForm('User Managment','/inc/templates/userform.php'); OC_CONFIG::addForm('User Managment','/inc/templates/userform.php');
OC_CONFIG::addForm('Plugin Managment','/inc/templates/pluginform.php');
} }
echo('<div class="center">'); echo('<div class="center">');
......
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