ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLangDeprecated Class Reference

Search for deprecated lang vars. More...

+ Collaboration diagram for ilLangDeprecated:

Public Member Functions

 __construct ()
 ilLangDeprecated constructor. More...
 
 getDeprecatedLangVars ()
 Get deprecated lang vars. More...
 

Protected Member Functions

 getCandidates ()
 Get candidates from the db. More...
 
 parseCodeFiles ()
 Parse Code Files. More...
 
 getCodeFiles (string $path)
 Get code files. More...
 
 parseCodeFile (string $file_path)
 Parse code file and reduce candidates. More...
 

Protected Attributes

array $candidates
 

Private Attributes

const ILIAS_CLASS_FILE_RE = "class\..*\.php$"
 
ilDBInterface $db
 

Detailed Description

Search for deprecated lang vars.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 27 of file class.ilLangDeprecated.php.

Constructor & Destructor Documentation

◆ __construct()

ilLangDeprecated::__construct ( )

ilLangDeprecated constructor.

Definition at line 37 of file class.ilLangDeprecated.php.

38 {
39 global $DIC;
40 $this->db = $DIC->database();
41 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ getCandidates()

ilLangDeprecated::getCandidates ( )
protected

Get candidates from the db.

Base are all lang vars of the english lang file reduced by the ones being accessed (having entries in lng_log)

Definition at line 57 of file class.ilLangDeprecated.php.

57 : void
58 {
59 $log = array();
60 $set = $this->db->query("SELECT module, identifier FROM lng_log ");
61 while ($rec = $this->db->fetchAssoc($set)) {
62 $log[$rec["module"] . ":" . $rec["identifier"]] = 1;
63 }
64 $set = $this->db->query("SELECT module, identifier FROM lng_data WHERE lang_key = " .
65 $this->db->quote("en", "text") . " ORDER BY module, identifier");
66 while ($rec = $this->db->fetchAssoc($set)) {
67 if (!isset($log[$rec["module"] . ":" . $rec["identifier"]])) {
68 $this->candidates[$rec["identifier"]] = $rec["module"];
69 }
70 }
71 }
$log
Definition: ltiresult.php:34

References $log.

Referenced by getDeprecatedLangVars().

+ Here is the caller graph for this function:

◆ getCodeFiles()

ilLangDeprecated::getCodeFiles ( string  $path)
protected

Get code files.

Definition at line 86 of file class.ilLangDeprecated.php.

86 : \Generator
87 {
88 foreach (
89 new \RegexIterator(
90 new \RecursiveIteratorIterator(
91 new \RecursiveDirectoryIterator($path),
92 \RecursiveIteratorIterator::SELF_FIRST,
93 \RecursiveIteratorIterator::CATCH_GET_CHILD
94 ),
95 '/' . self::ILIAS_CLASS_FILE_RE . '/i'
96 ) as $file
97 ) {
98 yield $file;
99 }
100 }
$path
Definition: ltiservices.php:30

References $path.

Referenced by parseCodeFiles().

+ Here is the caller graph for this function:

◆ getDeprecatedLangVars()

ilLangDeprecated::getDeprecatedLangVars ( )

Get deprecated lang vars.

Definition at line 46 of file class.ilLangDeprecated.php.

46 : array
47 {
48 $this->getCandidates();
49 $this->parseCodeFiles();
50 return $this->candidates;
51 }
parseCodeFiles()
Parse Code Files.
getCandidates()
Get candidates from the db.

References $candidates, getCandidates(), and parseCodeFiles().

+ Here is the call graph for this function:

◆ parseCodeFile()

ilLangDeprecated::parseCodeFile ( string  $file_path)
protected

Parse code file and reduce candidates.

Definition at line 105 of file class.ilLangDeprecated.php.

105 : void
106 {
107 $tokens = token_get_all(file_get_contents($file_path));
108 $num_tokens = count($tokens);
109
110 for ($i = 0; $i < $num_tokens; $i++) {
111 if (is_string($tokens[$i])) {
112 continue;
113 }
114
115 $token = $tokens[$i][0];
116 switch ($token) {
117 case T_STRING:
118 case T_CONSTANT_ENCAPSED_STRING:
119 $lv = str_replace(array("'", '"'), "", $tokens[$i][1]);
120 if ($lv !== "") {
121 unset($this->candidates[$lv]);
122 }
123 break;
124 }
125 }
126 }
$token
Definition: xapitoken.php:70

References $token.

Referenced by parseCodeFiles().

+ Here is the caller graph for this function:

◆ parseCodeFiles()

ilLangDeprecated::parseCodeFiles ( )
protected

Parse Code Files.

Definition at line 76 of file class.ilLangDeprecated.php.

76 : void
77 {
78 foreach ($this->getCodeFiles(ILIAS_ABSOLUTE_PATH) as $file) {
79 $this->parseCodeFile($file->getPathname());
80 }
81 }
parseCodeFile(string $file_path)
Parse code file and reduce candidates.
getCodeFiles(string $path)
Get code files.

References getCodeFiles(), and parseCodeFile().

Referenced by getDeprecatedLangVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $candidates

array ilLangDeprecated::$candidates
protected

Definition at line 31 of file class.ilLangDeprecated.php.

Referenced by getDeprecatedLangVars().

◆ $db

ilDBInterface ilLangDeprecated::$db
private

Definition at line 32 of file class.ilLangDeprecated.php.

◆ ILIAS_CLASS_FILE_RE

const ilLangDeprecated::ILIAS_CLASS_FILE_RE = "class\..*\.php$"
private

Definition at line 29 of file class.ilLangDeprecated.php.


The documentation for this class was generated from the following file: