admin function for fixing tag cases
This commit is contained in:
parent
c57801bce7
commit
01aacdb19c
@ -125,6 +125,15 @@ class AdminPage extends Extension {
|
||||
return false;
|
||||
}
|
||||
|
||||
private function set_tag_case() {
|
||||
global $database;
|
||||
$database->execute($database->scoreql_to_sql(
|
||||
"UPDATE tags SET tag=:tag1 WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag2)"
|
||||
), array("tag1" => $_POST['tag'], "tag2" => $_POST['tag']));
|
||||
log_info("admin", "Fixed the case of ".html_escape($_POST['tag']), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private function lowercase_all_tags() {
|
||||
global $database;
|
||||
$database->execute("UPDATE tags SET tag=lower(tag)");
|
||||
|
@ -31,6 +31,7 @@ class AdminPageTheme extends Themelet {
|
||||
* 'lowercase all tags'
|
||||
* 'recount tag use'
|
||||
* 'purge unused tags'
|
||||
* etc
|
||||
*/
|
||||
public function display_form() {
|
||||
global $page, $database;
|
||||
@ -40,8 +41,13 @@ class AdminPageTheme extends Themelet {
|
||||
$html .= $this->button("Recount tag use", "recount_tag_user", false);
|
||||
$html .= $this->button("Download all images", "image_dump", false);
|
||||
$html .= $this->button("Download database contents", "database_dump", false);
|
||||
|
||||
$page->add_block(new Block("Misc Admin Tools", $html));
|
||||
|
||||
$html = make_form(make_link("admin/set_tag_case"), "POST");
|
||||
$html .= "<input type='text' name='tag' placeholder='Enter tag with correct case'>";
|
||||
$html .= "<input type='submit' value='Set Tag Case'>";
|
||||
$html .= "</form>\n";
|
||||
$page->add_block(new Block("Set Tag Case", $html));
|
||||
}
|
||||
|
||||
public function dbq_html($terms) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user