mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Add theme for color impaired hams (based on default) (#2497)
This commit is contained in:
37
application/migrations/265_add_color_impaired_theme.php
Normal file
37
application/migrations/265_add_color_impaired_theme.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This migration adds a theme for color impaired hams (based on default skin)
|
||||
*/
|
||||
|
||||
class Migration_add_color_impaired_theme extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
if ($this->entrycheck() == 0) {
|
||||
$this->dbtry("INSERT INTO `themes` SET name = 'Color Impaired Support', foldername = 'color_impaired', header_logo = 'wavelog_icon_only_default', main_logo = 'wavelog_logo_default', theme_mode = 'light';");
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if ($this->entrycheck() > 0) {
|
||||
$this->dbtry("DELETE FROM themes WHERE name = 'Color Impaired Support';");
|
||||
$this->dbtry("UPDATE `users` SET user_stylesheet = 'default' WHERE user_stylesheet = 'color_impaired';");
|
||||
}
|
||||
}
|
||||
|
||||
function dbtry($what) {
|
||||
try {
|
||||
$this->db->query($what);
|
||||
} catch (Exception $e) {
|
||||
log_message("error", "Something gone wrong while altering the themes table: ".$e." // Executing: ".$this->db->last_query());
|
||||
}
|
||||
}
|
||||
|
||||
function entrycheck() {
|
||||
return $this->db->query("SELECT * FROM themes WHERE name = 'Color Impaired Support';")->num_rows();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user