mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
plugins: style sweep
This commit is contained in:
@@ -187,13 +187,13 @@ class Sftp extends Base implements IBackupProvider
|
|||||||
/**
|
/**
|
||||||
* @return list of files on remote location
|
* @return list of files on remote location
|
||||||
*/
|
*/
|
||||||
private function ls($pattern='')
|
private function ls($pattern = '')
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach (explode("\n", $this->sftpCmd('ls -lnt '. $pattern)['stdout']) as $line) {
|
foreach (explode("\n", $this->sftpCmd('ls -lnt ' . $pattern)['stdout']) as $line) {
|
||||||
$parts = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
|
$parts = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
if (count($parts) >= 7) {
|
if (count($parts) >= 7) {
|
||||||
$result[] = $parts[count($parts)-1];
|
$result[] = $parts[count($parts) - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@@ -249,7 +249,7 @@ class Sftp extends Base implements IBackupProvider
|
|||||||
/* cleanup */
|
/* cleanup */
|
||||||
rsort($remote_backups);
|
rsort($remote_backups);
|
||||||
if (count($remote_backups) > (int)$this->model->backupcount->getCurrentValue()) {
|
if (count($remote_backups) > (int)$this->model->backupcount->getCurrentValue()) {
|
||||||
for ($i = $this->model->backupcount->getCurrentValue() ; $i < count($remote_backups); $i++) {
|
for ($i = $this->model->backupcount->getCurrentValue(); $i < count($remote_backups); $i++) {
|
||||||
$this->del($remote_backups[$i]);
|
$this->del($remote_backups[$i]);
|
||||||
}
|
}
|
||||||
$remote_backups = $this->ls('config-*.xml');
|
$remote_backups = $this->ls('config-*.xml');
|
||||||
|
|||||||
@@ -262,4 +262,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</tab>
|
</tab>
|
||||||
<activetab>general-settings</activetab>
|
<activetab>general-settings</activetab>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ foreach ((new Caddy())->reverseproxy->reverse->iterateItems() as $reverseItem) {
|
|||||||
if (!empty($caCertField)) {
|
if (!empty($caCertField)) {
|
||||||
$refs = array_map('trim', explode(',', $caCertField));
|
$refs = array_map('trim', explode(',', $caCertField));
|
||||||
foreach ($refs as $ref) {
|
foreach ($refs as $ref) {
|
||||||
|
|
||||||
if (!empty($ref)) {
|
if (!empty($ref)) {
|
||||||
$caCertRefs[] = $ref;
|
$caCertRefs[] = $ref;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user