Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Feb 12, 2024
1 parent 3ced84c commit 9710566
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/console/controllers/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,13 @@ private function _deploy(array $siteUris): void
*/
private function _output(string $message): void
{
$processUser = posix_getpwuid(posix_geteuid());
$user = $processUser['name'] ?? 'unknown';
$user = 'unknown';

if (function_exists('posix_getpwuid')) {
$processUser = posix_getpwuid(posix_geteuid());
$user = $processUser['name'] ?? $user;
}

Blitz::$plugin->log($message . ' [via console command by "{user}"]', ['user' => $user]);

$this->stdout(Craft::t('blitz', $message) . PHP_EOL, BaseConsole::FG_GREEN);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DiagnosticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function actionExportPages(int $siteId): Response
->all();

$values = [];
foreach ($pages as &$page) {
foreach ($pages as $page) {
$values[] = [
'uri' => $page['uri'] ?: '/',
'elements' => $page['elementCount'] ?: 0,
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/DiagnosticsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ public static function getElementQuerySql(string $elementQueryType, string $para

// Return raw SQL with line breaks replaced with spaces.
return str_replace(["\r\n", "\r", "\n"], ' ', $sql);
} catch (QueryAbortedException) {
} /** @noinspection PhpRedundantCatchClauseInspection */
catch (QueryAbortedException) {
return null;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/records/ElementQuerySourceRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use craft\db\ActiveRecord;

/**
* @property int $id
* @property int $sourceId
* @property int $queryId
* @property-read ElementQueryRecord $elementQuery
Expand Down
1 change: 1 addition & 0 deletions src/records/IncludeRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* @property int $id
* @property int $index [bigint(20)]
* @property int $siteId
* @property string $template
* @property string $params
Expand Down
2 changes: 2 additions & 0 deletions src/services/ExpireCacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use putyourlightson\blitz\records\CacheRecord;

/**
* @property-read int[] $expiredCacheIds
*
* @since 4.8.0
*/
class ExpireCacheService extends Component
Expand Down

0 comments on commit 9710566

Please sign in to comment.