Replace array() with shorthand.

This commit is contained in:
Darko
2015-07-28 09:55:13 +02:00
parent 5657c27d18
commit 0ccb312ff5
78 changed files with 285 additions and 285 deletions
@@ -22,14 +22,14 @@ if (isset($argv[1])) {
function relativeTime($_time)
{
$d = array();
$d = [];
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = [];
$return = "";
$now = TIME();
@@ -13,7 +13,7 @@ function SplitSQL($file, $delimiter = ';')
$file = fopen($file, 'r');
if (is_resource($file) === true) {
$query = array();
$query = [];
$db = new DB();
$dbsys = DB_TYPE;
$c = new ColorCLI();
@@ -60,7 +60,7 @@ function SplitSQL($file, $delimiter = ';')
}
if (is_string($query) === true) {
$query = array();
$query = [];
}
}
return fclose($file);
@@ -105,7 +105,7 @@ if (isset($os) && $os == "unix") {
$tmux = $t->get();
$currentversion = $tmux->sqlpatch;
$patched = 0;
$patches = array();
$patches = [];
$db = new DB();
$backedup = false;
$c = new ColorCLI();
@@ -152,7 +152,7 @@ if (isset($os) && $os == "unix") {
$tmux = $t->get();
$currentversion = $tmux->sqlpatch;
$patched = 0;
$patches = array();
$patches = [];
// Open the patch folder.
if (!isset($argv[1])) {
@@ -56,7 +56,7 @@ function create_guids($live, $delete = false)
}
continue;
}
$binary_names = array();
$binary_names = [];
foreach ($nzbfile->file as $file) {
$binary_names[] = $file["subject"];
}
@@ -68,7 +68,7 @@ class HashAlgorithms
$firstArray = $this->_hashesToArray($this->_inputString);
$secondArray = array();
$secondArray = [];
foreach ($firstArray as $key => $value) {
if (!$this->_writeToFile) {
if (in_array($value, $this->_expectedString)) {
@@ -89,7 +89,7 @@ class HashAlgorithms
$secondArray[$key] = $this->_hashesToArray($value);
}
$thirdArray = array();
$thirdArray = [];
foreach ($secondArray as $key => $value) {
foreach ($value as $key2 => $value2) {
if (!$this->_writeToFile) {
@@ -171,7 +171,7 @@ class HashAlgorithms
);
$hashTypes = array('md5', 'md4', 'sha1', 'sha256', 'sha512');
$tmpArray = array();
$tmpArray = [];
foreach ($hashTypes as $hash) {
foreach ($strings as $key => $value) {
$tmpArray[$hash . '_' . $key] = hash($hash, $value, false);
@@ -44,7 +44,7 @@ if ($groups === false) {
echo "No active groups. Fix not needed.\n";
} else {
$queries = array();
$queries = [];
switch ($argv[1]) {
case 1:
@@ -36,7 +36,7 @@ if (!is_writable(NN_RES)) {
exit('The (' . NN_RES . ') folder must be writable.' . PHP_EOL);
}
$progress = rw_progress(settings_array());
$progress = rw_progress(settings_[]);
if (!isset($argv[1]) || !is_numeric($argv[1]) && $argv[1] != 'progress' || !isset($argv[2]) ||
!in_array($argv[2], ['local', 'remote']) || !isset($argv[3]) ||
@@ -45,7 +45,7 @@ my ($ib_bp_used, $ib_bp_total, $ib_bp_read_ratio);
my ($relative_live, $relative_infiles);
my $real_uptime;
my (%stats_present, %stats_past); # For relative reports
GetOptions (
\%op,
"user=s",
@@ -72,7 +72,7 @@ get_user_mycnf() unless $op{'no-mycnf'};
# Command line options override ~/.my.cnf
$mycnf{'host'} = $op{'host'} if have_op 'host';
$mycnf{'port'} = $op{'port'} if have_op 'port';
$mycnf{'socket'} = $op{'socket'} if have_op 'socket';
$mycnf{'socket'} = $op{'socket'} if have_op 'socket';
$mycnf{'user'} = $op{'user'} if have_op 'user';
$mycnf{'user'} ||= $ENV{'USER'};
@@ -138,8 +138,8 @@ $have_innodb_vals = 1; # This might be set to 0 later in get_MySQL_version()
if(defined $op{'r'})
{
if($relative_live)
{
print STDERR "mysqlreport is writing relative reports to '$tmpfile'.\n" unless $op{'detach'};
{
print STDERR "mysqlreport is writing relative reports to '$tmpfile'.\n" unless $op{'detach'};
get_MySQL_version();
collect_reports();
}
@@ -434,7 +434,7 @@ sub get_vals
$query = $dbh->prepare("SHOW STATUS;");
}
$query->execute();
while(@row = $query->fetchrow_array()) { $stats{$row[0]} = $row[1]; }
while(@row = $query->fetchrow_[]) { $stats{$row[0]} = $row[1]; }
$real_uptime = $stats{'Uptime'};
}
@@ -448,7 +448,7 @@ sub get_vars
# Get server system variables
$query = $dbh->prepare("SHOW VARIABLES;");
$query->execute();
while(@row = $query->fetchrow_array()) { $vars{$row[0]} = $row[1]; }
while(@row = $query->fetchrow_[]) { $vars{$row[0]} = $row[1]; }
# table_cache was renamed to table_open_cache in MySQL 5.1.3
if($MySQL_version >= 50103)
@@ -471,7 +471,7 @@ sub read_infile
$vars{'table_cache'} = 64 if !exists $vars{'table_cache'};
$vars{'max_connections'} = 100 if !exists $vars{'max_connections'};
$vars{'key_buffer_size'} = 8388600 if !exists $vars{'key_buffer_size'}; # 8M
$vars{'thread_cache_size'} = 0 if !exists $vars{'thread_cache_size'};
$vars{'thread_cache_size'} = 0 if !exists $vars{'thread_cache_size'};
$vars{'tmp_table_size'} = 0 if !exists $vars{'tmp_table_size'};
$vars{'long_query_time'} = '?' if !exists $vars{'long_query_time'};
$vars{'log_slow_queries'} = '?' if !exists $vars{'log_slow_queries'};
@@ -487,7 +487,7 @@ sub read_infile
{
last if !defined $_;
next if /^\+/; # skip divider lines
next if /^\+/; # skip divider lines
next if /^$/; # skip blank lines
next until /(Aborted_clients|back_log|=)/;
@@ -580,7 +580,7 @@ sub get_MySQL_version
$query = $dbh->prepare("SHOW VARIABLES LIKE 'version';");
$query->execute();
@row = $query->fetchrow_array();
@row = $query->fetchrow_[];
($major, $minor, $patch) = ($row[1] =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/);
}
@@ -731,8 +731,8 @@ sub write_report
$~ = 'SLOW_DMS', write;
write_DMS();
write_Com();
$~ = 'SAS', write;
write_qcache();
$~ = 'SAS', write;
write_qcache();
$~ = 'REPORT_END', write;
$~ = 'TAB', write;
@@ -757,10 +757,10 @@ sub sec_to_dhms # Seconds to days hours:minutes:seconds
$h = int $s / 3600;
$s -= $h * 3600;
}
$m = int $s / 60;
$s -= $m * 60;
return "$d $h:$m:$s";
}
@@ -1095,7 +1095,7 @@ $stat_name, make_short($stat_val), t($stat_val), $stat_label, perc($stat_val, $q
.
format SLOW_DMS =
Slow @<<<<<<< @>>>>>> @>>>>>/s @>>>>> %DMS: @>>>>> Log: @>>
Slow @<<<<<<< @>>>>>> @>>>>>/s @>>>>> %DMS: @>>>>> Log: @>>
$slow_query_t, make_short($stats{'Slow_queries'}), t($stats{'Slow_queries'}), perc($stats{'Slow_queries'}, $questions), perc($stats{'Slow_queries'}, $dms), $vars{'log_slow_queries'}
DMS @>>>>>>>> @>>>>>/s @>>>>>
make_short($dms), t($dms), perc($dms, $questions)
@@ -1225,7 +1225,7 @@ make_short($stats{'Innodb_buffer_pool_pages_data'}), perc($stats{'Innodb_buffer_
$stats{'Innodb_buffer_pool_pages_misc'}, perc($stats{'Innodb_buffer_pool_pages_misc'}, $stats{'Innodb_buffer_pool_pages_total'})
Latched @>>>>>>>> @>>>>>
$stats{'Innodb_buffer_pool_pages_latched'}, perc($stats{'Innodb_buffer_pool_pages_latched'}, $stats{'Innodb_buffer_pool_pages_total'})
Reads @>>>>>>>> @>>>>>/s
Reads @>>>>>>>> @>>>>>/s
make_short($stats{'Innodb_buffer_pool_read_requests'}), t($stats{'Innodb_buffer_pool_read_requests'})
From file @>>>>>>>> @>>>>>/s @>>>>>
make_short($stats{'Innodb_buffer_pool_reads'}), t($stats{'Innodb_buffer_pool_reads'}), perc($stats{'Innodb_buffer_pool_reads'}, $stats{'Innodb_buffer_pool_read_requests'})