mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
fix get script username
This commit is contained in:
@@ -102,7 +102,12 @@ class Test extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$this->info("haha");
|
$whoami = executeCommand('whoami');
|
||||||
|
$user = get_current_user();
|
||||||
|
$uid = getmyuid();
|
||||||
|
$uid2 = posix_getuid();
|
||||||
|
$info = posix_getpwuid($uid2);
|
||||||
|
dd($whoami, $user, $uid, $uid2, $info);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,13 +85,7 @@ class PluginStoreResource extends Resource
|
|||||||
->label(fn () => sprintf("进入目录: %s, 以 root 用户的身份依次执行以下命令进行安装: ", base_path()))
|
->label(fn () => sprintf("进入目录: %s, 以 root 用户的身份依次执行以下命令进行安装: ", base_path()))
|
||||||
->html(true)
|
->html(true)
|
||||||
->formatStateUsing(function (PluginStore $record) {
|
->formatStateUsing(function (PluginStore $record) {
|
||||||
$user = executeCommand("whoami");
|
return self::getPluginInstruction($record);
|
||||||
$commands = [
|
|
||||||
sprintf("sudo -u %s composer config repositories.%s %s", $user, $record->plugin_id, $record->remote_url),
|
|
||||||
sprintf("sudo -u %s composer require %s:%s", $user, $record->package_name, $record->version),
|
|
||||||
sprintf("sudo -u %s php artisan plugin install %s", $user, $record->package_name),
|
|
||||||
];
|
|
||||||
return implode("<br/>", $commands);
|
|
||||||
})
|
})
|
||||||
,
|
,
|
||||||
]);
|
]);
|
||||||
@@ -105,6 +99,18 @@ class PluginStoreResource extends Resource
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function getPluginInstruction(PluginStore $record): string
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
$result[] = "配置扩展地址";
|
||||||
|
$result[] = sprintf("<code>composer config repositories.%s git %s</code>", $record->plugin_id, $record->remote_url);
|
||||||
|
$result[] = "<br/>下载扩展. 这里展示的最新版本号, 如果要要安装其他版本自行替换(dev-master 代表开发中的版本)";
|
||||||
|
$result[] = sprintf("<code>composer require %s:%s</code>", $record->package_name, $record->version);
|
||||||
|
$result[] = "<br/>执行安装";
|
||||||
|
$result[] = sprintf("<code>php artisan plugin install %s</code>", $record->package_name);
|
||||||
|
return implode("<br/>", $result);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getRelations(): array
|
public static function getRelations(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"ext-zend-opcache": "*",
|
"ext-zend-opcache": "*",
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
|
"ext-posix": "*",
|
||||||
"calebporzio/sushi": "^2.5",
|
"calebporzio/sushi": "^2.5",
|
||||||
"elasticsearch/elasticsearch": "^7.16",
|
"elasticsearch/elasticsearch": "^7.16",
|
||||||
"filament/filament": "^3.2",
|
"filament/filament": "^3.2",
|
||||||
|
|||||||
@@ -265,7 +265,8 @@ function getLogFile($append = '')
|
|||||||
$name .= "-$append";
|
$name .= "-$append";
|
||||||
}
|
}
|
||||||
if (isRunningInConsole()) {
|
if (isRunningInConsole()) {
|
||||||
$name .= sprintf("-cli-%s-%s", get_current_user(), getmyuid());
|
$scriptUserInfo = posix_getpwuid(posix_getuid());
|
||||||
|
$name .= sprintf("-cli-%s", $scriptUserInfo['name']);
|
||||||
}
|
}
|
||||||
$logFile = sprintf('%s-%s%s', $name, date('Y-m-d'), $suffix);
|
$logFile = sprintf('%s-%s%s', $name, date('Y-m-d'), $suffix);
|
||||||
return $logFiles[$append] = $logFile;
|
return $logFiles[$append] = $logFile;
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ class Update extends Install
|
|||||||
$this->runMigrate("database/migrations/2025_01_08_133847_create_user_modify_logs_table.php");
|
$this->runMigrate("database/migrations/2025_01_08_133847_create_user_modify_logs_table.php");
|
||||||
$this->runMigrate("database/migrations/2025_01_18_235747_drop_users_table_text_column.php");
|
$this->runMigrate("database/migrations/2025_01_18_235747_drop_users_table_text_column.php");
|
||||||
$this->runMigrate("database/migrations/2025_01_18_235757_drop_torrents_table_text_column.php");
|
$this->runMigrate("database/migrations/2025_01_18_235757_drop_torrents_table_text_column.php");
|
||||||
Artisan::call("upgrade:upgrade:migrate_torrents_table_text_column");
|
Artisan::call("upgrade:migrate_torrents_table_text_column");
|
||||||
Artisan::call("upgrade:migrate_users_table_comment_related_column");
|
Artisan::call("upgrade:migrate_users_table_comment_related_column");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user