Skip to content

Commit d21abe0

Browse files
authored
Deepscan Error Mitigation (#355)
1 parent 2c2067c commit d21abe0

File tree

3 files changed

+12
-56
lines changed

3 files changed

+12
-56
lines changed

.deepsource.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ name = "javascript"
88

99
[[analyzers]]
1010
name = "sql"
11+
12+
exclude_files = [
13+
"lib/phpmailer/**",
14+
]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FluxCP
22
======
3-
[![Total alerts](https://img.shields.io/lgtm/alerts/g/rathena/FluxCP.svg?logo=lgtm&logoWidth=18&color=orange)](https://lgtm.com/projects/g/rathena/FluxCP/alerts/)
3+
[![DeepSource](https://app.deepsource.com/gh/rathena/FluxCP.svg/?label=active+issues&show_trend=true&token=nhkIfid6qRIZxl2INWaaV4Qb)](https://app.deepsource.com/gh/rathena/FluxCP/?ref=repository-badge)
44
[![Open Issues](https://img.shields.io/github/issues/rathena/FluxCP.svg?logo=github&logoWidth=18&color=yellow)](https://lgtm.com/projects/g/rathena/FluxCP/alerts/)
55
[![Open PRs](https://img.shields.io/github/issues-pr/rathena/FluxCP.svg?logo=github&logoWidth=18&color=blue)](https://lgtm.com/projects/g/rathena/FluxCP/alerts/)
66
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4d1c0a43c0864764b3d3dc5ed2d93192)](https://www.codacy.com/gh/rathena/FluxCP/dashboard?utm_source=github.com&utm_medium=referral&utm_content=rathena/FluxCP&utm_campaign=Badge_Grade)

lib/functions/getReposVersion.php

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
function getReposVersion()
88
{
99
$gitDir = FLUX_ROOT.'/.git';
10-
$svnDir = FLUX_ROOT.'/.svn';
11-
12-
if (is_dir($gitDir)) {
10+
11+
if(is_dir($gitDir)) {
1312
return git_hash();
14-
}
15-
else if (is_dir($svnDir)) {
16-
return svn_version();
13+
} else {
14+
return null;
1715
}
1816
}
1917

@@ -23,63 +21,17 @@ function getReposVersion()
2321
* @param string file name.
2422
* @return int GIT hash
2523
*/
26-
function git_hash()
27-
{
24+
function git_hash() {
2825
$file = FLUX_ROOT.'/.git/refs/heads/master';
29-
3026
if (file_exists($file) && is_readable($file)) {
3127
$lines = implode('', file($file, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES));
32-
3328
if(isset($lines)) {
3429
return trim(substr($lines, 0, 10));
3530
}
3631
return null;
32+
} else {
33+
return null;
3734
}
3835
}
3936

40-
/**
41-
* Get the SVN revision of a directory.
42-
*
43-
* @param string `entries' file name.
44-
* @return int Revision number
45-
*/
46-
function svn_version()
47-
{
48-
$rev = null;
49-
50-
// Subversion 1.6 and lower
51-
$file = FLUX_ROOT.'/.svn/entries';
52-
if (file_exists($file) && is_readable($file)) {
53-
$fp = fopen($file, 'r');
54-
$arr = explode("\n", fread($fp, 256));
55-
56-
if (isset($arr[3]) && ctype_digit($found = trim($arr[3]))) {
57-
$rev = $found;
58-
}
59-
fclose($fp);
60-
}
61-
62-
//Subversion 1.7 and up
63-
if(!isset($rev)) {
64-
$file = FLUX_ROOT.'/.svn/wc.db';
65-
$curr = 0;
66-
67-
if (file_exists($file) && is_readable($file)) {
68-
$fp = fopen($file, 'r');
69-
70-
while(($line = fread($fp, 64))) {
71-
if(strstr($line,"!svn/ver/") && sscanf(strstr($line,"!svn/ver/"),"!svn/ver/%d/%*s", $curr) == 1) {
72-
if($curr > $rev) {
73-
$rev = $curr;
74-
}
75-
}
76-
}
77-
78-
fclose($fp);
79-
}
80-
}
81-
82-
return $rev;
83-
}
84-
8537
?>

0 commit comments

Comments
 (0)