Unify to a single console command location.

This commit is contained in:
Buster "Silver Eagle" Neece 2020-01-24 23:08:25 -06:00
parent 765a01c2d8
commit 6b92475d8d
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
9 changed files with 96 additions and 95 deletions

View File

@ -1,3 +0,0 @@
#!/usr/bin/env php
<?php
include __DIR__.'/azuracast.php';

View File

@ -1,17 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
ini_set('display_errors', 1);
$autoloader = require dirname(__DIR__) . '/vendor/autoload.php';
$app = App\AppFactory::create($autoloader, [
Azura\Settings::BASE_DIR => dirname(__DIR__),
]);
$di = $app->getContainer();
App\Customization::initCli();
/** @var Azura\Console\Application $cli */
$cli = $di->get(Azura\Console\Application::class);
$cli->run();

View File

@ -1,3 +1,18 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
include __DIR__.'/azuracast.php'; error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
ini_set('display_errors', 1);
$autoloader = require dirname(__DIR__) . '/vendor/autoload.php';
$app = App\AppFactory::create($autoloader, [
Azura\Settings::BASE_DIR => dirname(__DIR__),
]);
$di = $app->getContainer();
App\Customization::initCli();
/** @var Azura\Console\Application $cli */
$cli = $di->get(Azura\Console\Application::class);
$cli->run();

View File

@ -109,7 +109,7 @@
} }
}, },
"bin": [ "bin": [
"bin/azuracast" "bin/console"
], ],
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"

View File

@ -16,8 +16,8 @@ fi
BASE_DIR=`pwd` BASE_DIR=`pwd`
# Create backup from existing installation. # Create backup from existing installation.
chmod a+x bin/azuracast chmod a+x bin/console
./bin/azuracast azuracast:backup --exclude-media migration.zip ./bin/console azuracast:backup --exclude-media migration.zip
read -n 1 -s -r -p "Database backed up. Press any key to continue (Install Docker)..." read -n 1 -s -r -p "Database backed up. Press any key to continue (Install Docker)..."

View File

@ -719,7 +719,7 @@ class Liquidsoap extends AbstractBackend implements EventSubscriberInterface
} }
} else { } else {
// Ansible shell-script call. // Ansible shell-script call.
$shell_path = '/usr/bin/php ' . $settings->getBaseDirectory() . '/bin/azuracast'; $shell_path = '/usr/bin/php ' . $settings->getBaseDirectory() . '/bin/console';
$shell_args = []; $shell_args = [];
$shell_args[] = 'azuracast:internal:' . $endpoint; $shell_args[] = 'azuracast:internal:' . $endpoint;

View File

@ -6,7 +6,7 @@
$this->layout('main', [ $this->layout('main', [
'title' => __('Backups'), 'title' => __('Backups'),
'manual' => true 'manual' => true,
]); ]);
$assets $assets
@ -16,75 +16,75 @@ $assets
<div class="card-deck"> <div class="card-deck">
<div class="card mb-3"> <div class="card mb-3">
<?php if ($is_enabled): ?> <?php if ($is_enabled): ?>
<div class="card-header bg-primary-dark"> <div class="card-header bg-primary-dark">
<h3 class="card-title"> <h3 class="card-title">
<?=__('Automatic Backups') ?> <?=__('Automatic Backups')?>
<small class="badge badge-pill badge-success"><?=__('Enabled') ?></small> <small class="badge badge-pill badge-success"><?=__('Enabled')?></small>
</h3> </h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="card-text"> <p class="card-text">
<?php if ($last_run > 0): ?> <?php if ($last_run > 0): ?>
<?=__('Last run: %s', '<time data-duration="'.(0-(time()-$last_run)).'"></time>') ?> <?=__('Last run: %s', '<time data-duration="' . (0 - (time() - $last_run)) . '"></time>')?>
<?php else: ?> <?php else: ?>
<?=__('Never run') ?> <?=__('Never run')?>
<?php endif; ?>
</p>
</div>
<div class="card-actions">
<a class="btn btn-outline-primary" href="<?=$router->fromHere('admin:backups:configure')?>">
<i class="material-icons" aria-hidden="true">settings</i>
<?=__('Configure')?>
</a>
<?php if (!empty($last_output)): ?>
<a class="btn btn-outline-secondary" id="btn-view-log" href="#">
<i class="material-icons" aria-hidden="true">assignment</i>
<?=__('Most Recent Backup Log')?>
</a>
<?php endif; ?> <?php endif; ?>
</p> </div>
</div> <?php else: ?>
<div class="card-actions"> <div class="card-header bg-primary-dark">
<a class="btn btn-outline-primary" href="<?=$router->fromHere('admin:backups:configure') ?>"> <h3 class="card-title">
<i class="material-icons" aria-hidden="true">settings</i> <?=__('Automatic Backups')?>
<?=__('Configure') ?> <small class="badge badge-pill badge-danger"><?=__('Disabled')?></small>
</a> </h3>
<?php if (!empty($last_output)): ?> </div>
<a class="btn btn-outline-secondary" id="btn-view-log" href="#"> <div class="card-actions">
<i class="material-icons" aria-hidden="true">assignment</i> <a class="btn btn-outline-primary" href="<?=$router->fromHere('admin:backups:configure')?>">
<?=__('Most Recent Backup Log') ?> <i class="material-icons" aria-hidden="true">settings</i>
</a> <?=__('Configure')?>
</a>
</div>
<?php endif; ?> <?php endif; ?>
</div>
<?php else: ?>
<div class="card-header bg-primary-dark">
<h3 class="card-title">
<?=__('Automatic Backups') ?>
<small class="badge badge-pill badge-danger"><?=__('Disabled') ?></small>
</h3>
</div>
<div class="card-actions">
<a class="btn btn-outline-primary" href="<?=$router->fromHere('admin:backups:configure') ?>">
<i class="material-icons" aria-hidden="true">settings</i>
<?=__('Configure') ?>
</a>
</div>
<?php endif; ?>
</div> </div>
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header bg-primary-dark"> <div class="card-header bg-primary-dark">
<h3 class="card-title"><?=__('Restoring Backups') ?></h3> <h3 class="card-title"><?=__('Restoring Backups')?></h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="card-text"><?=__('To restore a backup from your host computer, run:') ?></p> <p class="card-text"><?=__('To restore a backup from your host computer, run:')?></p>
<?php if (\App\Settings::getInstance()->isDocker()): ?> <?php if (\App\Settings::getInstance()->isDocker()): ?>
<pre><code>./docker.sh restore path_to_backup.zip</code></pre> <pre><code>./docker.sh restore path_to_backup.zip</code></pre>
<?php else: ?> <?php else: ?>
<pre><code>/var/azuracast/www/bin/azuracast azuracast:restore path_to_backup.zip</code></pre> <pre><code>/var/azuracast/www/bin/console azuracast:restore path_to_backup.zip</code></pre>
<?php endif; ?> <?php endif; ?>
<p class="card-text text-warning"><?=__('Note that restoring a backup will clear your existing database. Never restore backup files from untrusted users.') ?></p> <p class="card-text text-warning"><?=__('Note that restoring a backup will clear your existing database. Never restore backup files from untrusted users.')?></p>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header bg-primary-dark"> <div class="card-header bg-primary-dark">
<h3 class="card-title"><?=__('Backups') ?></h3> <h3 class="card-title"><?=__('Backups')?></h3>
</div> </div>
<div class="card-actions"> <div class="card-actions">
<a class="btn btn-outline-primary" role="button" href="<?=$router->named('admin:backups:run') ?>"> <a class="btn btn-outline-primary" role="button" href="<?=$router->named('admin:backups:run')?>">
<i class="material-icons" aria-hidden="true">send</i> <i class="material-icons" aria-hidden="true">send</i>
<?=__('Run Manual Backup') ?> <?=__('Run Manual Backup')?>
</a> </a>
</div> </div>
<table class="table table-responsive-md table-striped mb-0"> <table class="table table-responsive-md table-striped mb-0">
@ -96,26 +96,33 @@ $assets
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th><?=__('Actions') ?></th> <th><?=__('Actions')?></th>
<th><?=__('Backup') ?></th> <th><?=__('Backup')?></th>
<th><?=__('Last Modified') ?></th> <th><?=__('Last Modified')?></th>
<th><?=__('Size') ?></th> <th><?=__('Size')?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach($backups as $row): ?> <?php foreach ($backups as $row): ?>
<tr class="align-middle"> <tr class="align-middle">
<td> <td>
<div class="btn-group btn-group-sm"> <div class="btn-group btn-group-sm">
<a class="btn btn-sm btn-primary" href="<?=$router->fromHere('admin:backups:download', ['path' => base64_encode($row['path'])]) ?>"><?=__('Download') ?></a> <a class="btn btn-sm btn-primary" href="<?=$router->fromHere('admin:backups:download',
<a class="btn btn-sm btn-danger" href="<?=$router->fromHere('admin:backups:delete', ['path' => base64_encode($row['path']), 'csrf' => $csrf]) ?>" data-confirm-title="<?=$this->e(__('Delete backup "%s"?', $row['filename'])) ?>"><?=__('Delete') ?></a> ['path' => base64_encode($row['path'])])?>"><?=__('Download')?></a>
<a class="btn btn-sm btn-danger" href="<?=$router->fromHere('admin:backups:delete', [
'path' => base64_encode($row['path']),
'csrf' => $csrf,
])?>" data-confirm-title="<?=$this->e(__('Delete backup "%s"?',
$row['filename']))?>"><?=__('Delete')?></a>
</div> </div>
</td> </td>
<td> <td>
<big><?=$this->e($row['basename']) ?></big> <big><?=$this->e($row['basename'])?></big>
</td> </td>
<td><time data-content="<?=$row['timestamp'] ?>"><?=gmdate('Y-m-d', $row['timestamp']) ?></time></td> <td>
<td><span data-file-size="<?=$row['size'] ?>"><?=$row['size'] ?></span></td> <time data-content="<?=$row['timestamp']?>"><?=gmdate('Y-m-d', $row['timestamp'])?></time>
</td>
<td><span data-file-size="<?=$row['size']?>"><?=$row['size']?></span></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@ -127,11 +134,12 @@ $assets
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="modal-log-view-label"><?=__('Most Recent Backup Log') ?></h4> <h4 class="modal-title" id="modal-log-view-label"><?=__('Most Recent Backup Log')?></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<pre id="modal-log-view-contents"><?=$last_output ?></pre> <pre id="modal-log-view-contents"><?=$last_output?></pre>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,16 +3,16 @@
file: path="{{ item }}" state=touch mode="a+x" file: path="{{ item }}" state=touch mode="a+x"
with_items: with_items:
- "{{ www_base }}/update.sh" - "{{ www_base }}/update.sh"
- "{{ www_base }}/bin/azuracast" - "{{ www_base }}/bin/console"
- name: Run AzuraCast Setup (Install Mode) - name: Run AzuraCast Setup (Install Mode)
become: true become: true
become_user: azuracast become_user: azuracast
shell: php {{ www_base }}/bin/azuracast.php azuracast:setup shell: php {{ www_base }}/bin/console azuracast:setup
when: update_mode|bool == false when: update_mode|bool == false
- name: Run AzuraCast Setup (Update Mode) - name: Run AzuraCast Setup (Update Mode)
become: true become: true
become_user: azuracast become_user: azuracast
shell: php {{ www_base }}/bin/azuracast.php azuracast:setup --update shell: php {{ www_base }}/bin/console azuracast:setup --update
when: update_mode|bool == true when: update_mode|bool == true

View File

@ -1,2 +0,0 @@
<?php
include dirname(__DIR__) . '/bin/azuracast.php';