Minor - format code

fc4ee68c2b
pull/3559/head
Julio Montoya 5 years ago
parent 64e1983f6d
commit 138854be25
  1. 20
      plugin/cleandeletedfiles/admin.php
  2. 2
      plugin/cleandeletedfiles/config.php
  3. 1
      plugin/cleandeletedfiles/index.php
  4. 3
      plugin/cleandeletedfiles/plugin.php
  5. 2
      plugin/cleandeletedfiles/src/CleanDeletedFilesPlugin.php

@ -6,9 +6,8 @@
* Plugin.
*
* @author Jose Angel Ruiz
*
* @package chamilo.plugin.CleanDeletedFiles
*/
$cidReset = true;
require_once __DIR__.'/config.php';
@ -17,12 +16,11 @@ api_protect_admin_script();
/** @var \CleanDeletedFilesPlugin $plugin */
$plugin = CleanDeletedFilesPlugin::create();
$plugin_info = $plugin->get_info();
$isPlatformAdmin = api_is_platform_admin();
if ($plugin->isEnabled() && $isPlatformAdmin) {
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$(".delete-file").click(function(e) {
e.preventDefault();
var path = $(this).prop("href").substr(7);
@ -84,7 +82,8 @@ if ($plugin->isEnabled() && $isPlatformAdmin) {
"app/upload",
];
function findDeletedFiles($pathRelative) {
function findDeletedFiles($pathRelative)
{
global $sizePath;
$pathAbsolute = api_get_path(SYS_PATH).$pathRelative;
$result = [];
@ -94,7 +93,7 @@ if ($plugin->isEnabled() && $isPlatformAdmin) {
if (is_file($pathAbsolute.'/'.$file)) {
$filesize = round(filesize($pathAbsolute.'/'.$file) / 1024, 1);
$pos = strpos($file, "DELETED");
if ($pos !== FALSE) {
if ($pos !== false) {
$result[] = [
'path_complete' => $pathAbsolute.'/'.$file,
'path_relative' => $pathRelative.'/'.$file,
@ -102,11 +101,14 @@ if ($plugin->isEnabled() && $isPlatformAdmin) {
];
$sizePath += $filesize;
}
} else if ($file!='..' && $file!='.') {
} else {
if ($file != '..' && $file != '.') {
$result = array_merge($result, findDeletedFiles($pathRelative.'/'.$file));
}
}
}
}
return $result;
}
@ -133,7 +135,7 @@ if ($plugin->isEnabled() && $isPlatformAdmin) {
'<input type="checkbox" id="select_'.$i.'" class="select_all" />',
false,
null,
['style' => 'text-align:center']
['style' => 'text-align:center'],
],
[$plugin->get_lang('path_dir'), true],
[$plugin->get_lang('size'), true, null, ['style' => 'min-width:85px']],
@ -156,7 +158,7 @@ if ($plugin->isEnabled() && $isPlatformAdmin) {
id="file://'.$value['path_complete'].'" />',
$value['path_relative'],
$value['size'].' '.($value['size'] >= 1024 ? 'Mb' : 'Kb'),
$tools
$tools,
];
$data[] = $row;
}

@ -6,7 +6,5 @@
* Config the plugin.
*
* @author Jose Angel Ruiz
*
* @package chamilo.plugin.CleanDeletedFiles
*/
require_once __DIR__.'/../../main/inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For license terms, see /license.txt */
require_once 'config.php';

@ -6,10 +6,7 @@
* Plugin.
*
* @author Jose Angel Ruiz
*
* @package chamilo.plugin.CleanDeletedFiles
*/
/* Plugin config */
require_once __DIR__.'/config.php';
$plugin_info = CleanDeletedFilesPlugin::create()->get_info();

@ -6,8 +6,6 @@
* Clean deleted files plugin.
*
* @author Jose Angel Ruiz
*
* @package chamilo.plugin.CleanDeletedFiles
*/
class CleanDeletedFilesPlugin extends Plugin
{

Loading…
Cancel
Save