remove some unused bits

This commit is contained in:
Shish 2023-01-11 18:28:43 +00:00
parent c81911893f
commit 1f48c5ba19
9 changed files with 17 additions and 83 deletions

View file

@ -106,7 +106,7 @@ class AliasEditor extends Extension
if (count($_FILES) > 0) {
$tmp = $_FILES['alias_file']['tmp_name'];
$contents = file_get_contents($tmp);
$this->add_alias_csv($database, $contents);
$this->add_alias_csv($contents);
log_info("alias_editor", "Imported aliases from file", "Imported aliases"); # FIXME: how many?
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("alias/list"));
@ -179,7 +179,7 @@ class AliasEditor extends Extension
return $csv;
}
private function add_alias_csv(Database $database, string $csv): int
private function add_alias_csv(string $csv): int
{
$csv = str_replace("\r", "\n", $csv);
$i = 0;

View file

@ -166,7 +166,7 @@ class Artists extends Extension
//*************ARTIST SECTION**************
case "list":
{
$this->get_listing($page, $event);
$this->get_listing($event);
$this->theme->sidebar_options("neutral");
break;
}
@ -847,7 +847,7 @@ class Artists extends Extension
/*
* HERE WE GET THE LIST OF ALL ARTIST WITH PAGINATION
*/
private function get_listing(Page $page, PageRequestEvent $event)
private function get_listing(PageRequestEvent $event)
{
global $config, $database;

View file

@ -112,7 +112,7 @@ class AutoTagger extends Extension
if (count($_FILES) > 0) {
$tmp = $_FILES['auto_tag_file']['tmp_name'];
$contents = file_get_contents($tmp);
$count = $this->add_auto_tag_csv($database, $contents);
$count = $this->add_auto_tag_csv($contents);
log_info(AutoTaggerInfo::KEY, "Imported $count auto-tag definitions from file from file", "Imported $count auto-tag definitions");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("auto_tag/list"));
@ -191,7 +191,7 @@ class AutoTagger extends Extension
return $csv;
}
private function add_auto_tag_csv(Database $database, string $csv): int
private function add_auto_tag_csv(string $csv): int
{
$csv = str_replace("\r", "\n", $csv);
$i = 0;
@ -250,37 +250,6 @@ class AutoTagger extends Extension
$this->apply_new_auto_tag($tag);
}
private function update_auto_tag(string $tag, string $additional_tags): bool
{
global $database;
$result = $database->get_row("SELECT * FROM auto_tag WHERE LOWER(tag)=LOWER(:tag)", ["tag"=>$tag]);
if ($result===null) {
throw new AutoTaggerException("Auto-tag not set for $tag, can't update");
} else {
$additional_tags = Tag::explode($additional_tags);
$current_additional_tags = Tag::explode($result["additional_tags"]);
if (!Tag::compare($additional_tags, $current_additional_tags)) {
$database->execute(
"UPDATE auto_tag SET additional_tags = :additional_tags WHERE LOWER(tag)=LOWER(:tag)",
["tag"=>$tag, "additional_tags"=>Tag::implode($additional_tags)]
);
log_info(
AutoTaggerInfo::KEY,
"Updated auto-tag for {$tag} -> {".implode(" ", $additional_tags)."}",
"Updated Auto-Tag"
);
// Now we apply it to existing items
$this->apply_new_auto_tag($tag);
return true;
}
}
return false;
}
private function apply_new_auto_tag(string $tag)
{
global $database;
@ -296,8 +265,6 @@ class AutoTagger extends Extension
}
}
private function remove_auto_tag(String $tag)
{
global $database;

View file

@ -15,16 +15,12 @@ class BiographyTheme extends Themelet
public function display_composer(Page $page, string $bio)
{
global $user;
$post_url = make_link("biography");
$auth = $user->get_auth_html();
$html = SHM_SIMPLE_FORM(
$post_url,
make_link("biography"),
TEXTAREA(["style"=>"width: 100%", "rows"=>"6", "name"=>"biography"], $bio),
SHM_SUBMIT("Save")
);
$page->add_block(new Block("About Me", (string)$html, "main", 30));
$page->add_block(new Block("About Me", $html, "main", 30));
}
}

View file

@ -353,7 +353,7 @@ class CronUploader extends Extension
//set_time_limit(0);
$output_subdir = date('Ymd-His', time());
$image_queue = $this->generate_image_queue($user_config->get_string(CronUploaderConfig::DIR));
$image_queue = $this->generate_image_queue();
// Randomize Images
//shuffle($this->image_queue);
@ -502,18 +502,6 @@ class CronUploader extends Extension
private const PARTIAL_DOWNLOAD_EXTENSIONS = ['crdownload','part'];
private const SKIPPABLE_FILES = ['.ds_store','thumbs.db'];
private const SKIPPABLE_DIRECTORIES = ['__macosx'];
private function is_skippable_dir(string $path): bool
{
$info = pathinfo($path);
if (array_key_exists("basename", $info) && in_array(strtolower($info['basename']), self::SKIPPABLE_DIRECTORIES)) {
return true;
}
return false;
}
private function is_skippable_file(string $path): bool
{
@ -530,7 +518,7 @@ class CronUploader extends Extension
return false;
}
private function generate_image_queue(string $root_dir, ?int $limit = null): \Generator
private function generate_image_queue(): \Generator
{
$base = $this->get_queue_dir();

View file

@ -125,7 +125,7 @@ class CronUploaderTheme extends Themelet
}
}
public function get_user_options(string $dir, bool $stop_on_error, int $log_level, bool $all_logs): string
public function get_user_options(): string
{
$form = SHM_SIMPLE_FORM(
"user_admin/cron_uploader",

View file

@ -354,23 +354,6 @@ class Forum extends Extension
$database->execute("UPDATE forum_threads SET uptodate=now() WHERE id=:id", ['id'=>$threadID]);
}
private function retrieve_posts(int $threadID, int $pageNumber): array
{
global $database, $config;
$postsPerPage = $config->get_int('forumPostsPerPage', 15);
return $database->get_all(
"SELECT p.id, p.date, p.message, u.name as user_name, u.email AS user_email, u.class AS user_class ".
"FROM forum_posts AS p ".
"INNER JOIN users AS u ".
"ON p.user_id = u.id ".
"WHERE thread_id = :thread_id ".
"ORDER BY p.date ASC ".
"LIMIT :limit OFFSET :offset ",
["thread_id"=>$threadID, "offset"=>($pageNumber - 1) * $postsPerPage, "limit"=>$postsPerPage]
);
}
private function delete_thread(int $threadID): void
{
global $database;

View file

@ -82,7 +82,7 @@ class IndexTest extends ShimmiePHPUnitTestCase
/** @depends testUpload */
public function testTagSearchNoResults($image_ids)
{
$image_ids = $this->testUpload();
$this->testUpload();
$this->assert_search_results(["maumaumau"], []);
}
@ -106,7 +106,7 @@ class IndexTest extends ShimmiePHPUnitTestCase
/** @depends testUpload */
public function testMultiTagSearchNoResults($image_ids)
{
$image_ids = $this->testUpload();
$this->testUpload();
# multiple tags, one of which doesn't exist
# (test the "one tag doesn't exist = no hits" path)
$this->assert_search_results(["computer", "asdfasdfwaffle"], []);
@ -132,7 +132,7 @@ class IndexTest extends ShimmiePHPUnitTestCase
/** @depends testUpload */
public function testMetaSearchNoResults($image_ids)
{
$image_ids = $this->testUpload();
$this->testUpload();
$this->assert_search_results(["hash=1234567890"], []);
$this->assert_search_results(["ratio=42:12345"], []);
}
@ -162,7 +162,7 @@ class IndexTest extends ShimmiePHPUnitTestCase
/** @depends testUpload */
public function testWildSearchNoResults($image_ids)
{
$image_ids = $this->testUpload();
$this->testUpload();
$this->assert_search_results(["asdfasdf*"], []);
}

View file

@ -560,7 +560,7 @@ class UserPage extends Extension
return $new_user;
}
private function set_login_cookie(string $name, string $pass): void
private function set_login_cookie(string $name): void
{
global $config, $page;
@ -639,7 +639,7 @@ class UserPage extends Extension
$duser->set_password($pass1);
if ($duser->id == $user->id) {
$this->set_login_cookie($duser->name, $pass1);
$this->set_login_cookie($duser->name);
}
$page->flash("Password changed");