Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ISPConfig 3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Gonzalez
ISPConfig 3
Commits
8c4359bb
Commit
8c4359bb
authored
Oct 17, 2018
by
Jesse Norell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getDatabaseSize()
parent
6d28d421
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
14 deletions
+36
-14
interface/lib/classes/db_mysql.inc.php
interface/lib/classes/db_mysql.inc.php
+18
-7
server/lib/classes/db_mysql.inc.php
server/lib/classes/db_mysql.inc.php
+18
-7
No files found.
interface/lib/classes/db_mysql.inc.php
View file @
8c4359bb
...
...
@@ -654,18 +654,29 @@ class db
* @return int - database-size in bytes
*/
public
function
getDatabaseSize
(
$database_name
)
{
global
$app
;
require_once
'lib/mysql_clientdb.conf'
;
$result
=
$this
->
_query
(
"SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='"
.
$this
->
escape
(
$database_name
)
.
"'"
);
global
$app
,
$conf
;
static
$db
=
null
;
if
(
!
$db
)
{
$clientdb_host
=
(
$conf
[
'db_host'
])
?
$conf
[
'db_host'
]
:
NULL
;
$clientdb_user
=
(
$conf
[
'db_user'
])
?
$conf
[
'db_user'
]
:
NULL
;
$clientdb_password
=
(
$conf
[
'db_password'
])
?
$conf
[
'db_password'
]
:
NULL
;
$clientdb_port
=
((
int
)
$conf
[
'db_port'
])
?
(
int
)
$conf
[
'db_port'
]
:
NULL
;
$clientdb_flags
=
(
$conf
[
'db_flags'
]
!==
NULL
)
?
$conf
[
'db_flags'
]
:
NULL
;
require_once
'lib/mysql_clientdb.conf'
;
$db
=
new
db
(
$clientdb_host
,
$clientdb_user
,
$clientdb_password
,
NULL
,
$clientdb_port
,
$clientdb_flags
);
}
$result
=
$db
->
_query
(
"SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='"
.
$db
->
escape
(
$database_name
)
.
"'"
);
if
(
!
$result
)
{
$
this
->
_sqlerror
(
'Unable to determine the size of database '
.
$database_name
);
$
db
->
_sqlerror
(
'Unable to determine the size of database '
.
$database_name
);
return
;
}
$database_size
=
$result
->
getAsRow
();
$result
->
free
();
return
$database_size
[
0
]
?
$database_size
[
0
]
:
0
;
return
$database_size
[
0
]
?
$database_size
[
0
]
:
0
;
}
//** Function to fill the datalog with a full differential record.
...
...
server/lib/classes/db_mysql.inc.php
View file @
8c4359bb
...
...
@@ -654,18 +654,29 @@ class db
* @return int - database-size in bytes
*/
public
function
getDatabaseSize
(
$database_name
)
{
global
$app
;
require_once
'lib/mysql_clientdb.conf'
;
$result
=
$this
->
_query
(
"SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='"
.
$this
->
escape
(
$database_name
)
.
"'"
);
global
$app
,
$conf
;
static
$db
=
null
;
if
(
!
$db
)
{
$clientdb_host
=
(
$conf
[
'db_host'
])
?
$conf
[
'db_host'
]
:
NULL
;
$clientdb_user
=
(
$conf
[
'db_user'
])
?
$conf
[
'db_user'
]
:
NULL
;
$clientdb_password
=
(
$conf
[
'db_password'
])
?
$conf
[
'db_password'
]
:
NULL
;
$clientdb_port
=
((
int
)
$conf
[
'db_port'
])
?
(
int
)
$conf
[
'db_port'
]
:
NULL
;
$clientdb_flags
=
(
$conf
[
'db_flags'
]
!==
NULL
)
?
$conf
[
'db_flags'
]
:
NULL
;
require_once
'lib/mysql_clientdb.conf'
;
$db
=
new
db
(
$clientdb_host
,
$clientdb_user
,
$clientdb_password
,
NULL
,
$clientdb_port
,
$clientdb_flags
);
}
$result
=
$db
->
_query
(
"SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='"
.
$db
->
escape
(
$database_name
)
.
"'"
);
if
(
!
$result
)
{
$
this
->
_sqlerror
(
'Unable to determine the size of database '
.
$database_name
);
$
db
->
_sqlerror
(
'Unable to determine the size of database '
.
$database_name
);
return
;
}
$database_size
=
$result
->
getAsRow
();
$result
->
free
();
return
$database_size
[
0
]
?
$database_size
[
0
]
:
0
;
return
$database_size
[
0
]
?
$database_size
[
0
]
:
0
;
}
//** Function to fill the datalog with a full differential record.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment