Skip to content

Commit 3953b18

Browse files
committed
cleanup: cleanup to match coding standards
1 parent 9daf98d commit 3953b18

33 files changed

+216
-216
lines changed

classes/local/object_manipulator/candidates/deleter_candidates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function get_candidates_sql_params() {
5757
return [
5858
'consistancythreshold' => $consistancythreshold,
5959
'location' => OBJECT_LOCATION_DUPLICATED,
60-
'sizethreshold' => $this->config->sizethreshold
60+
'sizethreshold' => $this->config->sizethreshold,
6161
];
6262
}
6363
}

classes/local/object_manipulator/candidates/orphaner_candidates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function get_candidates_sql() {
5353
*/
5454
public function get_candidates_sql_params() {
5555
return [
56-
'location' => OBJECT_LOCATION_ORPHANED
56+
'location' => OBJECT_LOCATION_ORPHANED,
5757
];
5858
}
5959
}

classes/local/object_manipulator/manipulator_builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class manipulator_builder {
4848
pusher::class,
4949
recoverer::class,
5050
checker::class,
51-
orphaner::class
51+
orphaner::class,
5252
];
5353

5454
/** @var string $manipulatorclass */

classes/local/report/location_report_builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function build_report($reportid) {
4747
OBJECT_LOCATION_DUPLICATED,
4848
OBJECT_LOCATION_EXTERNAL,
4949
OBJECT_LOCATION_ORPHANED,
50-
OBJECT_LOCATION_ERROR
50+
OBJECT_LOCATION_ERROR,
5151
];
5252

5353
$totalcount = 0;
@@ -71,7 +71,7 @@ public function build_report($reportid) {
7171

7272
if ($location !== OBJECT_LOCATION_ORPHANED) {
7373
// Process the query normally.
74-
$result = $DB->get_record_sql($sql, array($location));
74+
$result = $DB->get_record_sql($sql, [$location]);
7575
} else if ($location === OBJECT_LOCATION_ORPHANED) {
7676
// Start the query from objectfs, for ORPHANED objects, they are not located in the files table.
7777
$sql = 'SELECT COALESCE(count(sub.contenthash) ,0) AS objectcount
@@ -80,7 +80,7 @@ public function build_report($reportid) {
8080
LEFT JOIN {files} f on f.contenthash = o.contenthash
8181
GROUP BY o.contenthash, f.filesize, o.location
8282
HAVING o.location = ?' . $localsql .') AS sub';
83-
$result = $DB->get_record_sql($sql, array($location));
83+
$result = $DB->get_record_sql($sql, [$location]);
8484
$result->objectsum = 0;
8585
}
8686

classes/local/report/object_location_history_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ public function __construct() {
8282
public function query_db($pagesize, $useinitialsbar = true) {
8383
global $DB;
8484
$fields = 'CONCAT(reportid, datakey) AS uid, datakey AS location, objectcount AS count, objectsum AS size';
85-
$conditions = array('reporttype' => 'location');
85+
$conditions = ['reporttype' => 'location'];
8686
$rawrecords = $DB->get_records('tool_objectfs_report_data', $conditions, 'reportid', $fields);
8787
$reports = objectfs_report::get_report_ids();
8888

8989
// Used to fallback to when the expected record is not there.
9090
// NOTE: This avoids the need to null coalesce on a non-existing count/size.
9191
$emptyrecord = (object)[
9292
'count' => 0,
93-
'size' => 0
93+
'size' => 0,
9494
];
9595
foreach ($reports as $id => $timecreated) {
9696
// Initialises the records to be used, and fallback to an empty one if not found.

classes/local/report/object_status_history_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function query_db($pagesize, $useinitialsbar = true) {
102102
default:
103103
$sort = 'heading ASC';
104104
}
105-
$params = array('reporttype' => $this->reporttype, 'reportid' => $this->reportid);
105+
$params = ['reporttype' => $this->reporttype, 'reportid' => $this->reportid];
106106
$fields = 'datakey AS heading, objectcount AS count, objectsum AS size';
107107
$rows = $DB->get_records('tool_objectfs_report_data', $params, $sort, $fields);
108108
$this->rawdata = $rows;
@@ -196,7 +196,7 @@ public function add_barchart($value, $max, $type, $precision = 0) {
196196
if ($max > 0) {
197197
$share = round(100 * $value / $max, $precision);
198198
}
199-
$htmlparams = array('class' => 'ofs-bar', 'style' => 'width:'.$share.'%');
199+
$htmlparams = ['class' => 'ofs-bar', 'style' => 'width:'.$share.'%'];
200200

201201
switch ($type) {
202202
case 'count':

classes/local/report/objectfs_report.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static function generate_status_report() {
150150
public static function cleanup_reports() {
151151
global $DB;
152152
$reportdate = time() - YEARSECS;
153-
$params = array('reportdate' => $reportdate);
153+
$params = ['reportdate' => $reportdate];
154154
$reports = $DB->get_records_select('tool_objectfs_reports', 'reportdate < :reportdate', $params, 'id', 'id');
155155
$reportids = array_keys($reports);
156156
$DB->delete_records_list('tool_objectfs_reports', 'id', $reportids);
@@ -177,7 +177,7 @@ public static function get_report_types() {
177177
*/
178178
public static function get_report_ids() {
179179
global $DB;
180-
$reports = array();
180+
$reports = [];
181181
$records = $DB->get_records('tool_objectfs_reports', null, 'id DESC', 'id, reportdate');
182182
foreach ($records as $record) {
183183
$reports[$record->id] = $record->reportdate;

classes/local/store/azure/client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ public function get_relative_path_from_fullpath($fullpath) {
149149
* @return resource
150150
*/
151151
public function get_seekable_stream_context() {
152-
$context = stream_context_create(array(
153-
'blob' => array(
154-
'seekable' => true
155-
)
156-
));
152+
$context = stream_context_create([
153+
'blob' => [
154+
'seekable' => true,
155+
],
156+
]);
157157
return $context;
158158
}
159159

@@ -259,7 +259,7 @@ public function test_connection() {
259259
public function test_permissions($testdelete) {
260260
$permissions = new \stdClass();
261261
$permissions->success = true;
262-
$permissions->messages = array();
262+
$permissions->messages = [];
263263

264264
try {
265265
$result = $this->client->createBlockBlob($this->container, 'permissions_check_file', 'permissions_check_file');

classes/local/store/digitalocean/client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ public function set_client($config) {
7777
return;
7878
}
7979

80-
$this->client = \Aws\S3\S3Client::factory(array(
81-
'credentials' => array('key' => $config->do_key, 'secret' => $config->do_secret),
80+
$this->client = \Aws\S3\S3Client::factory([
81+
'credentials' => ['key' => $config->do_key, 'secret' => $config->do_secret],
8282
'region' => $config->do_region,
8383
'endpoint' => 'https://' . $config->do_region . '.digitaloceanspaces.com',
84-
'version' => AWS_API_VERSION
85-
));
84+
'version' => AWS_API_VERSION,
85+
]);
8686
}
8787

8888
/**
@@ -93,13 +93,13 @@ public function set_client($config) {
9393
*/
9494
public function define_client_section($settings, $config) {
9595

96-
$regionoptions = array(
96+
$regionoptions = [
9797
'sfo2' => 'sfo2 (San Fransisco)',
9898
'nyc3' => 'nyc3 (New York City)',
9999
'ams3' => 'ams3 (Amsterdam)',
100100
'sgp1' => 'spg1 (Singapore)',
101101
'fra1' => 'fra1 (Frankfurt)',
102-
);
102+
];
103103

104104
$settings->add(new \admin_setting_heading('tool_objectfs/do',
105105
new \lang_string('settings:do:header', 'tool_objectfs'), ''));

classes/local/store/object_client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function verify_object($contenthash, $localpath);
9898
*
9999
* @return mixed
100100
*/
101-
public function generate_presigned_url($contenthash, $headers = array());
101+
public function generate_presigned_url($contenthash, $headers = []);
102102

103103
/**
104104
* support_presigned_urls

0 commit comments

Comments
 (0)