Move get_all_php_files() to FileManage library as getAllPhpFiles() - part 3/3 :-)

Improve code syntax, fix warnings and fix typo.
pull/2487/head
Yannick Warnier 7 years ago
parent c0e2f91f29
commit 813a63ddd0
  1. 2
      main/cron/lang/list_undefined_langvars.php
  2. 4
      main/cron/lang/list_unused_langvars.php
  3. 11
      main/inc/lib/fileManage.lib.php
  4. 2
      tests/scripts/img/list_unused_img.php
  5. 3
      tests/scripts/img/list_used_img.php

@ -8,7 +8,7 @@
* Includes and declarations.
*/
die();
require_once '../../inc/global.inc.php';
require_once __DIR__.'/../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M');
/**

@ -8,7 +8,7 @@
* Includes and declarations.
*/
die();
require_once '../../inc/global.inc.php';
require_once __DIR__.'/../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M');
/**
@ -31,7 +31,7 @@ echo count($defined_terms)." terms were found in language files<br />";
// time and memory)
$usedTerms = [];
$l = strlen(api_get_path(SYS_PATH));
$files = getAllPhpFget_iles(api_get_path(SYS_PATH));
$files = getAllPhpFiles(api_get_path(SYS_PATH));
// Browse files
foreach ($files as $file) {
//echo 'Analyzing '.$file."<br />";

@ -63,9 +63,8 @@ function my_delete($file)
return true;
}
} else {
return false; // no file or directory to delete
}
return false; // no file or directory to delete
}
/**
@ -258,9 +257,8 @@ function move($source, $target, $forceMove = true, $moveContent = false)
return true;
}
} else {
return false;
}
return false;
}
/**
@ -270,6 +268,7 @@ function move($source, $target, $forceMove = true, $moveContent = false)
*
* @param string $source the path of the directory to move
* @param string $destination the path of the new area
* @param bool $move Whether we want to remove the source at the end
*
* @return bool false on error
*/
@ -347,8 +346,8 @@ function getextension($filename)
/**
* Get a list of all PHP (.php) files in a given directory. Includes .tpl files
* @param $base_path The base path in which to find the corresponding files
* @param $includeStatic Include static .html, .htm and .css files
* @param string $base_path The base path in which to find the corresponding files
* @param bool $includeStatic Include static .html, .htm and .css files
* @return array
*/
function getAllPhpFiles($base_path, $includeStatic = false)

@ -9,7 +9,7 @@
if (PHP_SAPI!='cli') {
die('Run this script through the command line or comment this line in the code');
}
require_once '../../inc/global.inc.php';
require_once __DIR__.'/../../../main/inc/global.inc.php';
$path = api_get_path(SYS_CODE_PATH).'img/';
ini_set('memory_limit', '128M');
ini_set('max_execution_time', '240');

@ -7,7 +7,7 @@
* Includes and declarations
*/
if (PHP_SAPI!='cli') { die('Run this script through the command line or comment this line in the code'); }
require_once '../../inc/global.inc.php';
require_once __DIR__.'/../../../main/inc/global.inc.php';
$path = api_get_path(SYS_CODE_PATH).'img/';
ini_set('memory_limit','128M');
ini_set('max_execution_time','240');
@ -21,6 +21,7 @@ $unexisting_img = array();
$l = strlen(api_get_path(SYS_PATH));
$files = getAllPhpFiles(api_get_path(SYS_PATH), true);
$counter = 0;
$used_icons = [];
foreach ($files as $file) {
$shortfile = substr($file,$l);
$lines = file($file);

Loading…
Cancel
Save