Updating and buxfixing action class
This commit is contained in:
parent
4d8bb1d4de
commit
c61cc3434e
|
@ -31,7 +31,7 @@ class m_action {
|
||||||
/*
|
/*
|
||||||
* function to set the cration of a file
|
* function to set the cration of a file
|
||||||
*/
|
*/
|
||||||
function create_file($file,$content,$user="root") {
|
function create_file($file,$content="",$user="root") {
|
||||||
return $this->set('create_file',$user, array('file'=>$file,'content'=>$content));
|
return $this->set('create_file',$user, array('file'=>$file,'content'=>$content));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -49,14 +49,23 @@ class m_action {
|
||||||
/*
|
/*
|
||||||
* function returning the first not locked line of the action table
|
* function returning the first not locked line of the action table
|
||||||
*/
|
*/
|
||||||
function move($src,$dest) {
|
function move($src,$dst,$user="root") {
|
||||||
return $this->set('move',$user, array('src'=>$src, 'dst'=>$dst));
|
return $this->set('move',$user, array('src'=>$src, 'dst'=>$dst));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* function archiving a directory ( upon account deletion )
|
* function archiving a directory ( upon account deletion )
|
||||||
*/
|
*/
|
||||||
function archive($archive) {
|
function archive($archive,$dir) {
|
||||||
global $cuid;
|
global $cuid,$db;
|
||||||
|
$db->query("select login from membres where uid=$cuid;");
|
||||||
|
$db->next_record();
|
||||||
|
if (!$db->Record["login"]) {
|
||||||
|
$err->raise("action",_("Login corresponding to $cuid not found"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$uidlogin=$cuid."-".$db->Record["login"];
|
||||||
|
|
||||||
|
$BACKUP_DIR="/tmp/backup/$dir";
|
||||||
//utiliser la function move après avoir construit le chemin
|
//utiliser la function move après avoir construit le chemin
|
||||||
$today=getdate();
|
$today=getdate();
|
||||||
$dest=$BACKUP_DIR.'/'.$today["year"].'-'.$today["mon"].'/'.$uidlogin.'/';
|
$dest=$BACKUP_DIR.'/'.$today["year"].'-'.$today["mon"].'/'.$uidlogin.'/';
|
||||||
|
@ -73,18 +82,23 @@ class m_action {
|
||||||
case 'create_file':
|
case 'create_file':
|
||||||
//do some shit
|
//do some shit
|
||||||
$db->query("insert into actions values ('','CREATE_FILE','$serialized','','','','$user','');");
|
$db->query("insert into actions values ('','CREATE_FILE','$serialized','','','','$user','');");
|
||||||
|
break;
|
||||||
case 'create_dir':
|
case 'create_dir':
|
||||||
//do more shit
|
//do more shit
|
||||||
$db->query("insert into actions values ('','CREATE_DIR','$serialized','','','','$user','');");
|
$db->query("insert into actions values ('','CREATE_DIR','$serialized','','','','$user','');");
|
||||||
|
break;
|
||||||
case 'move':
|
case 'move':
|
||||||
//do more shit
|
//do more shit
|
||||||
$db->query("insert into actions values ('','MOVE','$serialized','','','','$user','');");
|
$db->query("insert into actions values ('','MOVE','$serialized','','','','$user','');");
|
||||||
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
//do more shit
|
//do more shit
|
||||||
$db->query("insert into actions values ('','DELETE','$serialized','','','','$user','');");
|
$db->query("insert into actions values ('','DELETE','$serialized','','','','$user','');");
|
||||||
|
break;
|
||||||
case 'archive':
|
case 'archive':
|
||||||
//do more shit
|
//do more shit
|
||||||
$db->query("insert into actions values ('','ARCHIVE','$serialized','','','','$user','');");
|
$db->query("insert into actions values ('','ARCHIVE','$serialized','','','','$user','');");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +131,7 @@ class m_action {
|
||||||
*/
|
*/
|
||||||
function finish($id) {
|
function finish($id) {
|
||||||
global $db;
|
global $db;
|
||||||
$db->query("update actions set end=".date()." where id=$id ");
|
$db->query("update actions set end=".date()." where id=$id");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue