src/Intraface/modules/filemanager/FileHandler.php 1 location
|
@@ 380-397 (lines=18) @@
|
377 |
|
* |
378 |
|
* @return boolean |
379 |
|
*/ |
380 |
|
public function delete() |
381 |
|
{ |
382 |
|
if ($this->id == 0) { |
383 |
|
return false; |
384 |
|
} |
385 |
|
|
386 |
|
$db = new DB_Sql; |
387 |
|
|
388 |
|
if ($this->get('server_file_name') != '' && file_exists($this->get('file_path'))) { |
389 |
|
if (!rename($this->get('file_path'), $this->upload_path.'_deleted_'.$this->get('server_file_name'))) { |
390 |
|
throw new Exception("Kunne ikke omdøbe filen i FileHandler->delete()"); |
391 |
|
} |
392 |
|
} |
393 |
|
|
394 |
|
$db->query("UPDATE file_handler SET active = 0 WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id); |
395 |
|
return true; |
396 |
|
} |
397 |
|
|
398 |
|
/** |
399 |
|
* Undeletes a file |
400 |
|
* |
src/Intraface/modules/filemanager/InstanceHandler.php 1 location
|
@@ 311-327 (lines=17) @@
|
308 |
|
* |
309 |
|
* @return boolean |
310 |
|
*/ |
311 |
|
function delete() |
312 |
|
{ |
313 |
|
if ($this->id == 0) { |
314 |
|
return false; |
315 |
|
} |
316 |
|
|
317 |
|
$db = new DB_Sql; |
318 |
|
|
319 |
|
if (file_exists($this->get('file_path'))) { |
320 |
|
if (!rename($this->get('file_path'), $this->instance_path.'_deleted_'.$this->get('server_file_name'))) { |
321 |
|
throw new Exception("Kunne ikke omd�be filen i InstanceHandler->delete()"); |
322 |
|
} |
323 |
|
} |
324 |
|
|
325 |
|
$db->query("UPDATE file_handler_instance SET active = 0 WHERE intranet_id = ".$this->file_handler->kernel->intranet->get('id')." AND id = ".$this->id); |
326 |
|
return true; |
327 |
|
} |
328 |
|
|
329 |
|
/** |
330 |
|
* Deletes all instances for a file |