Commit 5ff1a3a2 authored by Cédric Anne's avatar Cédric Anne Committed by Johan Cwiklinski

Remove obsolete tools (#5011)

* Remove obsolete tools

* Fix LDAP tests
parent 2a06524b
#!/bin/sh
# /**
# * ---------------------------------------------------------------------
# * GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2015-2018 Teclib' and contributors.
# *
# * http://glpi-project.org
# *
# * based on GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2003-2014 by the INDEPNET Development Team.
# *
# * ---------------------------------------------------------------------
# *
# * LICENSE
# *
# * This file is part of GLPI.
# *
# * GLPI is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * GLPI is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
# * ---------------------------------------------------------------------
# */
# TO BE LAUNCH ON A ROOT OF GLPI REPOSITORY
# First you need to have a complete repository of GLPI
# Ex : svn co https://forge.indepnet.net/svn/glpi/trunk
# Your repository must be used only for locale update usage
VERSION="0.84"
LOG="/tmp/autoupdatelang$VERSION.log"
# Second you need to have transifex client installed
# and link your repository to transifex
# tx set --execute --auto-local -r GLPI.glpipot084 'locales/<lang>.po' --source-lang en --source-file locales/glpi.pot
# GLPI is the project name and glpipot084 the slug name
TRANSIFEXPROJECT="GLPI"
SLUGNAME="glpipot084"
cat /dev/null > $LOG
date >> $LOG
echo "Update SVN repository" >> $LOG
svn update . >> $LOG
echo "Extract glpi.pot" >> $LOG
tools/locale/extract_template.sh >> $LOG
echo "Push template to transifex" >> $LOG
tx push -s >> $LOG
echo "Pull all po files" >> $LOG
tx pull -a >> $LOG
#echo "Pull en_GB po files" >> $LOG
#tx pull -l en_GB >> $LOG
echo "Update mo files" >> $LOG
tools/locale/update_mo.pl >> $LOG
echo "Update SVN repository " >> $LOG
svn update >> $LOG
echo "Add new po and mo " >> $LOG
svn add locales/*.po locales/*.mo >> $LOG
echo "commit locales SVN repository " >> $LOG
svn commit locales -m "Auto update locales" >> $LOG
#!/usr/bin/perl
#!/usr/bin/perl -w
# /**
# * ---------------------------------------------------------------------
# * GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2015-2018 Teclib' and contributors.
# *
# * http://glpi-project.org
# *
# * based on GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2003-2014 by the INDEPNET Development Team.
# *
# * ---------------------------------------------------------------------
# *
# * LICENSE
# *
# * This file is part of GLPI.
# *
# * GLPI is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * GLPI is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
# * ---------------------------------------------------------------------
# */
if (@ARGV==0){
print "USAGE check_dict.pl dico_file [1=count_all_entries]\n Must to be launch in GLPI root dir\n\n";
exit();
}
$count_all=0;
if (length($ARGV[1])>0){
$count_all=1;
print "EXACT ENTRY COUNT\n";
} else {
print "NOT EXACT ENTRY COUNT - JUST FIRST FIND FILE\n";
}
open(INFO,$ARGV[0]) or die("Fichier ".$ARGV[0]." absent");
@lines=<INFO>;
close(INFO);
foreach (@lines)
{
if ($_=~m/\$(LANG)\[['"]([a-zA-Z_]+)['"]\]\[([0-9]+)\]/){
print "SEARCH $1\['$2'\]\[$3\] : ";
$count=0;
do_dir(".",$1,$2,$3);
print $count;
if ($2=~m/calendarDay/||$2=~m/calendarM/) {print " <- not found but OK - used with key computation";}
elsif ($count==0) {print " <<<<--------------- NOT FOUND";}
print "\n";
}
if ($_=~m/\$(LANG)\[['"]([a-zA-Z_]+)['"]\]\[['"]([a-zA-Z_]+)['"]\]\[([0-9]+)\]/){
print "SEARCH2 $1\['$2'\]['$3'\]\[$4\] : ";
$count=0;
do_dir2(".",$1,$2,$3,$4);
print $count;
print "\n";
}
}
sub do_dir{
local ($dir,$varname,$module,$i)=@_;
#print "Entering $dir\n";
my $found_php=0;
opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if (-d "$dir/$_" && $_!~m/locales/ && $_!~m/files/ && $_!~m/\.svn/ ){
if ($count_all==1 || $count==0){
do_dir("$dir/$_",$varname,$module,$i);
}
} else {
if ($count_all==1 || $count==0){
if (!-d "$dir/$_" && (index($_,".php",0)==length($_)-4)){
$found_php=1;
}
}
}
}
}
if ($found_php==1 && ($count_all==1 || $count==0) ){
open COUNT, "cat $dir/*.php | grep \"$varname\\\[\['\\\"\]$module\['\\\"\]\\\]\\\[$i\\\]\" | wc -l |";
while(<COUNT>) {
$count+=$_;
#print $_."\n";
}
}
closedir DIRHANDLE;
}
sub do_dir2{
local ($dir,$varname,$module,$module2,$i)=@_;
#print "Entering $dir\n";
my $found_php=0;
opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if (-d "$dir/$_" && $_!~m/locales/ && $_!~m/files/ && $_!~m/\.svn/ ){
if ($count_all==1 || $count==0){
do_dir2("$dir/$_",$varname,$module,$module2,$i);
}
} else {
if ($count_all==1 || $count==0){
if (!-d "$dir/$_" && (index($_,".php",0)==length($_)-4)){
$found_php=1;
}
}
}
}
}
if ($found_php==1 && ($count_all==1 || $count==0) ){
open COUNT, "cat $dir/*.php | grep \"$varname\\\[\['\\\"\]$module\['\\\"\]\\\]\\\[\['\\\"\]$module2\['\\\"\]\\\]\\\[$i\\\]\" | wc -l |";
while(<COUNT>) {
$count+=$_;
#print $_."\n";
}
}
closedir DIRHANDLE;
}
#!/usr/bin/perl
#!/usr/bin/perl -w
# /**
# * ---------------------------------------------------------------------
# * GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2015-2018 Teclib' and contributors.
# *
# * http://glpi-project.org
# *
# * based on GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2003-2014 by the INDEPNET Development Team.
# *
# * ---------------------------------------------------------------------
# *
# * LICENSE
# *
# * This file is part of GLPI.
# *
# * GLPI is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * GLPI is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
# * ---------------------------------------------------------------------
# */
print "USAGE check_functions.pl [1=count_all_entries]\n Must to be launch in GLPI root dir\n\n";
$count_all=0;
if (length($ARGV[1])>0){
$count_all=1;
print "EXACT ENTRY COUNT\n";
} else {
print "NOT EXACT ENTRY COUNT - JUST FIRST FIND FILE\n";
}
read_dir(".");
sub read_dir{
local ($dir)=@_;
#print "Entering $dir\n";
my $found_php=0;
opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if (-d "$dir/$_" && $_!~m/locales/ && $_!~m/files/ && $_!~m/\.svn/ && $_!~m/lib/){
read_dir("$dir/$_");
} else {
if (!-d "$dir/$_" && (index($_,".php",0)==length($_)-4)){
open(INFO,"$dir/$_") or die("Fichier ".$dir/$_." absent");
$file=$_;
@lines=<INFO>;
close(INFO);
#print "Open $dir/$_\n";
foreach (@lines){
if ($_=~m/^\s*function\s*(\w+)\s*\(/){
print "SEARCH $1 in $file : ";
$count=0;
do_dir(".",$1);
print $count;
if ($count <= 1) {print " <<<<--------------- NOT FOUND";}
print "\n";
}
}
}
}
}
}
closedir DIRHANDLE;
}
sub do_dir{
local ($dir,$function)=@_;
#print "Entering $dir\n";
my $found_php=0;
opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n";
foreach (readdir(DIRHANDLE)){
if ($_ ne '..' && $_ ne '.'){
if (-d "$dir/$_" && $_!~m/locales/ && $_!~m/files/ && $_!~m/\.svn/ ){
if ($count_all==1 || $count<=1){
do_dir("$dir/$_",$function);
}
} else {
if ($count_all==1 || $count<=1){
if (!-d "$dir/$_" && (index($_,".php",0)==length($_)-4)){
$found_php=1;
}
}
}
}
}
if ($found_php==1 && ($count_all==1 || $count<=1) ){
open COUNT, "grep -i \'".$function."\\s*(\' $dir/*.php | wc -l |";
while(<COUNT>) {
$count+=$_;
#print $_."\n";
}
}
closedir DIRHANDLE;
}
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/**
* Check forms opened / closed
* @since 0.83.3
*/
define('GLPI_ROOT', realpath('..'));
$dirs = [GLPI_ROOT,GLPI_ROOT.'/inc/',
GLPI_ROOT.'/ajax/',
GLPI_ROOT.'/front/',
GLPI_ROOT.'/install/'];
foreach ($dirs as $dir) {
if ($handle = opendir($dir)) {
/* Ceci est la façon correcte de traverser un dossier. */
while (false !== ($file = readdir($handle))) {
if (($file != ".") && ($file != "..")
&& preg_match('/\.php$/', $file)) {
checkFormsInFile($dir.'/'.$file);
}
}
closedir($handle);
}
}
function checkFormsInFile($file) {
$inform =false;
$handle = fopen($file, "r");
$i = 0;
while (!feof($handle)) {
$line = fgets($handle);
$i++;
// echo $i.$line;
if ((stripos($line, '<form ') !== false)
|| (stripos($line, 'Html::openMassiveActionsForm(') !== false)
|| (stripos($line, 'showFormHeader(') !== false)) {
$lastopen = $i;
if ($inform) {
echo "$file line $i : open form in form\n";
}
$inform = true;
}
if ((stripos($line, 'Html::closeForm(') !== false)
|| (stripos($line, 'showFormButtons(') !== false)) {
if (!$inform) {
echo "$file line $i : close not opened form\n";
}
$inform = false;
}
}
if ($inform) {
echo "$file : form opened on line $lastopen but not closed\n";
}
}
This diff is collapsed.
#!/usr/bin/php
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
$cmd = $_SERVER["argv"][0];
function checkOne ($name, $tab = "") {
global $cmd;
if (empty($tab)) {
$tab = Toolbox::strtoupper("LANG$name");
}
$old = getcwd();
if (is_dir($name."/trunk/locales") && is_file($name."/trunk/locales/fr_FR.php")) {
echo "+ ----- $name -----\n";
$dir = opendir($name."/trunk/locales");
while (($file = readdir($dir)) !== false) {
if (strpos($file, ".php") && $file!="fr_FR.php") {
passthru("php $cmd $name/trunk/locales/fr_FR.php $name/trunk/locales/$file $tab\n");
}
}
closedir($dir);
} else {
echo ("no $name/trunk/locales/fr_FR.php\n");
}
chdir($old);
}
function diffTab ($from, $dest, $name) {
$nb = 0;
if (is_array($from)) {
foreach ($from as $ligne => $value) {
if (isset($dest[$ligne])) {
$nb += diffTab($from[$ligne], $dest[$ligne], $name."['$ligne']");
} else {
echo $name."['$ligne'] absent ($value)\n";
$nb++;
}
}
}
//else echo "$name ok (".$from." => ".$dest.")\n";
return $nb;
}
if (isset($_SERVER["argc"]) && $_SERVER["argc"]==2 && $_SERVER["argv"][1]=="all") {
// For 0.71 plugin only
$exception = ["data_injection" => "DATAINJECTIONLANG",
"hole" => "LANG_HOLE",
"backups" => "LANGBACKUP",
"reports" => "GEDIFFREPORTLANG",
"mass_ocs_import" => "OCSMASSIMPORTLANG"];
$dir = opendir(".");
while (($file = readdir($dir)) !== false) {
if (is_dir($file) && substr($file, 0, 1)!=".") {
checkOne($file,
(is_file($file."/trunk/hook.php") ? "LANG" : (isset($exception[$file])
? $exception[$file] : "")));
}
}
closedir($dir);
} else if (isset($_SERVER["argc"]) && $_SERVER["argc"]>=3) {
$nomtab = ($_SERVER["argc"]>=4 ? $_SERVER["argv"][3] : "LANG");
require $_SERVER["argv"][1];
isset($GLOBALS[$nomtab]) or die ($nomtab . " not defined in " . $_SERVER["argv"][1] . "\n");
$from = $GLOBALS[$nomtab];
unset ($GLOBALS[$nomtab]);
require $_SERVER["argv"][2];
isset($GLOBALS[$nomtab]) or die ($nomtab . " not defined in " . $_SERVER["argv"][2] . "\n");
$dest = $GLOBALS[$nomtab];
$nb = 0;
printf ("Contrôle %s dans %s\n", $nomtab, $_SERVER["argv"][2]);
$nb += diffTab($from, $dest, '$'.$nomtab);
printf ("Contrôle %s dans %s\n", $nomtab, $_SERVER["argv"][1]);
$nb += diffTab($dest, $from, '$'.$nomtab);
if ($nb) {
echo "$nb erreur(s) détectée(s) : au boulot !\n";
} else {
echo "C'est bon :)\n";
}
} else {
echo "\nusage $cmd langue1 langue2 [ nomtableau | LANG ]\n";
echo "\nusage $cmd all\n\n";
}
#!/bin/bash
# /**
# * ---------------------------------------------------------------------
# * GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2015-2018 Teclib' and contributors.
# *
# * http://glpi-project.org
# *
# * based on GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2003-2014 by the INDEPNET Development Team.
# *
# * ---------------------------------------------------------------------
# *
# * LICENSE
# *
# * This file is part of GLPI.
# *
# * GLPI is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * GLPI is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
# * ---------------------------------------------------------------------
# */
grep msgid ../locales/glpi.pot | grep -v 'msgid ""' | sort | uniq -c | sort -n
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
include ('../inc/includes.php');
$result = $DB->list_tables();
$i = 0;
while ($line = $DB->fetch_array($result)) {
$itemtype = getItemTypeForTable($line[0]);
if (!class_exists($itemtype)) {
echo $line[0].' '.$itemtype." does not exists\n";
}
}
#!/bin/bash
# /**
# * ---------------------------------------------------------------------
# * GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2015-2018 Teclib' and contributors.
# *
# * http://glpi-project.org
# *
# * based on GLPI - Gestionnaire Libre de Parc Informatique
# * Copyright (C) 2003-2014 by the INDEPNET Development Team.
# *
# * ---------------------------------------------------------------------
# *
# * LICENSE
# *
# * This file is part of GLPI.
# *
# * GLPI is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * GLPI is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
# * ---------------------------------------------------------------------
# */
for i in $(grep -rli $'\xEF\xBB\xBF' *); do
echo Processing $i;
cat $i | perl -pe 's/\xEF\xBB\xBF//i' > $i.new;
mv $i.new $i;
done
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment