Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbyssMorgan committed Aug 23, 2024
1 parent c9cb189 commit dd0d430
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion AVE-PHP.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "AVE-PHP"
#define MyAppVersion "2.2.4"
#define MyAppVersion "2.2.5"
#define MyAppPublisher "Abyss Morgan"
#define MyAppURL "https://github.com/AbyssMorgan"
#define MyAppExeName "AVE-PHP.cmd"
Expand Down
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v2.2.5:
- Fixes

v2.2.2:
- Linux support improvements and fixes
- Updated tool: Media Tools > Video: Fetch media info: Added output folder setup
Expand Down
2 changes: 1 addition & 1 deletion includes/AVE.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AVE extends Core {
public string $app_data;
public bool $abort = false;
public string $app_name = "AVE-PHP";
public string $version = "2.2.4";
public string $version = "2.2.5";

private array $folders_to_scan = [
'bin',
Expand Down
7 changes: 6 additions & 1 deletion includes/avecore/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ class Migration extends MySQL {

protected string $table_version = 'ave_version';
protected string $table_config = 'ave_config';
protected array $tables = [];

public function __construct(){
parent::__construct();
}

public function table_exists(string $table) : bool {
if(isset($this->tables[$table])) return $this->tables[$table];
$result = $this->query("SHOW TABLES LIKE '$table'");
return $result && $result->rowCount() == 1;
$this->tables[$table] = ($result && $result->rowCount() == 1);
return $this->tables[$table];
}

public function migrate() : void {
Expand All @@ -32,6 +35,7 @@ public function migrate() : void {
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
$this->tables[$this->table_version] = true;
}

$version = $this->get_version($this->table_config, false);
Expand All @@ -45,6 +49,7 @@ public function migrate() : void {
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
$this->set_version($this->table_config, 1);
$this->tables[$this->table_config] = true;
}
}

Expand Down
10 changes: 8 additions & 2 deletions includes/avecore/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
class MySQL {

public ?PDO $db;
private bool $debug = false;

function __construct(){

function __construct(bool $debug = false){
$this->debug = $debug;
}

public function connect(string $host, string $user, string $password, string $dbname, int $port = 3306) : bool {
Expand All @@ -35,6 +36,10 @@ public function connect(string $host, string $user, string $password, string $db
return true;
}

public function toggle_debug(bool $toggle) : void {
$this->debug = $toggle;
}

public function disconnect() : void {
$this->db = null;
}
Expand All @@ -56,6 +61,7 @@ public function escape(mixed $string) : string {
}

public function query(string $query, ?int $fetchMode = null) : PDOStatement|false {
if($this->debug) echo " [MySQL] $query\r\n";
return $this->db->query($query, $fetchMode);
}

Expand Down
12 changes: 9 additions & 3 deletions includes/services/MediaFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,15 @@ public function get_media_quality(int $width, int $height, bool $is_video = fals
}

public function get_image_color_count(string $path) : int|null {
$image = new Imagick($path);
if(!$image->valid()) return null;
return $image->getImageColors();
if(!file_exists($path)) return -1;
try {
$image = new Imagick($path);
if(!$image->valid()) return null;
return $image->getImageColors();
}
catch(Exception $e){
return -1;
}
}

public function get_image_color_group(int $colors) : string {
Expand Down
2 changes: 1 addition & 1 deletion includes/tools/MediaTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function tool_video_fetch_media_info() : bool {
'fps' => $fps,
'codec' => $codec,
]);
if($new % 25 == 0) $cache->save();
if($new > 0 && $new % 25 == 0) $cache->save();
$this->ave->write_log("FETCH MEDIA INFO \"$file\"");
}
$meta = [
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.4
2.2.5

0 comments on commit dd0d430

Please sign in to comment.