Skip to content

Commit

Permalink
Fix PHP warnings & fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sama34 committed Aug 13, 2024
1 parent d599fd9 commit f122271
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions resources/class_cache_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function fid($old_fid)
$this->cache_forums();
}

return $this->cache_fids[$old_fid];
return isset($this->cache_fids[$old_fid]) ? $this->cache_fids[$old_fid] : 0;
}

/**
Expand Down Expand Up @@ -448,7 +448,7 @@ function tid($old_tid)
$this->cache_threads();
}

return $this->cache_tids[$old_tid];
return isset($this->cache_tids[$old_tid]) ? $this->cache_tids[$old_tid] : 0;
}

/**
Expand Down
19 changes: 1 addition & 18 deletions resources/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,28 +255,11 @@ function delete_import_fields($text=true)
$progress += $increment;
}

$columns_to_drop = array();
foreach($columns as $column)
{
if($db->field_exists($column, $table))
{
$columns_to_drop[] = $column;
}
}
if(!empty($columns_to_drop))
{
if($db->type == "sqlite")
{
// Can be achieved in a transaction if we'd finally support it.
foreach($columns_to_drop as $column)
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX.$table." DROP {$column}");
}
}
else
{
$columns_sql = implode(", DROP ", $columns_to_drop);
$db->write_query("ALTER TABLE ".TABLE_PREFIX.$table." DROP {$columns_sql}");
$db->drop_column($table, $column);
}
}
}
Expand Down

0 comments on commit f122271

Please sign in to comment.