refactoring leftovers

This commit is contained in:
Saeed Vaziry 2024-03-14 21:18:59 +01:00
parent 428140b931
commit f907bacdd0
22 changed files with 26 additions and 173 deletions

View File

@ -1,9 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class BackupFileException extends Exception
{
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class CannotDeployKey extends Exception
{
//
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class ComposerInstallFailed extends Exception
{
//
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class ErrorUpdatingRedirects extends Exception
{
//
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class FailedToInstallWordpress extends Exception
{
//
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class ProcessFailed extends Exception
{
//
}

View File

@ -72,6 +72,6 @@ public function path(): string
public function storagePath(): string
{
return '/'.$this->name.'.zip';
return '/'.$this->backup->database->name.'/'.$this->name.'.zip';
}
}

View File

@ -63,10 +63,6 @@ public function deploySSHKey(string $key): void
public function deleteSSHKey(string $key): void
{
info($this->getScript('delete-ssh-key.sh', [
'key' => $key,
'user' => $this->server->getSshUser(),
]));
$this->server->ssh()->exec(
$this->getScript('delete-ssh-key.sh', [
'key' => $key,

View File

@ -1,7 +0,0 @@
if ! echo '__data__' | sudo -u __user__ crontab -; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo -u __user__ crontab -l; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -1,5 +0,0 @@
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install nodejs -y

View File

@ -1,17 +0,0 @@
if ! sudo chown -R 755 /home/vito/phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! echo '__vhost__' | sudo tee /etc/nginx/sites-available/phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "PHPMyAdmin vhost created"

View File

@ -1,11 +0,0 @@
sudo rm -rf __path__
sudo rm /etc/nginx/sites-available/phpmyadmin
sudo rm /etc/nginx/sites-enabled/phpmyadmin
if ! sudo service nginx restart; then
echo 'VITO_SSH_ERROR' && exit 1
fi
echo "PHPMyAdmin deleted"

View File

@ -1,21 +0,0 @@
sudo rm -rf phpmyadmin
if ! wget https://files.phpmyadmin.net/phpMyAdmin/5.1.2/phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! unzip phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! rm -rf phpMyAdmin-5.1.2-all-languages.zip; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! mv phpMyAdmin-5.1.2-all-languages phpmyadmin; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! mv phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php; then
echo 'VITO_SSH_ERROR' && exit 1
fi

View File

@ -1,3 +0,0 @@
sudo service __service__ restart
sudo service __service__ status | cat

View File

@ -1 +0,0 @@
sudo service __service__ status | cat

View File

@ -1,3 +0,0 @@
sudo service __service__ start
sudo service __service__ status | cat

View File

@ -1,3 +0,0 @@
sudo service __service__ stop
sudo service __service__ status | cat

View File

@ -1 +0,0 @@
sudo DEBIAN_FRONTEND=noninteractive apt install certbot python3-certbot-nginx -y

View File

@ -1 +0,0 @@
sudo sed -i 's/__key__//g' ~/.ssh/authorized_keys

View File

@ -1,27 +0,0 @@
if ! curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! chmod +x wp-cli.phar; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo mv wp-cli.phar /usr/local/bin/wp; then
echo 'VITO_SSH_ERROR' && exit 1
fi
rm -rf __path__
if ! wp --path=__path__ core download; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! wp --path=__path__ core config --dbname='__db_name__' --dbuser='__db_user__' --dbpass='__db_pass__' --dbhost='__db_host__' --dbprefix='__db_prefix__'; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! wp --path=__path__ core install --url='http://__domain__' --title="__title__" --admin_user='__username__' --admin_password="__password__" --admin_email='__email__'; then
echo 'VITO_SSH_ERROR' && exit 1
fi
print "Wordpress installed!"

View File

@ -32,6 +32,7 @@ class="p-6"
<div class="mt-6">
<x-input-label for="backup_storage" :value="__('Storage')" />
<div class="mt-1 flex items-center">
<x-select-input id="backup_storage" name="backup_storage" class="mt-1 w-full">
<option value="" selected disabled>{{ __("Select") }}</option>
@foreach (auth()->user()->storageProviders as $st)
@ -40,6 +41,10 @@ class="p-6"
</option>
@endforeach
</x-select-input>
<x-secondary-button :href="route('storage-providers')" class="ml-2 flex-none">
Connect
</x-secondary-button>
</div>
@error("backup_storage")
<x-input-error class="mt-2" :messages="$message" />
@enderror

View File

@ -5,7 +5,7 @@
<x-modal name="connect-provider">
@php
$oldProvider = old("provider", request()->input("provider") ?? "");
$oldProvider = old("provider", request()->input("provider") ?? "dropbox");
@endphp
<form
@ -33,6 +33,9 @@ class="p-6"
@if ($p !== "custom")
<option value="{{ $p }}" @if($oldProvider === $p) selected @endif>
{{ $p }}
@if ($p === "ftp")
(Beta)
@endif
</option>
@endif
@endforeach
@ -56,6 +59,14 @@ class="p-6"
@error("token")
<x-input-error class="mt-2" :messages="$message" />
@enderror
<a
class="mt-1 text-primary-500"
href="https://dropbox.tech/developers/generate-an-access-token-for-your-own-account"
target="_blank"
>
How to generate?
</a>
</div>
<div x-show="provider === 'ftp'" class="mt-6">