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
<?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/azuracast"
"bin/console"
],
"config": {
"preferred-install": "dist"

View File

@ -16,8 +16,8 @@ fi
BASE_DIR=`pwd`
# Create backup from existing installation.
chmod a+x bin/azuracast
./bin/azuracast azuracast:backup --exclude-media migration.zip
chmod a+x bin/console
./bin/console azuracast:backup --exclude-media migration.zip
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 {
// 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[] = 'azuracast:internal:' . $endpoint;

View File

@ -6,7 +6,7 @@
$this->layout('main', [
'title' => __('Backups'),
'manual' => true
'manual' => true,
]);
$assets
@ -16,75 +16,75 @@ $assets
<div class="card-deck">
<div class="card mb-3">
<?php if ($is_enabled): ?>
<div class="card-header bg-primary-dark">
<h3 class="card-title">
<?=__('Automatic Backups') ?>
<small class="badge badge-pill badge-success"><?=__('Enabled') ?></small>
</h3>
</div>
<div class="card-body">
<p class="card-text">
<?php if ($last_run > 0): ?>
<?=__('Last run: %s', '<time data-duration="'.(0-(time()-$last_run)).'"></time>') ?>
<?php else: ?>
<?=__('Never run') ?>
<?php if ($is_enabled): ?>
<div class="card-header bg-primary-dark">
<h3 class="card-title">
<?=__('Automatic Backups')?>
<small class="badge badge-pill badge-success"><?=__('Enabled')?></small>
</h3>
</div>
<div class="card-body">
<p class="card-text">
<?php if ($last_run > 0): ?>
<?=__('Last run: %s', '<time data-duration="' . (0 - (time() - $last_run)) . '"></time>')?>
<?php else: ?>
<?=__('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; ?>
</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>
</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>
<?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 class="card mb-3">
<div class="card-header bg-primary-dark">
<h3 class="card-title"><?=__('Restoring Backups') ?></h3>
<h3 class="card-title"><?=__('Restoring Backups')?></h3>
</div>
<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()): ?>
<pre><code>./docker.sh restore path_to_backup.zip</code></pre>
<?php else: ?>
<pre><code>/var/azuracast/www/bin/azuracast azuracast:restore path_to_backup.zip</code></pre>
<?php endif; ?>
<?php if (\App\Settings::getInstance()->isDocker()): ?>
<pre><code>./docker.sh restore path_to_backup.zip</code></pre>
<?php else: ?>
<pre><code>/var/azuracast/www/bin/console azuracast:restore path_to_backup.zip</code></pre>
<?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 class="card">
<div class="card-header bg-primary-dark">
<h3 class="card-title"><?=__('Backups') ?></h3>
<h3 class="card-title"><?=__('Backups')?></h3>
</div>
<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>
<?=__('Run Manual Backup') ?>
<?=__('Run Manual Backup')?>
</a>
</div>
<table class="table table-responsive-md table-striped mb-0">
@ -96,26 +96,33 @@ $assets
</colgroup>
<thead>
<tr>
<th><?=__('Actions') ?></th>
<th><?=__('Backup') ?></th>
<th><?=__('Last Modified') ?></th>
<th><?=__('Size') ?></th>
<th><?=__('Actions')?></th>
<th><?=__('Backup')?></th>
<th><?=__('Last Modified')?></th>
<th><?=__('Size')?></th>
</tr>
</thead>
<tbody>
<?php foreach($backups as $row): ?>
<?php foreach ($backups as $row): ?>
<tr class="align-middle">
<td>
<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-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>
<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-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>
</td>
<td>
<big><?=$this->e($row['basename']) ?></big>
<big><?=$this->e($row['basename'])?></big>
</td>
<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>
<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>
<?php endforeach; ?>
</tbody>
@ -127,11 +134,12 @@ $assets
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<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>
<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>
</div>
<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>

View File

@ -3,16 +3,16 @@
file: path="{{ item }}" state=touch mode="a+x"
with_items:
- "{{ www_base }}/update.sh"
- "{{ www_base }}/bin/azuracast"
- "{{ www_base }}/bin/console"
- name: Run AzuraCast Setup (Install Mode)
become: true
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
- name: Run AzuraCast Setup (Update Mode)
become: true
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

View File

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