[Welcome] Claim all station logbooks to first user in the datbase

pull/1653/head
Peter Goodhall 2022-10-09 14:55:46 +01:00
rodzic 40b5746e48
commit c0c4caa53a
3 zmienionych plików z 96 dodań i 1 usunięć

Wyświetl plik

@ -17,4 +17,17 @@ class Welcome extends CI_Controller {
$this->load->view('welcome/index');
$this->load->view('interface_assets/footer');
}
public function locationsclaim() {
try {
// load model Stations and call function ClaimAllStationLocations
$this->load->model('stations');
$this->stations->ClaimAllStationLocations();
echo "All Station Locations Claimed";
} catch (Exception $e) {
log_message('error', 'Error Claiming Station Locations during Migration. '.$e->getMessage());
echo "Error Claiming Station Locations during Migration. See Logs for further information";
}
}
}

Wyświetl plik

@ -142,6 +142,20 @@ class Stations extends CI_Model {
$this->db->update('station_profile', $data);
}
function ClaimAllStationLocations($id = NULL) {
// if $id is empty then use session user_id
if (empty($id)) {
// Get the first USER ID from user table in the database
$id = $this->db->get("users")->row()->user_id;
}
$data = array(
'user_id' => $id,
);
$this->db->update('station_profile', $data);
}
function set_active($current, $new) {
// Clean inputs
$clean_current = $this->security->xss_clean($current);

Wyświetl plik

@ -12,7 +12,7 @@
<h2><?php echo $page_title; ?></h2>
<p class="lead">After many years and hard work Cloudlog version 2.0 has finally arrived, this brings multi-user support, logbooks to group station locations, improved code with lots of speed increases sprinkled around.</p>
<p class="lead">I'd like to thank Andreas (LA8AJA) and Flo (DF2ET) for helping getting this over the finish line.</p>
<p class="lead">This guide is to help you get your installation configured to work with all the new features please follow it!</p>
<?php if(ENVIRONMENT != "production") { ?>
@ -48,5 +48,73 @@
$config['auth_level'][99] = "Administrator";
</code>
</div>
</div>
<br>
<div class="card">
<div class="card-header">Cronjob Refresher</div>
<div class="card-body">
<p class="card-text">Needs Text</p>
<code>
# Update the Cloudlog installation every day at midnight <br>
0 0 * * * /bin/bash -c "<Full-Path-To-Bash-Script>/cloudlog.sh" <br>
<br>
# Upload QSOs to Club Log (ignore cron job if this integration is not required) <br>
0 */6 * * * curl --silent <?php echo site_url();?>/clublog/upload/<username-with-clublog-login> &>/dev/null <br>
<br>
# Upload QSOs to LoTW if certs have been provided every hour. <br>
0 */1 * * * curl --silent <?php echo site_url();?>/lotw/lotw_upload &>/dev/null <br>
<br>
# Upload QSOs to QRZ Logbook (ignore cron job if this integration is not required) <br>
0 */6 * * * curl --silent <?php echo site_url();?>/qrz/upload &>/dev/null <br>
<br>
# Update LOTW Users Database <br>
@weekly curl --silent<?php echo site_url();?>/lotw/load_users &>/dev/null <br>
<br>
# Update Clublog SCP Database File <br>
@weekly curl --silent <?php echo site_url();?>/update/update_clublog_scp &>/dev/null <br>
<br>
# Update DOK File for autocomplete <br>
@monthly curl --silent <?php echo site_url();?>/update/update_dok &>/dev/null <br>
<br>
# Update SOTA File for autocomplete <br>
@monthly curl --silent <?php echo site_url();?>/update/update_sota &>/dev/null <br>
<br>
# Update WWFF File for autocomplete <br>
@monthly curl --silent <?php echo site_url();?>/update/update_wwff &>/dev/null <br>
</code>
</div>
</div>
<br>
<div class="card">
<div class="card-header">Assign ALL Station Locations to this username</div>
<div class="card-body">
<p class="card-text">With Cloudlog Version 2.0, Station Locations must be associated with a user pressing the button below will assign all Station Locations to the first user in the database</p>
<button type="button" class="btn btn-primary" hx-post="<?php echo site_url('welcome/locationsclaim'); ?>">Associate Station Locations with the Administrator account.</button>
</div>
</div>
<br>
<div class="card">
<div class="card-header">Create Station Logbooks</div>
<div class="card-body">
<p class="card-text">Needs Text</p>
</div>
</div>
<br>
<div class="card">
<div class="card-header">Update Country Files</div>
<div class="card-body">
<p class="card-text">Needs Text</p>
</div>
</div>
<br>
</div>