Skip to content

Commit

Permalink
fix: Catch misnamed, undefined vars
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Aug 1, 2023
1 parent 96d721c commit 5a17c5d
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 77 deletions.
4 changes: 2 additions & 2 deletions app/Modules/History/Listeners/LogSendingMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function handle(MessageSending $event): void
$headers = $event->message->getHeaders();

$classname = 'LogSendingMessage';
$targetuserid = -2;
$targetobjectid = -2;
$targetuserid = 0;
$targetobjectid = 0;
$objectid = '';

if ($headers->has('x-command'))
Expand Down
3 changes: 2 additions & 1 deletion app/Modules/History/Traits/Historable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Modules\History\Traits;

use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Model;
use App\Modules\History\Models\History;

Expand Down Expand Up @@ -70,7 +71,7 @@ public function writeHistory($action, array $old = [], array $new = [])
/**
* Model has history
*
* @return object
* @return MorphMany
*/
public function history()
{
Expand Down
47 changes: 0 additions & 47 deletions app/Modules/Queues/Models/Policy.php

This file was deleted.

39 changes: 39 additions & 0 deletions app/Modules/Queues/Models/Qos.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,45 @@

/**
* Model for a queue Quality of Service
*
* @property int $scheduler_id
* @property string $name
* @property string $description
* @property string $flags
* @property int $grace_time
* @property int $max_jobs_pa
* @property int $max_jobs_per_user
* @property int $max_jobs_accrue_pa
* @property int $max_jobs_accrue_pu
* @property int $min_prio_thresh
* @property int $max_submit_jobs_pa
* @property int $max_submit_jobs_per_user
* @property string $max_tres_pa
* @property string $max_tres_pj
* @property string $max_tres_pn
* @property string $max_tres_pu
* @property string $max_tres_mins_pj
* @property string $max_tres_run_mins_pa
* @property string $max_tres_run_mins_pu
* @property string $min_tres_pj
* @property int $max_wall_duration_per_job
* @property int $grp_jobs
* @property int $grp_jobs_accrue
* @property int $grp_submit_jobs
* @property string $grp_tres
* @property string $grp_tres_mins
* @property string $grp_tres_run_mins
* @property int $grp_wall
* @property string $preempt
* @property int $preempt_mode
* @property int $preempt_exempt_time
* @property int $priority
* @property float $usage_factor
* @property float $usage_thres
* @property float $limit_factor
* @property Carbon|null $datetimecreated
* @property Carbon|null $datetimeremoved
* @property Carbon|null $datetimeedited
*/
class Qos extends Model
{
Expand Down
1 change: 0 additions & 1 deletion app/Modules/Queues/Models/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ public function addPurchase($sellerqueueid, $start, $stop = null, $nodecount = 0
/**
* Delete entry and associated data
*
* @param array $options
* @return bool
*/
public function delete(): bool
Expand Down
5 changes: 0 additions & 5 deletions app/Modules/Queues/Resources/lang/en/queues.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
'acl users enabled desc' => 'User ACL Enabled',
'acl groups' => 'Group ACL',
'acl groups desc' => 'Comma separated list of ACL groups',
'priority' => 'Priority',
'submission state' => 'Submission to the queue',
'gpus' => 'GPUs',
'nodes' => 'Nodes',
Expand All @@ -102,12 +101,9 @@
'lender' => 'Lender',
'org owned' => '(Organization Owned)',
'standby' => 'Standby',
'owner' => 'Owner',
'work' => 'Workq',
'debug' => 'Debug',
'end of life' => 'end of cluster life',
'nodes' => 'Nodes',
'cores' => 'Cores',
'start' => 'Start',
'stop' => 'Stop',
'end' => 'End',
Expand Down Expand Up @@ -165,7 +161,6 @@
// Qos
'limits' => 'Limits',
'description' => 'Description',
'min_prio_thresh' => 'Minimum priority threshold',
'max_jobs_pa' => 'Max jobs per account',
'max_jobs_pa desc' => 'The maximum number of jobs an account (or subaccount) can have running at a given time.',
'max_jobs_per_user' => 'Max jobs per user',
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/Resources/Console/CopyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle(): int

if (!$asset || !$asset->id)
{
$this->danger('Failed to find resource entry for ID #' . $id);
$this->error('Failed to find resource entry for ID #' . $id);
return Command::FAILURE;
}

Expand Down
20 changes: 10 additions & 10 deletions app/Modules/Search/Models/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

/**
* Model class for a search result
*
* @property string $category
* @property int $weight
* @property string $title
* @property string $text
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string $route
*/
class Result
{
Expand Down Expand Up @@ -55,19 +47,27 @@ class Result
/**
* Created
*
* @var string
* @var Carbon|null
*/
public $created_at;

/**
* Updated
*
* @var string
* @var Carbon|null
*/
public $updated_at;

/**
* Constructor
*
* @param string $category
* @param int $weight
* @param string $title
* @param string $text
* @param string $route
* @param Carbon|null $created_at
* @param Carbon|null $updated_at
*/
public function __construct(string $category, int $weight, string $title, string $text, string $route, $created_at = null, $updated_at = null)
{
Expand Down
16 changes: 10 additions & 6 deletions app/Modules/Storage/Http/Controllers/Admin/StorageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,21 @@ public function index(StatefulRequest $request): View
*/
public function create(): View
{
$asset = new StorageResource;
$row = new StorageResource;

$resources = (new Asset)->tree();

$messagetypes = MessageType::query()->orderBy('name', 'asc')->get();
$messagetypes = MessageType::query()
->orderBy('name', 'asc')
->get();

if ($fields = app('request')->old('fields'))
{
$row->fill($fields);
}

return view('storage::admin.storage.edit', [
'row' => $asset,
'row' => $row,
'resources' => $resources,
'messagetypes' => $messagetypes,
]);
Expand All @@ -129,19 +131,21 @@ public function create(): View
*/
public function edit($id): View
{
$asset = StorageResource::find($id);
$row = StorageResource::find($id);

$resources = (new Asset)->tree();

$messagetypes = MessageType::query()->orderBy('name', 'asc')->get();
$messagetypes = MessageType::query()
->orderBy('name', 'asc')
->get();

if ($fields = app('request')->old('fields'))
{
$row->fill($fields);
}

return view('storage::admin.storage.edit', [
'row' => $asset,
'row' => $row,
'resources' => $resources,
'messagetypes' => $messagetypes,
]);
Expand Down
7 changes: 5 additions & 2 deletions app/Modules/Storage/Http/Controllers/Api/UsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use App\Modules\Storage\Http\Resources\UsageResource;
use App\Modules\Storage\Models\Usage;
use App\Modules\Storage\Models\Directory;
use App\Modules\Storage\Models\StorageResource;
use App\Modules\Resources\Models\Asset;
use Carbon\Carbon;

Expand Down Expand Up @@ -660,12 +661,14 @@ public function batch($resource, $dir, Request $request)
}
}

$user = User::findByUsername($username);

$directory = Directory::query()
->where('userid', '=', $user->id)
->where('storageresourceid', '=', $storage->id)
->get();
->first();

if (!$row->directory)
if (!$directory)
{
//return response()->json(['message' => trans('Invalid storagedirid specified')], 409);
$messages[] = trans('Invalid storage/resource/user specified');
Expand Down
4 changes: 2 additions & 2 deletions app/Modules/Storage/Listeners/GroupMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace App\Modules\Storage\Listeners;

use Illuminate\Events\Dispatcher;
use App\Modules\Groups\Events\GroupMemberCreated;
use App\Modules\Groups\Events\GroupMemberDeleted;
use App\Modules\Groups\Events\MemberCreated as GroupMemberCreated;
use App\Modules\Groups\Events\MemberDeleted as GroupMemberDeleted;
use App\Modules\Storage\Models\Directory;
use App\Modules\Storage\Models\Notification;

Expand Down

0 comments on commit 5a17c5d

Please sign in to comment.