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

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

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

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

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

Loading…
Cancel
Save