diff --git a/.circleci/config.yml b/.circleci/config.yml
index 9e92613921b..dcd894d821b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -76,6 +76,7 @@ jobs:
--source Perl \
-I lib \
-j 9 \
+ t/critic.t \
t/pgtap/* \
t/pgtap/unused-tags/* \
t/script/MergeDuplicateArtistCredits.t \
diff --git a/admin/CompileSchemaScripts.pl b/admin/CompileSchemaScripts.pl
index a68f178274d..c44318ba177 100755
--- a/admin/CompileSchemaScripts.pl
+++ b/admin/CompileSchemaScripts.pl
@@ -21,12 +21,12 @@
my $scripts = $upgrade_data->{$schema_version}->{$script_name};
my $filename = "$FindBin::Bin/sql/updates/schema-change/$schema_version.$script_name.sql";
my $data = join("\n", '-- Generated by CompileSchemaScripts.pl from:', map { '-- ' . $_ } @$scripts) . "\n";
- $data .= <<~'EOSQL';
+ $data .= <<~'SQL';
\\set ON_ERROR_STOP 1
BEGIN;
SET search_path = musicbrainz, public;
SET LOCAL statement_timeout = 0;
- EOSQL
+ SQL
for my $script (@$scripts) {
my @script_data = read_file("$FindBin::Bin/sql/updates/$script");
$data .= "--------------------------------------------------------------------------------\n";
@@ -37,8 +37,8 @@
}
}
}
- $data .= <<~'EOSQL';
+ $data .= <<~'SQL';
COMMIT;
- EOSQL
+ SQL
write_file($filename, \$data);
}
diff --git a/admin/sql/CreateFunctions.sql b/admin/sql/CreateFunctions.sql
index dcc3d75c214..89f4372ddb4 100644
--- a/admin/sql/CreateFunctions.sql
+++ b/admin/sql/CreateFunctions.sql
@@ -1356,150 +1356,6 @@ BEGIN
END;
$$ LANGUAGE 'plpgsql';
-CREATE OR REPLACE FUNCTION unique_primary_area_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE area_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND area = NEW.area;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_artist_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE artist_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND artist = NEW.artist;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_event_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE event_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND event = NEW.event;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_genre_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE genre_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND genre = NEW.genre;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_instrument_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE instrument_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND instrument = NEW.instrument;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_label_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE label_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND label = NEW.label;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_place_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE place_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND place = NEW.place;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_recording_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE recording_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND recording = NEW.recording;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_release_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE release_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND release = NEW.release;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_release_group_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE release_group_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND release_group = NEW.release_group;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_series_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE series_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND series = NEW.series;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION unique_primary_work_alias()
-RETURNS trigger AS $$
-BEGIN
- IF NEW.primary_for_locale THEN
- UPDATE work_alias SET primary_for_locale = FALSE
- WHERE locale = NEW.locale AND id != NEW.id
- AND work = NEW.work;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE 'plpgsql';
-
CREATE OR REPLACE FUNCTION simplify_search_hints()
RETURNS trigger AS $$
BEGIN
diff --git a/admin/sql/CreateTriggers.sql b/admin/sql/CreateTriggers.sql
index 3248af3c8ab..dbb1f570888 100644
--- a/admin/sql/CreateTriggers.sql
+++ b/admin/sql/CreateTriggers.sql
@@ -10,9 +10,6 @@ CREATE TRIGGER b_upd_area_alias BEFORE UPDATE ON area_alias
CREATE TRIGGER b_upd_area_tag BEFORE UPDATE ON area_tag
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON area_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_area_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON area_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(3);
@@ -55,9 +52,6 @@ CREATE TRIGGER del_collection_sub_on_delete BEFORE DELETE ON editor_collection
CREATE TRIGGER del_collection_sub_on_private BEFORE UPDATE ON editor_collection
FOR EACH ROW EXECUTE PROCEDURE del_collection_sub_on_private();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON artist_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_artist_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON artist_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(3);
@@ -88,9 +82,6 @@ CREATE TRIGGER b_upd_event_alias BEFORE UPDATE ON event_alias
CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON event_alias
FOR EACH ROW EXECUTE PROCEDURE end_date_implies_ended();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON event_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_event_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON event_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -103,9 +94,6 @@ CREATE TRIGGER b_upd_genre BEFORE UPDATE ON genre
CREATE TRIGGER b_upd_genre_alias BEFORE UPDATE ON genre_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON genre_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_genre_alias();
-
CREATE TRIGGER b_upd_instrument BEFORE UPDATE ON instrument
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
@@ -118,9 +106,6 @@ CREATE TRIGGER b_upd_instrument_alias BEFORE UPDATE ON instrument_alias
CREATE TRIGGER b_upd_instrument_tag BEFORE UPDATE ON instrument_tag
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON instrument_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_instrument_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON instrument_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -340,9 +325,6 @@ CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON label_alias
CREATE TRIGGER b_upd_label_alias BEFORE UPDATE ON label_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON label_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_label_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON label_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -391,9 +373,6 @@ CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON place_alias
CREATE TRIGGER b_upd_place_alias BEFORE UPDATE ON place_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON place_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_place_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON place_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -418,9 +397,6 @@ CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON recording_alias
CREATE TRIGGER b_upd_recording_alias BEFORE UPDATE ON recording_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON recording_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_recording_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON recording_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -445,9 +421,6 @@ CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON release_alias
CREATE TRIGGER b_upd_release_alias BEFORE UPDATE ON release_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON release_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_release_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON release_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -508,9 +481,6 @@ CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON release_group_a
CREATE TRIGGER b_upd_release_group_alias BEFORE UPDATE ON release_group_alias
FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON release_group_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_release_group_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON release_group_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -529,9 +499,6 @@ CREATE TRIGGER b_upd_series_tag BEFORE UPDATE ON series_tag
CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON series_alias
FOR EACH ROW EXECUTE PROCEDURE end_date_implies_ended();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON series_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_series_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON series_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
@@ -569,9 +536,6 @@ CREATE TRIGGER b_upd_work_alias BEFORE UPDATE ON work_alias
CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON work_alias
FOR EACH ROW EXECUTE PROCEDURE end_date_implies_ended();
-CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON work_alias
- FOR EACH ROW EXECUTE PROCEDURE unique_primary_work_alias();
-
CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON work_alias
FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2);
diff --git a/admin/sql/DropFunctions.sql b/admin/sql/DropFunctions.sql
index 956d08437bb..7ed45a6d8bb 100644
--- a/admin/sql/DropFunctions.sql
+++ b/admin/sql/DropFunctions.sql
@@ -102,17 +102,5 @@ DROP FUNCTION simplify_search_hints();
DROP FUNCTION track_count_matches_cdtoc(medium, int);
DROP FUNCTION trg_delete_unused_tag();
DROP FUNCTION trg_delete_unused_tag_ref();
-DROP FUNCTION unique_primary_area_alias();
-DROP FUNCTION unique_primary_artist_alias();
-DROP FUNCTION unique_primary_event_alias();
-DROP FUNCTION unique_primary_genre_alias();
-DROP FUNCTION unique_primary_instrument_alias();
-DROP FUNCTION unique_primary_label_alias();
-DROP FUNCTION unique_primary_place_alias();
-DROP FUNCTION unique_primary_recording_alias();
-DROP FUNCTION unique_primary_release_alias();
-DROP FUNCTION unique_primary_release_group_alias();
-DROP FUNCTION unique_primary_series_alias();
-DROP FUNCTION unique_primary_work_alias();
DROP FUNCTION whitespace_collapsed(TEXT);
DROP AGGREGATE array_accum (anyelement);
diff --git a/admin/sql/DropTriggers.sql b/admin/sql/DropTriggers.sql
index f10906dee07..5b2afc4d57c 100644
--- a/admin/sql/DropTriggers.sql
+++ b/admin/sql/DropTriggers.sql
@@ -4,7 +4,6 @@
DROP TRIGGER b_upd_area ON area;
DROP TRIGGER b_upd_area_alias ON area_alias;
DROP TRIGGER b_upd_area_tag ON area_tag;
-DROP TRIGGER unique_primary_for_locale ON area_alias;
DROP TRIGGER search_hint ON area_alias;
DROP TRIGGER end_date_implies_ended ON area_alias;
DROP TRIGGER end_date_implies_ended ON area;
@@ -19,7 +18,6 @@ DROP TRIGGER b_upd_artist_alias ON artist_alias;
DROP TRIGGER replace_old_sub_on_add ON editor_subscribe_collection;
DROP TRIGGER del_collection_sub_on_delete ON editor_collection;
DROP TRIGGER del_collection_sub_on_private ON editor_collection;
-DROP TRIGGER unique_primary_for_locale ON artist_alias;
DROP TRIGGER search_hint ON artist_alias;
DROP TRIGGER b_upd_artist_tag ON artist_tag;
DROP TRIGGER b_upd_editor ON editor;
@@ -30,17 +28,14 @@ DROP TRIGGER b_upd_event ON event;
DROP TRIGGER end_date_implies_ended ON event;
DROP TRIGGER b_upd_event_alias ON event_alias;
DROP TRIGGER end_date_implies_ended ON event_alias;
-DROP TRIGGER unique_primary_for_locale ON event_alias;
DROP TRIGGER search_hint ON event_alias;
DROP TRIGGER b_upd_event_tag ON event_tag;
DROP TRIGGER b_upd_genre ON genre;
DROP TRIGGER b_upd_genre_alias ON genre_alias;
-DROP TRIGGER unique_primary_for_locale ON genre_alias;
DROP TRIGGER b_upd_instrument ON instrument;
DROP TRIGGER end_date_implies_ended ON instrument_alias;
DROP TRIGGER b_upd_instrument_alias ON instrument_alias;
DROP TRIGGER b_upd_instrument_tag ON instrument_tag;
-DROP TRIGGER unique_primary_for_locale ON instrument_alias;
DROP TRIGGER search_hint ON instrument_alias;
DROP TRIGGER b_upd_l_area_area ON l_area_area;
DROP TRIGGER b_upd_l_area_artist ON l_area_artist;
@@ -114,7 +109,6 @@ DROP TRIGGER b_upd_label ON label;
DROP TRIGGER end_date_implies_ended ON label;
DROP TRIGGER end_date_implies_ended ON label_alias;
DROP TRIGGER b_upd_label_alias ON label_alias;
-DROP TRIGGER unique_primary_for_locale ON label_alias;
DROP TRIGGER search_hint ON label_alias;
DROP TRIGGER b_upd_label_tag ON label_tag;
DROP TRIGGER end_date_implies_ended ON link;
@@ -131,7 +125,6 @@ DROP TRIGGER b_upd_place ON place;
DROP TRIGGER end_date_implies_ended ON place;
DROP TRIGGER end_date_implies_ended ON place_alias;
DROP TRIGGER b_upd_place_alias ON place_alias;
-DROP TRIGGER unique_primary_for_locale ON place_alias;
DROP TRIGGER search_hint ON place_alias;
DROP TRIGGER b_upd_place_tag ON place_tag;
DROP TRIGGER a_ins_recording ON recording;
@@ -140,7 +133,6 @@ DROP TRIGGER a_upd_recording ON recording;
DROP TRIGGER a_del_recording ON recording;
DROP TRIGGER end_date_implies_ended ON recording_alias;
DROP TRIGGER b_upd_recording_alias ON recording_alias;
-DROP TRIGGER unique_primary_for_locale ON recording_alias;
DROP TRIGGER search_hint ON recording_alias;
DROP TRIGGER b_upd_recording_tag ON recording_tag;
DROP TRIGGER a_ins_release ON release;
@@ -149,7 +141,6 @@ DROP TRIGGER a_del_release ON release;
DROP TRIGGER b_upd_release ON release;
DROP TRIGGER end_date_implies_ended ON release_alias;
DROP TRIGGER b_upd_release_alias ON release_alias;
-DROP TRIGGER unique_primary_for_locale ON release_alias;
DROP TRIGGER search_hint ON release_alias;
DROP TRIGGER a_ins_release_event ON release_country;
DROP TRIGGER a_upd_release_event ON release_country;
@@ -170,14 +161,12 @@ DROP TRIGGER a_del_release_group_secondary_type_join ON release_group_secondary_
DROP TRIGGER b_upd_release_group_secondary_type_join ON release_group_secondary_type_join;
DROP TRIGGER end_date_implies_ended ON release_group_alias;
DROP TRIGGER b_upd_release_group_alias ON release_group_alias;
-DROP TRIGGER unique_primary_for_locale ON release_group_alias;
DROP TRIGGER search_hint ON release_group_alias;
DROP TRIGGER b_upd_release_group_tag ON release_group_tag;
DROP TRIGGER b_upd_series ON series;
DROP TRIGGER b_upd_series_alias ON series_alias;
DROP TRIGGER b_upd_series_tag ON series_tag;
DROP TRIGGER end_date_implies_ended ON series_alias;
-DROP TRIGGER unique_primary_for_locale ON series_alias;
DROP TRIGGER search_hint ON series_alias;
DROP TRIGGER b_upd_tag_relation ON tag_relation;
DROP TRIGGER a_ins_track ON track;
@@ -190,7 +179,6 @@ DROP TRIGGER a_ins_work ON work;
DROP TRIGGER b_upd_work ON work;
DROP TRIGGER b_upd_work_alias ON work_alias;
DROP TRIGGER end_date_implies_ended ON work_alias;
-DROP TRIGGER unique_primary_for_locale ON work_alias;
DROP TRIGGER search_hint ON work_alias;
DROP TRIGGER b_upd_work_tag ON work_tag;
DROP TRIGGER inserting_edits_requires_confirmed_email_address ON edit;
diff --git a/admin/sql/updates/20210916-mbs-11896.sql b/admin/sql/updates/20210916-mbs-11896.sql
new file mode 100644
index 00000000000..ffad0b5ecf9
--- /dev/null
+++ b/admin/sql/updates/20210916-mbs-11896.sql
@@ -0,0 +1,31 @@
+\set ON_ERROR_STOP 1
+
+BEGIN;
+
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON area_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON artist_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON event_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON genre_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON instrument_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON label_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON place_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON recording_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON release_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON release_group_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON series_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON work_alias;
+
+DROP FUNCTION IF EXISTS unique_primary_area_alias();
+DROP FUNCTION IF EXISTS unique_primary_artist_alias();
+DROP FUNCTION IF EXISTS unique_primary_event_alias();
+DROP FUNCTION IF EXISTS unique_primary_genre_alias();
+DROP FUNCTION IF EXISTS unique_primary_instrument_alias();
+DROP FUNCTION IF EXISTS unique_primary_label_alias();
+DROP FUNCTION IF EXISTS unique_primary_place_alias();
+DROP FUNCTION IF EXISTS unique_primary_recording_alias();
+DROP FUNCTION IF EXISTS unique_primary_release_alias();
+DROP FUNCTION IF EXISTS unique_primary_release_group_alias();
+DROP FUNCTION IF EXISTS unique_primary_series_alias();
+DROP FUNCTION IF EXISTS unique_primary_work_alias();
+
+COMMIT;
diff --git a/admin/sql/updates/schema-change/27.slave.sql b/admin/sql/updates/schema-change/27.slave.sql
new file mode 100644
index 00000000000..725f745eaa2
--- /dev/null
+++ b/admin/sql/updates/schema-change/27.slave.sql
@@ -0,0 +1,127 @@
+-- Generated by CompileSchemaScripts.pl from:
+-- 20210526-a_upd_release_event.sql
+-- 20210606-mbs-11682.sql
+\\set ON_ERROR_STOP 1
+BEGIN;
+SET search_path = musicbrainz, public;
+SET LOCAL statement_timeout = 0;
+--------------------------------------------------------------------------------
+SELECT '20210526-a_upd_release_event.sql';
+
+
+CREATE OR REPLACE FUNCTION a_upd_release_event()
+RETURNS TRIGGER AS $$
+BEGIN
+ IF (
+ NEW.release != OLD.release OR
+ NEW.date_year IS DISTINCT FROM OLD.date_year OR
+ NEW.date_month IS DISTINCT FROM OLD.date_month OR
+ NEW.date_day IS DISTINCT FROM OLD.date_day
+ ) THEN
+ PERFORM set_release_first_release_date(OLD.release);
+ IF NEW.release != OLD.release THEN
+ PERFORM set_release_first_release_date(NEW.release);
+ END IF;
+
+ PERFORM set_release_group_first_release_date(release_group)
+ FROM release
+ WHERE release.id IN (NEW.release, OLD.release);
+
+ PERFORM set_releases_recordings_first_release_dates(ARRAY[NEW.release, OLD.release]);
+ END IF;
+
+ IF TG_TABLE_NAME = 'release_country' THEN
+ IF NEW.country != OLD.country THEN
+ INSERT INTO artist_release_pending_update VALUES (OLD.release);
+ END IF;
+ END IF;
+
+ RETURN NULL;
+END;
+$$ LANGUAGE 'plpgsql';
+
+--------------------------------------------------------------------------------
+SELECT '20210606-mbs-11682.sql';
+
+
+CREATE OR REPLACE FUNCTION apply_artist_release_pending_updates()
+RETURNS trigger AS $$
+DECLARE
+ release_ids INTEGER[];
+ release_id INTEGER;
+BEGIN
+ -- DO NOT modify any replicated tables in this function; it's used
+ -- by a trigger on slaves.
+ WITH pending AS (
+ DELETE FROM artist_release_pending_update
+ RETURNING release
+ )
+ SELECT array_agg(DISTINCT release)
+ INTO release_ids
+ FROM pending;
+
+ IF coalesce(array_length(release_ids, 1), 0) > 0 THEN
+ -- If the user hasn't generated `artist_release`, then we
+ -- shouldn't update or insert to it. MBS determines whether to
+ -- use this table based on it being non-empty, so a partial
+ -- table would manifest as partial data on the website and
+ -- webservice.
+ PERFORM 1 FROM artist_release LIMIT 1;
+ IF FOUND THEN
+ DELETE FROM artist_release WHERE release = any(release_ids);
+
+ FOREACH release_id IN ARRAY release_ids LOOP
+ -- We handle each release ID separately because the
+ -- `get_artist_release_rows` query can be planned much
+ -- more efficiently that way.
+ INSERT INTO artist_release
+ SELECT * FROM get_artist_release_rows(release_id);
+ END LOOP;
+ END IF;
+ END IF;
+
+ RETURN NULL;
+END;
+$$ LANGUAGE 'plpgsql';
+
+CREATE OR REPLACE FUNCTION apply_artist_release_group_pending_updates()
+RETURNS trigger AS $$
+DECLARE
+ release_group_ids INTEGER[];
+ release_group_id INTEGER;
+BEGIN
+ -- DO NOT modify any replicated tables in this function; it's used
+ -- by a trigger on slaves.
+ WITH pending AS (
+ DELETE FROM artist_release_group_pending_update
+ RETURNING release_group
+ )
+ SELECT array_agg(DISTINCT release_group)
+ INTO release_group_ids
+ FROM pending;
+
+ IF coalesce(array_length(release_group_ids, 1), 0) > 0 THEN
+ -- If the user hasn't generated `artist_release_group`, then we
+ -- shouldn't update or insert to it. MBS determines whether to
+ -- use this table based on it being non-empty, so a partial
+ -- table would manifest as partial data on the website and
+ -- webservice.
+ PERFORM 1 FROM artist_release_group LIMIT 1;
+ IF FOUND THEN
+ DELETE FROM artist_release_group WHERE release_group = any(release_group_ids);
+
+ FOREACH release_group_id IN ARRAY release_group_ids LOOP
+ -- We handle each release group ID separately because
+ -- the `get_artist_release_group_rows` query can be
+ -- planned much more efficiently that way.
+ INSERT INTO artist_release_group
+ SELECT * FROM get_artist_release_group_rows(release_group_id);
+ END LOOP;
+ END IF;
+ END IF;
+
+ RETURN NULL;
+END;
+$$ LANGUAGE 'plpgsql';
+
+COMMIT;
diff --git a/admin/sql/updates/schema-change/27.standalone.sql b/admin/sql/updates/schema-change/27.standalone.sql
new file mode 100644
index 00000000000..b1ccf3aa091
--- /dev/null
+++ b/admin/sql/updates/schema-change/27.standalone.sql
@@ -0,0 +1,58 @@
+-- Generated by CompileSchemaScripts.pl from:
+-- 20210702-mbs-11760.sql
+-- 20210916-mbs-11896.sql
+\\set ON_ERROR_STOP 1
+BEGIN;
+SET search_path = musicbrainz, public;
+SET LOCAL statement_timeout = 0;
+--------------------------------------------------------------------------------
+SELECT '20210702-mbs-11760.sql';
+
+
+CREATE CONSTRAINT TRIGGER delete_unused_tag
+AFTER DELETE ON event_tag DEFERRABLE INITIALLY DEFERRED
+FOR EACH ROW EXECUTE PROCEDURE trg_delete_unused_tag_ref();
+
+CREATE CONSTRAINT TRIGGER delete_unused_tag
+AFTER DELETE ON place_tag DEFERRABLE INITIALLY DEFERRED
+FOR EACH ROW EXECUTE PROCEDURE trg_delete_unused_tag_ref();
+
+CREATE CONSTRAINT TRIGGER delete_unused_tag
+AFTER DELETE ON recording_tag DEFERRABLE INITIALLY DEFERRED
+FOR EACH ROW EXECUTE PROCEDURE trg_delete_unused_tag_ref();
+
+CREATE CONSTRAINT TRIGGER delete_unused_tag
+AFTER DELETE ON release_tag DEFERRABLE INITIALLY DEFERRED
+FOR EACH ROW EXECUTE PROCEDURE trg_delete_unused_tag_ref();
+
+--------------------------------------------------------------------------------
+SELECT '20210916-mbs-11896.sql';
+
+
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON area_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON artist_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON event_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON genre_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON instrument_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON label_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON place_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON recording_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON release_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON release_group_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON series_alias;
+DROP TRIGGER IF EXISTS unique_primary_for_locale ON work_alias;
+
+DROP FUNCTION IF EXISTS unique_primary_area_alias();
+DROP FUNCTION IF EXISTS unique_primary_artist_alias();
+DROP FUNCTION IF EXISTS unique_primary_event_alias();
+DROP FUNCTION IF EXISTS unique_primary_genre_alias();
+DROP FUNCTION IF EXISTS unique_primary_instrument_alias();
+DROP FUNCTION IF EXISTS unique_primary_label_alias();
+DROP FUNCTION IF EXISTS unique_primary_place_alias();
+DROP FUNCTION IF EXISTS unique_primary_recording_alias();
+DROP FUNCTION IF EXISTS unique_primary_release_alias();
+DROP FUNCTION IF EXISTS unique_primary_release_group_alias();
+DROP FUNCTION IF EXISTS unique_primary_series_alias();
+DROP FUNCTION IF EXISTS unique_primary_work_alias();
+
+COMMIT;
diff --git a/bin/delete-old-fullexports b/bin/delete-old-fullexports
index 3c172241298..b8204a27f09 100755
--- a/bin/delete-old-fullexports
+++ b/bin/delete-old-fullexports
@@ -12,10 +12,10 @@ my $just_echo;
use Getopt::Long;
Getopt::Long::Configure(qw( no_ignore_case ));
GetOptions(
- "k" => \$show_kept,
- "r" => \$show_removed,
- "n" => \$dry_run,
- "e" => \$just_echo,
+ 'k' => \$show_kept,
+ 'r' => \$show_removed,
+ 'n' => \$dry_run,
+ 'e' => \$just_echo,
) or exit 2;
my $errors = 0;
@@ -50,8 +50,8 @@ sub prune_dir
print "Removing $fullexport/$dir\n" if $show_removed;
next if $dry_run;
- my @echo = ($just_echo ? ("echo") : ());
- system @echo, "/bin/rm", "-rf", "$fullexport/$dir";
+ my @echo = ($just_echo ? ('echo') : ());
+ system @echo, '/bin/rm', '-rf', "$fullexport/$dir";
unless ($? == 0)
{
diff --git a/bin/runexclusive b/bin/runexclusive
index 2fd436981c9..b73b85f86dc 100755
--- a/bin/runexclusive
+++ b/bin/runexclusive
@@ -10,16 +10,16 @@ my $timeout;
use Getopt::Long;
GetOptions(
- "lockfile|f=s" => \$lockfile,
- "wait|w" => sub { $wait = 1 },
- "nowait|no-wait|n" => sub { $wait = 0 },
- "timeout|t=i" => \$timeout,
+ 'lockfile|f=s' => \$lockfile,
+ 'wait|w' => sub { $wait = 1 },
+ 'nowait|no-wait|n' => sub { $wait = 0 },
+ 'timeout|t=i' => \$timeout,
) or exit 2;
defined($lockfile) or die "No lockfile defined\n";
use Fcntl qw( LOCK_EX LOCK_NB );
-open(my $fh, ">", $lockfile) or die $!;
+open(my $fh, '>', $lockfile) or die $!;
$SIG{ALRM} = sub {};
alarm($timeout) if $timeout;
diff --git a/lib/DBDefs.pm.sample b/lib/DBDefs.pm.sample
index 30542d29da9..d30f87aec20 100644
--- a/lib/DBDefs.pm.sample
+++ b/lib/DBDefs.pm.sample
@@ -39,7 +39,7 @@ use MusicBrainz::Server::DatabaseConnectionFactory;
# The server root, i.e. the parent directory of admin, bin, lib, root, etc.
# By default, this uses the path of lib/DBDefs/Default.pm, minus '/lib/DBDefs/Default.pm'
-# sub MB_SERVER_ROOT { "/home/httpd/musicbrainz/musicbrainz-server" }
+# sub MB_SERVER_ROOT { '/home/httpd/musicbrainz/musicbrainz-server' }
# Where static files are located
# sub STATIC_FILES_DIR { my $self= shift; $self->MB_SERVER_ROOT . '/root/static' }
@@ -51,19 +51,19 @@ use MusicBrainz::Server::DatabaseConnectionFactory;
MusicBrainz::Server::DatabaseConnectionFactory->register_databases(
# How to connect when we need read-write access to the database
READWRITE => {
- database => "musicbrainz_db",
- username => "musicbrainz",
- password => "musicbrainz",
-# host => "",
-# port => "",
+ database => 'musicbrainz_db',
+ username => 'musicbrainz',
+ password => 'musicbrainz',
+# host => '',
+# port => '',
},
# How to connect to a test database
TEST => {
- database => "musicbrainz_test",
- username => "musicbrainz",
- password => "musicbrainz",
-# host => "",
-# port => "",
+ database => 'musicbrainz_test',
+ username => 'musicbrainz',
+ password => 'musicbrainz',
+# host => '',
+# port => '',
},
# How to connect to a Selenium test database. This database is created
# (and dropped) automatically by t/selenium.js, and uses the TEST
@@ -72,42 +72,42 @@ MusicBrainz::Server::DatabaseConnectionFactory->register_databases(
database => 'musicbrainz_selenium',
schema => 'musicbrainz',
username => 'musicbrainz',
-# host => "",
-# port => "",
+# host => '',
+# port => '',
},
# How to connect for read-only access. See "REPLICATION_TYPE" (below)
READONLY => {
- database => "musicbrainz_db",
- username => "musicbrainz",
- password => "musicbrainz",
-# host => "",
-# port => "",
+ database => 'musicbrainz_db',
+ username => 'musicbrainz',
+ password => 'musicbrainz',
+# host => '',
+# port => '',
},
# How to connect for administrative access
SYSTEM => {
- database => "template1",
- username => "postgres",
-# password => "",
-# host => "",
-# port => "",
+ database => 'template1',
+ username => 'postgres',
+# password => '',
+# host => '',
+# port => '',
},
# How to connect when running maintenance scripts located under admin/.
# This defaults to READWRITE if left undefined, but should be configured if
# READWRITE points to a connection pooler that doesn't support session-based features.
# MAINTENANCE => {
-# database => "musicbrainz_db",
-# username => "musicbrainz",
-# password => "musicbrainz",
-# host => "",
-# port => "5432",
+# database => 'musicbrainz_db',
+# username => 'musicbrainz',
+# password => 'musicbrainz',
+# host => '',
+# port => '5432',
# },
# How to connect when running development scripts that query the production database.
# PROD_STANDBY => {
-# database => "musicbrainz_db",
-# username => "musicbrainz_ro",
-# password => "",
-# host => "",
-# port => "5432",
+# database => 'musicbrainz_db',
+# username => 'musicbrainz_ro',
+# password => '',
+# host => '',
+# port => '5432',
# },
);
@@ -137,25 +137,25 @@ sub DB_SCHEMA_SEQUENCE { 26 }
# the replication packets. Enter the access token below:
# NOTE: DO NOT EXPOSE THIS ACCESS TOKEN PUBLICLY!
#
-# sub REPLICATION_ACCESS_TOKEN { "" }
+# sub REPLICATION_ACCESS_TOKEN { '' }
################################################################################
# GPG Signature
################################################################################
# Location of the public key file
-# sub GPG_PUB_KEY { "" }
+# sub GPG_PUB_KEY { '' }
# Define how validation deals with the missing signature file:
# FAIL - validation fails if signature file is missing
# PASS - validation passes if signature file is missing
-# sub GPG_MISSING_SIGNATURE_MODE { "PASS" }
+# sub GPG_MISSING_SIGNATURE_MODE { 'PASS' }
# Key identifiers (compatible with --recipient in GPG) for
# signatures and encryption of data dumps and packets. Should
# only be required on the master server.
-# sub GPG_SIGN_KEY { "" }
-# sub GPG_ENCRYPT_KEY { "" }
+# sub GPG_SIGN_KEY { '' }
+# sub GPG_ENCRYPT_KEY { '' }
################################################################################
# HTTP Server Names
@@ -166,11 +166,11 @@ sub DB_SCHEMA_SEQUENCE { 26 }
# Additionally you should set the environment variable
# MUSICBRAINZ_USE_PROXY=1 when using a reverse proxy to make the server
# aware of it when generating things like the canonical url in catalyst.
-sub WEB_SERVER { "www.musicbrainz.example.com" }
+sub WEB_SERVER { 'www.musicbrainz.example.com' }
# Relevant only if SSL redirects are enabled
-# sub WEB_SERVER_SSL { "localhost" }
-# sub SEARCH_SERVER { "search.musicbrainz.org" }
-# sub SEARCH_ENGINE { "SOLR" }
+# sub WEB_SERVER_SSL { 'localhost' }
+# sub SEARCH_SERVER { 'search.musicbrainz.org' }
+# sub SEARCH_ENGINE { 'SOLR' }
# Used, for example, to have emails sent from the beta server list the
# main server
# sub WEB_SERVER_USED_IN_EMAIL { my $self = shift; $self->WEB_SERVER }
@@ -184,7 +184,7 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# Mail Settings
################################################################################
-# sub SMTP_SERVER { "localhost" }
+# sub SMTP_SERVER { 'localhost' }
# This value should be set to some secret value for your server. Any old
# string of stuff should do; something suitably long and random, like for
@@ -192,7 +192,7 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# value (the empty string). This is so an attacker can't just look in CVS and
# see the default secret value, and then use it to attack your server.
-# sub SMTP_SECRET_CHECKSUM { "" }
+# sub SMTP_SECRET_CHECKSUM { '' }
# sub EMAIL_VERIFICATION_TIMEOUT { 604800 } # one week
################################################################################
@@ -231,12 +231,12 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
################################################################################
# Documentation Server Settings
################################################################################
-# sub WIKITRANS_SERVER { "wiki.musicbrainz.org" }
+# sub WIKITRANS_SERVER { 'wiki.musicbrainz.org' }
# The path to MediaWiki's api.php file. This is required to automatically
# determine which documentation pages need to be updated in the
# transclusion table.
-# sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/api.php" }
+# sub WIKITRANS_SERVER_API { 'wiki.musicbrainz.org/api.php' }
# To enable documentation search on your server, create your own Google Custom
# Search engine and enter its ID as the value of GOOGLE_CUSTOM_SEARCH.
@@ -307,7 +307,7 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# The session store holds user login sessions. Session::Store::MusicBrainz
# uses DATASTORE_REDIS_ARGS to connect to and store sessions in Redis.
-# sub SESSION_STORE { "Session::Store::MusicBrainz" }
+# sub SESSION_STORE { 'Session::Store::MusicBrainz' }
# sub SESSION_STORE_ARGS { return {} }
# sub SESSION_EXPIRE { return 36000; } # 10 hours
@@ -337,7 +337,7 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# sub WEB_SESSION_SECONDS_TO_LIVE { 3600 * 3 }
# The cookie name to use
-# sub SESSION_COOKIE { "AF_SID" }
+# sub SESSION_COOKIE { 'AF_SID' }
# The domain into which the session cookie is written
# sub SESSION_DOMAIN { undef }
@@ -391,8 +391,8 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# internet archive private/public keys (for coverartarchive.org).
# sub COVER_ART_ARCHIVE_ACCESS_KEY { };
# sub COVER_ART_ARCHIVE_SECRET_KEY { };
-# sub COVER_ART_ARCHIVE_UPLOAD_PREFIXER { shift; sprintf("//%s.s3.us.archive.org/", shift) };
-# sub COVER_ART_ARCHIVE_DOWNLOAD_PREFIX { "//coverartarchive.org" };
+# sub COVER_ART_ARCHIVE_UPLOAD_PREFIXER { shift; sprintf('//%s.s3.us.archive.org/', shift) };
+# sub COVER_ART_ARCHIVE_DOWNLOAD_PREFIX { '//coverartarchive.org' };
# Mapbox access token must be set to display area/place maps.
# sub MAPBOX_MAP_ID { 'mapbox/streets-v11' }
diff --git a/lib/DBDefs/Default.pm b/lib/DBDefs/Default.pm
index 08d7c282a8b..ddbf4d7c54f 100644
--- a/lib/DBDefs/Default.pm
+++ b/lib/DBDefs/Default.pm
@@ -70,25 +70,25 @@ sub REPLICATION_TYPE { RT_STANDALONE }
# the replication packets. Enter the access token below:
# NOTE: DO NOT EXPOSE THIS ACCESS TOKEN PUBLICLY!
#
-sub REPLICATION_ACCESS_TOKEN { "" }
+sub REPLICATION_ACCESS_TOKEN { '' }
################################################################################
# GPG Signature
################################################################################
# Location of the public key file to use for verifying packets.
-sub GPG_PUB_KEY { "" }
+sub GPG_PUB_KEY { '' }
# Define how validation deals with the missing signature file:
# FAIL - validation fails if signature file is missing
# PASS - validation passes if signature file is missing
-sub GPG_MISSING_SIGNATURE_MODE { "PASS" }
+sub GPG_MISSING_SIGNATURE_MODE { 'PASS' }
# Key identifiers (compatible with --recipient in GPG) for
# signatures and encryption of data dumps and packets. Should
# only be required on the master server.
-sub GPG_SIGN_KEY { "" }
-sub GPG_ENCRYPT_KEY { "" }
+sub GPG_SIGN_KEY { '' }
+sub GPG_ENCRYPT_KEY { '' }
################################################################################
# HTTP Server Names
@@ -99,11 +99,11 @@ sub GPG_ENCRYPT_KEY { "" }
# Additionally you should set the environment variable
# MUSICBRAINZ_USE_PROXY=1 when using a reverse proxy to make the server
# aware of it when generating things like the canonical url in catalyst.
-sub WEB_SERVER { "localhost:5000" }
+sub WEB_SERVER { 'localhost:5000' }
# Relevant only if SSL redirects are enabled
-sub WEB_SERVER_SSL { "localhost" }
-sub SEARCH_SERVER { "search.musicbrainz.org" }
-sub SEARCH_ENGINE { "SOLR" }
+sub WEB_SERVER_SSL { 'localhost' }
+sub SEARCH_SERVER { 'search.musicbrainz.org' }
+sub SEARCH_ENGINE { 'SOLR' }
# Whether to use x-accel-redirect for webservice searches,
# using /internal/search as the internal redirect
sub SEARCH_X_ACCEL_REDIRECT { 0 }
@@ -117,13 +117,13 @@ sub IS_BETA { 0 }
sub BETA_REDIRECT_HOSTNAME { '' }
# The base URI to use for JSON-LD (RDF) identifiers. Includes scheme.
-sub JSON_LD_ID_BASE_URI { "http://musicbrainz.org" }
+sub JSON_LD_ID_BASE_URI { 'http://musicbrainz.org' }
# The server to use for rel="canonical" links. Includes scheme.
-sub CANONICAL_SERVER { "https://musicbrainz.org" }
+sub CANONICAL_SERVER { 'https://musicbrainz.org' }
# The server used to link to CritiqueBrainz users and reviews.
-sub CRITIQUEBRAINZ_SERVER { "https://critiquebrainz.org" }
+sub CRITIQUEBRAINZ_SERVER { 'https://critiquebrainz.org' }
# The URL where static resources are located, excluding the trailing slash.
sub STATIC_RESOURCES_LOCATION { '//' . shift->WEB_SERVER . '/static/build' }
@@ -132,7 +132,7 @@ sub STATIC_RESOURCES_LOCATION { '//' . shift->WEB_SERVER . '/static/build' }
# Mail Settings
################################################################################
-sub SMTP_SERVER { "localhost" }
+sub SMTP_SERVER { 'localhost' }
# This value should be set to some secret value for your server. Any old
# string of stuff should do; something suitably long and random, like for
@@ -140,7 +140,7 @@ sub SMTP_SERVER { "localhost" }
# value (the empty string). This is so an attacker can't just look in CVS and
# see the default secret value, and then use it to attack your server.
-sub SMTP_SECRET_CHECKSUM { "" }
+sub SMTP_SECRET_CHECKSUM { '' }
sub EMAIL_VERIFICATION_TIMEOUT { 604800 } # one week
################################################################################
@@ -188,12 +188,12 @@ sub LWP_USER_AGENT {
################################################################################
# Documentation Server Settings
################################################################################
-sub WIKITRANS_SERVER { "wiki.musicbrainz.org" }
+sub WIKITRANS_SERVER { 'wiki.musicbrainz.org' }
# The path to MediaWiki's api.php file. This is required to automatically
# determine which documentation pages need to be updated in the
# transclusion table.
-sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/api.php" }
+sub WIKITRANS_SERVER_API { 'wiki.musicbrainz.org/api.php' }
# To enable documentation search on your server, create your own Google Custom
# Search engine and enter its ID as the value of GOOGLE_CUSTOM_SEARCH.
@@ -264,7 +264,7 @@ sub ENTITY_CACHE_TTL {
# The session store holds user login sessions. Session::Store::MusicBrainz
# uses DATASTORE_REDIS_ARGS to connect to and store sessions in Redis.
-sub SESSION_STORE { "Session::Store::MusicBrainz" }
+sub SESSION_STORE { 'Session::Store::MusicBrainz' }
sub SESSION_STORE_ARGS { return {} }
sub SESSION_EXPIRE { return 36000; } # 10 hours
@@ -294,7 +294,7 @@ sub DATASTORE_REDIS_ARGS {
sub WEB_SESSION_SECONDS_TO_LIVE { 3600 * 3 }
# The cookie name to use
-sub SESSION_COOKIE { "AF_SID" }
+sub SESSION_COOKIE { 'AF_SID' }
# The domain into which the session cookie is written
sub SESSION_DOMAIN { undef }
@@ -365,8 +365,8 @@ sub RECAPTCHA_PRIVATE_KEY { return undef }
# internet archive private/public keys (for coverartarchive.org).
sub COVER_ART_ARCHIVE_ACCESS_KEY { };
sub COVER_ART_ARCHIVE_SECRET_KEY { };
-sub COVER_ART_ARCHIVE_UPLOAD_PREFIXER { shift; sprintf("//%s.s3.us.archive.org/", shift) };
-sub COVER_ART_ARCHIVE_DOWNLOAD_PREFIX { "//coverartarchive.org" };
+sub COVER_ART_ARCHIVE_UPLOAD_PREFIXER { shift; sprintf('//%s.s3.us.archive.org/', shift) };
+sub COVER_ART_ARCHIVE_DOWNLOAD_PREFIX { '//coverartarchive.org' };
sub COVER_ART_ARCHIVE_IA_DOWNLOAD_PREFIX { '//archive.org/download' };
sub COVER_ART_ARCHIVE_IA_METADATA_PREFIX { 'https://archive.org/metadata' };
diff --git a/lib/MusicBrainz/Script/EntityDump.pm b/lib/MusicBrainz/Script/EntityDump.pm
index 9a0e0d16eca..67cb4ed37ab 100644
--- a/lib/MusicBrainz/Script/EntityDump.pm
+++ b/lib/MusicBrainz/Script/EntityDump.pm
@@ -174,7 +174,7 @@ sub collections {
# Need a custom query here to exclude private collections.
my $collection_rows = $c->sql->select_list_of_hashes(
- "SELECT * FROM editor_collection WHERE id = any(?) and public = 't' ORDER BY id",
+ q{SELECT * FROM editor_collection WHERE id = any(?) and public = 't' ORDER BY id},
pluck('collection', $entity_collection_rows),
);
@@ -208,7 +208,7 @@ sub relationships {
if (defined $relationships_cardinality) {
$joins .= "JOIN link ON link.id = $table.link\n";
- $joins .= "JOIN link_type ON link_type.id = link.link_type";
+ $joins .= 'JOIN link_type ON link_type.id = link.link_type';
$conditions .= "\n";
$conditions .= "AND link_type.${column}_cardinality = ?";
push @values, $relationships_cardinality;
diff --git a/lib/MusicBrainz/Script/FixLinkDuplicates.pm b/lib/MusicBrainz/Script/FixLinkDuplicates.pm
index aed459827b5..7254204016e 100644
--- a/lib/MusicBrainz/Script/FixLinkDuplicates.pm
+++ b/lib/MusicBrainz/Script/FixLinkDuplicates.pm
@@ -69,7 +69,7 @@ sub remove_duplicates
my $count = 0;
printf "%s : Replace links %s with %s\n",
- scalar localtime, join(", ", @remove_ids), $keep_id if $self->verbose;
+ scalar localtime, join(', ', @remove_ids), $keep_id if $self->verbose;
my $rows = $self->c->sql->select_list_of_hashes(
'SELECT entity_type0, entity_type1
@@ -86,13 +86,13 @@ sub remove_duplicates
$count += $self->remove_one_duplicate($table, $keep_id, $remove_id);
}
- my $query = "DELETE FROM link_attribute WHERE link IN (" . placeholders (@remove_ids) . ")";
+ my $query = 'DELETE FROM link_attribute WHERE link IN (' . placeholders (@remove_ids) . ')';
$count += $self->sql_do($query, @remove_ids);
- $query = "DELETE FROM link_attribute_credit WHERE link IN (" . placeholders (@remove_ids) . ")";
+ $query = 'DELETE FROM link_attribute_credit WHERE link IN (' . placeholders (@remove_ids) . ')';
$count += $self->sql_do($query, @remove_ids);
- $query = "DELETE FROM link WHERE id IN (" . placeholders (@remove_ids) . ")";
+ $query = 'DELETE FROM link WHERE id IN (' . placeholders (@remove_ids) . ')';
$count += $self->sql_do($query, @remove_ids);
return $count;
}
@@ -112,7 +112,7 @@ sub run {
# and where the actual attributes are the same, including credits
# (not that, at time of this writing, credits are fully implemented)
# And when we do, we should keep the oldest one (i.e., earliest 'created' date)
- my $query = "
+ my $query = '
SELECT array_agg(id ORDER BY created ASC)
FROM (SELECT link.*,array_agg((attribute_type, credited_as) ORDER BY attribute_type) AS attributes
FROM link
@@ -122,7 +122,7 @@ sub run {
GROUP BY link_type, attribute_count, ended, attributes,
begin_date_year, begin_date_month, begin_date_day,
end_date_year, end_date_month, end_date_day
- HAVING count(id) > 1";
+ HAVING count(id) > 1';
my $rows = $self->c->sql->select_single_column_array($query);
@@ -131,7 +131,7 @@ sub run {
for my $link (@$rows)
{
if ($self->limit > 0 && $count >= $self->limit) {
- print localtime() . " : Removed limit of " . $self->limit . ", stopping until next invocation\n";
+ print localtime() . ' : Removed limit of ' . $self->limit . ", stopping until next invocation\n";
last;
}
my ($keep, @drop) = @$link;
@@ -145,17 +145,17 @@ sub run {
if ($self->summary) {
printf "%s : Found %d duplicated link%s.\n",
scalar localtime,
- scalar @$rows, ((scalar @$rows)==1 ? "" : "s");
+ scalar @$rows, ((scalar @$rows)==1 ? '' : 's');
printf "%s : Processed %d link%s.\n",
scalar localtime,
- $count, ($count==1 ? "" : "s");
+ $count, ($count==1 ? '' : 's');
printf "%s : Successfully removed %d duplicate%s.\n",
scalar localtime,
- $removed, ($removed==1 ? "" : "s")
+ $removed, ($removed==1 ? '' : 's')
if !$self->dry_run;
printf "%s : Touched %d row%s total.\n",
scalar localtime,
- $total_row_changes, ($total_row_changes==1 ? "" : "s")
+ $total_row_changes, ($total_row_changes==1 ? '' : 's')
if !$self->dry_run;
}
diff --git a/lib/MusicBrainz/Script/MBDump.pm b/lib/MusicBrainz/Script/MBDump.pm
index 2b5df6c7743..fafa5ff08bf 100644
--- a/lib/MusicBrainz/Script/MBDump.pm
+++ b/lib/MusicBrainz/Script/MBDump.pm
@@ -101,7 +101,7 @@ sub begin_dump {
my $schema_sequence = $replication_control->{current_schema_sequence};
my $dbdefs_schema_sequence = DBDefs->DB_SCHEMA_SEQUENCE;
$schema_sequence
- or die "Don't know what schema sequence number we're using";
+ or die q(Don't know what schema sequence number we're using);
$schema_sequence == $dbdefs_schema_sequence
or die "Stored schema sequence ($schema_sequence) does not match " .
"DBDefs->DB_SCHEMA_SEQUENCE ($dbdefs_schema_sequence)";
diff --git a/lib/MusicBrainz/Script/RebuildCoverArt.pm b/lib/MusicBrainz/Script/RebuildCoverArt.pm
index 0498042bd62..aba94e11f0c 100644
--- a/lib/MusicBrainz/Script/RebuildCoverArt.pm
+++ b/lib/MusicBrainz/Script/RebuildCoverArt.pm
@@ -42,11 +42,11 @@ sub run
{
my $self = shift;
- die "Can't work on a read-only database (DB_READ_ONLY is set)"
+ die q{Can't work on a read-only database (DB_READ_ONLY is set)}
if DBDefs->DB_READ_ONLY;
printf STDERR "You do not have both AWS_PUBLIC and AWS_PRIVATE defined in DBDefs.\n" .
- "You will not be able to find artwork from Amazon until these are set."
+ 'You will not be able to find artwork from Amazon until these are set.'
unless (DBDefs->AWS_PUBLIC && DBDefs->AWS_PRIVATE);
$self->ensure_release_cover_art;
@@ -77,11 +77,11 @@ sub run
$self->sql->commit;
if ($art) {
- log_debug { sprintf "Cover art for %d is %s", $release->id, $art->image_uri };
+ log_debug { sprintf 'Cover art for %d is %s', $release->id, $art->image_uri };
$updated++;
}
else {
- log_warning { sprintf "Could not find cover art for %d", $release->id };
+ log_warning { sprintf 'Could not find cover art for %d', $release->id };
}
$seen{$release->id} = 1;
@@ -92,16 +92,16 @@ sub run
$self->sql->finish;
log_notice {
- sprintf "Examined %d (%.2f%%) cover art rows, last updated between %s and %s. ".
- "Updated %d releases.",
+ sprintf 'Examined %d (%.2f%%) cover art rows, last updated between %s and %s. '.
+ 'Updated %d releases.',
$seen,
($seen / $total) * 100,
- ($first // "(never updated)"), ($last // "(never updated)"),
+ ($first // '(never updated)'), ($last // '(never updated)'),
$updated
};
log_notice {
- sprintf "A complete pass of all %d releases will take up to approximately %.2f days.",
+ sprintf 'A complete pass of all %d releases will take up to approximately %.2f days.',
$total, (((($total * 2) / 60) / 60) / 24)
};
diff --git a/lib/MusicBrainz/Script/RemoveBarcodeCoverArt.pm b/lib/MusicBrainz/Script/RemoveBarcodeCoverArt.pm
index 74ffa137113..750c3ed5cdb 100644
--- a/lib/MusicBrainz/Script/RemoveBarcodeCoverArt.pm
+++ b/lib/MusicBrainz/Script/RemoveBarcodeCoverArt.pm
@@ -19,7 +19,7 @@ sub find_releases
# Find all releases that have a cover art URL but no URL relationship
# that would explain it.
- my $query = "
+ my $query = q{
SELECT r_id
FROM (
SELECT
@@ -34,7 +34,7 @@ sub find_releases
GROUP BY release.id
) s
WHERE NOT (url_link_types && ?);
- ";
+ };
$self->c->model('Release')->query_to_list($query, [\@url_types], sub {
my ($model, $row) = @_;
@@ -71,7 +71,7 @@ sub run
$self->c->model('CoverArt')->cache_cover_art($release);
$self->sql->commit;
- log_debug { sprintf "Cover art removed for %d", $release->id };
+ log_debug { sprintf 'Cover art removed for %d', $release->id };
$removed++;
$seen{$release->id} = 1;
@@ -82,7 +82,7 @@ sub run
$self->sql->finish;
log_notice {
- sprintf "Examined %d (%.2f%%) releases, removed %d cover art urls.",
+ sprintf 'Examined %d (%.2f%%) releases, removed %d cover art urls.',
$seen,
$total != 0 ? ($seen / $total) * 100 : 100,
$removed
diff --git a/lib/MusicBrainz/Script/RemoveEmpty.pm b/lib/MusicBrainz/Script/RemoveEmpty.pm
index 08ada7aa4e7..205b5a9f27d 100644
--- a/lib/MusicBrainz/Script/RemoveEmpty.pm
+++ b/lib/MusicBrainz/Script/RemoveEmpty.pm
@@ -156,10 +156,10 @@ sub run {
if ($self->summary) {
printf "%s : Found %d unused $entity%s.\n",
scalar localtime,
- $count, ($count==1 ? "" : "s");
+ $count, ($count==1 ? '' : 's');
printf "%s : Successfully removed %d $entity%s\n",
scalar localtime,
- $removed, ($removed==1 ? "" : "s")
+ $removed, ($removed==1 ? '' : 's')
if !$self->dry_run;
}
}
diff --git a/lib/MusicBrainz/Script/RemoveExpiredSessions.pm b/lib/MusicBrainz/Script/RemoveExpiredSessions.pm
index f63f2eeb9aa..9af89eb56b8 100644
--- a/lib/MusicBrainz/Script/RemoveExpiredSessions.pm
+++ b/lib/MusicBrainz/Script/RemoveExpiredSessions.pm
@@ -53,7 +53,7 @@ sub run {
my $now = time + 5; # five seconds grace period for server differences
printf qq(Fetching entries from database; prefix used is "%s".\n), $store->_namespace if $self->verbose;
- my @keys = $r->_connection->keys($store->_namespace . "expires:*");
+ my @keys = $r->_connection->keys($store->_namespace . 'expires:*');
# KEYS is very heavy, but our current Redis doesn't have SCAN
my $considered = scalar @keys;
if ($considered == 0) {
diff --git a/lib/MusicBrainz/Script/Role/IncrementalDump.pm b/lib/MusicBrainz/Script/Role/IncrementalDump.pm
index 7d676b897af..1b828cad276 100644
--- a/lib/MusicBrainz/Script/Role/IncrementalDump.pm
+++ b/lib/MusicBrainz/Script/Role/IncrementalDump.pm
@@ -450,7 +450,7 @@ sub run_incremental_dump {
if (defined $last_processed_seq) {
if ($current_seq == $last_processed_seq) {
- log("Up-to-date.");
+ log('Up-to-date.');
last;
}
} else {
@@ -476,12 +476,12 @@ sub run_incremental_dump {
if (($current_seq - $last_processed_seq) > 2) {
log("ERROR: Table $dump_schema.tmp_checked_entities " .
- "is not empty, and the script is more than two " .
- "replication packets behind. You should check " .
- "that a previous run of the script didn't " .
- "unexpectedly die; this script will not run again " .
+ 'is not empty, and the script is more than two ' .
+ 'replication packets behind. You should check ' .
+ q(that a previous run of the script didn't ) .
+ 'unexpectedly die; this script will not run again ' .
"until $dump_schema.tmp_checked_entities is " .
- "cleared.");
+ 'cleared.');
exit 1;
}
exit 0;
diff --git a/lib/MusicBrainz/Server.pm b/lib/MusicBrainz/Server.pm
index 886dae6fb78..f7d3e430933 100644
--- a/lib/MusicBrainz/Server.pm
+++ b/lib/MusicBrainz/Server.pm
@@ -56,7 +56,7 @@ __PACKAGE__->config(
name => 'MusicBrainz::Server',
default_view => 'Default',
encoding => 'UTF-8',
- "View::Default" => {
+ 'View::Default' => {
expose_methods => [qw(
boolean_to_json
comma_list
@@ -154,12 +154,12 @@ __PACKAGE__->config->{form} = {
};
if ($ENV{'MUSICBRAINZ_RUNNING_TESTS'}) {
- push @args, "Session::Store::Dummy";
+ push @args, 'Session::Store::Dummy';
# /static is usually taken care of by Plack or nginx, but not when running
# as part of Test::WWW::Selenium::Catalyst, so we need Static::Simple when
# running tests.
- push @args, "Static::Simple";
+ push @args, 'Static::Simple';
__PACKAGE__->config->{'Plugin::Static::Simple'} = {
mime_types => {
json => 'application/json; charset=UTF-8',
@@ -177,7 +177,7 @@ if (DBDefs->STAT_TTL) {
}
if (DBDefs->CATALYST_DEBUG) {
- push @args, "-Debug";
+ push @args, '-Debug';
}
if (DBDefs->SESSION_COOKIE) {
@@ -191,7 +191,7 @@ if (DBDefs->SESSION_DOMAIN) {
__PACKAGE__->config->{session}{cookie_expires} = DBDefs->WEB_SESSION_SECONDS_TO_LIVE;
if (DBDefs->USE_ETAGS) {
- push @args, "Cache::HTTP";
+ push @args, 'Cache::HTTP';
}
if ($ENV{'MUSICBRAINZ_USE_TEST_DATABASE'})
@@ -399,7 +399,7 @@ around dispatch => sub {
local $SIG{__WARN__} = sub {
my $warning = shift;
chomp $warning;
- $c->log->warn($c->req->method . " " . $c->req->uri . " caused a warning: " . $warning);
+ $c->log->warn($c->req->method . ' ' . $c->req->uri . ' caused a warning: ' . $warning);
};
$c->$orig(@args);
@@ -692,8 +692,12 @@ sub set_csp_headers {
push @csp_script_src, qw(
https://www.google.com/recaptcha/
https://www.gstatic.com/recaptcha/
+ https://www.recaptcha.net/recaptcha/
+ );
+ push @csp_frame_src, qw(
+ https://www.google.com/recaptcha/
+ https://www.recaptcha.net/recaptcha/
);
- push @csp_frame_src, 'https://www.google.com/recaptcha/';
}
}
diff --git a/lib/MusicBrainz/Server/Constants.pm b/lib/MusicBrainz/Server/Constants.pm
index 955b9c95ad1..1298c725563 100644
--- a/lib/MusicBrainz/Server/Constants.pm
+++ b/lib/MusicBrainz/Server/Constants.pm
@@ -969,7 +969,7 @@ Readonly our $EDITOR_SANITISED_COLUMNS => join(', ',
'editor.id',
'editor.name',
'0 AS privs',
- "'' AS email",
+ q('' AS email),
'NULL AS website',
'NULL AS bio',
'editor.member_since',
@@ -979,8 +979,8 @@ Readonly our $EDITOR_SANITISED_COLUMNS => join(', ',
'NULL AS birth_date',
'NULL AS gender',
'NULL as area',
- "'{CLEARTEXT}mb' AS password",
- "md5(editor.name || ':musicbrainz.org:mb') AS ha1",
+ q('{CLEARTEXT}mb' AS password),
+ q{md5(editor.name || ':musicbrainz.org:mb') AS ha1},
'editor.deleted',
);
diff --git a/lib/MusicBrainz/Server/Context.pm b/lib/MusicBrainz/Server/Context.pm
index 14ca1c8f8ee..b28dc9213ea 100644
--- a/lib/MusicBrainz/Server/Context.pm
+++ b/lib/MusicBrainz/Server/Context.pm
@@ -102,7 +102,7 @@ sub model
my $model = $self->models->{$name};
if (!$model) {
my $class_name = $self->data_prefix . "::$name";
- if ($name eq "Email") {
+ if ($name eq 'Email') {
$class_name =~ s/Data::Email/Email/;
}
load_class($class_name);
diff --git a/lib/MusicBrainz/Server/Controller.pm b/lib/MusicBrainz/Server/Controller.pm
index 0363d30b4ca..94d892ed158 100644
--- a/lib/MusicBrainz/Server/Controller.pm
+++ b/lib/MusicBrainz/Server/Controller.pm
@@ -30,7 +30,7 @@ sub not_found : Private
sub invalid_mbid
{
my ($self, $c, $id) = @_;
- $c->stash( message => l("'{id}' is not a valid MusicBrainz ID", { id => $id }) );
+ $c->stash( message => l(q('{id}' is not a valid MusicBrainz ID), { id => $id }) );
$c->detach('/error_400');
}
@@ -104,7 +104,7 @@ sub _insert_edit {
num_open_edits => $c->stash->{num_open_edits} );
my $first_edit_id = $c->stash->{edit_ids}->[0];
my @edit_ids = @{$c->stash->{edit_ids}};
- $args{edit_ids} = "#" . join(", #", @edit_ids[0.. ($#edit_ids > 2 ? 2 : $#edit_ids)]) . ($#edit_ids>2?", ...":"");
+ $args{edit_ids} = '#' . join(', #', @edit_ids[0.. ($#edit_ids > 2 ? 2 : $#edit_ids)]) . ($#edit_ids>2?', ...':'');
$args{edit_url} =
(($args{num_edits} == 1)
? $c->uri_for_action('/edit/show', [ $first_edit_id ])
@@ -231,7 +231,7 @@ sub _load_paged
my ($self, $c, $loader, %opts) = @_;
my $prefix = $opts{prefix} || '';
- my $page = $c->request->query_params->{$prefix . "page"};
+ my $page = $c->request->query_params->{$prefix . 'page'};
$page = 1 unless is_positive_integer($page);
my $LIMIT = $opts{limit} || $self->{paging_limit};
@@ -250,7 +250,7 @@ sub _load_paged
$pager->total_entries($total || 0);
$pager->current_page($page);
- $c->stash( $prefix . "pager" => $pager,
+ $c->stash( $prefix . 'pager' => $pager,
edit_count_limit => $LIMIT_FOR_EDIT_LISTING );
return $data;
}
diff --git a/lib/MusicBrainz/Server/Controller/Account.pm b/lib/MusicBrainz/Server/Controller/Account.pm
index 23dc72b7148..cc999d26001 100644
--- a/lib/MusicBrainz/Server/Controller/Account.pm
+++ b/lib/MusicBrainz/Server/Controller/Account.pm
@@ -605,7 +605,7 @@ sub register : Path('/register') ForbiddenOnSlaves RequireSSL DenyWhenReadonly S
}
}
- my $captcha_html = "";
+ my $captcha_html = '';
$captcha_html = $captcha->get_html_v2(DBDefs->RECAPTCHA_PUBLIC_KEY)
if $use_captcha;
@@ -660,7 +660,7 @@ sub _send_confirmation_email
email => $email,
ip => $c->req->address,
editor => $editor
- );
+ );
} else {
$c->model('Email')->send_email_verification(
email => $email,
@@ -703,7 +703,7 @@ sub donation : Local RequireAuth HiddenOnSlaves
current_view => 'Node',
component_path => 'account/Donation',
component_props => {
- days => sprintf("%.0f", $result->{days}),
+ days => sprintf('%.0f', $result->{days}),
nag => boolean_to_json($nag),
}
);
@@ -726,7 +726,7 @@ sub applications : Path('/account/applications') RequireAuth RequireSSL
$c->stash(
current_view => 'Node',
- component_path => 'account/applications/Index.js',
+ component_path => 'account/applications/Index',
component_props => {
applications => to_json_array($applications),
appsPager => serialize_pager($c->stash->{apps_pager}),
diff --git a/lib/MusicBrainz/Server/Controller/Admin/Attributes.pm b/lib/MusicBrainz/Server/Controller/Admin/Attributes.pm
index d683a4186d3..28972040828 100644
--- a/lib/MusicBrainz/Server/Controller/Admin/Attributes.pm
+++ b/lib/MusicBrainz/Server/Controller/Admin/Attributes.pm
@@ -4,7 +4,7 @@ use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array );
use MusicBrainz::Server::Translation qw( l ln );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
BEGIN { extends 'MusicBrainz::Server::Controller' };
@@ -36,7 +36,7 @@ sub index : Path('/admin/attributes') Args(0) RequireAuth(account_admin) {
$c->stash(
current_view => 'Node',
- component_path => 'admin/attributes/Index.js',
+ component_path => 'admin/attributes/Index',
component_props => {models => \@models}
);
}
@@ -55,10 +55,10 @@ sub attribute_index : Chained('attribute_base') PathPart('') RequireAuth(account
my @attr = $c->model($model)->get_all();
my %component_paths = (
- Language => "admin/attributes/Language.js",
- Script => "admin/attributes/Script.js"
+ Language => 'admin/attributes/Language',
+ Script => 'admin/attributes/Script'
);
- my $component_path = $component_paths{$model} // "admin/attributes/Attribute.js";
+ my $component_path = $component_paths{$model} // 'admin/attributes/Attribute';
$c->stash(
current_view => 'Node',
@@ -75,10 +75,10 @@ sub create : Chained('attribute_base') RequireAuth(account_admin) SecureForm {
my $model = $c->stash->{model};
my %forms = (
- Language => "Admin::Attributes::Language",
- Script => "Admin::Attributes::Script"
+ Language => 'Admin::Attributes::Language',
+ Script => 'Admin::Attributes::Script'
);
- my $form_name = $forms{$model} // "Admin::Attributes";
+ my $form_name = $forms{$model} // 'Admin::Attributes';
my $form = $c->form( form => $form_name );
if ($c->form_posted_and_valid($form)) {
@@ -97,10 +97,10 @@ sub edit : Chained('attribute_base') Args(1) RequireAuth(account_admin) SecureFo
my $attr = $c->model($model)->get_by_id($id);
my %forms = (
- Language => "Admin::Attributes::Language",
- Script => "Admin::Attributes::Script"
+ Language => 'Admin::Attributes::Language',
+ Script => 'Admin::Attributes::Script'
);
- my $form_name = $forms{$model} // "Admin::Attributes";
+ my $form_name = $forms{$model} // 'Admin::Attributes';
my $form = $c->form( form => $form_name, init_object => $attr );
if ($c->form_posted_and_valid($form)) {
@@ -128,7 +128,7 @@ sub delete : Chained('attribute_base') Args(1) RequireAuth(account_admin) Secure
component_path => 'admin/attributes/CannotRemoveAttribute',
component_props => {message => $error_message}
);
-
+
$c->detach;
}
@@ -140,7 +140,7 @@ sub delete : Chained('attribute_base') Args(1) RequireAuth(account_admin) Secure
component_path => 'admin/attributes/CannotRemoveAttribute',
component_props => {message => $error_message}
);
-
+
$c->detach;
}
if ($c->form_posted_and_valid($form)) {
diff --git a/lib/MusicBrainz/Server/Controller/Artist.pm b/lib/MusicBrainz/Server/Controller/Artist.pm
index ac5d2565693..a084d682cdd 100644
--- a/lib/MusicBrainz/Server/Controller/Artist.pm
+++ b/lib/MusicBrainz/Server/Controller/Artist.pm
@@ -282,7 +282,7 @@ sub show : PathPart('') Chained('load')
grep { ($_->name) ne $legal_name->name }
# A legal name alias marked ended isn't a current legal name
grep { !($_->ended) }
- grep { ($_->type_name // "") eq 'Legal name' } @$aliases;
+ grep { ($_->type_name // '') eq 'Legal name' } @$aliases;
$c->stash( legal_name_artist_aliases => \@aliases );
$legal_name_artist_aliases = \@aliases;
push(@identities, $legal_name);
@@ -293,7 +293,7 @@ sub show : PathPart('') Chained('load')
sort_by { $coll->getSortKey($_->name) }
# A legal name alias marked ended isn't a current legal name
grep { !($_->ended) }
- grep { ($_->type_name // "") eq 'Legal name' } @$aliases;
+ grep { ($_->type_name // '') eq 'Legal name' } @$aliases;
$c->stash( legal_name_aliases => \@aliases );
$legal_name_aliases = \@aliases;
}
diff --git a/lib/MusicBrainz/Server/Controller/ArtistCredit.pm b/lib/MusicBrainz/Server/Controller/ArtistCredit.pm
index ae8db900687..b1a0fc7ef52 100644
--- a/lib/MusicBrainz/Server/Controller/ArtistCredit.pm
+++ b/lib/MusicBrainz/Server/Controller/ArtistCredit.pm
@@ -80,7 +80,7 @@ map {
};
find_meta(__PACKAGE__)->add_method($_ => $method);
- find_meta(__PACKAGE__)->register_method_attributes($method, ["Chained('load')", "PathPart('$url')"]);
+ find_meta(__PACKAGE__)->register_method_attributes($method, [q{Chained('load')}, "PathPart('$url')"]);
} entities_with('artist_credits');
1;
diff --git a/lib/MusicBrainz/Server/Controller/AutoEditorElections.pm b/lib/MusicBrainz/Server/Controller/AutoEditorElections.pm
index 504c4936e93..b54d1b9ea29 100644
--- a/lib/MusicBrainz/Server/Controller/AutoEditorElections.pm
+++ b/lib/MusicBrainz/Server/Controller/AutoEditorElections.pm
@@ -21,7 +21,7 @@ sub index : Path('')
$c->stash(
current_view => 'Node',
- component_path => 'elections/Index.js',
+ component_path => 'elections/Index',
component_props => {elections => to_json_array(\@elections)},
);
}
@@ -51,7 +51,7 @@ sub nominate : Path('nominate') Args(1) RequireAuth(auto_editor) SecureForm
$c->stash(
current_view => 'Node',
- component_path => 'elections/Nominate.js',
+ component_path => 'elections/Nominate',
component_props => {
candidate => $candidate->TO_JSON,
form => $form->TO_JSON,
@@ -80,7 +80,7 @@ sub _load {
return $election;
}
else {
- $c->stash( message => l("'{id}' is not a valid election ID", { id => $id }) );
+ $c->stash( message => l(q('{id}' is not a valid election ID), { id => $id }) );
$c->detach('/error_400');
}
}
@@ -95,7 +95,7 @@ sub show : Chained('load') PathPart('') Args(0)
$c->stash(
current_view => 'Node',
- component_path => 'elections/Show.js',
+ component_path => 'elections/Show',
component_props => {election => $election->TO_JSON},
);
diff --git a/lib/MusicBrainz/Server/Controller/ISRC.pm b/lib/MusicBrainz/Server/Controller/ISRC.pm
index 7e28356a3ff..01c8f4bd818 100644
--- a/lib/MusicBrainz/Server/Controller/ISRC.pm
+++ b/lib/MusicBrainz/Server/Controller/ISRC.pm
@@ -37,7 +37,7 @@ sub show : Chained('load') PathPart('')
$c->model('ArtistCredit')->load(@recordings);
$c->stash(
current_view => 'Node',
- component_path => 'isrc/Index.js',
+ component_path => 'isrc/Index',
component_props => {
%{$c->stash->{component_props}},
isrcs => to_json_array($isrcs),
diff --git a/lib/MusicBrainz/Server/Controller/ISWC.pm b/lib/MusicBrainz/Server/Controller/ISWC.pm
index 63d300a8516..1ad1b5bd09e 100644
--- a/lib/MusicBrainz/Server/Controller/ISWC.pm
+++ b/lib/MusicBrainz/Server/Controller/ISWC.pm
@@ -41,7 +41,7 @@ sub show : Chained('load') PathPart('')
$c->model('Language')->load_for_works(@works);
$c->stash(
current_view => 'Node',
- component_path => 'iswc/Index.js',
+ component_path => 'iswc/Index',
component_props => {
%{$c->stash->{component_props}},
iswcs => to_json_array($iswcs),
diff --git a/lib/MusicBrainz/Server/Controller/Instrument.pm b/lib/MusicBrainz/Server/Controller/Instrument.pm
index 73a6de3fbe5..7d47d858f85 100644
--- a/lib/MusicBrainz/Server/Controller/Instrument.pm
+++ b/lib/MusicBrainz/Server/Controller/Instrument.pm
@@ -217,7 +217,7 @@ sub list : Path('/instruments') Args(0) {
my $entities = {};
for my $i (@sorted) {
- my $type = $i->type_id || "unknown";
+ my $type = $i->type_id || 'unknown';
push @{ $entities->{$type} }, $i->TO_JSON;
}
diff --git a/lib/MusicBrainz/Server/Controller/Label.pm b/lib/MusicBrainz/Server/Controller/Label.pm
index 649b6053ccb..8bc391958cc 100644
--- a/lib/MusicBrainz/Server/Controller/Label.pm
+++ b/lib/MusicBrainz/Server/Controller/Label.pm
@@ -132,7 +132,7 @@ sub show : PathPart('') Chained('load')
$c->model('Medium')->load_for_releases(@$releases);
$c->model('MediumFormat')->load(map { $_->all_mediums } @$releases);
$c->model('ReleaseLabel')->load(@$releases);
-
+
my (@renamed_from, @renamed_into);
for my $rel (@{ $label->relationships }) {
diff --git a/lib/MusicBrainz/Server/Controller/OAuth2.pm b/lib/MusicBrainz/Server/Controller/OAuth2.pm
index fcbbd29d413..985acb53fdb 100644
--- a/lib/MusicBrainz/Server/Controller/OAuth2.pm
+++ b/lib/MusicBrainz/Server/Controller/OAuth2.pm
@@ -561,9 +561,9 @@ sub tokeninfo : Local
audience => $application->oauth_id,
issued_to => $application->oauth_id,
expires_in => $token->expire_time->subtract_datetime_absolute(DateTime->now)->seconds,
- access_type => $token->refresh_token ? "offline" : "online",
- token_type => "Bearer",
- scope => join(" ", @scope),
+ access_type => $token->refresh_token ? 'offline' : 'online',
+ token_type => 'Bearer',
+ scope => join(' ', @scope),
});
}
diff --git a/lib/MusicBrainz/Server/Controller/Partners.pm b/lib/MusicBrainz/Server/Controller/Partners.pm
index 21ca6fb333e..71153b370c5 100644
--- a/lib/MusicBrainz/Server/Controller/Partners.pm
+++ b/lib/MusicBrainz/Server/Controller/Partners.pm
@@ -7,10 +7,10 @@ sub amazon : Local Args(2)
my ($self, $c, $store, $asin) = @_;
my $ass_id = DBDefs->AWS_ASSOCIATE_ID($store)
- or die "Invalid store";
+ or die 'Invalid store';
$c->response->redirect(
- sprintf("http://%s/exec/obidos/ASIN/%s/%s?v=glance&s=music",
+ sprintf('http://%s/exec/obidos/ASIN/%s/%s?v=glance&s=music',
$store, $asin, $ass_id));
}
diff --git a/lib/MusicBrainz/Server/Controller/Place.pm b/lib/MusicBrainz/Server/Controller/Place.pm
index 54eb5553b59..ad6bf631693 100644
--- a/lib/MusicBrainz/Server/Controller/Place.pm
+++ b/lib/MusicBrainz/Server/Controller/Place.pm
@@ -109,7 +109,7 @@ sub show : PathPart('') Chained('load') {
);
$c->stash(
- component_path => 'place/PlaceIndex.js',
+ component_path => 'place/PlaceIndex',
component_props => \%props,
current_view => 'Node',
);
@@ -138,7 +138,7 @@ sub events : Chained('load')
);
$c->stash(
- component_path => 'place/PlaceEvents.js',
+ component_path => 'place/PlaceEvents',
component_props => \%props,
current_view => 'Node',
);
@@ -150,7 +150,7 @@ Shows performances linked to a place.
=cut
-sub performances : Chained('load') {
+sub performances : Chained('load') {
my ($self, $c) = @_;
my $stash = $c->stash;
diff --git a/lib/MusicBrainz/Server/Controller/Relationship/LinkType.pm b/lib/MusicBrainz/Server/Controller/Relationship/LinkType.pm
index f28866d25c6..e5a1d67541b 100644
--- a/lib/MusicBrainz/Server/Controller/Relationship/LinkType.pm
+++ b/lib/MusicBrainz/Server/Controller/Relationship/LinkType.pm
@@ -67,7 +67,7 @@ sub type_specific : Chained('/') PathPart('relationships') CaptureArgs(1) {
if (!exists $allowed{$types}) {
$c->stash(
message => l(
- "'{types}' is not a valid pair of types for relationships.",
+ q('{types}' is not a valid pair of types for relationships.),
{ types => $types }
)
);
diff --git a/lib/MusicBrainz/Server/Controller/RelationshipEditor.pm b/lib/MusicBrainz/Server/Controller/RelationshipEditor.pm
index deaf2ad3454..0305bf8fdcd 100644
--- a/lib/MusicBrainz/Server/Controller/RelationshipEditor.pm
+++ b/lib/MusicBrainz/Server/Controller/RelationshipEditor.pm
@@ -94,7 +94,7 @@ sub submit_edits {
} elsif ($action eq 'edit') {
$rel->{edit_type} = $EDIT_RELATIONSHIP_EDIT;
} else {
- detach_with_error($c, "Missing field: action");
+ detach_with_error($c, 'Missing field: action');
}
}
diff --git a/lib/MusicBrainz/Server/Controller/Release.pm b/lib/MusicBrainz/Server/Controller/Release.pm
index af58f00bd3b..f43af1579ae 100644
--- a/lib/MusicBrainz/Server/Controller/Release.pm
+++ b/lib/MusicBrainz/Server/Controller/Release.pm
@@ -306,7 +306,7 @@ sub add_cover_art : Chained('load') PathPart('add-cover-art') Edit {
my $id = $c->model('CoverArtArchive')->fresh_id;
$c->stash({
id => $id,
- index_url => DBDefs->COVER_ART_ARCHIVE_DOWNLOAD_PREFIX . "/release/" . $entity->gid . "/",
+ index_url => DBDefs->COVER_ART_ARCHIVE_DOWNLOAD_PREFIX . '/release/' . $entity->gid . '/',
images => \@artwork,
mime_types => \@mime_types,
access_key => DBDefs->COVER_ART_ARCHIVE_ACCESS_KEY // '',
@@ -336,9 +336,9 @@ sub add_cover_art : Chained('load') PathPart('add-cover-art') Edit {
release => $entity,
cover_art_types => [
grep { defined $_ && looks_like_number($_) }
- @{ $form->field("type_id")->value }
+ @{ $form->field('type_id')->value }
],
- cover_art_position => $form->field("position")->value,
+ cover_art_position => $form->field('position')->value,
cover_art_id => $form->field('id')->value,
cover_art_comment => $form->field('comment')->value || '',
cover_art_mime_type => $form->field('mime_type')->value,
@@ -397,7 +397,7 @@ sub reorder_cover_art : Chained('load') PathPart('reorder-cover-art') Edit {
edit_type => $EDIT_RELEASE_REORDER_COVER_ART,
release => $entity,
old => \@positions,
- new => $form->field("artwork")->value
+ new => $form->field('artwork')->value
);
});
@@ -579,7 +579,7 @@ around _validate_merge => sub {
l('This merge strategy is not applicable to the releases you have selected.')
);
$form->field('merge_strategy')->add_error(
- l($cannot_merge_reason->{message}, $cannot_merge_reason->{args} // {}),
+ l($cannot_merge_reason->{message}, $cannot_merge_reason->{vars} // {}),
);
return 0;
}
@@ -613,7 +613,7 @@ sub edit_cover_art : Chained('load') PathPart('edit-cover-art') Args(1) Edit {
$c->stash({
artwork => $artwork,
images => \@artwork,
- index_url => DBDefs->COVER_ART_ARCHIVE_DOWNLOAD_PREFIX . "/release/" . $entity->gid . "/"
+ index_url => DBDefs->COVER_ART_ARCHIVE_DOWNLOAD_PREFIX . '/release/' . $entity->gid . '/'
});
my @type_ids = map { $_->id } $c->model('CoverArtType')->get_by_name(@{ $artwork->types });
@@ -635,7 +635,7 @@ sub edit_cover_art : Chained('load') PathPart('edit-cover-art') Args(1) Edit {
artwork_id => $artwork->id,
old_types => [ grep { defined $_ && looks_like_number($_) } @type_ids ],
old_comment => $artwork->comment,
- new_types => [ grep { defined $_ && looks_like_number($_) } @{ $form->field("type_id")->value } ],
+ new_types => [ grep { defined $_ && looks_like_number($_) } @{ $form->field('type_id')->value } ],
new_comment => $form->field('comment')->value || '',
);
});
diff --git a/lib/MusicBrainz/Server/Controller/ReleaseEditor.pm b/lib/MusicBrainz/Server/Controller/ReleaseEditor.pm
index 0c9c73a92e7..207ea8b6feb 100644
--- a/lib/MusicBrainz/Server/Controller/ReleaseEditor.pm
+++ b/lib/MusicBrainz/Server/Controller/ReleaseEditor.pm
@@ -158,7 +158,7 @@ sub _process_seeded_data
if (my $ac = $params->{artist_credit}) {
$result->{artistCredit} = _seeded_hash($c, \&_seeded_artist_credit,
- $ac, "artist_credit", \@errors);
+ $ac, 'artist_credit', \@errors);
}
if (my $gid = $params->{release_group}) {
@@ -248,15 +248,15 @@ sub _process_seeded_data
}
if (my $events = $params->{events}) {
- $result->{events} = _seeded_array($c, \&_seeded_event, $events, "events", \@errors);
+ $result->{events} = _seeded_array($c, \&_seeded_event, $events, 'events', \@errors);
}
if (my $labels = $params->{labels}) {
- $result->{labels} = _seeded_array($c, \&_seeded_label, $labels, "labels", \@errors);
+ $result->{labels} = _seeded_array($c, \&_seeded_label, $labels, 'labels', \@errors);
}
if (my $mediums = $params->{mediums}) {
- $result->{mediums} = _seeded_array($c, \&_seeded_medium, $mediums, "mediums", \@errors);
+ $result->{mediums} = _seeded_array($c, \&_seeded_medium, $mediums, 'mediums', \@errors);
my $position = 0;
@@ -266,7 +266,7 @@ sub _process_seeded_data
}
if (my $urls = $params->{urls}) {
- $result->{relationships} = _seeded_array($c, \&_seeded_url, $urls, "urls", \@errors);
+ $result->{relationships} = _seeded_array($c, \&_seeded_url, $urls, 'urls', \@errors);
}
$result->{editNote} = $params->{edit_note} if $params->{edit_note};
@@ -298,7 +298,7 @@ sub _seeded_hash
return unless defined $params;
- if (ref($params) eq "HASH") {
+ if (ref($params) eq 'HASH') {
return $parse->($c, $params, $field_name, $errors);
} else {
push @$errors, "$field_name must be a hash.";
@@ -310,10 +310,10 @@ sub _seeded_array
{
my ($c, $parse, $params, $field_name, $errors) = @_;
- unless (ref($params) eq "ARRAY") {
+ unless (ref($params) eq 'ARRAY') {
push @$errors, "$field_name must be an array";
- if (ref($params) eq "HASH") {
+ if (ref($params) eq 'HASH') {
_report_unknown_fields($field_name, $params, $errors);
}
return undef;
@@ -620,7 +620,7 @@ sub _report_unknown_fields
my @unknown_keys = sort { $a cmp $b } grep { !exists $valid_keys{$_} } keys %$fields;
push @$errors, map {
- "Unknown field: " . ($parent ? "$parent." : "") . "$_"
+ 'Unknown field: ' . ($parent ? "$parent." : '') . "$_"
} @unknown_keys;
}
diff --git a/lib/MusicBrainz/Server/Controller/ReleaseGroup.pm b/lib/MusicBrainz/Server/Controller/ReleaseGroup.pm
index 0615dfa6c72..75f9306f200 100644
--- a/lib/MusicBrainz/Server/Controller/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/Controller/ReleaseGroup.pm
@@ -94,7 +94,7 @@ sub show : Chained('load') PathPart('') {
);
$c->stash(
- component_path => 'release_group/ReleaseGroupIndex.js',
+ component_path => 'release_group/ReleaseGroupIndex',
component_props => \%props,
current_view => 'Node',
releases_jsonld => { items => $releases },
@@ -148,7 +148,7 @@ with 'MusicBrainz::Server::Controller::Role::Merge' => {
sub forward_merge : Chained('/') PathPart('release-group/merge') {
# Since Role::Merge is generic it uses release_group rather than release-group
# like elsewhere. We should make sure nothing breaks if we expect release-group somewhere
- my ($self, $c) = @_;
+ my ($self, $c) = @_;
$c->forward('/release_group/merge');
}
diff --git a/lib/MusicBrainz/Server/Controller/Report.pm b/lib/MusicBrainz/Server/Controller/Report.pm
index 83b9ca53bfb..807f54eb787 100644
--- a/lib/MusicBrainz/Server/Controller/Report.pm
+++ b/lib/MusicBrainz/Server/Controller/Report.pm
@@ -15,7 +15,7 @@ sub index : Path('/reports') Args(0)
$c->stash(
current_view => 'Node',
- component_path => 'report/ReportsIndex.js',
+ component_path => 'report/ReportsIndex',
);
}
@@ -30,7 +30,7 @@ sub show : Path Args(1)
if (!$report->generated) {
$c->stash(
current_view => 'Node',
- component_path => 'report/ReportNotAvailable.js',
+ component_path => 'report/ReportNotAvailable',
);
$c->detach;
}
diff --git a/lib/MusicBrainz/Server/Controller/Role/Alias.pm b/lib/MusicBrainz/Server/Controller/Role/Alias.pm
index fde376855af..9a6811dd333 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Alias.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Alias.pm
@@ -52,7 +52,7 @@ sub aliases : Chained('load') PathPart('aliases')
$c->stash(
# "aliases" needs to remain here for JSON-LD serialization
aliases => $aliases,
- component_path => 'entity/Aliases.js',
+ component_path => 'entity/Aliases',
component_props => \%props,
current_view => 'Node',
);
@@ -119,11 +119,12 @@ sub delete_alias : Chained('alias') PathPart('delete') Edit
my $type = $self->{entity_name};
my $entity = $c->stash->{ $type };
my $edit = $c->model('Edit')->find_creation_edit($model_to_edit_type{add}->{ $self->{model} }, $alias->id, id_field => 'alias_id');
+ my $entity_type = $type eq 'rg' ? 'release_group' : $type;
my %props = (
alias => $alias->TO_JSON,
entity => $entity->TO_JSON,
- type => $type,
+ type => $entity_type,
);
$c->stash(
diff --git a/lib/MusicBrainz/Server/Controller/Role/CommonsImage.pm b/lib/MusicBrainz/Server/Controller/Role/CommonsImage.pm
index d9daddf45bf..40f57fee5ce 100644
--- a/lib/MusicBrainz/Server/Controller/Role/CommonsImage.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/CommonsImage.pm
@@ -8,9 +8,9 @@ use Readonly;
requires 'load';
-Readonly my $WIKIDATA_PROP_IMAGE => "P18";
-Readonly my $WIKIDATA_PROP_LOGO_IMAGE => "P154";
-Readonly my $WIKIDATA_PROP_LOCATOR_MAP_IMAGE => "P242";
+Readonly my $WIKIDATA_PROP_IMAGE => 'P18';
+Readonly my $WIKIDATA_PROP_LOGO_IMAGE => 'P154';
+Readonly my $WIKIDATA_PROP_LOCATOR_MAP_IMAGE => 'P242';
after load => sub {
my ($self, $c) = @_;
diff --git a/lib/MusicBrainz/Server/Controller/Role/Details.pm b/lib/MusicBrainz/Server/Controller/Role/Details.pm
index 9311fa27485..ce645f5e52b 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Details.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Details.pm
@@ -7,7 +7,7 @@ sub details : Chained('load') PathPart {
my $entity = $c->stash->{$self->{entity_name}};
$c->stash(
- component_path => 'entity/Details.js',
+ component_path => 'entity/Details',
component_props => {entity => $entity->TO_JSON},
current_view => 'Node',
);
diff --git a/lib/MusicBrainz/Server/Controller/Role/EditRelationships.pm b/lib/MusicBrainz/Server/Controller/Role/EditRelationships.pm
index 46679c15125..bcf5910d145 100644
--- a/lib/MusicBrainz/Server/Controller/Role/EditRelationships.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/EditRelationships.pm
@@ -118,7 +118,7 @@ role {
}
my $url_changes = 0;
- if ($form_name ne "edit-url") {
+ if ($form_name ne 'edit-url') {
my @urls = grep { !$_->is_empty } $form->field('url')->fields;
$url_changes = $self->edit_relationships($c, $form, \@urls, $source);
}
@@ -213,7 +213,7 @@ role {
my $is_series = $unorderable_entity->isa('MusicBrainz::Server::Entity::Series');
if (!$is_series || $unorderable_entity->ordering_type_id == $SERIES_ORDERING_TYPE_MANUAL) {
- my $key = join "-", $link_type->id, $unorderable_entity->id;
+ my $key = join '-', $link_type->id, $unorderable_entity->id;
push @{ $reordered_relationships{$key} //= [] }, {
relationship => $relationship,
diff --git a/lib/MusicBrainz/Server/Controller/Role/Load.pm b/lib/MusicBrainz/Server/Controller/Role/Load.pm
index 85d3e2ea4ba..135130d303c 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Load.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Load.pm
@@ -8,7 +8,7 @@ use MusicBrainz::Server::Constants qw( :direction %ENTITIES );
use Readonly;
use aliased 'MusicBrainz::Server::Entity::RelationshipLinkTypeGroup';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
parameter 'model' => (
isa => 'Str',
@@ -128,8 +128,8 @@ role
);
} else {
$lt_group = $lt_groups->[0];
- }
-
+ }
+
$pager->total_entries($lt_group->total_relationships);
$c->stash->{pager} = $pager;
$c->stash->{paged_link_type_group} = $lt_group;
diff --git a/lib/MusicBrainz/Server/Controller/Role/Merge.pm b/lib/MusicBrainz/Server/Controller/Role/Merge.pm
index 236c1315530..3fe34fb841a 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Merge.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Merge.pm
@@ -178,7 +178,7 @@ role {
toMerge => to_json_array(\@entities),
);
$c->stash(
- component_path => $c->namespace . '/'. type_to_model($c->namespace) . 'Merge.js',
+ component_path => $c->namespace . '/'. type_to_model($c->namespace) . 'Merge',
component_props => \%props,
current_view => 'Node',
);
diff --git a/lib/MusicBrainz/Server/Controller/Role/Profile.pm b/lib/MusicBrainz/Server/Controller/Role/Profile.pm
index bcb4ace2e8e..947b85d7266 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Profile.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Profile.pm
@@ -27,7 +27,7 @@ role {
my ($depth, $name, $duration) = @$stat;
if ($name eq 'request' && $duration > $threshold) {
$c->log->warn(
- sprintf("Slow request (%.3fs): %s %s", $duration, $c->req->method, $c->req->uri)
+ sprintf('Slow request (%.3fs): %s %s', $duration, $c->req->method, $c->req->uri)
);
}
}
diff --git a/lib/MusicBrainz/Server/Controller/Role/Subscribe.pm b/lib/MusicBrainz/Server/Controller/Role/Subscribe.pm
index 647c95c542a..530a089df98 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Subscribe.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Subscribe.pm
@@ -46,7 +46,7 @@ sub subscribers : Chained('load') RequireAuth {
);
$c->stash(
- component_path => 'entity/Subscribers.js',
+ component_path => 'entity/Subscribers',
component_props => \%props,
current_view => 'Node',
);
diff --git a/lib/MusicBrainz/Server/Controller/Role/Tag.pm b/lib/MusicBrainz/Server/Controller/Role/Tag.pm
index b2e560e90aa..fe54358b5e0 100644
--- a/lib/MusicBrainz/Server/Controller/Role/Tag.pm
+++ b/lib/MusicBrainz/Server/Controller/Role/Tag.pm
@@ -46,7 +46,7 @@ sub tags : Chained('load') PathPart('tags') {
);
$c->stash(
- component_path => 'entity/Tags.js',
+ component_path => 'entity/Tags',
component_props => \%props,
current_view => 'Node',
);
diff --git a/lib/MusicBrainz/Server/Controller/Root.pm b/lib/MusicBrainz/Server/Controller/Root.pm
index fdeb56633fc..52fe0c65a43 100644
--- a/lib/MusicBrainz/Server/Controller/Root.pm
+++ b/lib/MusicBrainz/Server/Controller/Root.pm
@@ -57,7 +57,7 @@ sub index : Path Args(0)
$c->stash(
current_view => 'Node',
- component_path => 'main/index.js',
+ component_path => 'main/index',
component_props => {
blogEntries => $c->model('Blog')->get_latest_entries,
newestReleases => to_json_array(\@newest_releases),
@@ -377,7 +377,7 @@ sub begin : Private
$c->stash->{current_action_requires_auth} = 1;
$c->forward('/user/do_login');
my $privs = $attributes->{RequireAuth};
- if ($privs && ref($privs) eq "ARRAY") {
+ if ($privs && ref($privs) eq 'ARRAY') {
foreach my $priv (@$privs) {
last unless $priv;
my $accessor = "is_$priv";
diff --git a/lib/MusicBrainz/Server/Controller/Search.pm b/lib/MusicBrainz/Server/Controller/Search.pm
index 5ddb8484099..b6c4834dd79 100644
--- a/lib/MusicBrainz/Server/Controller/Search.pm
+++ b/lib/MusicBrainz/Server/Controller/Search.pm
@@ -11,7 +11,7 @@ use MusicBrainz::Server::Form::Search::Search;
use Scalar::Util qw( looks_like_number );
use feature 'switch';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
sub search : Path('')
{
@@ -73,7 +73,7 @@ sub search : Path('')
);
$c->stash(
- component_path => 'search/components/' . type_to_model($type) . 'Results.js',
+ component_path => 'search/components/' . type_to_model($type) . 'Results',
component_props => \%props,
current_view => 'Node',
);
@@ -98,7 +98,7 @@ sub doc : Private
my ($self, $c) = @_;
$c->stash(
- component_path => 'search/components/DocResults.js',
+ component_path => 'search/components/DocResults',
current_view => 'Node',
);
}
diff --git a/lib/MusicBrainz/Server/Controller/Statistics.pm b/lib/MusicBrainz/Server/Controller/Statistics.pm
index 7187d2e3a4c..045dc01a5e4 100644
--- a/lib/MusicBrainz/Server/Controller/Statistics.pm
+++ b/lib/MusicBrainz/Server/Controller/Statistics.pm
@@ -98,7 +98,7 @@ sub timeline : Path('timeline/main')
sub timeline_redirect : Path('timeline')
{
my ($self, $c) = @_;
- $c->response->redirect($c->uri_for("/statistics/timeline/main"), 303);
+ $c->response->redirect($c->uri_for('/statistics/timeline/main'), 303);
}
sub individual_timeline : Path('timeline') Args(1)
diff --git a/lib/MusicBrainz/Server/Controller/Tag.pm b/lib/MusicBrainz/Server/Controller/Tag.pm
index 3fe93174977..1c4d33941b7 100644
--- a/lib/MusicBrainz/Server/Controller/Tag.pm
+++ b/lib/MusicBrainz/Server/Controller/Tag.pm
@@ -124,7 +124,7 @@ map {
};
find_meta(__PACKAGE__)->add_method($_ => $method);
- find_meta(__PACKAGE__)->register_method_attributes($method, ["Chained('load')", "PathPart('$url')"]);
+ find_meta(__PACKAGE__)->register_method_attributes($method, [q{Chained('load')}, "PathPart('$url')"]);
} entities_with('tags');
sub not_found : Private
diff --git a/lib/MusicBrainz/Server/Controller/User.pm b/lib/MusicBrainz/Server/Controller/User.pm
index da497c44242..46fd5a82514 100644
--- a/lib/MusicBrainz/Server/Controller/User.pm
+++ b/lib/MusicBrainz/Server/Controller/User.pm
@@ -337,7 +337,7 @@ sub contact : Chained('load') RequireAuth HiddenOnSlaves SecureForm
component_path => 'user/UserMessage',
component_props => {
title => l('Email Sent'),
- message => l("Your email has been successfully sent! Click {link|here} to continue to {user}'s profile.",
+ message => l(q(Your email has been successfully sent! Click {link|here} to continue to {user}'s profile.),
{
link => $c->uri_for_action('/user/profile', [ $editor->name ]),
user => $editor->name
@@ -514,7 +514,7 @@ sub ratings : Chained('load') PathPart('ratings') Args(1) HiddenOnSlaves
if (!$model || !$c->model($model)->can('rating')) {
$c->stash(
message => l(
- "'{type}' is not an entity type that can have ratings.",
+ q('{type}' is not an entity type that can have ratings.),
{ type => $type }
)
);
@@ -683,7 +683,7 @@ map {
};
find_meta(__PACKAGE__)->add_method($entity_type . '_tag' => $method);
- find_meta(__PACKAGE__)->register_method_attributes($method, ["Chained('load_tag')", "PathPart('$url')"]);
+ find_meta(__PACKAGE__)->register_method_attributes($method, [q{Chained('load_tag')}, "PathPart('$url')"]);
} entities_with('tags');
sub privileged : Path('/privileged')
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Area.pm b/lib/MusicBrainz/Server/Controller/WS/2/Area.pm
index e3eb0cb1d38..1e136953cd8 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Area.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Area.pm
@@ -75,7 +75,7 @@ sub area_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Artist.pm b/lib/MusicBrainz/Server/Controller/WS/2/Artist.pm
index 3e530cb1db8..8a99eae9238 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Artist.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Artist.pm
@@ -129,7 +129,7 @@ sub artist_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Collection.pm b/lib/MusicBrainz/Server/Controller/WS/2/Collection.pm
index 7dd326f4cd4..b4a9600a024 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Collection.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Collection.pm
@@ -49,7 +49,7 @@ sub get_collection_from_stash {
my $collection = $c->stash->{entity} // $c->detach('not_found');
if (!$collection->public) {
$self->authenticate($c, $ACCESS_SCOPE_COLLECTION);
- unless ($c->user_exists &&
+ unless ($c->user_exists &&
$c->model('Collection')->is_collection_collaborator($c->user->id, $collection->id)) {
$self->_error($c, 'You do not have permission to view this collection');
}
@@ -172,12 +172,12 @@ map {
my $method_name = $plural . '_get';
find_meta(__PACKAGE__)->add_method($method_name => $method);
- find_meta(__PACKAGE__)->register_method_attributes($method, ["Chained('load')", "PathPart('$plural_url')", "Args(0)"]);
+ find_meta(__PACKAGE__)->register_method_attributes($method, [q{Chained('load')}, "PathPart('$plural_url')", 'Args(0)']);
find_meta(__PACKAGE__)->add_method($plural => $submission_method);
find_meta(__PACKAGE__)->register_method_attributes(
$submission_method,
- ["Chained('load')", "PathPart('$plural_url')", "Args(1)"],
+ [q{Chained('load')}, "PathPart('$plural_url')", 'Args(1)'],
);
} entities_with('collections');
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/DiscID.pm b/lib/MusicBrainz/Server/Controller/WS/2/DiscID.pm
index f2b7e6add80..e6aed9bb2ef 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/DiscID.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/DiscID.pm
@@ -30,7 +30,7 @@ sub discid : Chained('root') PathPart('discid') {
if (!is_valid_discid($id) && !(exists $c->req->query_params->{toc}))
{
- $c->stash->{error} = "Invalid discid.";
+ $c->stash->{error} = 'Invalid discid.';
$c->detach('bad_req');
}
@@ -90,8 +90,8 @@ sub discid : Chained('root') PathPart('discid') {
if (my $toc = $c->req->query_params->{toc}) {
my $all_formats = 0;
- if (exists $c->req->query_params->{"media-format"} &&
- $c->req->query_params->{'media-format'} eq "all") {
+ if (exists $c->req->query_params->{'media-format'} &&
+ $c->req->query_params->{'media-format'} eq 'all') {
$all_formats = 1;
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Event.pm b/lib/MusicBrainz/Server/Controller/WS/2/Event.pm
index 59945082015..4a4b1ff4360 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Event.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Event.pm
@@ -72,7 +72,7 @@ sub event_browse : Private {
my ($limit, $offset) = $self->_limit_and_offset($c);
if (!is_guid($id)) {
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/ISRC.pm b/lib/MusicBrainz/Server/Controller/WS/2/ISRC.pm
index 203f1a62b0f..8f157c0b9f1 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/ISRC.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/ISRC.pm
@@ -26,7 +26,7 @@ sub isrc : Chained('root') PathPart('isrc') Args(1)
if (!is_valid_isrc($isrc_code))
{
- $c->stash->{error} = "Invalid isrc.";
+ $c->stash->{error} = 'Invalid isrc.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/ISWC.pm b/lib/MusicBrainz/Server/Controller/WS/2/ISWC.pm
index 7606da5f798..ab0aa2b3540 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/ISWC.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/ISWC.pm
@@ -26,7 +26,7 @@ sub iswc : Chained('root') PathPart('iswc') Args(1)
if (!is_valid_iswc($iswc))
{
- $c->stash->{error} = "Invalid iswc.";
+ $c->stash->{error} = 'Invalid iswc.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Instrument.pm b/lib/MusicBrainz/Server/Controller/WS/2/Instrument.pm
index 5679bf7467b..26ef1e866de 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Instrument.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Instrument.pm
@@ -62,7 +62,7 @@ sub instrument_browse : Private {
my ($limit, $offset) = $self->_limit_and_offset($c);
if (!is_guid($id)) {
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Label.pm b/lib/MusicBrainz/Server/Controller/WS/2/Label.pm
index 43e69c2df82..f71dade6453 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Label.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Label.pm
@@ -83,7 +83,7 @@ sub label_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Place.pm b/lib/MusicBrainz/Server/Controller/WS/2/Place.pm
index 932d51701e6..c8b4af6b7be 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Place.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Place.pm
@@ -70,7 +70,7 @@ sub place_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Rating.pm b/lib/MusicBrainz/Server/Controller/WS/2/Rating.pm
index 8dd76037ab0..fbaa1d6a64e 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Rating.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Rating.pm
@@ -43,7 +43,7 @@ sub rating_submit : Private
{
my $type = $node->getLocalName;
$self->_error($c, "Entity type '$type' cannot have ratings. " .
- "Supported types are: " . join(', ', keys %ratable))
+ 'Supported types are: ' . join(', ', keys %ratable))
unless $ratable{$type};
my $gid = $xp->find('@mb:id', $node)->string_value;
@@ -55,7 +55,7 @@ sub rating_submit : Private
$self->_error($c, "Cannot find $type entity $gid.") unless $entity;
my $rating = $xp->find('mb:user-rating', $node)->string_value;
- $self->_error($c, "Rating should be an integer between 0 and 100")
+ $self->_error($c, 'Rating should be an integer between 0 and 100')
unless is_integer($rating) && $rating >= 0 && $rating <= 100;
# postpone any updates until we've made some effort to parse the whole
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Recording.pm b/lib/MusicBrainz/Server/Controller/WS/2/Recording.pm
index 510af338678..baccbab01a7 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Recording.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Recording.pm
@@ -139,7 +139,7 @@ sub recording_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
@@ -207,7 +207,7 @@ sub recording_submit : Private
for my $node ($xp->find('/mb:metadata/mb:recording-list/mb:recording')->get_nodelist)
{
my $id = $xp->find('@mb:id', $node)->string_value or
- $self->_error($c, "All releases must have an MBID present");
+ $self->_error($c, 'All releases must have an MBID present');
$self->_error($c, "$id is not a valid MBID")
unless is_guid($id);
@@ -236,7 +236,7 @@ sub recording_submit : Private
}
if (!$c->user->has_confirmed_email_address) {
- $self->_error($c, "You must have a verified email address to submit edits");
+ $self->_error($c, 'You must have a verified email address to submit edits');
}
$c->model('MB')->with_transaction(sub {
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Release.pm b/lib/MusicBrainz/Server/Controller/WS/2/Release.pm
index b2e86309d42..92efdd941e0 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Release.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Release.pm
@@ -222,7 +222,7 @@ sub release_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
@@ -314,7 +314,7 @@ sub release_submit : Private
my @submit;
for my $node ($xp->find('/mb:metadata/mb:release-list/mb:release')->get_nodelist) {
my $id = $xp->find('@mb:id', $node)->string_value or
- $self->_error($c, "All releases must have an MBID present");
+ $self->_error($c, 'All releases must have an MBID present');
$self->_error($c, "$id is not a valid MBID")
unless is_guid($id);
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/ReleaseGroup.pm b/lib/MusicBrainz/Server/Controller/WS/2/ReleaseGroup.pm
index 81e85b33718..d8f254d5492 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/ReleaseGroup.pm
@@ -8,19 +8,19 @@ use List::AllUtils qw( uniq );
use Readonly;
my $ws_defs = Data::OptList::mkopt([
- "release-group" => {
+ 'release-group' => {
method => 'GET',
required => [ qw(query) ],
optional => [ qw(fmt limit offset) ],
},
- "release-group" => {
+ 'release-group' => {
method => 'GET',
linked => [ qw(artist release collection) ],
inc => [ qw(aliases artist-credits annotation
_relations tags user-tags genres user-genres ratings user-ratings) ],
optional => [ qw(fmt limit offset) ],
},
- "release-group" => {
+ 'release-group' => {
action => '/ws/2/releasegroup/lookup',
method => 'GET',
inc => [ qw(artists releases artist-credits aliases annotation
@@ -95,7 +95,7 @@ sub release_group_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Role/BrowseByCollection.pm b/lib/MusicBrainz/Server/Controller/WS/2/Role/BrowseByCollection.pm
index fddf7bb166e..3a37b672d76 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Role/BrowseByCollection.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Role/BrowseByCollection.pm
@@ -20,7 +20,7 @@ sub browse_by_collection {
if (!$collection->public) {
$self->authenticate($c, $ACCESS_SCOPE_COLLECTION);
$self->unauthorized($c)
- unless $c->user_exists &&
+ unless $c->user_exists &&
$c->model('Collection')->is_collection_collaborator($c->user->id, $collection->id);
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Series.pm b/lib/MusicBrainz/Server/Controller/WS/2/Series.pm
index a677a836419..1809cf83488 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Series.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Series.pm
@@ -62,7 +62,7 @@ sub series_browse : Private
my ($limit, $offset) = $self->_limit_and_offset($c);
if (!is_guid($id)) {
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Tag.pm b/lib/MusicBrainz/Server/Controller/WS/2/Tag.pm
index d75a6e9a200..eacadb0b5c9 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Tag.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Tag.pm
@@ -8,7 +8,7 @@ use MusicBrainz::Server::Validation qw( is_guid );
use MusicBrainz::Server::WebService::XML::XPath;
use Readonly;
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
my $ws_defs = Data::OptList::mkopt([
tag => {
diff --git a/lib/MusicBrainz/Server/Controller/WS/2/Work.pm b/lib/MusicBrainz/Server/Controller/WS/2/Work.pm
index 3b9fb5c29bd..3cbaeb34ed5 100644
--- a/lib/MusicBrainz/Server/Controller/WS/2/Work.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/2/Work.pm
@@ -69,7 +69,7 @@ sub work_browse : Private
if (!is_guid($id))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/js.pm b/lib/MusicBrainz/Server/Controller/WS/js.pm
index 3a96553529a..2cebc3c093e 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js.pm
@@ -37,30 +37,30 @@ use XML::XPath;
# This defines what options are acceptable for WS calls
my $ws_defs = Data::OptList::mkopt([
- "medium" => {
+ 'medium' => {
method => 'GET',
inc => [ qw(recordings rels) ],
optional => [ qw(q artist tracks limit page timestamp) ]
},
- "tracks" => {
+ 'tracks' => {
method => 'GET',
optional => [ qw(q page ) ]
},
- "cdstub" => {
+ 'cdstub' => {
method => 'GET',
optional => [ qw(q artist tracks limit page timestamp) ]
},
- "cover-art-upload" => {
+ 'cover-art-upload' => {
method => 'GET',
},
- "entity" => {
+ 'entity' => {
method => 'GET',
inc => [ qw(rels) ]
},
- "entities" => {
+ 'entities' => {
method => 'GET',
},
- "events" => {
+ 'events' => {
method => 'GET'
},
]);
@@ -134,7 +134,7 @@ sub cdstub : Chained('root') PathPart Args(1) {
my $cdstub = $c->model('CDStub')->get_by_discid($id);
my $ret = {
- toc => "",
+ toc => '',
tracks => []
};
@@ -230,7 +230,7 @@ sub disc_search {
push @query, "artist:($artist)" if $artist;
push @query, ($type eq 'release' ? "tracksmedium:($tracks)" : "tracks:($tracks)") if $tracks;
- $query = join(" AND ", @query);
+ $query = join(' AND ', @query);
my $no_redirect = 1;
my $response = $c->model('Search')->external_search($type, $query, $limit, $page, 1);
@@ -519,7 +519,7 @@ sub entity : Chained('root') PathPart('entity') Args(1)
}
unless (defined $entity) {
- $c->stash->{error} = "The requested entity was not found.";
+ $c->stash->{error} = 'The requested entity was not found.';
$c->detach('not_found');
return;
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Area.pm b/lib/MusicBrainz/Server/Controller/WS/js/Area.pm
index 8e07ac05db1..3c07140a809 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Area.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Area.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "area" => {
+ 'area' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Artist.pm b/lib/MusicBrainz/Server/Controller/WS/js/Artist.pm
index f8421e8dff8..bbe103e8669 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Artist.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Artist.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "artist" => {
+ 'artist' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/CheckDuplicates.pm b/lib/MusicBrainz/Server/Controller/WS/js/CheckDuplicates.pm
index 44d136c79c5..1e5fa6d7b6f 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/CheckDuplicates.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/CheckDuplicates.pm
@@ -8,7 +8,7 @@ use aliased 'MusicBrainz::Server::WebService::JSONSerializer';
BEGIN {extends 'MusicBrainz::Server::ControllerBase::WS::js'}
my $ws_defs = Data::OptList::mkopt([
- "check_duplicates" => {
+ 'check_duplicates' => {
method => 'GET',
required => [qw(type name)],
optional => [qw(mbid)]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Edit.pm b/lib/MusicBrainz/Server/Controller/WS/js/Edit.pm
index 18f78ee251e..e3c17cefef8 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Edit.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Edit.pm
@@ -60,7 +60,7 @@ use aliased 'MusicBrainz::Server::Entity::Track';
use aliased 'MusicBrainz::Server::WebService::JSONSerializer';
BEGIN { extends 'MusicBrainz::Server::Controller' }
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
Readonly our $ERROR_NOT_LOGGED_IN => 1;
Readonly our $ERROR_NON_EXISTENT_ENTITIES => 2;
@@ -411,7 +411,7 @@ sub process_relationship {
delete $data->{entities};
delete $data->{linkOrder};
- for my $prop ("entity0", "entity1") {
+ for my $prop ('entity0', 'entity1') {
my $entity_data = $data->{$prop};
if ($entity_data) {
@@ -433,10 +433,10 @@ sub process_relationship {
if ($previewing && !$entity_data->{gid}) {
my $entity_class = "MusicBrainz::Server::Entity::$model";
- my ($entity) = $model eq "URL" ? $c->model('URL')->find_by_url($name) : ();
+ my ($entity) = $model eq 'URL' ? $c->model('URL')->find_by_url($name) : ();
$data->{$prop} = $entity // $entity_class->new(name => $name);
- } elsif ($model eq "URL") {
+ } elsif ($model eq 'URL') {
$data->{$prop} = $c->model('URL')->find_or_insert($name);
} else {
$loader->($entity_data->{gid}, $model, sub { $data->{$prop} = shift });
@@ -725,7 +725,7 @@ sub submit_edits {
$response->{entity}->{position} = $entity->position;
}
};
- } elsif ($edit->isa("MusicBrainz::Server::Edit::Release::AddReleaseLabel")) {
+ } elsif ($edit->isa('MusicBrainz::Server::Edit::Release::AddReleaseLabel')) {
$response->{entity} = {
id => $edit->entity_id,
labelID => defined($edit->data->{label}) ? $edit->data->{label}{id} : undef,
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Editor.pm b/lib/MusicBrainz/Server/Controller/WS/js/Editor.pm
index f6bb85b954b..c62f4357850 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Editor.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Editor.pm
@@ -5,7 +5,7 @@ BEGIN { extends 'MusicBrainz::Server::ControllerBase::WS::js' }
use Text::Trim 'trim';
my $ws_defs = Data::OptList::mkopt([
- "editor" => {
+ 'editor' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Event.pm b/lib/MusicBrainz/Server/Controller/WS/js/Event.pm
index dc58f4d2923..210a2931419 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Event.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Event.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "event" => {
+ 'event' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Genre.pm b/lib/MusicBrainz/Server/Controller/WS/js/Genre.pm
index 47e8e2d0bc2..a1399798a44 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Genre.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Genre.pm
@@ -5,7 +5,7 @@ BEGIN { extends 'MusicBrainz::Server::ControllerBase::WS::js' }
with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion';
my $ws_defs = Data::OptList::mkopt([
- "genre" => {
+ 'genre' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Instrument.pm b/lib/MusicBrainz/Server/Controller/WS/js/Instrument.pm
index f8cccf2c4d5..11eef885b67 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Instrument.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Instrument.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "instrument" => {
+ 'instrument' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Label.pm b/lib/MusicBrainz/Server/Controller/WS/js/Label.pm
index 253d30a7485..da4fa26cdd3 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Label.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Label.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "label" => {
+ 'label' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/ParseCoordinates.pm b/lib/MusicBrainz/Server/Controller/WS/js/ParseCoordinates.pm
index 8169d3b0c25..794d66b4907 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/ParseCoordinates.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/ParseCoordinates.pm
@@ -7,7 +7,7 @@ use MusicBrainz::Server::Data::Utils qw( trim );
use MusicBrainz::Server::Validation qw( validate_coordinates );
my $ws_defs = Data::OptList::mkopt([
- "parse-coordinates" => {
+ 'parse-coordinates' => {
method => 'GET',
required => [ qw(coordinates) ]
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Place.pm b/lib/MusicBrainz/Server/Controller/WS/js/Place.pm
index b26833ed1a3..8057882e371 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Place.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Place.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "place" => {
+ 'place' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Recording.pm b/lib/MusicBrainz/Server/Controller/WS/js/Recording.pm
index ddada6b7304..e7576d46648 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Recording.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Recording.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "recording" => {
+ 'recording' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(a r direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Release.pm b/lib/MusicBrainz/Server/Controller/WS/js/Release.pm
index f07f3bd6d1a..68978f069a2 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Release.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Release.pm
@@ -12,12 +12,12 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "release" => {
+ 'release' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
},
- "release" => {
+ 'release' => {
method => 'GET',
inc => [ qw(recordings rels) ]
},
@@ -57,7 +57,7 @@ sub release : Chained('root') PathPart('release') Args(1)
my ($self, $c, $gid) = @_;
if (!is_guid($gid)) {
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/ReleaseGroup.pm b/lib/MusicBrainz/Server/Controller/WS/js/ReleaseGroup.pm
index f0b64bfeac4..73db8b8cba6 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/ReleaseGroup.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "release-group" => {
+ 'release-group' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Series.pm b/lib/MusicBrainz/Server/Controller/WS/js/Series.pm
index 021fa90f56b..e18ff210641 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Series.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Series.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "series" => {
+ 'series' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/Work.pm b/lib/MusicBrainz/Server/Controller/WS/js/Work.pm
index 82c7c9c9566..c1852d943ec 100644
--- a/lib/MusicBrainz/Server/Controller/WS/js/Work.pm
+++ b/lib/MusicBrainz/Server/Controller/WS/js/Work.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Controller::WS::js::Role::Autocompletion::PrimaryAlia
};
my $ws_defs = Data::OptList::mkopt([
- "work" => {
+ 'work' => {
method => 'GET',
required => [ qw(q) ],
optional => [ qw(direct limit page timestamp) ]
diff --git a/lib/MusicBrainz/Server/ControllerBase/WS/2.pm b/lib/MusicBrainz/Server/ControllerBase/WS/2.pm
index 8f011728374..1751eda8efd 100644
--- a/lib/MusicBrainz/Server/ControllerBase/WS/2.pm
+++ b/lib/MusicBrainz/Server/ControllerBase/WS/2.pm
@@ -47,7 +47,7 @@ sub deny_readonly : Private
if (DBDefs->DB_READ_ONLY) {
$c->res->status(503);
$c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->output_error("The database is currently in readonly mode and cannot handle your request"));
+ $c->res->body($c->stash->{serializer}->output_error('The database is currently in readonly mode and cannot handle your request'));
$c->detach;
}
}
@@ -64,7 +64,7 @@ sub forbidden : Private
my ($self, $c) = @_;
$c->res->status(401);
$c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->output_error("You are not authorized to access this resource."));
+ $c->res->body($c->stash->{serializer}->output_error('You are not authorized to access this resource.'));
$c->detach;
}
@@ -73,10 +73,10 @@ sub unauthorized : Private
my ($self, $c) = @_;
$c->res->status(401);
$c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->output_error("Your credentials ".
- "could not be verified. Either you supplied the wrong credentials ".
- "(e.g., bad password), or your client doesn't understand how to ".
- "supply the credentials required."));
+ $c->res->body($c->stash->{serializer}->output_error('Your credentials '.
+ 'could not be verified. Either you supplied the wrong credentials '.
+ q{(e.g., bad password), or your client doesn't understand how to }.
+ 'supply the credentials required.'));
$c->detach;
}
@@ -85,13 +85,13 @@ sub not_found : Private
my ($self, $c) = @_;
$c->res->status(404);
$c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->output_error("Not Found"));
+ $c->res->body($c->stash->{serializer}->output_error('Not Found'));
}
sub invalid_mbid : Private
{
my ($self, $c, $id) = @_;
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
@@ -111,7 +111,7 @@ sub not_implemented : Private
$c->res->status(501);
$c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->output_error("This hasn't been implemented yet."));
+ $c->res->body($c->stash->{serializer}->output_error(q(This hasn't been implemented yet.)));
}
sub begin : Private {
@@ -123,7 +123,7 @@ sub begin : Private {
sub end : Private { }
-sub root : Chained('/') PathPart("ws/2") CaptureArgs(0)
+sub root : Chained('/') PathPart('ws/2') CaptureArgs(0)
{
my ($self, $c) = @_;
@@ -298,7 +298,7 @@ sub _limit_and_offset
if (!(is_nat($limit) && is_nat($offset))) {
$self->_error(
- $c, "The 'limit' and 'offset' parameters must be positive integers"
+ $c, q(The 'limit' and 'offset' parameters must be positive integers)
);
}
@@ -531,7 +531,7 @@ sub _validate_post
$c->detach;
}
- $self->_error($c, "Please specify the name and version number of your client application.")
+ $self->_error($c, 'Please specify the name and version number of your client application.')
unless $c->req->params->{client};
}
@@ -547,13 +547,13 @@ sub _validate_entity
if (!$gid || !is_guid($gid))
{
- $c->stash->{error} = "Invalid mbid.";
+ $c->stash->{error} = 'Invalid mbid.';
$c->detach('bad_req');
}
if (!$model)
{
- $c->stash->{error} = "Invalid entity type.";
+ $c->stash->{error} = 'Invalid entity type.';
$c->detach('bad_req');
}
@@ -581,7 +581,7 @@ sub load_relationships {
if ($c->stash->{inc}->work_level_rels)
{
- push(@entities_with_rels, @works);
+ push(@entities_with_rels, @works);
# Avoid returning recording-work relationships for other recordings
$c->model('Relationship')->load_subset_cardinal($types, @works);
}
diff --git a/lib/MusicBrainz/Server/ControllerUtils/SSL.pm b/lib/MusicBrainz/Server/ControllerUtils/SSL.pm
index e2ff2a1ff21..03c53fcd594 100644
--- a/lib/MusicBrainz/Server/ControllerUtils/SSL.pm
+++ b/lib/MusicBrainz/Server/ControllerUtils/SSL.pm
@@ -13,7 +13,7 @@ sub ensure_ssl {
if (DBDefs->SSL_REDIRECTS_ENABLED && !$c->request->secure) {
$c->response->redirect(
- "https://".DBDefs->WEB_SERVER_SSL.$c->request->env->{REQUEST_URI});
+ 'https://'.DBDefs->WEB_SERVER_SSL.$c->request->env->{REQUEST_URI});
$c->detach;
}
}
diff --git a/lib/MusicBrainz/Server/CoverArt/Provider/WebService/Amazon.pm b/lib/MusicBrainz/Server/CoverArt/Provider/WebService/Amazon.pm
index 04e94fc3142..1fe6860bc45 100644
--- a/lib/MusicBrainz/Server/CoverArt/Provider/WebService/Amazon.pm
+++ b/lib/MusicBrainz/Server/CoverArt/Provider/WebService/Amazon.pm
@@ -82,11 +82,11 @@ sub lookup_cover_art
}
my $url = "http://$end_point/onca/xml?" .
- "Service=AWSECommerceService&" .
- "Operation=ItemLookup&" .
+ 'Service=AWSECommerceService&' .
+ 'Operation=ItemLookup&' .
"ItemId=$asin&" .
- "Version=2011-08-01&" .
- "ResponseGroup=Images";
+ 'Version=2011-08-01&' .
+ 'ResponseGroup=Images';
my $cover_art = $self->_lookup_coverart($url) or return;
$cover_art->asin($asin);
@@ -105,7 +105,7 @@ sub fallback_meta {
sub _lookup_coverart {
my ($self, $url) = @_;
- $url .= "&AssociateTag=" . DBDefs->AMAZON_ASSOCIATE_TAG;
+ $url .= '&AssociateTag=' . DBDefs->AMAZON_ASSOCIATE_TAG;
$url = $self->_aws_signature->addRESTSecret($url);
# Respect Amazon SLA
diff --git a/lib/MusicBrainz/Server/Data/Alias.pm b/lib/MusicBrainz/Server/Data/Alias.pm
index 2dc0a836884..d42397de4f8 100644
--- a/lib/MusicBrainz/Server/Data/Alias.pm
+++ b/lib/MusicBrainz/Server/Data/Alias.pm
@@ -78,9 +78,9 @@ sub find_by_entity_ids
my $key = $self->type;
- my $query = "SELECT $key parent_id, " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE $key IN (" . placeholders(@ids) . ")
+ my $query = "SELECT $key parent_id, " . $self->_columns . '
+ FROM ' . $self->_table . "
+ WHERE $key IN (" . placeholders(@ids) . ')
ORDER BY locale NULLS LAST,
begin_date_year NULLS LAST,
begin_date_month NULLS LAST,
@@ -89,7 +89,7 @@ sub find_by_entity_ids
end_date_month NULLS LAST,
end_date_day NULLS LAST,
sort_name COLLATE musicbrainz,
- name COLLATE musicbrainz";
+ name COLLATE musicbrainz';
my %ret = map { $_ => [] } @ids;
@@ -133,8 +133,8 @@ sub load
sub delete
{
my ($self, @ids) = @_;
- my $query = "DELETE FROM " . $self->table .
- " WHERE id IN (" . placeholders(@ids) . ")";
+ my $query = 'DELETE FROM ' . $self->table .
+ ' WHERE id IN (' . placeholders(@ids) . ')';
$self->sql->do($query, @ids);
return 1;
}
@@ -142,8 +142,8 @@ sub delete
sub delete_entities
{
my ($self, @ids) = @_;
- my $query = "DELETE FROM " . $self->table .
- " WHERE " . $self->type . " IN (" . placeholders(@ids) . ")";
+ my $query = 'DELETE FROM ' . $self->table .
+ ' WHERE ' . $self->type . ' IN (' . placeholders(@ids) . ')';
$self->sql->do($query, @ids);
return 1;
}
@@ -165,8 +165,8 @@ sub insert
ended => $hash->{ended},
};
- add_partial_date_to_row($row, $hash->{begin_date}, "begin_date");
- add_partial_date_to_row($row, $hash->{end_date}, "end_date");
+ add_partial_date_to_row($row, $hash->{begin_date}, 'begin_date');
+ add_partial_date_to_row($row, $hash->{end_date}, 'end_date');
push @created, $class->new(id => $self->sql->insert_row($table, $row, 'id'));
}
@@ -208,7 +208,7 @@ sub merge
# Update all aliases to the new entity
$self->sql->do("UPDATE $table SET $type = ?
- WHERE $type IN (".placeholders(@old_ids).")", $new_id, @old_ids);
+ WHERE $type IN (".placeholders(@old_ids).')', $new_id, @old_ids);
# Insert any aliases from old entity names
my $sortnamecol = ($type eq 'artist') ? 'sort_name' : 'name';
@@ -238,9 +238,9 @@ sub update
my %row = %$alias_hash;
delete @row{qw( begin_date end_date )};
- add_partial_date_to_row(\%row, $alias_hash->{begin_date}, "begin_date")
+ add_partial_date_to_row(\%row, $alias_hash->{begin_date}, 'begin_date')
if exists $alias_hash->{begin_date};
- add_partial_date_to_row(\%row, $alias_hash->{end_date}, "end_date")
+ add_partial_date_to_row(\%row, $alias_hash->{end_date}, 'end_date')
if exists $alias_hash->{end_date};
$row{type} = delete $row{type_id}
if exists $row{type_id};
@@ -255,8 +255,8 @@ sub exists {
return $self->sql->select_single_value(
"SELECT EXISTS (
SELECT TRUE
- FROM $table " .
- "WHERE name IS NOT DISTINCT FROM ?
+ FROM $table
+ WHERE name IS NOT DISTINCT FROM ?
AND locale IS NOT DISTINCT FROM ?
AND type IS NOT DISTINCT FROM ?
AND $table.id IS DISTINCT FROM ?
diff --git a/lib/MusicBrainz/Server/Data/Application.pm b/lib/MusicBrainz/Server/Data/Application.pm
index b809b3e5ceb..a276f094664 100644
--- a/lib/MusicBrainz/Server/Data/Application.pm
+++ b/lib/MusicBrainz/Server/Data/Application.pm
@@ -55,10 +55,10 @@ sub get_by_oauth_id
sub find_by_owner
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE owner = ?
- ORDER BY id";
+ ORDER BY id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -81,7 +81,7 @@ before 'delete' => sub
sub delete_editor {
my ($self, $editor_id) = @_;
- $self->sql->do("DELETE FROM " . $self->_table . " WHERE owner = ?", $editor_id);
+ $self->sql->do('DELETE FROM ' . $self->_table . ' WHERE owner = ?', $editor_id);
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Data/Area.pm b/lib/MusicBrainz/Server/Data/Area.pm
index 40115ef90b4..cfad2d94153 100644
--- a/lib/MusicBrainz/Server/Data/Area.pm
+++ b/lib/MusicBrainz/Server/Data/Area.pm
@@ -104,7 +104,7 @@ sub _set_codes
$self->sql->do("DELETE FROM $type WHERE area = ?", $area);
$self->sql->do(
"INSERT INTO $type (area, code) VALUES " .
- join(', ', ("(?, ?)") x @$codes),
+ join(', ', ('(?, ?)') x @$codes),
map { $area, $_ } @$codes
) if @$codes;
}
@@ -152,7 +152,7 @@ sub can_delete
return 0 if $self->is_release_country_area($area_id);
my $used_in_relationship = used_in_relationship($self->c, area => 'area_row.id');
- return 1 if $self->sql->select_single_value(<<~"EOSQL", $area_id, $STATUS_OPEN);
+ return 1 if $self->sql->select_single_value(<<~"SQL", $area_id, $STATUS_OPEN);
SELECT TRUE
FROM area area_row
WHERE id = ?
@@ -179,7 +179,7 @@ sub can_delete
) OR
$used_in_relationship
)
- EOSQL
+ SQL
return 0;
}
@@ -195,7 +195,7 @@ sub delete
$self->tags->delete(@area_ids);
$self->remove_gid_redirects(@area_ids);
for my $code_table (@CODE_TYPES) {
- $self->sql->do("DELETE FROM $code_table WHERE area IN (" . placeholders(@area_ids) . ")", @area_ids);
+ $self->sql->do("DELETE FROM $code_table WHERE area IN (" . placeholders(@area_ids) . ')', @area_ids);
}
$self->delete_returning_gids(@area_ids);
return 1;
@@ -226,13 +226,13 @@ sub _merge_impl
);
for my $update (
- [ artist => "area" ],
- [ artist => "begin_area" ],
- [ artist => "end_area" ],
- [ label => "area" ],
- [ place => "area" ],
- [ editor => "area" ],
- [ release_country => "country" ]
+ [ artist => 'area' ],
+ [ artist => 'begin_area' ],
+ [ artist => 'end_area' ],
+ [ label => 'area' ],
+ [ place => 'area' ],
+ [ editor => 'area' ],
+ [ release_country => 'country' ]
) {
my ($table, $column) = @$update;
$self->sql->do(
@@ -311,10 +311,10 @@ sub load_ids
my @gids = map { $_->gid } @areas;
return () unless @gids;
- my $query = "
+ my $query = '
SELECT gid, id FROM area
- WHERE gid IN (" . placeholders(@gids) . ")
- ";
+ WHERE gid IN (' . placeholders(@gids) . ')
+ ';
my %map = map { $_->[0] => $_->[1] }
@{ $self->sql->select_list_of_lists($query, @gids) };
@@ -338,10 +338,10 @@ sub get_by_iso_3166_3 {
sub _get_by_iso {
my ($self, $table, @codes) = @_;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
" JOIN ${table} c ON c.area = area.id" .
- " WHERE c.code = any(?)";
+ ' WHERE c.code = any(?)';
my %ret = map { $_ => undef } @codes;
for my $row (@{ $self->sql->select_list_of_hashes($query, \@codes) }) {
@@ -358,12 +358,12 @@ sub _get_by_iso {
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
}
});
diff --git a/lib/MusicBrainz/Server/Data/Artist.pm b/lib/MusicBrainz/Server/Data/Artist.pm
index 7e2893abec6..ae8a4bd7a8c 100644
--- a/lib/MusicBrainz/Server/Data/Artist.pm
+++ b/lib/MusicBrainz/Server/Data/Artist.pm
@@ -97,11 +97,11 @@ after '_delete_from_cache' => sub {
sub find_by_subscribed_editor
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_artist s ON artist.id = s.artist
WHERE s.editor = ?
- ORDER BY artist.sort_name COLLATE musicbrainz, artist.id";
+ ORDER BY artist.sort_name COLLATE musicbrainz, artist.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -111,8 +111,8 @@ sub find_by_area {
$containment_query,
@containment_query_args,
) = get_area_containment_query('$2', 'any(array[area, begin_area, end_area])', check_all_levels => 1);
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . "
WHERE \$1 IN (area, begin_area, end_area) OR EXISTS (
SELECT 1 FROM ($containment_query) ac
WHERE ac.descendant IN (area, begin_area, end_area) AND ac.parent = \$1
@@ -128,9 +128,9 @@ sub find_by_instrument {
my ($self, $instrument_id, $limit, $offset) = @_;
my $query =
- "SELECT " . $self->_columns . ",
+ 'SELECT ' . $self->_columns . q(,
array_agg(json_build_object('typeName', link_type.name, 'credit', lac.credited_as)) AS instrument_credits_and_rel_types
- FROM " . $self->_table . "
+ FROM ) . $self->_table . '
JOIN (
SELECT * FROM l_artist_artist
UNION ALL
@@ -149,7 +149,7 @@ sub find_by_instrument {
)
WHERE instrument.id = ?
GROUP BY artist.id
- ORDER BY artist.sort_name COLLATE musicbrainz";
+ ORDER BY artist.sort_name COLLATE musicbrainz';
$self->query_to_list_limited(
$query,
@@ -167,20 +167,20 @@ sub find_by_instrument {
sub find_by_recording
{
my ($self, $recording_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn ON acn.artist = artist.id
JOIN recording ON recording.artist_credit = acn.artist_credit
WHERE recording.id = ?
- ORDER BY artist.name COLLATE musicbrainz, artist.id";
+ ORDER BY artist.name COLLATE musicbrainz, artist.id';
$self->query_to_list_limited($query, [$recording_id], $limit, $offset);
}
sub find_by_release
{
my ($self, $release_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE artist.id IN (SELECT artist.id
FROM artist
JOIN artist_credit_name acn ON acn.artist = artist.id
@@ -192,67 +192,67 @@ sub find_by_release
JOIN artist_credit_name acn ON acn.artist = artist.id
JOIN release ON release.artist_credit = acn.artist_credit
WHERE release.id = ?)
- ORDER BY artist.name COLLATE musicbrainz, artist.id";
+ ORDER BY artist.name COLLATE musicbrainz, artist.id';
$self->query_to_list_limited($query, [($release_id) x 2], $limit, $offset);
}
sub find_by_release_group
{
my ($self, $recording_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn ON acn.artist = artist.id
JOIN release_group ON release_group.artist_credit = acn.artist_credit
WHERE release_group.id = ?
- ORDER BY artist.name COLLATE musicbrainz, artist.id";
+ ORDER BY artist.name COLLATE musicbrainz, artist.id';
$self->query_to_list_limited($query, [$recording_id], $limit, $offset);
}
sub find_by_work
{
my ($self, $work_id, $limit, $offset) = @_;
- my $query = "SELECT DISTINCT name COLLATE musicbrainz name_collate, s.*
+ my $query = 'SELECT DISTINCT name COLLATE musicbrainz name_collate, s.*
FROM (
- SELECT " . $self->_columns . " FROM ". $self->_table . "
+ SELECT ' . $self->_columns . ' FROM '. $self->_table . '
JOIN artist_credit_name acn ON acn.artist = artist.id
JOIN recording ON recording.artist_credit = acn.artist_credit
JOIN l_recording_work lrw ON lrw.entity0 = recording.id
WHERE lrw.entity1 = ?
UNION ALL
- SELECT " . $self->_columns . " FROM ". $self->_table . "
+ SELECT ' . $self->_columns . ' FROM '. $self->_table . '
JOIN l_artist_work law ON law.entity0 = artist.id
WHERE law.entity1 = ?
) s
- ORDER BY name COLLATE musicbrainz, id";
+ ORDER BY name COLLATE musicbrainz, id';
$self->query_to_list_limited($query, [($work_id) x 2], $limit, $offset);
}
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "sort_name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'sort_name COLLATE musicbrainz'
},
- "area" => sub {
- return "area, name COLLATE musicbrainz"
+ 'area' => sub {
+ return 'area, name COLLATE musicbrainz'
},
- "gender" => sub {
- return "gender, sort_name COLLATE musicbrainz"
+ 'gender' => sub {
+ return 'gender, sort_name COLLATE musicbrainz'
},
- "begin_date" => sub {
- return "begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz"
+ 'begin_date' => sub {
+ return 'begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz'
},
- "begin_area" => sub {
- return "begin_area, name COLLATE musicbrainz"
+ 'begin_area' => sub {
+ return 'begin_area, name COLLATE musicbrainz'
},
- "end_date" => sub {
- return "end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz"
+ 'end_date' => sub {
+ return 'end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz'
},
- "end_area" => sub {
- return "end_area, name COLLATE musicbrainz"
+ 'end_area' => sub {
+ return 'end_area, name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, sort_name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, sort_name COLLATE musicbrainz'
}
});
@@ -297,7 +297,7 @@ sub can_split
# These AND NOT EXISTS clauses are ordered by my estimated likelihood of a
# relationship existing for a collaboration, as postgresql will not execute
# the later clauses if an earlier one has already excluded the lone artist row.
- my $can_split = $self->sql->select_single_value(<<~'EOSQL', $artist_id);
+ my $can_split = $self->sql->select_single_value(<<~'SQL', $artist_id);
SELECT TRUE FROM artist WHERE id = ?
AND NOT EXISTS (SELECT TRUE FROM l_artist_url lau WHERE lau.entity0 = artist.id)
AND NOT EXISTS (
@@ -320,7 +320,7 @@ sub can_split
AND NOT EXISTS (SELECT TRUE FROM l_artist_series las WHERE las.entity0 = artist.id)
AND NOT EXISTS (SELECT TRUE FROM l_artist_instrument lai WHERE lai.entity0 = artist.id)
AND NOT EXISTS (SELECT TRUE FROM l_area_artist lara WHERE lara.entity1 = artist.id)
- EOSQL
+ SQL
return $can_split;
}
@@ -496,7 +496,7 @@ sub load_related_info {
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "artist_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'artist_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -529,7 +529,7 @@ sub is_empty {
my ($self, $artist_id) = @_;
my $used_in_relationship = used_in_relationship($self->c, artist => 'artist_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $artist_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $artist_id, $STATUS_OPEN);
SELECT TRUE
FROM artist artist_row
WHERE id = ?
@@ -546,7 +546,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Data/ArtistCredit.pm b/lib/MusicBrainz/Server/Data/ArtistCredit.pm
index d05ceb220c7..906cefe180e 100644
--- a/lib/MusicBrainz/Server/Data/ArtistCredit.pm
+++ b/lib/MusicBrainz/Server/Data/ArtistCredit.pm
@@ -24,13 +24,13 @@ sub get_by_ids
{
my ($self, @ids) = @_;
my $artist_columns = $self->c->model('Artist')->_columns;
- my $query = "SELECT artist, artist_credit_name.name AS ac_name, join_phrase, artist_credit, " .
- $artist_columns . ", ac.edits_pending AS ac_edits_pending " .
- "FROM artist_credit_name " .
- "JOIN artist ON artist.id=artist_credit_name.artist " .
- "JOIN artist_credit ac ON ac.id = artist_credit_name.artist_credit " .
- "WHERE artist_credit IN (" . placeholders(@ids) . ") " .
- "ORDER BY artist_credit, position";
+ my $query = "SELECT artist, artist_credit_name.name AS ac_name, join_phrase, artist_credit,
+ $artist_columns, ac.edits_pending AS ac_edits_pending
+ FROM artist_credit_name
+ JOIN artist ON artist.id=artist_credit_name.artist
+ JOIN artist_credit ac ON ac.id = artist_credit_name.artist_credit
+ WHERE artist_credit IN (" . placeholders(@ids) . ')
+ ORDER BY artist_credit, position';
my %result;
my %counts;
@@ -114,7 +114,7 @@ sub _find
my @credits = map { $_->{name} } @names;
my @join_phrases = map { $_->{join_phrase} } @names;
- my $name = "";
+ my $name = '';
my (@joins, @conditions, @args);
for my $i (@positions) {
my $ac_name = $names[$i];
@@ -138,9 +138,9 @@ sub _find
$name .= $ac_name->{join_phrase} if $ac_name->{join_phrase};
}
- my $query = "SELECT ac.id FROM artist_credit ac " .
- join(" ", @joins) .
- " WHERE " . join(" AND ", @conditions) . " AND ac.artist_count = ?";
+ my $query = 'SELECT ac.id FROM artist_credit ac ' .
+ join(' ', @joins) .
+ ' WHERE ' . join(' AND ', @conditions) . ' AND ac.artist_count = ?';
my $id = $self->sql->select_single_value($query, @args, scalar @credits);
@@ -346,7 +346,7 @@ sub related_entities {
}
my $track_ac_releases = $self->c->sql->select_single_column_array(
- "SELECT DISTINCT medium.release FROM track JOIN medium ON track.medium = medium.id WHERE track.artist_credit = ?",
+ 'SELECT DISTINCT medium.release FROM track JOIN medium ON track.medium = medium.id WHERE track.artist_credit = ?',
$ac_id
);
diff --git a/lib/MusicBrainz/Server/Data/Artwork.pm b/lib/MusicBrainz/Server/Data/Artwork.pm
index 74e6cf2bb93..0619592a36c 100644
--- a/lib/MusicBrainz/Server/Data/Artwork.pm
+++ b/lib/MusicBrainz/Server/Data/Artwork.pm
@@ -75,7 +75,7 @@ sub find_by_release
my @ids = keys %id_to_release;
return unless @ids; # nothing to do
- my $query = "SELECT
+ my $query = 'SELECT
cover_art_archive.index_listing.id,
cover_art_archive.index_listing.release,
cover_art_archive.index_listing.comment,
@@ -93,8 +93,8 @@ sub find_by_release
JOIN cover_art_archive.image_type
ON cover_art_archive.index_listing.mime_type = cover_art_archive.image_type.mime_type
WHERE cover_art_archive.index_listing.release
- IN (" . placeholders(@ids) . ")
- ORDER BY cover_art_archive.index_listing.ordering";
+ IN (' . placeholders(@ids) . ')
+ ORDER BY cover_art_archive.index_listing.ordering';
my @artwork = $self->query_to_list($query, \@ids);
for my $image (@artwork) {
@@ -111,7 +111,7 @@ sub find_front_cover_by_release
my @ids = keys %id_to_release;
return unless @ids; # nothing to do
- my $query = "SELECT
+ my $query = 'SELECT
cover_art_archive.index_listing.id,
cover_art_archive.index_listing.release,
cover_art_archive.index_listing.comment,
@@ -131,8 +131,8 @@ sub find_front_cover_by_release
JOIN cover_art_archive.image_type
ON cover_art_archive.index_listing.mime_type = cover_art_archive.image_type.mime_type
WHERE cover_art_archive.index_listing.release
- IN (" . placeholders(@ids) . ")
- AND is_front = true";
+ IN (' . placeholders(@ids) . ')
+ AND is_front = true';
my @artwork = $self->query_to_list($query, \@ids);
foreach my $image (@artwork) {
@@ -150,9 +150,9 @@ sub find_count_by_release
my ($self, $release_id) = @_;
return unless $release_id; # nothing to do
- my $query = "SELECT count(*)
+ my $query = 'SELECT count(*)
FROM cover_art_archive.index_listing
- WHERE cover_art_archive.index_listing.release = ?";
+ WHERE cover_art_archive.index_listing.release = ?';
return $self->sql->select_single_value($query, $release_id);
}
@@ -164,7 +164,7 @@ sub load_for_release_groups
my @ids = keys %id_to_rg;
return unless @ids; # nothing to do
- my $query = "SELECT
+ my $query = 'SELECT
DISTINCT ON (release.release_group)
cover_art_archive.index_listing.id,
cover_art_archive.index_listing.release,
@@ -194,12 +194,12 @@ sub load_for_release_groups
ON release_group_cover_art.release = musicbrainz.release.id
JOIN cover_art_archive.image_type
ON cover_art_archive.index_listing.mime_type = cover_art_archive.image_type.mime_type
- WHERE release.release_group IN (" . placeholders(@ids) . ")
+ WHERE release.release_group IN (' . placeholders(@ids) . q{)
AND is_front = true
AND cover_art_presence != 'darkened'
ORDER BY release.release_group, release_group_cover_art.release,
release_event.date_year, release_event.date_month,
- release_event.date_day";
+ release_event.date_day};
for my $row (@{ $self->sql->select_list_of_hashes($query, @ids) }) {
my $artwork = $self->_new_from_row($row);
diff --git a/lib/MusicBrainz/Server/Data/AutoEditorElection.pm b/lib/MusicBrainz/Server/Data/AutoEditorElection.pm
index a99f4fbf2ff..012c9fd641c 100644
--- a/lib/MusicBrainz/Server/Data/AutoEditorElection.pm
+++ b/lib/MusicBrainz/Server/Data/AutoEditorElection.pm
@@ -55,11 +55,11 @@ sub nominate
my $sql = $self->c->sql;
return Sql::run_in_transaction(sub {
- $sql->do("LOCK TABLE autoeditor_election IN EXCLUSIVE MODE");
+ $sql->do('LOCK TABLE autoeditor_election IN EXCLUSIVE MODE');
- my $id = $sql->select_single_value("
- SELECT id FROM " . $self->_table . "
- WHERE candidate = ? AND status IN (?, ?, ?)",
+ my $id = $sql->select_single_value('
+ SELECT id FROM ' . $self->_table . '
+ WHERE candidate = ? AND status IN (?, ?, ?)',
$candidate->id, $ELECTION_SECONDER_1, $ELECTION_SECONDER_2,
$ELECTION_OPEN);
return $self->_entity_class->new( id => $id )
@@ -91,7 +91,7 @@ sub second
$election = $self->get_by_id_locked($election->id);
- die "Forbidden" unless $election->can_second($seconder);
+ die 'Forbidden' unless $election->can_second($seconder);
my %update;
if ($election->status == $ELECTION_SECONDER_1) {
@@ -154,9 +154,9 @@ sub vote
die 'Forbidden' unless $election->can_vote($voter);
- my $old_vote = $sql->select_single_row_hash("
+ my $old_vote = $sql->select_single_row_hash('
SELECT id, vote FROM autoeditor_election_vote
- WHERE autoeditor_election = ? AND voter = ?",
+ WHERE autoeditor_election = ? AND voter = ?',
$election->id, $voter->id);
if (defined $old_vote && $old_vote->{vote} == $vote) {
@@ -164,13 +164,13 @@ sub vote
}
if (defined $old_vote) {
- $self->sql->update_row("autoeditor_election_vote", {
+ $self->sql->update_row('autoeditor_election_vote', {
vote => $vote,
vote_time => DateTime->now(),
}, { id => $old_vote->{id} });
}
else {
- $self->sql->insert_row("autoeditor_election_vote", {
+ $self->sql->insert_row('autoeditor_election_vote', {
autoeditor_election => $election->id,
voter => $voter->id,
vote => $vote,
@@ -204,7 +204,7 @@ sub try_to_close
my $sql = $self->sql;
return Sql::run_in_transaction(sub {
- $sql->do("LOCK TABLE autoeditor_election IN EXCLUSIVE MODE");
+ $sql->do('LOCK TABLE autoeditor_election IN EXCLUSIVE MODE');
$self->_try_to_close_timeout();
$self->_try_to_close_voting();
@@ -216,10 +216,10 @@ sub _try_to_close_timeout
{
my ($self) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE now() - propose_time > INTERVAL ? AND
- status IN (?, ?)";
+ status IN (?, ?)';
my @elections = $self->query_to_list(
$query,
[$PROPOSAL_TIMEOUT, $ELECTION_SECONDER_1, $ELECTION_SECONDER_2],
@@ -237,10 +237,10 @@ sub _try_to_close_voting
{
my ($self) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE now() - propose_time > INTERVAL ? AND
- status = ?";
+ status = ?';
my @elections = $self->query_to_list(
$query,
[$VOTING_TIMEOUT, $ELECTION_OPEN],
@@ -298,8 +298,8 @@ sub load_votes
my ($self, $election) = @_;
my $sql = $self->c->sql;
- my $query = "SELECT * FROM autoeditor_election_vote
- WHERE autoeditor_election = ? ORDER BY vote_time";
+ my $query = 'SELECT * FROM autoeditor_election_vote
+ WHERE autoeditor_election = ? ORDER BY vote_time';
for my $row (@{ $self->sql->select_list_of_hashes($query, $election->id) }) {
my $vote = MusicBrainz::Server::Entity::AutoEditorElectionVote->new({
election_id => $election->id,
@@ -315,9 +315,9 @@ sub load_votes
sub get_all {
my ($self) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- ORDER BY propose_time DESC";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ ORDER BY propose_time DESC';
$self->query_to_list($query);
}
diff --git a/lib/MusicBrainz/Server/Data/Blog.pm b/lib/MusicBrainz/Server/Data/Blog.pm
index a08fdb48c14..85e3cb4ddd1 100644
--- a/lib/MusicBrainz/Server/Data/Blog.pm
+++ b/lib/MusicBrainz/Server/Data/Blog.pm
@@ -22,7 +22,7 @@ sub get_latest_entries {
if (!$entries) {
my $xml;
try {
- $xml = $self->c->lwp->get("http://blog.metabrainz.org/?feed=rss2");
+ $xml = $self->c->lwp->get('http://blog.metabrainz.org/?feed=rss2');
};
return undef unless $xml && $xml->is_success;
diff --git a/lib/MusicBrainz/Server/Data/CDStub.pm b/lib/MusicBrainz/Server/Data/CDStub.pm
index 2cf6bf0b5bd..ba034047719 100644
--- a/lib/MusicBrainz/Server/Data/CDStub.pm
+++ b/lib/MusicBrainz/Server/Data/CDStub.pm
@@ -77,9 +77,9 @@ sub load
sub load_top_cdstubs
{
my ($self, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- ORDER BY lookup_count desc, modify_count DESC";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ ORDER BY lookup_count desc, modify_count DESC';
$self->query_to_list_limited($query, [], $LIMIT_TOP_CDSTUBS, $offset);
}
diff --git a/lib/MusicBrainz/Server/Data/CDStubTrack.pm b/lib/MusicBrainz/Server/Data/CDStubTrack.pm
index edea51b11a9..4baca8ee82c 100644
--- a/lib/MusicBrainz/Server/Data/CDStubTrack.pm
+++ b/lib/MusicBrainz/Server/Data/CDStubTrack.pm
@@ -47,10 +47,10 @@ sub load_for_cdstub
my %id_to_cdstub = map { $_->id => $_ } @cdstubs;
my @ids = keys %id_to_cdstub;
return unless @ids; # nothing to do
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE release IN (" . placeholders(@ids) . ")
- ORDER BY release, sequence";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE release IN (' . placeholders(@ids) . ')
+ ORDER BY release, sequence';
my @tracks = $self->query_to_list($query, \@ids);
foreach my $track (@tracks) {
$id_to_cdstub{$track->cdstub_id}->add_track($track);
diff --git a/lib/MusicBrainz/Server/Data/CDTOC.pm b/lib/MusicBrainz/Server/Data/CDTOC.pm
index f9dea405e24..f8025999e5e 100644
--- a/lib/MusicBrainz/Server/Data/CDTOC.pm
+++ b/lib/MusicBrainz/Server/Data/CDTOC.pm
@@ -39,16 +39,16 @@ sub _entity_class
sub get_by_discid
{
my ($self, $discid) = @_;
- my @result = $self->_get_by_keys("discid", $discid);
+ my @result = $self->_get_by_keys('discid', $discid);
return $result[0];
}
sub find_by_freedbid
{
my ($self, $freedbid) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE freedb_id = ?";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE freedb_id = ?';
$self->query_to_list($query, [$freedbid]);
}
@@ -64,7 +64,7 @@ sub find_or_insert
my $cdtoc = MusicBrainz::Server::Entity::CDTOC->new_from_toc($toc);
if (!$cdtoc) {
- log_error { "Attempt to insert invalid CDTOC; aborting "};
+ log_error { 'Attempt to insert invalid CDTOC; aborting '};
return;
}
diff --git a/lib/MusicBrainz/Server/Data/Collection.pm b/lib/MusicBrainz/Server/Data/Collection.pm
index e4af4d390f5..501ec6f5072 100644
--- a/lib/MusicBrainz/Server/Data/Collection.pm
+++ b/lib/MusicBrainz/Server/Data/Collection.pm
@@ -46,11 +46,11 @@ sub _column_mapping {
sub find_by_subscribed_editor {
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_collection s ON editor_collection.id = s.collection
WHERE s.editor = ? AND s.available
- ORDER BY name COLLATE musicbrainz, editor_collection.id";
+ ORDER BY name COLLATE musicbrainz, editor_collection.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -64,7 +64,7 @@ sub add_entities_to_collection {
$self->sql->do("
INSERT INTO editor_collection_$type (collection, $type)
SELECT DISTINCT add.collection, add.$type
- FROM (VALUES " . join(', ', ("(?::integer, ?::integer)") x @ids) . ") add (collection, $type)
+ FROM (VALUES " . join(', ', ('(?::integer, ?::integer)') x @ids) . ") add (collection, $type)
WHERE NOT EXISTS (
SELECT TRUE FROM editor_collection_$type
WHERE collection = add.collection AND $type = add.$type
@@ -78,7 +78,7 @@ sub remove_entities_from_collection {
$self->sql->auto_commit;
$self->sql->do("DELETE FROM editor_collection_$type
- WHERE collection = ? AND $type IN (" . placeholders(@ids) . ")",
+ WHERE collection = ? AND $type IN (" . placeholders(@ids) . ')',
$collection_id, @ids);
}
@@ -95,9 +95,9 @@ sub is_collection_collaborator {
my ($self, $user_id, $collection_id) = @_;
return $self->sql->select_single_value(
- "SELECT 1 FROM editor_collection WHERE (id = \$1 AND editor = \$2) OR
+ 'SELECT 1 FROM editor_collection WHERE (id = $1 AND editor = $2) OR
EXISTS (SELECT 1 FROM editor_collection_collaborator ecc
- WHERE ecc.collection = \$1 AND ecc.editor = \$2)",
+ WHERE ecc.collection = $1 AND ecc.editor = $2)',
$collection_id, $user_id,
);
}
@@ -184,8 +184,8 @@ sub merge {
map { $_->description }
@collections);
if ($new_description ne '') {
- $self->sql->do("UPDATE editor_collection SET description = ?
- WHERE id = ?",
+ $self->sql->do('UPDATE editor_collection SET description = ?
+ WHERE id = ?',
$new_description,
$new_id);
}
@@ -209,13 +209,13 @@ sub merge_entities {
AND (collection, $type) NOT IN (
SELECT DISTINCT ON (collection) collection, $type
FROM editor_collection_$type
- WHERE $type IN (" . placeholders(@ids) . ")
- )",
+ WHERE $type IN (" . placeholders(@ids) . ')
+ )',
@ids, @ids);
# Move all remaining joins to the new release
$self->sql->do("UPDATE editor_collection_$type SET $type = ?
- WHERE $type IN (".placeholders(@ids).")",
+ WHERE $type IN (".placeholders(@ids).')',
$new_id, @ids);
}
@@ -223,7 +223,7 @@ sub delete_entities {
my ($self, $type, @ids) = @_;
$self->sql->do("DELETE FROM editor_collection_$type
- WHERE $type IN (".placeholders(@ids).")", @ids);
+ WHERE $type IN (".placeholders(@ids).')', @ids);
}
sub find_by {
@@ -345,7 +345,7 @@ sub load_entity_count {
FROM editor_collection_$_ WHERE collection = col.id), 0)"
} entities_with('collections')) . '
) FROM (
- VALUES '. join(', ', ("(?::integer)") x keys %collection_map) .'
+ VALUES '. join(', ', ('(?::integer)') x keys %collection_map) .'
) col (id)';
for my $row (@{ $self->sql->select_list_of_lists($query, keys %collection_map) }) {
@@ -371,7 +371,7 @@ sub update {
!$self->is_empty($old_entity_type, $collection->id)) {
my $new_type = $self->c->model('CollectionType')->get_by_id($row->{type});
- die "The collection type must match the type of entities it contains."
+ die 'The collection type must match the type of entities it contains.'
if $old_entity_type ne $new_type->item_entity_type;
}
diff --git a/lib/MusicBrainz/Server/Data/CommonsImage.pm b/lib/MusicBrainz/Server/Data/CommonsImage.pm
index 0fe22153664..4cc81e1c857 100644
--- a/lib/MusicBrainz/Server/Data/CommonsImage.pm
+++ b/lib/MusicBrainz/Server/Data/CommonsImage.pm
@@ -18,11 +18,11 @@ sub get_commons_image
{
my ($self, $title, %opts) = @_;
my $cache_only = $opts{cache_only} // 0;
- my $url_pattern = "https://%s.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=url&redirects&format=json&iiurlwidth=250&titles=%s";
+ my $url_pattern = 'https://%s.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=url&redirects&format=json&iiurlwidth=250&titles=%s';
return $self->_fetch_cache_or_url($url_pattern, 'imageinfo',
$COMMONS_CACHE_TIMEOUT,
- $title, "commons",
+ $title, 'commons',
\&_commons_image_callback,
cache_only => $cache_only);
}
diff --git a/lib/MusicBrainz/Server/Data/CoreEntity.pm b/lib/MusicBrainz/Server/Data/CoreEntity.pm
index dcb329fc3f7..9662c5ea767 100644
--- a/lib/MusicBrainz/Server/Data/CoreEntity.pm
+++ b/lib/MusicBrainz/Server/Data/CoreEntity.pm
@@ -44,7 +44,7 @@ around get_by_gids => sub
}
if (@missing_gids) {
my $sql = "SELECT new_id, gid FROM $table
- WHERE gid IN (" . placeholders(@missing_gids) . ")";
+ WHERE gid IN (" . placeholders(@missing_gids) . ')';
my $ids = $self->sql->select_list_of_lists($sql, @missing_gids);
my $id_map = $self->get_by_ids(map { $_->[0] } @$ids);
for my $row (@$ids) {
@@ -117,8 +117,8 @@ sub _insert_hook_after { }
sub find_by_name
{
my ($self, $name) = @_;
- my $query = "SELECT " . $self->_columns . " FROM " . $self->_table . "
- WHERE lower(musicbrainz_unaccent(name)) = lower(musicbrainz_unaccent(?))";
+ my $query = 'SELECT ' . $self->_columns . ' FROM ' . $self->_table . '
+ WHERE lower(musicbrainz_unaccent(name)) = lower(musicbrainz_unaccent(?))';
$self->query_to_list($query, [$name]);
}
@@ -133,9 +133,9 @@ sub get_by_ids_sorted_by_name
: 'name COLLATE musicbrainz';
my $key = $self->_id_column;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
- " WHERE $key IN (" . placeholders(@ids) . ") " .
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
+ " WHERE $key IN (" . placeholders(@ids) . ') ' .
" ORDER BY $ordering_condition";
my @result;
@@ -153,13 +153,13 @@ sub find_by_names
return () unless scalar @names;
- my $query = "SELECT " . $self->_columns . ", search_terms.term "
- ."FROM " . $self->_table
- . ", (VALUES "
- . join (",", ("(?)") x scalar(@names))
- . ") search_terms (term)"
- ." WHERE lower(musicbrainz_unaccent(name)) = "
- ." lower(musicbrainz_unaccent(search_terms.term));";
+ my $query = 'SELECT ' . $self->_columns . ', search_terms.term '
+ .'FROM ' . $self->_table
+ . ', (VALUES '
+ . join (',', ('(?)') x scalar(@names))
+ . ') search_terms (term)'
+ .' WHERE lower(musicbrainz_unaccent(name)) = '
+ .' lower(musicbrainz_unaccent(search_terms.term));';
my $results = $self->c->sql->select_list_of_hashes($query, @names);
@@ -204,7 +204,7 @@ sub add_gid_redirects
my ($self, %redirects) = @_;
my $table = $self->_gid_redirect_table;
my $query = "INSERT INTO $table (gid, new_id) VALUES " .
- (join ", ", ('(?, ?)') x keys %redirects);
+ (join ', ', ('(?, ?)') x keys %redirects);
$self->sql->do($query, %redirects);
}
@@ -214,7 +214,7 @@ sub update_gid_redirects
my $table = $self->_gid_redirect_table;
$self->sql->do("
UPDATE $table SET new_id = ?
- WHERE new_id IN (".placeholders(@old_ids).")", $new_id, @old_ids);
+ WHERE new_id IN (".placeholders(@old_ids).')', $new_id, @old_ids);
}
sub _delete_and_redirect_gids
diff --git a/lib/MusicBrainz/Server/Data/CountryArea.pm b/lib/MusicBrainz/Server/Data/CountryArea.pm
index 4d5926c9d15..d785a0a1003 100644
--- a/lib/MusicBrainz/Server/Data/CountryArea.pm
+++ b/lib/MusicBrainz/Server/Data/CountryArea.pm
@@ -9,9 +9,9 @@ with 'MusicBrainz::Server::Data::Role::SelectAll' => { order_by => [ 'name ASC'
around '_get_all_from_db' => sub {
my ($orig, $self, $p) = @_;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table . " JOIN country_area ca ON ca.area = area.id " .
- " ORDER BY " . (join ", ", @{ $p->order_by });
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table . ' JOIN country_area ca ON ca.area = area.id ' .
+ ' ORDER BY ' . (join ', ', @{ $p->order_by });
$self->query_to_list($query);
};
diff --git a/lib/MusicBrainz/Server/Data/CoverArtArchive.pm b/lib/MusicBrainz/Server/Data/CoverArtArchive.pm
index 4a72281cca3..1f63d372367 100644
--- a/lib/MusicBrainz/Server/Data/CoverArtArchive.pm
+++ b/lib/MusicBrainz/Server/Data/CoverArtArchive.pm
@@ -57,7 +57,7 @@ Generate the policy and form values to upload cover art.
sub post_fields {
my ($self, $bucket, $mbid, $id, $opts) = @_;
- my $mime_type = $opts->{mime_type} // "image/jpeg";
+ my $mime_type = $opts->{mime_type} // 'image/jpeg';
my $redirect = $opts->{redirect};
my $suffix = $self->c->model('CoverArt')->image_type_suffix($mime_type);
@@ -66,10 +66,10 @@ sub post_fields {
my $filename = "mbid-$mbid-$id.$suffix";
my %extra_fields = (
- "x-archive-auto-make-bucket" => '1',
- "x-archive-meta-collection" => 'coverartarchive',
- "x-archive-meta-mediatype" => 'image',
- "x-archive-meta-noindex" => 'true',
+ 'x-archive-auto-make-bucket' => '1',
+ 'x-archive-meta-collection' => 'coverartarchive',
+ 'x-archive-meta-mediatype' => 'image',
+ 'x-archive-meta-noindex' => 'true',
);
my $policy = {
@@ -93,7 +93,7 @@ sub post_fields {
signature => $policy_signature_base64,
key => $filename,
acl => 'public-read',
- "content-type" => $mime_type,
+ 'content-type' => $mime_type,
%extra_fields
};
@@ -157,7 +157,7 @@ sub reorder_cover_art {
$self->sql->do(
'UPDATE cover_art_archive.cover_art SET ordering = position.ordering ' .
- 'FROM (VALUES '. (join ", ", (("(?::bigint, ?::integer)") x (keys %$positions))) . ') ' .
+ 'FROM (VALUES '. (join ', ', (('(?::bigint, ?::integer)') x (keys %$positions))) . ') ' .
'AS position (id, ordering) WHERE cover_art.id = position.id', %$positions);
}
@@ -172,9 +172,9 @@ sub merge_releases {
# cover_art_presence enum has 'darkened' as max, and 'absent' as min,
# so we always want the highest value to be preserved
$self->sql->do(
- "UPDATE release_meta SET cover_art_presence = (SELECT max(cover_art_presence)
+ 'UPDATE release_meta SET cover_art_presence = (SELECT max(cover_art_presence)
FROM release_meta WHERE id = any(?))
- WHERE id = ?", [ $new_release, @old_releases ], $new_release);
+ WHERE id = ?', [ $new_release, @old_releases ], $new_release);
for my $old_release (@old_releases) {
$self->sql->do(
diff --git a/lib/MusicBrainz/Server/Data/CoverArtType.pm b/lib/MusicBrainz/Server/Data/CoverArtType.pm
index e0d6723057b..8a6b9805caf 100644
--- a/lib/MusicBrainz/Server/Data/CoverArtType.pm
+++ b/lib/MusicBrainz/Server/Data/CoverArtType.pm
@@ -50,11 +50,11 @@ sub find_by_cover_art_ids
my ($self, @ids) = @_;
return () unless @ids;
- my $query = "SELECT cover_art_type.id AS cover_art_id, " . $self->_columns . " " .
- "FROM " . $self->_table . " " .
- "JOIN cover_art_archive.cover_art_type " .
- "ON cover_art_type.type_id = art_type.id " .
- "WHERE cover_art_type.id IN (" . placeholders(@ids) . ")";
+ my $query = 'SELECT cover_art_type.id AS cover_art_id, ' . $self->_columns . ' ' .
+ 'FROM ' . $self->_table . ' ' .
+ 'JOIN cover_art_archive.cover_art_type ' .
+ 'ON cover_art_type.type_id = art_type.id ' .
+ 'WHERE cover_art_type.id IN (' . placeholders(@ids) . ')';
my %map;
for my $row (@{ $self->sql->select_list_of_hashes($query, @ids) }) {
diff --git a/lib/MusicBrainz/Server/Data/DurationLookup.pm b/lib/MusicBrainz/Server/Data/DurationLookup.pm
index f9ef6b52550..e8153f9cbdb 100644
--- a/lib/MusicBrainz/Server/Data/DurationLookup.pm
+++ b/lib/MusicBrainz/Server/Data/DurationLookup.pm
@@ -70,7 +70,7 @@ sub lookup
push @durations, $duration;
}
- my $dur_string = "'{" . join(",", @durations) . "}'";
+ my $dur_string = q('{) . join(',', @durations) . q(}');
$self->query_to_list_limited(
"SELECT release,
@@ -85,10 +85,10 @@ sub lookup
($all_formats ? '' : ' LEFT JOIN medium_format mf ON m.format = mf.id ') . "
WHERE track_count_matches_cdtoc(m, ?)
AND toc <@ create_bounding_cube($dur_string, ?) " .
- ($all_formats ? '' : ' AND (m.format IS NULL OR mf.has_discids) ') . "
+ ($all_formats ? '' : ' AND (m.format IS NULL OR mf.has_discids) ') . '
GROUP BY release
ORDER BY min_distance, release
- LIMIT 25",
+ LIMIT 25',
[$toc_info{tracks}, $fuzzy], $limit, $offset, sub {
my ($model, $row) = @_;
return {
@@ -109,14 +109,14 @@ sub update
# 3. there are at most 99 tracks on the disc
my $results = $self->sql->select_list_of_hashes(
- "SELECT (sum(track.length) < 4800000 AND
+ 'SELECT (sum(track.length) < 4800000 AND
bool_and(track.length IS NOT NULL) AND
count(track.id) <= 99) AS should_have_index,
medium_index.medium IS NOT NULL AS has_index
FROM track
LEFT JOIN medium_index ON medium_index.medium = track.medium
WHERE track.medium = ? AND track.position > 0 AND track.is_data_track = false
- GROUP BY track.medium, medium_index.medium;", $medium_id);
+ GROUP BY track.medium, medium_index.medium;', $medium_id);
return unless @$results;
@@ -124,7 +124,7 @@ sub update
# get track count, excluding any pregap or data track
my $track_count = $self->sql->select_single_value(
- "SELECT count(*) FROM track WHERE medium = ? AND position > 0 AND is_data_track = false",
+ 'SELECT count(*) FROM track WHERE medium = ? AND position > 0 AND is_data_track = false',
$medium_id
);
@@ -139,7 +139,7 @@ sub update
if ($disc{has_index} && ! $disc{should_have_index})
{
- $self->sql->delete_row("medium_index", { medium => $medium_id });
+ $self->sql->delete_row('medium_index', { medium => $medium_id });
}
if ($disc{has_index} && $disc{should_have_index})
diff --git a/lib/MusicBrainz/Server/Data/Edit.pm b/lib/MusicBrainz/Server/Data/Edit.pm
index 7a4150ab4ed..666a7c63952 100644
--- a/lib/MusicBrainz/Server/Data/Edit.pm
+++ b/lib/MusicBrainz/Server/Data/Edit.pm
@@ -68,7 +68,7 @@ sub _new_from_row
# Readd the class marker
my $class = MusicBrainz::Server::EditRegistry->class_from_type($row->{type})
- or confess"Could not look up class for type ".$row->{type};
+ or confess 'Could not look up class for type '.$row->{type};
state $json = JSON::XS->new;
my $data = $json->decode($row->{data});
@@ -113,8 +113,8 @@ sub get_by_id_and_lock
my ($self, $id) = @_;
my $query =
- "SELECT id FROM edit " .
- "WHERE id = ? FOR UPDATE NOWAIT";
+ 'SELECT id FROM edit ' .
+ 'WHERE id = ? FOR UPDATE NOWAIT';
my $row = $self->sql->select_single_row_hash($query, $id);
return unless defined $row;
@@ -126,7 +126,7 @@ sub get_max_id
{
my ($self) = @_;
- return $self->sql->select_single_value("SELECT max(id) FROM edit");
+ return $self->sql->select_single_value('SELECT max(id) FROM edit');
}
sub find
@@ -160,7 +160,7 @@ sub find
while (my ($param, $value) = each %$p) {
my @values = ref($value) ? @$value : ($value);
next unless @values;
- push @pred, (join " OR ", (("$param = ?") x @values));
+ push @pred, (join ' OR ', (("$param = ?") x @values));
push @args, @values;
}
@@ -247,7 +247,7 @@ sub find_for_subscription
my $type = $subscription->type;
my $query = 'SELECT ' . $self->_columns . ' FROM ' . $self->_table .
" WHERE id IN (SELECT edit FROM edit_$type WHERE $type = ?) " .
- " AND id > ? AND status IN (?, ?) ORDER BY id";
+ ' AND id > ? AND status IN (?, ?) ORDER BY id';
$self->query_to_list(
$query,
[
@@ -329,12 +329,12 @@ sub find_creation_edit {
my ($self, $create_edit_type, $entity_id, %args) = @_;
$args{id_field} ||= 'entity_id';
my $query =
- "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE edit.status = ?
AND edit.type = ?
AND (edit_data.data->>(?::text))::bigint = ?
- ORDER BY edit.id ASC LIMIT 1";
+ ORDER BY edit.id ASC LIMIT 1';
# NB. This function is used for cover art too, which uses bigint IDs.
my ($edit) = $self->query_to_list(
$query,
@@ -375,10 +375,10 @@ sub subscribed_entity_edits {
my $edit_entity_table = 'edit_' . $_;
my $edit_status_table = $edit_entity_table;
my $editor_subscribe_table = 'editor_subscribe_' . $_;
- my $result = <<~"EOSQL";
+ my $result = <<~"SQL";
SELECT edit FROM $edit_entity_table
JOIN $editor_subscribe_table ON $editor_subscribe_table.$_ = $edit_entity_table.$_
- EOSQL
+ SQL
# Join with the edit table if
# (1) this entity doesn't have a materialized edit status (e.g. series), or
@@ -408,7 +408,7 @@ sub subscribed_entity_edits {
} entities_with('collections'));
# FIXME: very similar to $EDIT_IDS_FOR_COLLECTION_SQL, should be generalized
- my $query = <<~"EOSQL";
+ my $query = <<~"SQL";
SELECT $columns FROM $table
JOIN (
$entity_sql
@@ -425,7 +425,7 @@ sub subscribed_entity_edits {
)
ORDER BY id ASC
LIMIT $LIMIT_FOR_EDIT_LISTING
- EOSQL
+ SQL
$self->query_to_list_limited($query, \@args, $limit, $offset, undef,
dollar_placeholders => 1);
@@ -489,13 +489,13 @@ sub merge_entities
@ids, @ids);
$self->sql->do("UPDATE edit_$type SET $type = ?
- WHERE $type IN (".placeholders(@old_ids).")", $new_id, @old_ids);
+ WHERE $type IN (".placeholders(@old_ids).')', $new_id, @old_ids);
}
sub _create_instance {
my ($self, $previewing, %opts) = @_;
- my $type = delete $opts{edit_type} or croak "edit_type required";
+ my $type = delete $opts{edit_type} or croak 'edit_type required';
my $editor = delete $opts{editor};
my $editor_id = delete $opts{editor_id};
@@ -503,7 +503,7 @@ sub _create_instance {
$editor = $self->c->model('Editor')->get_by_id($editor_id);
}
- croak "editor required" unless $editor;
+ croak 'editor required' unless $editor;
my $class = MusicBrainz::Server::EditRegistry->class_from_type($type)
or confess "Could not lookup edit type for $type";
@@ -572,7 +572,7 @@ sub create {
editor => $edit->editor_id,
status => $edit->status,
type => $edit->edit_type,
- open_time => \"now()",
+ open_time => \'now()',
expire_time => \"now() + interval '$interval'",
autoedit => $edit->auto_edit,
close_time => $edit->close_time
@@ -598,7 +598,7 @@ sub create {
@$ids or next;
my $query = "INSERT INTO edit_$type (edit, $type) VALUES ";
- $query .= join ", ", ("(?, ?)") x @$ids;
+ $query .= join ', ', ('(?, ?)') x @$ids;
my @all_ids = ($edit_id) x @$ids;
$self->c->sql->do($query, zip @all_ids, @$ids);
}
@@ -822,7 +822,7 @@ sub _do_reject
return $STATUS_APPLIED;
}
else {
- carp("Could not reject " . $edit->id . ": $err");
+ carp('Could not reject ' . $edit->id . ": $err");
return $STATUS_ERROR;
}
};
@@ -834,7 +834,7 @@ sub accept
{
my ($self, $edit) = @_;
- confess "The edit is not open anymore." if $edit->status != $STATUS_OPEN;
+ confess 'The edit is not open anymore.' if $edit->status != $STATUS_OPEN;
$self->_close($edit, sub { $self->_do_accept(shift) });
}
@@ -843,7 +843,7 @@ sub reject
{
my ($self, $edit, $status) = @_;
$status ||= $STATUS_FAILEDVOTE;
- confess "The edit is not open anymore."
+ confess 'The edit is not open anymore.'
unless $edit->status == $STATUS_OPEN;
$self->_close($edit, sub { $self->_do_reject(shift, $status) });
@@ -859,7 +859,7 @@ sub _close
{
my ($self, $edit, $close_sub) = @_;
my $status = &$close_sub($edit);
- my $query = "UPDATE edit SET status = ?, close_time = NOW() WHERE id = ?";
+ my $query = 'UPDATE edit SET status = ?, close_time = NOW() WHERE id = ?';
$self->c->sql->do($query, $status, $edit->id);
$edit->adjust_edit_pending(-1) unless $edit->auto_edit;
$edit->status($status);
@@ -909,8 +909,8 @@ sub add_link {
sub extend_expiration_time {
my ($self, @ids) = @_;
my $interval = DateTime::Format::Pg->format_interval($MINIMUM_RESPONSE_PERIOD);
- $self->sql->do("UPDATE edit SET expire_time = NOW() + interval ?
- WHERE id = any(?) AND expire_time < NOW() + interval ?", $interval, \@ids, $interval);
+ $self->sql->do('UPDATE edit SET expire_time = NOW() + interval ?
+ WHERE id = any(?) AND expire_time < NOW() + interval ?', $interval, \@ids, $interval);
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Data/EditNote.pm b/lib/MusicBrainz/Server/Data/EditNote.pm
index 6fcd053557d..82e6d91fb54 100644
--- a/lib/MusicBrainz/Server/Data/EditNote.pm
+++ b/lib/MusicBrainz/Server/Data/EditNote.pm
@@ -118,14 +118,14 @@ sub add_note
sub find_by_recipient {
my ($self, $recipient_id, $limit, $offset) = @_;
- my $query = <<~"EOSQL";
+ my $query = <<~"SQL";
SELECT ${\($self->_columns)}
FROM edit_note_recipient
JOIN ${\($self->_table)} ON ${\($self->_table)}.id = edit_note_recipient.edit_note
WHERE recipient = \$1
ORDER BY post_time DESC NULLS LAST, edit DESC
LIMIT $LIMIT_FOR_EDIT_LISTING
- EOSQL
+ SQL
$self->query_to_list_limited(
$query, [$recipient_id], $limit, $offset, undef,
dollar_placeholders => 1,
diff --git a/lib/MusicBrainz/Server/Data/Editor.pm b/lib/MusicBrainz/Server/Data/Editor.pm
index 913dc6e4a35..b8fc2c85d89 100644
--- a/lib/MusicBrainz/Server/Data/Editor.pm
+++ b/lib/MusicBrainz/Server/Data/Editor.pm
@@ -200,8 +200,8 @@ sub find_by_area {
$containment_query,
@containment_query_args,
) = get_area_containment_query('$2', 'area', check_all_levels => 1);
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . "
WHERE area = \$1 OR EXISTS (
SELECT 1 FROM ($containment_query) ac
WHERE ac.descendant = area AND ac.parent = \$1
@@ -216,32 +216,32 @@ sub find_by_area {
sub find_by_privileges
{
my ($self, $privs) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
WHERE (privs & ?) > 0
- ORDER BY editor.name, editor.id";
+ ORDER BY editor.name, editor.id';
$self->query_to_list($query, [$privs]);
}
sub find_by_subscribed_editor
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_editor s ON editor.id = s.subscribed_editor
WHERE s.editor = ?
- ORDER BY editor.name, editor.id";
+ ORDER BY editor.name, editor.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
sub find_subscribers
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_editor s ON editor.id = s.editor
WHERE s.subscribed_editor = ?
- ORDER BY editor.name, editor.id";
+ ORDER BY editor.name, editor.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -249,7 +249,7 @@ sub insert
{
my ($self, $data) = @_;
- die "Invalid user name" if $data->{name} =~ qr{^deleted editor \#\d+$}i;
+ die 'Invalid user name' if $data->{name} =~ qr{^deleted editor \#\d+$}i;
my $plaintext = $data->{password};
$data->{password} = hash_password($plaintext);
$data->{ha1} = ha1_password($data->{name}, $plaintext);
@@ -268,7 +268,7 @@ sub insert
sub search_old_editor_names {
my ($self, $name, $use_regular_expression) = @_;
- my $condition = $use_regular_expression ? "name ~* ?" : "LOWER(name) = LOWER(?)";
+ my $condition = $use_regular_expression ? 'name ~* ?' : 'LOWER(name) = LOWER(?)';
my $query = "SELECT name FROM old_editor_name WHERE $condition LIMIT 100";
@{ $self->sql->select_single_column_array($query, $name) };
@@ -277,7 +277,7 @@ sub search_old_editor_names {
sub unlock_old_editor_name {
my ($self, $name) = @_;
- my $query = "DELETE FROM old_editor_name WHERE name = ?";
+ my $query = 'DELETE FROM old_editor_name WHERE name = ?';
$self->sql->do($query, $name);
}
@@ -308,12 +308,12 @@ sub update_password
my ($self, $editor_name, $password) = @_;
Sql::run_in_transaction(sub {
- $self->sql->do(<<~'EOSQL', hash_password($password), $password, $editor_name);
+ $self->sql->do(<<~'SQL', hash_password($password), $password, $editor_name);
UPDATE editor
SET password = ?, ha1 = md5(name || ':musicbrainz.org:' || ?),
last_login_date = now()
WHERE lower(name) = lower(?)
- EOSQL
+ SQL
}, $self->sql);
}
@@ -392,8 +392,8 @@ sub load_preferences
my %editors = map { $_->id => $_ } grep { defined } @editors
or return;
- my $query = sprintf "SELECT editor, name, value ".
- "FROM editor_preference WHERE editor IN (%s)",
+ my $query = sprintf 'SELECT editor, name, value '.
+ 'FROM editor_preference WHERE editor IN (%s)',
placeholders(keys %editors);
my $prefs = $self->sql->select_list_of_hashes($query, keys %editors);
@@ -462,8 +462,8 @@ sub load_for_collection {
return unless $id; # nothing to do
$self->load($collection);
- my $query = "SELECT " . $self->_columns . ", ep.value AS show_gravatar
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . ', ep.value AS show_gravatar
+ FROM ' . $self->_table . "
JOIN editor_collection_collaborator ecc ON editor.id = ecc.editor
LEFT JOIN editor_preference ep ON ep.editor = editor.id AND ep.name = 'show_gravatar'
WHERE ecc.collection = $id
@@ -484,12 +484,12 @@ sub editors_with_subscriptions {
my ($self, $after, $limit) = @_;
my @tables = (entities_with('subscriptions',
- take => sub { return "editor_subscribe_" . (shift) }),
+ take => sub { return 'editor_subscribe_' . (shift) }),
entities_with(['subscriptions', 'deleted'],
- take => sub { return "editor_subscribe_" . (shift) . "_deleted" }));
+ take => sub { return 'editor_subscribe_' . (shift) . '_deleted' }));
my $ids = join(' UNION ALL ', map { "SELECT editor FROM $_" } @tables);
- my $query = "SELECT " . $self->_columns . ", ep.value AS prefs_value
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . ', ep.value AS prefs_value
+ FROM ' . $self->_table . "
LEFT JOIN editor_preference ep
ON ep.editor = editor.id AND
ep.name = 'subscriptions_email_period'
@@ -520,7 +520,7 @@ sub delete {
$editor_id,
) unless $allow_reuse;
$self->sql->do(
- "UPDATE editor SET name = 'Deleted Editor #' || id,
+ q{UPDATE editor SET name = 'Deleted Editor #' || id,
password = ?,
ha1 = '',
privs = 0,
@@ -532,12 +532,12 @@ sub delete {
birth_date = NULL,
gender = NULL,
deleted = TRUE
- WHERE id = ?",
+ WHERE id = ?},
Authen::Passphrase::RejectAll->new->as_rfc2307,
$editor_id
);
- $self->sql->do("DELETE FROM editor_preference WHERE editor = ?", $editor_id);
+ $self->sql->do('DELETE FROM editor_preference WHERE editor = ?', $editor_id);
$self->c->model('EditorLanguage')->delete_editor($editor_id);
$self->c->model('EditorOAuthToken')->delete_editor($editor_id);
@@ -596,16 +596,16 @@ sub delete {
# and whether or not they have an index to use, as postgresql will not execute
# the later clauses if an earlier one has already excluded the lone editor row.
my $should_delete = $self->sql->select_single_value(
- "SELECT TRUE FROM editor WHERE id = ? " .
- "AND NOT EXISTS (SELECT TRUE FROM edit WHERE editor = editor.id) " .
- "AND NOT EXISTS (SELECT TRUE FROM edit_note WHERE editor = editor.id) " .
- "AND NOT EXISTS (SELECT TRUE FROM vote WHERE editor = editor.id) " .
- "AND NOT EXISTS (SELECT TRUE FROM annotation WHERE editor = editor.id) " .
- "AND NOT EXISTS (SELECT TRUE FROM autoeditor_election_vote WHERE voter = editor.id) " .
- "AND NOT EXISTS (SELECT TRUE FROM autoeditor_election WHERE candidate = editor.id OR proposer = editor.id OR seconder_1 = editor.id OR seconder_2 = editor.id)",
+ 'SELECT TRUE FROM editor WHERE id = ?
+ AND NOT EXISTS (SELECT TRUE FROM edit WHERE editor = editor.id)
+ AND NOT EXISTS (SELECT TRUE FROM edit_note WHERE editor = editor.id)
+ AND NOT EXISTS (SELECT TRUE FROM vote WHERE editor = editor.id)
+ AND NOT EXISTS (SELECT TRUE FROM annotation WHERE editor = editor.id)
+ AND NOT EXISTS (SELECT TRUE FROM autoeditor_election_vote WHERE voter = editor.id)
+ AND NOT EXISTS (SELECT TRUE FROM autoeditor_election WHERE candidate = editor.id OR proposer = editor.id OR seconder_1 = editor.id OR seconder_2 = editor.id)',
$editor_id);
if ($should_delete) {
- $self->sql->do("DELETE FROM editor WHERE id = ?", $editor_id);
+ $self->sql->do('DELETE FROM editor WHERE id = ?', $editor_id);
}
$self->sql->commit;
@@ -780,12 +780,12 @@ sub secondary_counts {
sub last_24h_edit_count
{
my ($self, $editor_id) = @_;
+
my $query =
- "SELECT count(*)
+ q{SELECT count(*)
FROM edit
WHERE editor = ?
- AND open_time >= (now() - interval '1 day')
- ";
+ AND open_time >= (now() - interval '1 day')};
return $self->sql->select_single_value($query, $editor_id);
}
diff --git a/lib/MusicBrainz/Server/Data/EditorLanguage.pm b/lib/MusicBrainz/Server/Data/EditorLanguage.pm
index 14ea8dd6716..d94084a4379 100644
--- a/lib/MusicBrainz/Server/Data/EditorLanguage.pm
+++ b/lib/MusicBrainz/Server/Data/EditorLanguage.pm
@@ -93,7 +93,7 @@ sub set_languages {
sub delete_editor {
my ($self, $editor_id) = @_;
- $self->sql->do("DELETE FROM editor_language WHERE editor = ?", $editor_id);
+ $self->sql->do('DELETE FROM editor_language WHERE editor = ?', $editor_id);
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Data/EditorOAuthToken.pm b/lib/MusicBrainz/Server/Data/EditorOAuthToken.pm
index bace56782f7..a9ee536920e 100644
--- a/lib/MusicBrainz/Server/Data/EditorOAuthToken.pm
+++ b/lib/MusicBrainz/Server/Data/EditorOAuthToken.pm
@@ -69,25 +69,25 @@ sub get_by_refresh_token
sub find_granted_by_editor
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT application, scope, max(refresh_token) AS refresh_token
- FROM " . $self->_table . "
+ my $query = 'SELECT application, scope, max(refresh_token) AS refresh_token
+ FROM ' . $self->_table . '
WHERE
editor = ? AND
access_token IS NOT NULL
GROUP BY application, scope
- ORDER BY application, scope";
+ ORDER BY application, scope';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
sub check_granted_token
{
my ($self, $editor_id, $application_id, $scope, $offline) = @_;
- my $query = "SELECT count(*)
- FROM " . $self->_table . "
+ my $query = 'SELECT count(*)
+ FROM ' . $self->_table . '
WHERE editor = ? AND application = ? AND scope = ? AND
- access_token IS NOT NULL";
+ access_token IS NOT NULL';
if ($offline) {
- $query .= " AND refresh_token IS NOT NULL"
+ $query .= ' AND refresh_token IS NOT NULL'
}
return $self->c->sql->select_single_value($query, $editor_id, $application_id, $scope);
}
@@ -95,15 +95,15 @@ sub check_granted_token
sub delete_application
{
my ($self, $application_id) = @_;
- $self->sql->do("DELETE FROM editor_oauth_token WHERE application = ?", $application_id);
+ $self->sql->do('DELETE FROM editor_oauth_token WHERE application = ?', $application_id);
}
sub delete_editor
{
my ($self, $editor_id) = @_;
- $self->sql->do("DELETE FROM editor_oauth_token WHERE editor = ?", $editor_id);
- $self->sql->do("DELETE FROM editor_oauth_token WHERE application IN ".
- "(SELECT id FROM application WHERE owner = ?)", $editor_id);
+ $self->sql->do('DELETE FROM editor_oauth_token WHERE editor = ?', $editor_id);
+ $self->sql->do('DELETE FROM editor_oauth_token WHERE application IN '.
+ '(SELECT id FROM application WHERE owner = ?)', $editor_id);
}
sub create_authorization_code
@@ -152,10 +152,10 @@ sub grant_access_token
$self->sql->update_row($self->_table, $update, { id => $token->id });
# delete expired tokens that can't be refreshed in the future
- $self->sql->do("DELETE FROM editor_oauth_token
+ $self->sql->do('DELETE FROM editor_oauth_token
WHERE editor = ? AND application = ? AND scope = ? AND
expire_time < ? AND refresh_token IS NULL AND
- access_token IS NOT NULL",
+ access_token IS NOT NULL',
$token->editor_id, $token->application_id, $token->scope,
DateTime->now);
}
@@ -164,9 +164,9 @@ sub revoke_access
{
my ($self, $editor_id, $application_id, $scope) = @_;
- $self->sql->do("DELETE FROM editor_oauth_token
+ $self->sql->do('DELETE FROM editor_oauth_token
WHERE editor = ? AND application = ? AND scope = ? AND
- access_token IS NOT NULL",
+ access_token IS NOT NULL',
$editor_id, $application_id, $scope);
}
diff --git a/lib/MusicBrainz/Server/Data/EditorSubscriptions.pm b/lib/MusicBrainz/Server/Data/EditorSubscriptions.pm
index 4fea40a5e3c..46f2d8b392d 100644
--- a/lib/MusicBrainz/Server/Data/EditorSubscriptions.pm
+++ b/lib/MusicBrainz/Server/Data/EditorSubscriptions.pm
@@ -22,25 +22,25 @@ sub update_subscriptions
$self->sql->do("DELETE FROM $_ WHERE editor = ?", $editor_id)
for entities_with(['subscriptions', 'deleted'],
- take => sub { "editor_subscribe_" . (shift) . "_deleted" });
+ take => sub { 'editor_subscribe_' . (shift) . '_deleted' });
# Remove subscriptions to deleted or private collections
$self->sql->do(
- "DELETE FROM editor_subscribe_collection
- WHERE editor = ? AND NOT available",
+ 'DELETE FROM editor_subscribe_collection
+ WHERE editor = ? AND NOT available',
$editor_id);
$self->sql->do(
"UPDATE $_ SET last_edit_sent = ? WHERE editor = ?",
$max_id, $editor_id
- ) for entities_with('subscriptions', take => sub { "editor_subscribe_" . (shift) });
+ ) for entities_with('subscriptions', take => sub { 'editor_subscribe_' . (shift) });
$self->sql->commit;
}
sub delete_editor {
my ($self, $editor_id) = @_;
$self->sql->do("DELETE FROM $_ WHERE editor = ?", $editor_id)
- for entities_with('subscriptions', take => sub { "editor_subscribe_" . (shift) });
+ for entities_with('subscriptions', take => sub { 'editor_subscribe_' . (shift) });
}
1;
diff --git a/lib/MusicBrainz/Server/Data/Entity.pm b/lib/MusicBrainz/Server/Data/Entity.pm
index b51740070df..24c817d233a 100644
--- a/lib/MusicBrainz/Server/Data/Entity.pm
+++ b/lib/MusicBrainz/Server/Data/Entity.pm
@@ -15,12 +15,12 @@ with 'MusicBrainz::Server::Data::Role::QueryToList';
sub _columns
{
- die("Not implemented");
+ die('Not implemented');
}
sub _table
{
- die("Not implemented");
+ die('Not implemented');
}
sub _column_mapping
@@ -34,8 +34,8 @@ sub _get_by_keys {
@ids = grep { defined && $_ } @ids;
return () unless @ids;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
" WHERE $key = any(?)";
$self->query_to_list($query, [\@ids]);
@@ -54,8 +54,8 @@ sub get_by_id_locked {
return unless $id;
my $key = $self->_id_column;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
" WHERE $key = ? FOR UPDATE";
my $rows = $self->c->sql->select_list_of_hashes($query, $id);
@@ -129,10 +129,10 @@ sub _get_by_key
$query, $id));
}
-sub insert { confess "Not implemented" }
-sub update { confess "Not implemented" }
-sub delete { confess "Not implemented" }
-sub merge { confess "Not implemented" }
+sub insert { confess 'Not implemented' }
+sub update { confess 'Not implemented' }
+sub delete { confess 'Not implemented' }
+sub merge { confess 'Not implemented' }
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Data/EntityAnnotation.pm b/lib/MusicBrainz/Server/Data/EntityAnnotation.pm
index 827a0d62e8c..9393e44bea3 100644
--- a/lib/MusicBrainz/Server/Data/EntityAnnotation.pm
+++ b/lib/MusicBrainz/Server/Data/EntityAnnotation.pm
@@ -50,10 +50,10 @@ sub get_history
sub get_latest
{
my ($self, $id) = @_;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
- " WHERE " . $self->type . " = ?" .
- " ORDER BY created DESC, id DESC LIMIT 1";
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
+ ' WHERE ' . $self->type . ' = ?' .
+ ' ORDER BY created DESC, id DESC LIMIT 1';
my $row = $self->sql->select_single_row_hash($query, $id)
or return undef;
return $self->_new_from_row($row);
@@ -87,12 +87,12 @@ sub edit
sub delete
{
my ($self, @ids) = @_;
- my $query = "DELETE FROM " . $self->table .
- " WHERE " . $self->type . " IN (" . placeholders(@ids) . ")" .
- " RETURNING annotation";
+ my $query = 'DELETE FROM ' . $self->table .
+ ' WHERE ' . $self->type . ' IN (' . placeholders(@ids) . ')' .
+ ' RETURNING annotation';
my $annotations = $self->sql->select_single_column_array($query, @ids);
return 1 unless scalar @$annotations;
- $query = "DELETE FROM annotation WHERE id IN (" . placeholders(@$annotations) . ")";
+ $query = 'DELETE FROM annotation WHERE id IN (' . placeholders(@$annotations) . ')';
$self->sql->do($query, @$annotations);
return 1;
}
@@ -111,9 +111,9 @@ sub merge
SELECT $type, text, row_number() OVER (PARTITION BY $type ORDER BY created DESC)
FROM annotation
JOIN $table ent_annotation ON ent_annotation.annotation = annotation.id
- WHERE $type IN (".placeholders(@ids).")
+ WHERE $type IN (".placeholders(@ids).')
) s
- WHERE row_number = 1",
+ WHERE row_number = 1',
@ids
)
};
@@ -122,8 +122,8 @@ sub merge
if (keys %entity_to_annotation > 1) {
my $new_text = join("\n\n-------\n\n",
uniq
- grep { $_ ne "" }
- map { $entity_to_annotation{$_} // "" }
+ grep { $_ ne '' }
+ map { $entity_to_annotation{$_} // '' }
@ids);
if ($new_text ne '') {
$self->c->model('Edit')->create(
@@ -137,7 +137,7 @@ sub merge
}
$self->sql->do("UPDATE $table SET $type = ?
- WHERE $type IN (".placeholders(@old_ids).")", $new_id, @old_ids);
+ WHERE $type IN (".placeholders(@old_ids).')', $new_id, @old_ids);
}
no Moose;
diff --git a/lib/MusicBrainz/Server/Data/EntityTag.pm b/lib/MusicBrainz/Server/Data/EntityTag.pm
index d981706b6a9..4a7ab067906 100644
--- a/lib/MusicBrainz/Server/Data/EntityTag.pm
+++ b/lib/MusicBrainz/Server/Data/EntityTag.pm
@@ -28,13 +28,13 @@ has [qw( tag_table type )] => (
sub find_tags {
my ($self, $entity_id) = @_;
- my $query = "SELECT tag.name, entity_tag.count,
+ my $query = 'SELECT tag.name, entity_tag.count,
tag.id AS tag_id, genre.id AS genre_id
- FROM " . $self->tag_table . " entity_tag
+ FROM ' . $self->tag_table . ' entity_tag
JOIN tag ON tag.id = entity_tag.tag
LEFT JOIN genre ON tag.name = genre.name
- WHERE " . $self->type . " = ?
- ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz";
+ WHERE ' . $self->type . ' = ?
+ ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz';
$self->query_to_list($query, [$entity_id]);
}
@@ -42,8 +42,8 @@ sub find_tags {
sub find_tag_count
{
my ($self, $entity_id) = @_;
- my $query = "SELECT count(*) FROM " . $self->tag_table . " entity_tag " .
- "WHERE " . $self->type . " = ? ";
+ my $query = 'SELECT count(*) FROM ' . $self->tag_table . ' entity_tag ' .
+ 'WHERE ' . $self->type . ' = ? ';
return $self->sql->select_single_value($query, $entity_id);
}
@@ -51,22 +51,22 @@ sub find_tag_count
sub find_top_tags
{
my ($self, $entity_id, $limit) = @_;
- my $query = "
+ my $query = '
SELECT name, count, tag_id, genre_id FROM ((
SELECT tag.name, entity_tag.count,
tag.id AS tag_id, genre.id AS genre_id
- FROM " . $self->tag_table . " entity_tag
+ FROM ' . $self->tag_table . ' entity_tag
JOIN tag ON tag.id = entity_tag.tag
JOIN genre ON tag.name = genre.name
- WHERE " . $self->type . " = ?
+ WHERE ' . $self->type . ' = ?
ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz
LIMIT ?
) UNION (
SELECT tag.name, entity_tag.count,
tag.id AS tag_id, NULL AS genre_id
- FROM " . $self->tag_table . " entity_tag
+ FROM ' . $self->tag_table . ' entity_tag
JOIN tag ON tag.id = entity_tag.tag
- WHERE " . $self->type . " = ?
+ WHERE ' . $self->type . ' = ?
AND NOT EXISTS (
SELECT 1 FROM genre
WHERE genre.name = tag.name
@@ -74,7 +74,7 @@ sub find_top_tags
ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz
LIMIT ?
)) top_tags
- ORDER BY count DESC, name COLLATE musicbrainz";
+ ORDER BY count DESC, name COLLATE musicbrainz';
$self->query_to_list($query, [$entity_id, $limit, $entity_id, $limit]);
}
@@ -84,12 +84,12 @@ sub find_tags_for_entities
return unless scalar @ids;
- my $query = "SELECT tag.id AS tag_id, tag.name, entity_tag.count,
- entity_tag." . $self->type . " AS entity
- FROM " . $self->tag_table . " entity_tag
+ my $query = 'SELECT tag.id AS tag_id, tag.name, entity_tag.count,
+ entity_tag.' . $self->type . ' AS entity
+ FROM ' . $self->tag_table . ' entity_tag
JOIN tag ON tag.id = entity_tag.tag
- WHERE " . $self->type . " IN (" . placeholders(@ids) . ")
- ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz";
+ WHERE ' . $self->type . ' IN (' . placeholders(@ids) . ')
+ ORDER BY entity_tag.count DESC, tag.name COLLATE musicbrainz';
$self->query_to_list($query, \@ids);
}
@@ -107,8 +107,8 @@ sub find_user_tags_for_entities
FROM $table entity_tag
JOIN tag ON tag.id = entity_tag.tag
WHERE editor = ?
- AND $type IN (" . placeholders(@ids) . ")
- ORDER BY tag.name COLLATE musicbrainz";
+ AND $type IN (" . placeholders(@ids) . ')
+ ORDER BY tag.name COLLATE musicbrainz';
$self->query_to_list($query, [$user_id, @ids], sub {
my ($model, $row) = @_;
@@ -131,13 +131,13 @@ sub find_genres_for_entities
return unless scalar @ids;
- my $query = "SELECT tag.id AS tag_id, tag.name, entity_tag.count,
- entity_tag." . $self->type . " AS entity, genre.id AS genre_id
- FROM " . $self->tag_table . " entity_tag
+ my $query = 'SELECT tag.id AS tag_id, tag.name, entity_tag.count,
+ entity_tag.' . $self->type . ' AS entity, genre.id AS genre_id
+ FROM ' . $self->tag_table . ' entity_tag
JOIN tag ON tag.id = entity_tag.tag
JOIN genre ON tag.name = genre.name
- WHERE " . $self->type . " IN (" . placeholders(@ids) . ")
- ORDER BY tag.name COLLATE musicbrainz";
+ WHERE ' . $self->type . ' IN (' . placeholders(@ids) . ')
+ ORDER BY tag.name COLLATE musicbrainz';
my @tags = $self->query_to_list($query, \@ids);
@@ -161,8 +161,8 @@ sub find_user_genres_for_entities
JOIN tag ON tag.id = entity_tag.tag
JOIN genre ON tag.name = genre.name
WHERE editor = ?
- AND $type IN (" . placeholders(@ids) . ")
- ORDER BY tag.name COLLATE musicbrainz";
+ AND $type IN (" . placeholders(@ids) . ')
+ ORDER BY tag.name COLLATE musicbrainz';
my @tags = $self->query_to_list($query, [$user_id, @ids], sub {
my ($model, $row) = @_;
@@ -205,13 +205,13 @@ sub _new_from_row
sub delete
{
my ($self, @entity_ids) = @_;
- $self->sql->do("
- DELETE FROM " . $self->tag_table . "
- WHERE " . $self->type . " IN (" . placeholders(@entity_ids) . ")",
+ $self->sql->do('
+ DELETE FROM ' . $self->tag_table . '
+ WHERE ' . $self->type . ' IN (' . placeholders(@entity_ids) . ')',
@entity_ids);
- $self->c->sql->do("
- DELETE FROM " . $self->tag_table . "_raw
- WHERE " . $self->type . " IN (" . placeholders(@entity_ids) . ")",
+ $self->c->sql->do('
+ DELETE FROM ' . $self->tag_table . '_raw
+ WHERE ' . $self->type . ' IN (' . placeholders(@entity_ids) . ')',
@entity_ids);
return 1;
}
@@ -227,7 +227,7 @@ sub merge {
# FIXME: Due to the way DISTINCT ON works, if two entities have different
# votes for the same tag by the same editor, the vote that remains on the
# merge target is arbitrary. (ORDER BY doesn't work within the sub-select.)
- $self->c->sql->do(<<~"EOSQL", \@ids, $new_id);
+ $self->c->sql->do(<<~"SQL", \@ids, $new_id);
WITH deleted_tags AS (
DELETE FROM $assoc_table_raw
WHERE $entity_type = any(?)
@@ -236,7 +236,7 @@ sub merge {
INSERT INTO $assoc_table_raw ($entity_type, editor, tag, is_upvote)
SELECT ?, s.editor, s.tag, s.is_upvote
FROM (SELECT DISTINCT ON (editor, tag) editor, tag, is_upvote FROM deleted_tags) s
- EOSQL
+ SQL
$self->c->sql->do(
"DELETE FROM $assoc_table WHERE $entity_type = any(?)",
@@ -460,8 +460,8 @@ sub find_entities
? 'sort_name COLLATE musicbrainz'
: 'name COLLATE musicbrainz';
my $tag_table = $self->tag_table;
- my $query = "SELECT tt.count AS tt_count, " . $self->parent->_columns . "
- FROM " . $self->parent->_table . "
+ my $query = 'SELECT tt.count AS tt_count, ' . $self->parent->_columns . '
+ FROM ' . $self->parent->_table . "
JOIN $tag_table tt ON " . $self->parent->_id_column . " = tt.$type
WHERE tag = ?
AND tt.count > 0
@@ -486,8 +486,8 @@ sub find_editor_entities
my $tag_table = $self->tag_table . '_raw';
my $is_upvote = $show_downvoted ? 0 : 1;
- my $query = "SELECT " . $self->parent->_columns . "
- FROM " . $self->parent->_table . "
+ my $query = 'SELECT ' . $self->parent->_columns . '
+ FROM ' . $self->parent->_table . "
JOIN $tag_table ttr ON " . $self->parent->_id_column . " = ttr.$type
WHERE editor = ? AND tag = ? AND is_upvote = ?
ORDER BY name COLLATE musicbrainz, " . $self->parent->_id_column;
diff --git a/lib/MusicBrainz/Server/Data/Event.pm b/lib/MusicBrainz/Server/Data/Event.pm
index 0302af0c474..3345175c0fd 100644
--- a/lib/MusicBrainz/Server/Data/Event.pm
+++ b/lib/MusicBrainz/Server/Data/Event.pm
@@ -142,7 +142,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "event_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'event_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -153,7 +153,7 @@ sub is_empty {
my ($self, $event_id) = @_;
my $used_in_relationship = used_in_relationship($self->c, event => 'event_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $event_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $event_id, $STATUS_OPEN);
SELECT TRUE
FROM event event_row
WHERE id = ?
@@ -166,7 +166,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
sub load_related_info {
@@ -195,7 +195,7 @@ sub find_by_area
@area_containment_query_args,
) = get_area_containment_query('$2', 'ea.area');
my $query =
- "SELECT " . $self->_columns ."
+ 'SELECT ' . $self->_columns ."
FROM (
SELECT ea.event FROM (
SELECT lae.entity1 AS event, lae.entity0 AS area
@@ -209,9 +209,9 @@ sub find_by_area
SELECT 1 FROM ($area_containment_query) ac
WHERE ac.descendant = ea.area AND ac.parent = \$1
)
- ) s, " . $self->_table . "
+ ) s, " . $self->_table . '
WHERE event.id = s.event
- ORDER BY event.begin_date_year, event.begin_date_month, event.begin_date_day, event.time, event.name COLLATE musicbrainz";
+ ORDER BY event.begin_date_year, event.begin_date_month, event.begin_date_day, event.time, event.name COLLATE musicbrainz';
$self->query_to_list_limited(
$query, [$area_id, @area_containment_query_args], $limit, $offset, undef,
dollar_placeholders => 1,
@@ -239,17 +239,17 @@ sub find_by_artist
sub _order_by {
my ($self, $order) = @_;
- $order = (($order // "") eq "") ? "-date" : $order;
+ $order = (($order // '') eq '') ? '-date' : $order;
- my $order_by = order_by($order, "date", {
- "date" => sub {
- return "begin_date_year, begin_date_month, begin_date_day, time, name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'date', {
+ 'date' => sub {
+ return 'begin_date_year, begin_date_month, begin_date_day, time, name COLLATE musicbrainz'
},
- "name" => sub {
- return "name COLLATE musicbrainz, begin_date_year, begin_date_month, begin_date_day, time"
+ 'name' => sub {
+ return 'name COLLATE musicbrainz, begin_date_year, begin_date_month, begin_date_day, time'
},
- "type" => sub {
- return "type, begin_date_year, begin_date_month, begin_date_day, time, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, begin_date_year, begin_date_month, begin_date_day, time, name COLLATE musicbrainz'
},
});
@@ -345,10 +345,10 @@ sub load_ids
my @gids = map { $_->gid } @events;
return () unless @gids;
- my $query = "
+ my $query = '
SELECT gid, id FROM event
- WHERE gid IN (" . placeholders(@gids) . ")
- ";
+ WHERE gid IN (' . placeholders(@gids) . ')
+ ';
my %map = map { $_->[0] => $_->[1] }
@{ $self->sql->select_list_of_lists($query, @gids) };
@@ -385,16 +385,16 @@ sub _find_performers
my ($self, $ids, $map) = @_;
return unless @$ids;
- my $query = "
+ my $query = '
SELECT lae.entity1 AS event, lae.entity0 AS artist,
lae.entity0_credit AS credit, array_agg(lt.name) AS roles
FROM l_artist_event lae
JOIN link l ON lae.link = l.id
JOIN link_type lt ON l.link_type = lt.id
- WHERE lae.entity1 IN (" . placeholders(@$ids) . ")
+ WHERE lae.entity1 IN (' . placeholders(@$ids) . ')
GROUP BY lae.entity1, lae.entity0, lae.entity0_credit
ORDER BY count(*) DESC, artist, credit
- ";
+ ';
my $rows = $self->sql->select_list_of_lists($query, @$ids);
@@ -446,16 +446,16 @@ sub _find_places
my ($self, $ids, $map) = @_;
return unless @$ids;
- my $query = "
+ my $query = '
SELECT lep.entity0 AS event, lep.entity1 AS place,
lep.entity1_credit AS credit
FROM l_event_place lep
JOIN link l ON lep.link = l.id
JOIN link_type lt ON l.link_type = lt.id
- WHERE lep.entity0 IN (" . placeholders(@$ids) . ")
+ WHERE lep.entity0 IN (' . placeholders(@$ids) . ')
GROUP BY lep.entity0, lep.entity1, lep.entity1_credit
ORDER BY count(*) DESC, place, credit
- ";
+ ';
my $rows = $self->sql->select_list_of_lists($query, @$ids);
@@ -477,16 +477,16 @@ sub _find_areas
my ($self, $ids, $map) = @_;
return unless @$ids;
- my $query = "
+ my $query = '
SELECT lare.entity1 AS event, lare.entity0 AS area,
lare.entity0_credit AS credit
FROM l_area_event lare
JOIN link l ON lare.link = l.id
JOIN link_type lt ON l.link_type = lt.id
- WHERE lare.entity1 IN (" . placeholders(@$ids) . ")
+ WHERE lare.entity1 IN (' . placeholders(@$ids) . ')
GROUP BY lare.entity1, lare.entity0, lare.entity0_credit
ORDER BY count(*) DESC, area, credit
- ";
+ ';
my $rows = $self->sql->select_list_of_lists($query, @$ids);
diff --git a/lib/MusicBrainz/Server/Data/FileCache.pm b/lib/MusicBrainz/Server/Data/FileCache.pm
index 89b6785790f..5485147a670 100644
--- a/lib/MusicBrainz/Server/Data/FileCache.pm
+++ b/lib/MusicBrainz/Server/Data/FileCache.pm
@@ -51,7 +51,7 @@ sub manifest_signature {
if (($time - $instance->manifest_last_checked) > $ttl) {
$instance->manifest_last_checked($time);
- my $path = DBDefs->STATIC_FILES_DIR . "/build/rev-manifest.json";
+ my $path = DBDefs->STATIC_FILES_DIR . '/build/rev-manifest.json';
my @stat = stat($path);
my $mtime = $stat[9];
@@ -69,7 +69,7 @@ sub template_signature {
my $instance = $self->instance;
my $signature_key = 'template' . $template;
unless (exists $instance->file_signatures->{$signature_key}) {
- $instance->file_signatures->{$signature_key} = file_md5_hex(DBDefs->MB_SERVER_ROOT . "/root/" . $template);
+ $instance->file_signatures->{$signature_key} = file_md5_hex(DBDefs->MB_SERVER_ROOT . '/root/' . $template);
}
return $instance->file_signatures->{$signature_key};
diff --git a/lib/MusicBrainz/Server/Data/ISRC.pm b/lib/MusicBrainz/Server/Data/ISRC.pm
index 2833f3e23b9..099e21cebc5 100644
--- a/lib/MusicBrainz/Server/Data/ISRC.pm
+++ b/lib/MusicBrainz/Server/Data/ISRC.pm
@@ -44,10 +44,10 @@ sub find_by_recordings
my @ids = ref $_[0] ? @{$_[0]} : @_;
return () unless @ids;
- my $query = "SELECT ".$self->_columns."
- FROM ".$self->_table."
- WHERE recording IN (" . placeholders(@ids) . ")
- ORDER BY isrc";
+ my $query = 'SELECT '.$self->_columns.'
+ FROM '.$self->_table.'
+ WHERE recording IN (' . placeholders(@ids) . ')
+ ORDER BY isrc';
$self->query_to_list($query, \@ids);
}
@@ -73,10 +73,10 @@ sub find_by_isrc
{
my ($self, $isrc) = @_;
- my $query = "SELECT ".$self->_columns."
- FROM ".$self->_table."
+ my $query = 'SELECT '.$self->_columns.'
+ FROM '.$self->_table.'
WHERE isrc = ?
- ORDER BY id";
+ ORDER BY id';
$self->query_to_list($query, [$isrc]);
}
@@ -126,7 +126,7 @@ sub insert
my ($self, @isrcs) = @_;
$self->sql->do('INSERT INTO isrc (recording, isrc, source) VALUES ' .
- (join ",", (("(?, ?, ?)") x @isrcs)),
+ (join ',', (('(?, ?, ?)') x @isrcs)),
map { $_->{recording_id}, $_->{isrc}, $_->{source} || undef }
@isrcs);
}
diff --git a/lib/MusicBrainz/Server/Data/ISWC.pm b/lib/MusicBrainz/Server/Data/ISWC.pm
index 0640da7cc65..4ebe11bfb2f 100644
--- a/lib/MusicBrainz/Server/Data/ISWC.pm
+++ b/lib/MusicBrainz/Server/Data/ISWC.pm
@@ -40,8 +40,8 @@ sub _entity_class
sub _find {
my ($self, $field, @ids) = @_;
- my $query = "SELECT " . $self->_columns ."
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns .'
+ FROM ' . $self->_table . "
WHERE $field = any(?)
ORDER BY iswc, id";
@@ -186,7 +186,7 @@ sub insert
my ($self, @iswcs) = @_;
$self->sql->do('INSERT INTO iswc (work, iswc) VALUES ' .
- (join ",", (("(?, ?)") x @iswcs)),
+ (join ',', (('(?, ?)') x @iswcs)),
map { $_->{work_id}, $_->{iswc} } @iswcs);
}
diff --git a/lib/MusicBrainz/Server/Data/Instrument.pm b/lib/MusicBrainz/Server/Data/Instrument.pm
index ccc157eb654..1f8ba1090df 100644
--- a/lib/MusicBrainz/Server/Data/Instrument.pm
+++ b/lib/MusicBrainz/Server/Data/Instrument.pm
@@ -124,12 +124,12 @@ sub _hash_to_row {
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
}
});
@@ -139,7 +139,7 @@ sub _order_by {
sub get_all {
my $self = shift;
- my $query = "SELECT " . $self->_columns . " FROM " . $self->_table;
+ my $query = 'SELECT ' . $self->_columns . ' FROM ' . $self->_table;
$self->query_to_list($query);
}
diff --git a/lib/MusicBrainz/Server/Data/Label.pm b/lib/MusicBrainz/Server/Data/Label.pm
index ad962d6e911..d6ad4e5cb0c 100644
--- a/lib/MusicBrainz/Server/Data/Label.pm
+++ b/lib/MusicBrainz/Server/Data/Label.pm
@@ -78,11 +78,11 @@ sub _column_mapping
sub find_by_subscribed_editor
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_label s ON label.id = s.label
WHERE s.editor = ?
- ORDER BY label.name COLLATE musicbrainz, label.id";
+ ORDER BY label.name COLLATE musicbrainz, label.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -92,8 +92,8 @@ sub find_by_area {
$containment_query,
@containment_query_args,
) = get_area_containment_query('$2', 'area', check_all_levels => 1);
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . "
WHERE area = \$1 OR EXISTS (
SELECT 1 FROM ($containment_query) ac
WHERE ac.descendant = area AND ac.parent = \$1
@@ -109,35 +109,35 @@ sub find_by_release
{
my ($self, $release_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN release_label ON release_label.label = label.id
WHERE release_label.release = ?
- ORDER BY label.name COLLATE musicbrainz";
+ ORDER BY label.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$release_id], $limit, $offset);
}
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "label_code" => sub {
- return "label_code, name COLLATE musicbrainz"
+ 'label_code' => sub {
+ return 'label_code, name COLLATE musicbrainz'
},
- "area" => sub {
- return "area, name COLLATE musicbrainz"
+ 'area' => sub {
+ return 'area, name COLLATE musicbrainz'
},
- "begin_date" => sub {
- return "begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz"
+ 'begin_date' => sub {
+ return 'begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz'
},
- "end_date" => sub {
- return "end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz"
+ 'end_date' => sub {
+ return 'end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
}
});
@@ -264,7 +264,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "label_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'label_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -275,7 +275,7 @@ sub is_empty {
my ($self, $label_id) = @_;
my $used_in_relationship = used_in_relationship($self->c, label => 'label_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $label_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $label_id, $STATUS_OPEN);
SELECT TRUE
FROM label label_row
WHERE id = ?
@@ -291,7 +291,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Data/Language.pm b/lib/MusicBrainz/Server/Data/Language.pm
index ffe5643facf..2efa6743479 100644
--- a/lib/MusicBrainz/Server/Data/Language.pm
+++ b/lib/MusicBrainz/Server/Data/Language.pm
@@ -57,14 +57,6 @@ sub load_for_works {
load_subobjects($self, 'language', map { $_->all_languages } @objs);
- for my $work (@objs) {
- for my $wl ($work->all_languages) {
- if ($wl->language && $wl->language->iso_code_3 eq "zxx") {
- $wl->language->name(l("[No lyrics]"));
- }
- }
- }
-
return;
}
diff --git a/lib/MusicBrainz/Server/Data/Link.pm b/lib/MusicBrainz/Server/Data/Link.pm
index 7f18d46b898..dce2ca427d3 100644
--- a/lib/MusicBrainz/Server/Data/Link.pm
+++ b/lib/MusicBrainz/Server/Data/Link.pm
@@ -52,7 +52,7 @@ sub _load_attributes
my ($self, $data, @ids) = @_;
if (@ids) {
- my $query = "
+ my $query = q{
SELECT
link,
attr.id,
@@ -77,8 +77,8 @@ sub _load_attributes
LEFT OUTER JOIN link_attribute_credit attr_credit USING (link, attribute_type)
LEFT OUTER JOIN instrument ins ON ins.gid = attr.gid
LEFT OUTER JOIN instrument_type ins_t ON ins.type = ins_t.id
- WHERE link IN (" . placeholders(@ids) . ")
- ORDER BY link, attr.name";
+ WHERE link IN (} . placeholders(@ids) . ')
+ ORDER BY link, attr.name';
for my $row (@{ $self->sql->select_list_of_hashes($query, @ids) }) {
if (my $link = $data->{ $row->{link} }) {
@@ -149,7 +149,7 @@ sub find
my ($self, $values) = @_;
my (@joins, @conditions, @args);
- push @conditions, "link_type = ?";
+ push @conditions, 'link_type = ?';
push @args, $values->{link_type_id};
# end_date_implies_ended
@@ -160,7 +160,7 @@ sub find
$values->{ended} //= 0;
- push @conditions, "ended = ?";
+ push @conditions, 'ended = ?';
push @args, $values->{ended};
foreach my $date_key (qw( begin_date end_date )) {
@@ -177,7 +177,7 @@ sub find
my @attrs = @{ $values->{attributes} // [] };
- push @conditions, "attribute_count = ?";
+ push @conditions, 'attribute_count = ?';
push @args, scalar(@attrs);
my $i = 1;
@@ -214,7 +214,7 @@ sub find
$i += 1;
}
- my $query = "SELECT link.id FROM link " . join(" ", @joins) . " WHERE " . join(" AND ", @conditions);
+ my $query = 'SELECT link.id FROM link ' . join(' ', @joins) . ' WHERE ' . join(' AND ', @conditions);
return $self->sql->select_single_value($query, @args);
}
@@ -232,20 +232,20 @@ sub find_or_insert
attribute_count => scalar(@attrs),
ended => $values->{ended}
};
- add_partial_date_to_row($row, $values->{begin_date}, "begin_date");
- add_partial_date_to_row($row, $values->{end_date}, "end_date");
- $id = $self->sql->insert_row("link", $row, "id");
+ add_partial_date_to_row($row, $values->{begin_date}, 'begin_date');
+ add_partial_date_to_row($row, $values->{end_date}, 'end_date');
+ $id = $self->sql->insert_row('link', $row, 'id');
foreach my $attr (@attrs) {
my $attribute_type = $attr->{type}{id};
- $self->sql->insert_row("link_attribute", {
+ $self->sql->insert_row('link_attribute', {
link => $id,
attribute_type => $attribute_type,
});
if (non_empty($attr->{credited_as})) {
- $self->sql->insert_row("link_attribute_credit", {
+ $self->sql->insert_row('link_attribute_credit', {
attribute_type => $attribute_type,
link => $id,
credited_as => $attr->{credited_as}
@@ -253,7 +253,7 @@ sub find_or_insert
}
if (non_empty($attr->{text_value})) {
- $self->sql->insert_row("link_attribute_text_value", {
+ $self->sql->insert_row('link_attribute_text_value', {
link => $id,
attribute_type => $attribute_type,
text_value => $attr->{text_value}
diff --git a/lib/MusicBrainz/Server/Data/LinkAttributeType.pm b/lib/MusicBrainz/Server/Data/LinkAttributeType.pm
index 59ff48922ed..1b3cbdb34f2 100644
--- a/lib/MusicBrainz/Server/Data/LinkAttributeType.pm
+++ b/lib/MusicBrainz/Server/Data/LinkAttributeType.pm
@@ -60,9 +60,9 @@ sub _columns
WHERE attribute_type = link_attribute_type.id),
false
) AS creditable, ' .
- "COALESCE(ins.instrument_comment, '') AS instrument_comment, " .
+ q{COALESCE(ins.instrument_comment, '') AS instrument_comment, } .
'ins.instrument_type_id, ' .
- "COALESCE(ins.instrument_type_name, '') AS instrument_type_name";
+ q{COALESCE(ins.instrument_type_name, '') AS instrument_type_name};
}
sub _column_mapping
@@ -130,7 +130,7 @@ sub insert
my ($self, $values) = @_;
my $row = $self->_hash_to_row($values);
- $row->{id} = $self->sql->select_single_value("SELECT nextval('link_attribute_type_id_seq')");
+ $row->{id} = $self->sql->select_single_value(q{SELECT nextval('link_attribute_type_id_seq')});
$row->{gid} = $values->{gid} || generate_gid();
$row->{root} = $row->{parent} ? $self->find_root($row->{parent}) : $row->{id};
$self->sql->insert_row('link_attribute_type', $row);
@@ -355,7 +355,7 @@ sub merge_instrument_attributes {
$new_link->{attributes} = [values %new_attributes];
my $new_link_id = $self->c->model('Link')->find_or_insert($new_link);
- my $relationships = $self->sql->select_list_of_hashes(<<~"EOSQL", $new_link_id, $old_link_id, $new_link_id);
+ my $relationships = $self->sql->select_list_of_hashes(<<~"SQL", $new_link_id, $old_link_id, $new_link_id);
UPDATE l_${entity_type0}_${entity_type1} r1 SET link = ? WHERE link = ? AND NOT EXISTS (
SELECT 1
FROM l_${entity_type0}_${entity_type1} r2
@@ -365,7 +365,7 @@ sub merge_instrument_attributes {
AND r2.link_order = r1.link_order
)
RETURNING *
- EOSQL
+ SQL
# Delete leftover duplicate relationships already using $new_link_id.
$self->sql->do("DELETE FROM l_${entity_type0}_${entity_type1} WHERE link = ?", $old_link_id);
diff --git a/lib/MusicBrainz/Server/Data/LinkType.pm b/lib/MusicBrainz/Server/Data/LinkType.pm
index e357904aaf3..8787f37d277 100644
--- a/lib/MusicBrainz/Server/Data/LinkType.pm
+++ b/lib/MusicBrainz/Server/Data/LinkType.pm
@@ -47,11 +47,11 @@ sub _load_attributes
my ($self, $data, @ids) = @_;
if (@ids) {
- my $query = "
+ my $query = '
SELECT *
FROM link_type_attribute_type
- WHERE link_type IN (" . placeholders(@ids) . ")
- ORDER BY link_type";
+ WHERE link_type IN (' . placeholders(@ids) . ')
+ ORDER BY link_type';
for my $row (@{ $self->sql->select_list_of_hashes($query, @ids) }) {
my $id = $row->{link_type};
if (exists $data->{$id}) {
@@ -97,11 +97,11 @@ around get_by_gid => sub
sub find_by_attribute
{
my ($self, $attribute_id) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN link_type_attribute_type ltat ON ltat.link_type = link_type.id
WHERE ltat.attribute_type = ?
- ORDER BY link_type.name COLLATE musicbrainz";
+ ORDER BY link_type.name COLLATE musicbrainz';
$self->query_to_list($query, [$attribute_id]);
}
@@ -121,7 +121,7 @@ sub get_tree
my $extra_condition = '';
unless ($opts{get_deprecated_and_empty}) {
- $extra_condition = <<~'EOSQL';
+ $extra_condition = <<~'SQL';
AND (
is_deprecated = FALSE
OR
@@ -129,7 +129,7 @@ sub get_tree
SELECT 1 FROM link WHERE link.link_type = lt.id
)
)
- EOSQL
+ SQL
}
for my $row (@{
@@ -166,7 +166,7 @@ sub get_full_tree
my $extra_condition = '';
unless ($get_deprecated_and_empty) {
- $extra_condition = <<~'EOSQL';
+ $extra_condition = <<~'SQL';
WHERE (
is_deprecated = FALSE
OR
@@ -174,7 +174,7 @@ sub get_full_tree
SELECT 1 FROM link WHERE link.link_type = lt.id
)
)
- EOSQL
+ SQL
}
for my $row (@{
@@ -300,13 +300,13 @@ sub set_examples {
my ($self, $id, $examples) = @_;
my $link_table = $self->sql->select_single_value(
- "SELECT 'l_' || entity_type0 || '_' || entity_type1
+ q(SELECT 'l_' || entity_type0 || '_' || entity_type1
FROM link_type
- WHERE id = ?",
+ WHERE id = ?),
$id
);
- my $documentation_link_table = sprintf "documentation.%s_example",
+ my $documentation_link_table = sprintf 'documentation.%s_example',
$link_table;
$self->sql->do(
diff --git a/lib/MusicBrainz/Server/Data/Medium.pm b/lib/MusicBrainz/Server/Data/Medium.pm
index 8a5c7d4fa20..f3cc63a14a1 100644
--- a/lib/MusicBrainz/Server/Data/Medium.pm
+++ b/lib/MusicBrainz/Server/Data/Medium.pm
@@ -96,10 +96,10 @@ sub load_for_releases
my @ids = keys %id_to_release;
return unless @ids; # nothing to do
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE release IN (" . placeholders(@ids) . ")
- ORDER BY release, position";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE release IN (' . placeholders(@ids) . ')
+ ORDER BY release, position';
my @mediums = $self->query_to_list($query, \@ids);
foreach my $medium (@mediums) {
foreach my $release (@{ $id_to_release{$medium->release_id} })
@@ -117,7 +117,7 @@ sub load_for_releases
sub update
{
my ($self, $medium_id, $medium_hash) = @_;
- die "update cannot update tracklist" if exists $medium_hash->{tracklist};
+ die 'update cannot update tracklist' if exists $medium_hash->{tracklist};
my $row = $self->_create_row($medium_hash);
return unless %$row;
@@ -196,7 +196,7 @@ sub find_for_cdstub {
'SELECT ' . join(', ', $self->c->model('Release')->_columns,
map { "medium.$_ AS m_$_" } qw(
id name track_count release position format edits_pending
- )) . "
+ )) . q(
FROM (
SELECT id, ts_rank_cd(mb_simple_tsvector(name), query, 2) AS rank,
name
@@ -211,7 +211,7 @@ sub find_for_cdstub {
WHERE track_count_matches_cdtoc(medium, ?)
AND (medium_format.id IS NULL OR medium_format.has_discids)
ORDER BY name.rank DESC, name.name COLLATE musicbrainz,
- release.artist_credit";
+ release.artist_credit);
$self->query_to_list(
$query,
@@ -231,10 +231,10 @@ sub set_lengths_to_cdtoc
{
my ($self, $medium_id, $cdtoc_id) = @_;
my $cdtoc = $self->c->model('CDTOC')->get_by_id($cdtoc_id)
- or die "Could not load CDTOC";
+ or die 'Could not load CDTOC';
my $medium = $self->get_by_id($medium_id)
- or die "Could not load tracklist";
+ or die 'Could not load tracklist';
$self->c->model('Track')->load_for_mediums($medium);
$self->c->model('ArtistCredit')->load($medium->all_tracks);
diff --git a/lib/MusicBrainz/Server/Data/MediumCDTOC.pm b/lib/MusicBrainz/Server/Data/MediumCDTOC.pm
index 1d61701cfd2..e361f02a724 100644
--- a/lib/MusicBrainz/Server/Data/MediumCDTOC.pm
+++ b/lib/MusicBrainz/Server/Data/MediumCDTOC.pm
@@ -45,10 +45,10 @@ sub find_by_medium
my ($self, @medium_ids) = @_;
return () unless @medium_ids;
- my $query = "
- SELECT " . $self->_columns . " FROM " . $self->_table . "
- WHERE medium IN (" . placeholders(@medium_ids) . ")
- ORDER BY id";
+ my $query = '
+ SELECT ' . $self->_columns . ' FROM ' . $self->_table . '
+ WHERE medium IN (' . placeholders(@medium_ids) . ')
+ ORDER BY id';
$self->query_to_list($query, \@medium_ids);
}
diff --git a/lib/MusicBrainz/Server/Data/Place.pm b/lib/MusicBrainz/Server/Data/Place.pm
index 6778b174e91..7c1759fabb9 100644
--- a/lib/MusicBrainz/Server/Data/Place.pm
+++ b/lib/MusicBrainz/Server/Data/Place.pm
@@ -154,7 +154,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "place_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'place_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -165,7 +165,7 @@ sub is_empty {
my ($self, $place_id) = @_;
my $used_in_relationship = used_in_relationship($self->c, place => 'place_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $place_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $place_id, $STATUS_OPEN);
SELECT TRUE
FROM place place_row
WHERE id = ?
@@ -178,7 +178,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
sub find_by_area {
@@ -187,8 +187,8 @@ sub find_by_area {
$containment_query,
@containment_query_args,
) = get_area_containment_query('$2', 'area', check_all_levels => 1);
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . "
WHERE area = \$1 OR EXISTS (
SELECT 1 FROM ($containment_query) ac
WHERE ac.descendant = area AND ac.parent = \$1
@@ -202,24 +202,24 @@ sub find_by_area {
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "area" => sub {
- return "area, name COLLATE musicbrainz"
+ 'area' => sub {
+ return 'area, name COLLATE musicbrainz'
},
- "address" => sub {
- return "address COLLATE musicbrainz, name COLLATE musicbrainz"
+ 'address' => sub {
+ return 'address COLLATE musicbrainz, name COLLATE musicbrainz'
},
- "begin_date" => sub {
- return "begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz"
+ 'begin_date' => sub {
+ return 'begin_date_year, begin_date_month, begin_date_day, name COLLATE musicbrainz'
},
- "end_date" => sub {
- return "end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz"
+ 'end_date' => sub {
+ return 'end_date_year, end_date_month, end_date_day, name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
}
});
diff --git a/lib/MusicBrainz/Server/Data/Rating.pm b/lib/MusicBrainz/Server/Data/Rating.pm
index 3d0e5f4ccea..6be29bccd44 100644
--- a/lib/MusicBrainz/Server/Data/Rating.pm
+++ b/lib/MusicBrainz/Server/Data/Rating.pm
@@ -90,7 +90,7 @@ sub load_user_ratings
my $type = $self->type;
my $query = "
SELECT $type AS id, rating FROM ${type}_rating_raw
- WHERE editor = ? AND $type IN (".placeholders(@ids).")";
+ WHERE editor = ? AND $type IN (".placeholders(@ids).')';
for my $row (@{ $self->sql->select_list_of_hashes($query, $user_id, @ids) }) {
my $obj = $id_to_obj{$row->{id}};
@@ -146,9 +146,9 @@ sub merge
sub delete
{
my ($self, @entity_ids) = @_;
- $self->c->sql->do("
- DELETE FROM " . $self->type . "_rating_raw
- WHERE " . $self->type . " IN (" . placeholders(@entity_ids) . ")",
+ $self->c->sql->do('
+ DELETE FROM ' . $self->type . '_rating_raw
+ WHERE ' . $self->type . ' IN (' . placeholders(@entity_ids) . ')',
@entity_ids);
return 1;
}
diff --git a/lib/MusicBrainz/Server/Data/Recording.pm b/lib/MusicBrainz/Server/Data/Recording.pm
index 1bd5a90dcc3..08d83766056 100644
--- a/lib/MusicBrainz/Server/Data/Recording.pm
+++ b/lib/MusicBrainz/Server/Data/Recording.pm
@@ -70,11 +70,11 @@ sub find_artist_credits_by_artist
{
my ($self, $artist_id) = @_;
- my $query = "SELECT DISTINCT rec.artist_credit
+ my $query = 'SELECT DISTINCT rec.artist_credit
FROM recording rec
JOIN artist_credit_name acn
ON acn.artist_credit = rec.artist_credit
- WHERE acn.artist = ?";
+ WHERE acn.artist = ?';
my $ids = $self->sql->select_single_column_array($query, $artist_id);
return $self->c->model('ArtistCredit')->find_by_ids($ids);
}
@@ -85,30 +85,30 @@ sub find_by_artist
my (@where_query, @where_args);
- push @where_query, "acn.artist = ?";
+ push @where_query, 'acn.artist = ?';
push @where_args, $artist_id;
if (exists $args{filter}) {
my %filter = %{ $args{filter} };
if (exists $filter{name}) {
- push @where_query, "(mb_simple_tsvector(recording.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR recording.name = ?)";
+ push @where_query, q{(mb_simple_tsvector(recording.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR recording.name = ?)};
push @where_args, $filter{name}, $filter{name};
}
if (exists $filter{artist_credit_id}) {
- push @where_query, "recording.artist_credit = ?";
+ push @where_query, 'recording.artist_credit = ?';
push @where_args, $filter{artist_credit_id};
}
}
- my $query = "SELECT DISTINCT " . $self->_columns . ",
+ my $query = 'SELECT DISTINCT ' . $self->_columns . ',
recording.name COLLATE musicbrainz AS name_collate,
comment COLLATE musicbrainz AS comment_collate
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn
ON acn.artist_credit = recording.artist_credit
- WHERE " . join(" AND ", @where_query) . "
+ WHERE ' . join(' AND ', @where_query) . '
ORDER BY recording.name COLLATE musicbrainz,
- comment COLLATE musicbrainz";
+ comment COLLATE musicbrainz';
$self->query_to_list_limited($query, \@where_args, $limit, $offset);
}
@@ -116,11 +116,11 @@ sub find_by_artist_credit
{
my ($self, $artist_credit_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
name COLLATE musicbrainz AS name_collate
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
WHERE artist_credit = ?
- ORDER BY name COLLATE musicbrainz";
+ ORDER BY name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$artist_credit_id], $limit, $offset);
}
@@ -128,9 +128,9 @@ sub find_by_instrument {
my ($self, $instrument_id, $limit, $offset) = @_;
# NOTE: if more tables than l_artist_recording are added here, check admin/BuildSitemaps.pl
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . q{,
array_agg(json_build_object('typeName', link_type.name, 'credit', lac.credited_as)) AS instrument_credits_and_rel_types
- FROM " . $self->_table . "
+ FROM } . $self->_table . '
JOIN l_artist_recording ON l_artist_recording.entity1 = recording.id
JOIN link ON link.id = l_artist_recording.link
JOIN link_type ON link_type.id = link.link_type
@@ -143,7 +143,7 @@ sub find_by_instrument {
)
WHERE instrument.id = ?
GROUP BY recording.id
- ORDER BY recording.name COLLATE musicbrainz";
+ ORDER BY recording.name COLLATE musicbrainz';
$self->query_to_list_limited(
$query,
@@ -162,13 +162,13 @@ sub find_by_release
{
my ($self, $release_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN track ON track.recording = recording.id
JOIN medium ON medium.id = track.medium
JOIN release ON release.id = medium.release
WHERE release.id = ?
- ORDER BY recording.name COLLATE musicbrainz";
+ ORDER BY recording.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$release_id], $limit, $offset);
}
@@ -178,11 +178,11 @@ sub find_by_works
my ($self, $work_ids, $limit, $offset) = @_;
return ([], 0) unless @$work_ids;
- my $query = "SELECT " . $self->_columns . "
- FROM ". $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM '. $self->_table . '
JOIN l_recording_work lrw ON lrw.entity0 = recording.id
WHERE lrw.entity1 = any(?)
- ORDER BY recording.name COLLATE musicbrainz";
+ ORDER BY recording.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$work_ids], $limit, $offset);
}
@@ -190,20 +190,20 @@ sub find_by_works
sub _order_by {
my ($self, $order) = @_;
- my $extra_join = "";
- my $also_select = "";
+ my $extra_join = '';
+ my $also_select = '';
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "artist" => sub {
- $extra_join = "JOIN artist_credit ac ON ac.id = recording.artist_credit";
- $also_select = "ac.name AS ac_name";
- return "ac_name COLLATE musicbrainz, recording.name COLLATE musicbrainz";
+ 'artist' => sub {
+ $extra_join = 'JOIN artist_credit ac ON ac.id = recording.artist_credit';
+ $also_select = 'ac.name AS ac_name';
+ return 'ac_name COLLATE musicbrainz, recording.name COLLATE musicbrainz';
},
- "length" => sub {
- return "length, name COLLATE musicbrainz"
+ 'length' => sub {
+ return 'length, name COLLATE musicbrainz'
},
});
@@ -272,7 +272,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "recording_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'recording_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -394,7 +394,7 @@ sub appears_on
my @ids = map { $_->id } @$recordings;
- my $hits_query = <<~'EOSQL';
+ my $hits_query = <<~'SQL';
SELECT rec.id AS recording, rgs.hits
FROM recording rec, LATERAL (
SELECT count(DISTINCT rg.id) AS hits
@@ -405,19 +405,20 @@ sub appears_on
WHERE t.recording = rec.id
) rgs
WHERE rec.id = any(?)
- EOSQL
+ SQL
my %hits_map;
for my $row (@{ $self->sql->select_list_of_hashes($hits_query, \@ids) }) {
$hits_map{ $row->{recording} } = $row->{hits};
}
- my $query = <<~'EOSQL';
+ my $query = <<~'SQL';
SELECT rec.id AS recording, rgs.*
FROM recording rec, LATERAL (
SELECT DISTINCT rg.id, rg.gid, rg.name,
rg.type AS primary_type_id,
rg.artist_credit AS artist_credit_id,
+ rg.edits_pending,
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day
@@ -437,7 +438,7 @@ sub appears_on
rgs.first_release_date_year,
rgs.first_release_date_month,
rgs.first_release_date_day
- EOSQL
+ SQL
my %map;
for my $row (@{ $self->sql->select_list_of_hashes($query, $limit, \@ids) }) {
diff --git a/lib/MusicBrainz/Server/Data/Relationship.pm b/lib/MusicBrainz/Server/Data/Relationship.pm
index cb83d078abf..ce638e5f136 100644
--- a/lib/MusicBrainz/Server/Data/Relationship.pm
+++ b/lib/MusicBrainz/Server/Data/Relationship.pm
@@ -38,7 +38,7 @@ use List::UtilsBy qw( nsort_by partition_by );
use aliased 'MusicBrainz::Server::Entity::RelationshipTargetTypeGroup';
use aliased 'MusicBrainz::Server::Entity::RelationshipLinkTypeGroup';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Data::Entity';
@@ -90,7 +90,7 @@ sub _new_from_row
$info{target_type} = $type0;
}
else {
- carp "Neither relationship end-point matched the object.";
+ carp 'Neither relationship end-point matched the object.';
}
}
@@ -126,7 +126,7 @@ sub get_by_ids
my ($self, $type0, $type1, @ids) = @_;
$self->_check_types($type0, $type1);
- my $query = "SELECT * FROM l_${type0}_${type1} WHERE id IN (" . placeholders(@ids) . ")";
+ my $query = "SELECT * FROM l_${type0}_${type1} WHERE id IN (" . placeholders(@ids) . ')';
my $rows = $self->sql->select_list_of_hashes($query, @ids) or return undef;
return { map { $_->{id} => $self->_new_from_row($_, $type0, $type1) } @$rows };
@@ -150,7 +150,7 @@ sub _load
my (@cond, @params, $target, $target_id, $source_id, $query);
if ($type eq $type0) {
- my $condstring = "entity0 IN (" . placeholders(@ids) . ")";
+ my $condstring = 'entity0 IN (' . placeholders(@ids) . ')';
if ($use_cardinality) {
$condstring = "($condstring AND entity0_cardinality = 0)";
}
@@ -161,7 +161,7 @@ sub _load
$source_id = 'entity0';
}
if ($type eq $type1) {
- my $condstring = "entity1 IN (" . placeholders(@ids) . ")";
+ my $condstring = 'entity1 IN (' . placeholders(@ids) . ')';
if ($use_cardinality) {
$condstring = "($condstring AND entity1_cardinality = 0)";
}
@@ -174,7 +174,7 @@ sub _load
# If the source and target types are the same, two possible conditions
# will have been added above, so join them with an OR.
- @cond = join(" OR ", @cond);
+ @cond = join(' OR ', @cond);
my $select = "l_${type0}_${type1}.* FROM l_${type0}_${type1}
JOIN link l ON link = l.id
@@ -195,7 +195,7 @@ sub _load
$query = "SELECT $select
JOIN $target ON $target_id = ${target}.id
- WHERE " . join(" AND ", @cond) . "
+ WHERE " . join(' AND ', @cond) . "
ORDER BY $order";
for my $row (@{ $self->sql->select_list_of_hashes($query, @params) }) {
@@ -324,7 +324,7 @@ sub load_paged {
$condstring .= " AND ${source_column}_cardinality = 0";
}
- $query = "SELECT rel.* " .
+ $query = 'SELECT rel.* ' .
"FROM l_${type0}_${type1} rel " .
'JOIN link l ON link = l.id ' .
"JOIN $target_type ON rel.$target_column = ${target_type}.id " .
@@ -557,7 +557,7 @@ sub merge_entities {
);
}
- my $relationships = $self->sql->select_list_of_hashes(<<~"EOSQL", \@ids);
+ my $relationships = $self->sql->select_list_of_hashes(<<~"SQL", \@ids);
SELECT * FROM (
SELECT
a.*,
@@ -581,7 +581,7 @@ sub merge_entities {
) a
JOIN link ON link.id = a.link
) b WHERE redundant > 1
- EOSQL
+ SQL
# Given a set of duplicate relationship where only one will be kept,
# determine what {entity0,entity1}_credit should be used. Non-empty
@@ -718,8 +718,8 @@ sub delete_entities
my ($table, $entity0, $entity1) = @$t;
$self->sql->do("
DELETE FROM $table a
- WHERE $entity0 IN (" . placeholders(@ids) . ")
- ", @ids);
+ WHERE $entity0 IN (" . placeholders(@ids) . ')
+ ', @ids);
}
}
@@ -768,7 +768,7 @@ sub _check_series_type {
$self->c->model('SeriesType')->load($series);
if ($series->type->item_entity_type ne $entity_type) {
- die "Incorrect entity type for part of series relationship";
+ die 'Incorrect entity type for part of series relationship';
}
}
@@ -777,8 +777,8 @@ sub insert
my ($self, $type0, $type1, $values) = @_;
$self->_check_types($type0, $type1);
- $self->_check_series_type($values->{entity0_id}, $values->{link_type_id}, $type1) if $type0 eq "series";
- $self->_check_series_type($values->{entity1_id}, $values->{link_type_id}, $type0) if $type1 eq "series";
+ $self->_check_series_type($values->{entity0_id}, $values->{link_type_id}, $type1) if $type0 eq 'series';
+ $self->_check_series_type($values->{entity1_id}, $values->{link_type_id}, $type0) if $type1 eq 'series';
my $row = {
link => $self->c->model('Link')->find_or_insert({
@@ -796,11 +796,11 @@ sub insert
};
my $id = $self->sql->insert_row("l_${type0}_${type1}", $row, 'id');
- if ($type0 eq "series") {
+ if ($type0 eq 'series') {
$self->c->model('Series')->automatically_reorder($values->{entity0_id});
}
- if ($type1 eq "series") {
+ if ($type1 eq 'series') {
$self->c->model('Series')->automatically_reorder($values->{entity1_id});
}
@@ -833,8 +833,8 @@ sub update
$new->{entity0_credit} = $values->{entity0_credit} if defined $values->{entity0_credit};
$new->{entity1_credit} = $values->{entity1_credit} if defined $values->{entity1_credit};
- my $series0 = $type0 eq "series";
- my $series1 = $type1 eq "series";
+ my $series0 = $type0 eq 'series';
+ my $series1 = $type1 eq 'series';
my $entity0_changed = $new->{entity0} && $old->{entity0} != $new->{entity0};
my $entity1_changed = $new->{entity1} && $old->{entity1} != $new->{entity1};
my $series0_changed = $series0 && $entity0_changed;
@@ -869,13 +869,13 @@ sub delete
$self->_check_types($type0, $type1);
my $series_col;
- $series_col = "entity0" if $type0 eq "series";
- $series_col = "entity1" if $type1 eq "series";
+ $series_col = 'entity0' if $type0 eq 'series';
+ $series_col = 'entity1' if $type1 eq 'series';
my $deleted = $self->sql->select_list_of_hashes(
"DELETE FROM l_${type0}_${type1} " .
- "WHERE id IN (" . placeholders(@ids) . ") " .
- "RETURNING entity0, entity1",
+ 'WHERE id IN (' . placeholders(@ids) . ') ' .
+ 'RETURNING entity0, entity1',
@ids,
);
@@ -899,7 +899,7 @@ sub adjust_edit_pending
my $query = "UPDATE l_${type0}_${type1}
SET edits_pending = numeric_larger(0, edits_pending + ?)
- WHERE id IN (" . placeholders(@ids) . ")";
+ WHERE id IN (" . placeholders(@ids) . ')';
$self->sql->do($query, $adjust, @ids);
}
@@ -931,11 +931,11 @@ sub reorder {
\@ids
);
- die "Can only reorder one group of relationships" if @$groups != 1;
+ die 'Can only reorder one group of relationships' if @$groups != 1;
$self->sql->do(
- "WITH pos (relationship, link_order) AS (
- VALUES " . join(', ', ('(?::INTEGER, ?::INTEGER)') x @ids) . "
+ 'WITH pos (relationship, link_order) AS (
+ VALUES ' . join(', ', ('(?::INTEGER, ?::INTEGER)') x @ids) . "
)
UPDATE l_${type0}_${type1} SET link_order = pos.link_order
FROM pos WHERE pos.relationship = id",
diff --git a/lib/MusicBrainz/Server/Data/Release.pm b/lib/MusicBrainz/Server/Data/Release.pm
index a647ddcbfef..8870fcb93ee 100644
--- a/lib/MusicBrainz/Server/Data/Release.pm
+++ b/lib/MusicBrainz/Server/Data/Release.pm
@@ -108,11 +108,11 @@ sub _where_filter
if (defined $filter) {
if (exists $filter->{name}) {
- push @query, "(mb_simple_tsvector(release.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR release.name = ?)";
+ push @query, q{(mb_simple_tsvector(release.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR release.name = ?)};
push @params, $filter->{name}, $filter->{name};
}
if (exists $filter->{artist_credit_id}) {
- push @query, "release.artist_credit = ?";
+ push @query, 'release.artist_credit = ?';
push @params, $filter->{artist_credit_id};
}
if (exists $filter->{status} && $filter->{status}) {
@@ -185,23 +185,23 @@ sub find_artist_credits_by_artist
{
my ($self, $artist_id) = @_;
- my $query = "SELECT DISTINCT rel.artist_credit
+ my $query = 'SELECT DISTINCT rel.artist_credit
FROM release rel
JOIN artist_credit_name acn
ON acn.artist_credit = rel.artist_credit
- WHERE acn.artist = ?";
+ WHERE acn.artist = ?';
my $ids = $self->sql->select_single_column_array($query, $artist_id);
return $self->c->model('ArtistCredit')->find_by_ids($ids);
}
sub find_by_area {
my ($self, $area_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN release_event ON release.id = release_event.release
JOIN area ON release_event.country = area.id
WHERE area.id = ?
- ORDER BY release.name COLLATE musicbrainz, release.id";
+ ORDER BY release.name COLLATE musicbrainz, release.id';
$self->query_to_list_limited($query, [$area_id], $limit, $offset);
}
@@ -224,7 +224,7 @@ sub _find_by_artist_slow
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "acn.artist = ?";
+ push @$conditions, 'acn.artist = ?';
push @$params, $artist_id;
my $query;
@@ -232,31 +232,31 @@ sub _find_by_artist_slow
# MBS-10939: For VA, only order by ID. Sorting by date, country
# name, etc. doesn't currently scale at this level and causes
# load issues on our DB server.
- $query = "
- SELECT DISTINCT ON (release.id) " .
- $self->_columns . " FROM " . $self->_table . "
+ $query = '
+ SELECT DISTINCT ON (release.id) ' .
+ $self->_columns . ' FROM ' . $self->_table . '
JOIN artist_credit_name acn ON acn.artist_credit = release.artist_credit
- " . join(' ', @$extra_joins) . "
- WHERE " . join(" AND ", @$conditions) . "
- ORDER BY release.id";
+ ' . join(' ', @$extra_joins) . '
+ WHERE ' . join(' AND ', @$conditions) . '
+ ORDER BY release.id';
} else {
- $query = "
+ $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day, area.name AS country_name
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn ON acn.artist_credit = release.artist_credit
- " . join(' ', @$extra_joins) . "
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
country_name, barcode, release.name COLLATE musicbrainz
) release
ORDER BY date_year, date_month, date_day,
- country_name, barcode, name COLLATE musicbrainz";
+ country_name, barcode, name COLLATE musicbrainz';
}
$self->query_to_list_limited($query, $params, $limit, $offset, undef, cache_hits => 1);
}
@@ -270,7 +270,7 @@ sub _find_by_artist_fast {
push @$conditions, 'ar.artist = ?';
push @$params, $artist_id;
- my $inner_query = "FROM artist_release ar " .
+ my $inner_query = 'FROM artist_release ar ' .
join(' ', @$extra_joins) . ' ' .
'WHERE ' . join(' AND ', @$conditions);
@@ -316,11 +316,11 @@ sub find_by_artist_credit
{
my ($self, $artist_credit_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
release.name COLLATE musicbrainz AS name_collate
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
WHERE artist_credit = ?
- ORDER BY release.name COLLATE musicbrainz";
+ ORDER BY release.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$artist_credit_id], $limit, $offset);
}
@@ -329,18 +329,18 @@ sub find_by_instrument {
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "instrument.id = ?";
+ push @$conditions, 'instrument.id = ?';
push @$params, $instrument_id;
# NOTE: if more tables than l_artist_release are added here, check admin/BuildSitemaps.pl
- my $query = "
+ my $query = '
SELECT *
FROM (
- SELECT " . $self->_columns . ",
+ SELECT ' . $self->_columns . q(,
date_year, date_month, date_day,
area.name AS country_name,
array_agg(json_build_object('typeName', link_type.name, 'credit', lac.credited_as)) AS instrument_credits_and_rel_types
- FROM " . $self->_table . "
+ FROM ) . $self->_table . '
JOIN l_artist_release ON l_artist_release.entity1 = release.id
JOIN link ON link.id = l_artist_release.link
JOIN link_type ON link_type.id = link.link_type
@@ -351,10 +351,10 @@ sub find_by_instrument {
lac.link = link_attribute.link AND
lac.attribute_type = link_attribute.attribute_type
)
- " . join(' ', @$extra_joins) . "
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
GROUP BY release.id, date_year, date_month, date_day, country_name
ORDER BY release.id, date_year, date_month, date_day,
release.name COLLATE musicbrainz, country_name,
@@ -362,7 +362,7 @@ sub find_by_instrument {
) s
ORDER BY date_year, date_month, date_day,
name COLLATE musicbrainz, country_name,
- barcode";
+ barcode';
$self->query_to_list_limited($query, $params, $limit, $offset, sub {
my ($model, $row) = @_;
@@ -378,29 +378,29 @@ sub find_by_label
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "release_label.label = ?";
+ push @$conditions, 'release_label.label = ?';
push @$params, $label_id;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day, catalog_number,
area.name AS country_name
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN release_label ON release_label.release = release.id
- " . join(' ', @$extra_joins) . "
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day, catalog_number,
release.name COLLATE musicbrainz, country_name,
barcode
) s
ORDER BY date_year, date_month, date_day, catalog_number,
name COLLATE musicbrainz, country_name,
- barcode";
+ barcode';
$self->query_to_list_limited($query, $params, $limit, $offset, undef, cache_hits => 1);
}
@@ -408,13 +408,13 @@ sub find_by_disc_id
{
my ($self, $disc_id) = @_;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN medium ON medium.release = release.id
JOIN medium_cdtoc ON medium_cdtoc.medium = medium.id
JOIN cdtoc ON medium_cdtoc.cdtoc = cdtoc.id
@@ -424,7 +424,7 @@ sub find_by_disc_id
release.name COLLATE musicbrainz
) s
ORDER BY date_year, date_month, date_day,
- name COLLATE musicbrainz";
+ name COLLATE musicbrainz';
$self->query_to_list($query, [$disc_id]);
}
@@ -436,25 +436,25 @@ sub find_by_release_group
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "release_group IN (" . placeholders(@ids) . ")";
+ push @$conditions, 'release_group IN (' . placeholders(@ids) . ')';
push @$params, @ids;
- my $query = "
+ my $query = '
SELECT *
FROM (
- SELECT DISTINCT ON (release.id) " . $self->_columns . ",
+ SELECT DISTINCT ON (release.id) ' . $self->_columns . ',
date_year, date_month, date_day, area.name AS country_name
- FROM " . $self->_table . "
- " . join(' ', @$extra_joins) . "
+ FROM ' . $self->_table . '
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
country_name, barcode
) s
ORDER BY date_year, date_month, date_day,
country_name, barcode
- ";
+ ';
$self->query_to_list_limited($query, $params, $limit, $offset);
}
@@ -465,7 +465,7 @@ sub _find_by_track_artist_slow
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "
+ push @$conditions, '
release.id IN (
SELECT release FROM medium
JOIN track tr
@@ -477,25 +477,25 @@ sub _find_by_track_artist_slow
SELECT id FROM release
JOIN artist_credit_name acn
ON release.artist_credit = acn.artist_credit
- WHERE acn.artist = ?)";
+ WHERE acn.artist = ?)';
push @$params, $artist_id, $artist_id;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day
- FROM " . $self->_table . "
- " . join(' ', @$extra_joins) . "
+ FROM ' . $self->_table . '
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
release.name COLLATE musicbrainz
) s
ORDER BY date_year, date_month, date_day,
- name COLLATE musicbrainz";
+ name COLLATE musicbrainz';
$self->query_to_list_limited($query, $params, $limit, $offset);
}
@@ -520,28 +520,28 @@ sub find_by_recording
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "track.recording IN (" . placeholders(@ids) . ")";
+ push @$conditions, 'track.recording IN (' . placeholders(@ids) . ')';
push @$params, @ids;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day
- FROM " . $self->_table . "
- " . join(' ', @$extra_joins) . "
+ FROM ' . $self->_table . '
+ ' . join(' ', @$extra_joins) . '
JOIN medium ON medium.release = release.id
JOIN track ON track.medium = medium.id
LEFT JOIN release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
release.name COLLATE musicbrainz
) s
ORDER BY date_year, date_month, date_day,
name COLLATE musicbrainz
- ";
+ ';
$self->query_to_list_limited($query, $params, $limit, $offset);
}
@@ -552,13 +552,13 @@ sub find_by_recordings
return () unless @ids;
my $query =
- "SELECT DISTINCT ON (release.id, track.recording) " . $self->_columns . ",
+ 'SELECT DISTINCT ON (release.id, track.recording) ' . $self->_columns . ',
track.recording, track.position AS track_position, medium.position AS medium_position,
medium.track_count as medium_track_count
FROM release
JOIN medium ON release.id = medium.release
JOIN track ON track.medium = medium.id
- WHERE track.recording IN (" . placeholders(@ids) . ")";
+ WHERE track.recording IN (' . placeholders(@ids) . ')';
my %map;
for my $row (@{ $self->sql->select_list_of_hashes($query, @ids) }) {
@@ -580,29 +580,29 @@ sub find_by_country
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "release_event.country = ?";
+ push @$conditions, 'release_event.country = ?';
push @$params, $country_id;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day, area.name AS country_name
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn ON acn.artist_credit = release.artist_credit
- " . join(' ', @$extra_joins) . "
+ ' . join(' ', @$extra_joins) . '
LEFT JOIN (
SELECT release, country, date_year, date_month, date_day
FROM release_country
) release_event ON release_event.release = release.id
LEFT JOIN area ON area.id = release_event.country
- WHERE " . join(" AND ", @$conditions) . "
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
country_name, barcode, release.name COLLATE musicbrainz
) release
ORDER BY date_year, date_month, date_day,
- country_name, barcode, name COLLATE musicbrainz";
+ country_name, barcode, name COLLATE musicbrainz';
$self->query_to_list_limited($query, $params, $limit, $offset);
}
@@ -611,13 +611,13 @@ sub find_for_cdtoc
{
my ($self, $artist_id, $track_count, $limit, $offset) = @_;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
date_year, date_month, date_day
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn
ON acn.artist_credit = release.artist_credit
JOIN medium
@@ -633,7 +633,7 @@ sub find_for_cdtoc
date_year, date_month, date_day, release.name COLLATE musicbrainz
) s
ORDER BY release_group,
- date_year, date_month, date_day, name COLLATE musicbrainz";
+ date_year, date_month, date_day, name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$track_count, $artist_id], $limit, $offset);
}
@@ -647,11 +647,11 @@ sub find_gid_for_track
# on which the track appears. So only the release MBID is needed.
my $query =
- "SELECT release.gid
+ 'SELECT release.gid
FROM release
JOIN medium ON release.id = medium.release
JOIN track ON track.medium = medium.id
- WHERE track.id = ?";
+ WHERE track.id = ?';
return $self->sql->select_single_value($query, $track_id);
}
@@ -662,10 +662,10 @@ sub load_with_medium_for_recording
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "track.recording = ?";
+ push @$conditions, 'track.recording = ?';
push @$params, $recording_id;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (release.id)
@@ -702,13 +702,13 @@ sub load_with_medium_for_recording
JOIN medium ON medium.id = track.medium
JOIN release ON release.id = medium.release
LEFT JOIN release_event ON release_event.release = release.id
- " . join(' ', @$extra_joins) . "
- WHERE " . join(" AND ", @$conditions) . "
+ ' . join(' ', @$extra_joins) . '
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY release.id, date_year, date_month, date_day,
release.name COLLATE musicbrainz
) s
ORDER BY date_year, date_month, date_day,
- r_name COLLATE musicbrainz";
+ r_name COLLATE musicbrainz';
$self->query_to_list_limited($query, $params, $limit, $offset, sub {
my ($model, $row) = @_;
@@ -742,70 +742,70 @@ sub find_by_medium {
sub _order_by {
my ($self, $order) = @_;
- my $extra_join = "";
- my $also_select = "";
+ my $extra_join = '';
+ my $also_select = '';
- my $order_by = order_by($order, "date", {
- "date" => sub {
- return "date_year, date_month, date_day, release.name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'date', {
+ 'date' => sub {
+ return 'date_year, date_month, date_day, release.name COLLATE musicbrainz'
},
- "name" => sub {
- return "release.name COLLATE musicbrainz, date_year, date_month, date_day"
+ 'name' => sub {
+ return 'release.name COLLATE musicbrainz, date_year, date_month, date_day'
},
- "country" => sub {
- $extra_join = "LEFT JOIN area ON release_event.country = area.id";
- $also_select = "area.name AS country_name";
- return "country_name, date_year, date_month, date_day";
+ 'country' => sub {
+ $extra_join = 'LEFT JOIN area ON release_event.country = area.id';
+ $also_select = 'area.name AS country_name';
+ return 'country_name, date_year, date_month, date_day';
},
- "artist" => sub {
- $extra_join = "JOIN artist_credit ac ON ac.id = release.artist_credit";
- $also_select = "ac.name AS ac_name";
- return "ac_name COLLATE musicbrainz, release.name COLLATE musicbrainz";
+ 'artist' => sub {
+ $extra_join = 'JOIN artist_credit ac ON ac.id = release.artist_credit';
+ $also_select = 'ac.name AS ac_name';
+ return 'ac_name COLLATE musicbrainz, release.name COLLATE musicbrainz';
},
- "label" => sub {
- $extra_join = "LEFT OUTER JOIN
+ 'label' => sub {
+ $extra_join = 'LEFT OUTER JOIN
(SELECT release, array_agg(label.name COLLATE musicbrainz) AS labels FROM release_label
JOIN label ON release_label.label = label.id
GROUP BY release) rl
- ON rl.release = release.id";
- $also_select = "rl.labels AS labels";
- return "labels, release.name COLLATE musicbrainz";
+ ON rl.release = release.id';
+ $also_select = 'rl.labels AS labels';
+ return 'labels, release.name COLLATE musicbrainz';
},
- "catno" => sub {
- $extra_join = "LEFT OUTER JOIN
+ 'catno' => sub {
+ $extra_join = 'LEFT OUTER JOIN
(SELECT release, array_agg(catalog_number) AS catnos FROM release_label
WHERE catalog_number IS NOT NULL GROUP BY release) rl
- ON rl.release = release.id";
- $also_select = "catnos";
- return "catnos, release.name COLLATE musicbrainz";
+ ON rl.release = release.id';
+ $also_select = 'catnos';
+ return 'catnos, release.name COLLATE musicbrainz';
},
- "format" => sub {
- $extra_join = "LEFT JOIN medium ON medium.release = release.id
- LEFT JOIN medium_format ON medium.format = medium_format.id";
- $also_select = "medium_format.name AS medium_format_name";
- return "medium_format_name COLLATE musicbrainz, release.name COLLATE musicbrainz";
+ 'format' => sub {
+ $extra_join = 'LEFT JOIN medium ON medium.release = release.id
+ LEFT JOIN medium_format ON medium.format = medium_format.id';
+ $also_select = 'medium_format.name AS medium_format_name';
+ return 'medium_format_name COLLATE musicbrainz, release.name COLLATE musicbrainz';
},
- "tracks" => sub {
- $extra_join = "LEFT JOIN
+ 'tracks' => sub {
+ $extra_join = 'LEFT JOIN
(SELECT medium.release, sum(track_count) AS total_track_count
FROM medium
GROUP BY medium.release) tc
- ON tc.release = release.id";
- $also_select = "total_track_count";
- return "total_track_count, release.name COLLATE musicbrainz";
+ ON tc.release = release.id';
+ $also_select = 'total_track_count';
+ return 'total_track_count, release.name COLLATE musicbrainz';
},
- "barcode" => sub {
- return "length(barcode), barcode, release.name COLLATE musicbrainz"
+ 'barcode' => sub {
+ return 'length(barcode), barcode, release.name COLLATE musicbrainz'
},
});
# Date and release event information should always be included.
- if ($also_select ne "") {
- $also_select .= ", ";
+ if ($also_select ne '') {
+ $also_select .= ', ';
}
- $also_select .= "date_year, date_month, date_day";
+ $also_select .= 'date_year, date_month, date_day';
- $extra_join = "LEFT JOIN release_event ON release_event.release = release.id " . $extra_join;
+ $extra_join = 'LEFT JOIN release_event ON release_event.release = release.id ' . $extra_join;
my $inner_order_by = $order_by
=~ s/country_name/area.name/r
@@ -940,12 +940,12 @@ sub can_merge {
});
}
- my $merging_into_empty_medium = $self->sql->select_single_value(<<~"EOSQL", \@old_ids, $new_id);
+ my $merging_into_empty_medium = $self->sql->select_single_value(<<~"SQL", \@old_ids, $new_id);
$mediums_query
WHERE s.track_count > 0
AND new_medium.track_count = 0
LIMIT 1
- EOSQL
+ SQL
if ($merging_into_empty_medium) {
return (0, {
@@ -953,12 +953,12 @@ sub can_merge {
});
}
- my $medium_track_counts_differ = $self->sql->select_single_value(<<~"EOSQL", \@old_ids, $new_id);
+ my $medium_track_counts_differ = $self->sql->select_single_value(<<~"SQL", \@old_ids, $new_id);
$mediums_query
WHERE new_medium.track_count <> s.track_count
AND s.track_count > 0
LIMIT 1
- EOSQL
+ SQL
if ($medium_track_counts_differ) {
return (0, {
@@ -1345,10 +1345,10 @@ sub merge
# Set all medium positions in one query; otherwise medium_idx_uniq will
# sometimes cause individual reorders to fail when they produce
# duplicate positions. (MBS-7736)
- my $q = "WITH new_positions (medium, position) AS " .
- "(VALUES " . join(', ', ('(?::integer,?::integer)') x keys %positions_by_medium) .") " .
- "UPDATE medium SET release = ?, position = new_positions.position " .
- "FROM new_positions WHERE medium.id = new_positions.medium";
+ my $q = 'WITH new_positions (medium, position) AS ' .
+ '(VALUES ' . join(', ', ('(?::integer,?::integer)') x keys %positions_by_medium) .') ' .
+ 'UPDATE medium SET release = ?, position = new_positions.position ' .
+ 'FROM new_positions WHERE medium.id = new_positions.medium';
$self->sql->do($q, %positions_by_medium, $new_id);
if ($update_names) {
@@ -1430,10 +1430,10 @@ sub load_ids
my @gids = map { $_->gid } @releases;
return () unless @gids;
- my $query = "
+ my $query = '
SELECT gid, id FROM release
- WHERE gid IN (" . placeholders(@gids) . ")
- ";
+ WHERE gid IN (' . placeholders(@gids) . ')
+ ';
my %map = map { $_->[0] => $_->[1] }
@{ $self->sql->select_list_of_lists($query, @gids) };
@@ -1449,7 +1449,7 @@ sub load_meta
my %id_to_obj = map { $_->id => $_ } @objs;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "release_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'release_meta', sub {
my ($obj, $row) = @_;
$obj->info_url($row->{info_url}) if defined $row->{info_url};
$obj->amazon_asin($row->{amazon_asin}) if defined $row->{amazon_asin};
@@ -1524,7 +1524,7 @@ sub filter_barcode_changes {
return @{
$self->c->sql->select_list_of_hashes(
'SELECT DISTINCT change.release, change.barcode
- FROM (VALUES ' . join(', ', ("(?::uuid, ?)") x @barcodes) . ') change (release, barcode)
+ FROM (VALUES ' . join(', ', ('(?::uuid, ?)') x @barcodes) . ') change (release, barcode)
LEFT JOIN release_gid_redirect rgr ON rgr.gid = change.release
JOIN release ON (release.gid = change.release OR rgr.new_id = release.id)
WHERE change.barcode IS DISTINCT FROM release.barcode',
@@ -1587,7 +1587,7 @@ sub load_release_events {
sub find_release_events {
my ($self, @release_ids) = @_;
- my $query = "
+ my $query = '
SELECT *
FROM release_event
LEFT JOIN area ON release_event.country = area.id
@@ -1597,7 +1597,7 @@ sub find_release_events {
date_month ASC NULLS LAST,
date_day ASC NULLS LAST,
area.name COLLATE musicbrainz ASC NULLS LAST
- ";
+ ';
my $events = $self->sql->select_list_of_hashes($query, \@release_ids);
diff --git a/lib/MusicBrainz/Server/Data/ReleaseGroup.pm b/lib/MusicBrainz/Server/Data/ReleaseGroup.pm
index e555b665fff..04ff3f277df 100644
--- a/lib/MusicBrainz/Server/Data/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/Data/ReleaseGroup.pm
@@ -77,7 +77,7 @@ sub _where_filter
my $needs_rg_table = 0;
if (exists $filter->{name}) {
$needs_rg_table = 1 if $using_artist_release_group_table;
- push @query, "(mb_simple_tsvector(rg.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR rg.name = ?)";
+ push @query, q{(mb_simple_tsvector(rg.name) @@ plainto_tsquery('mb_simple', mb_lower(?)) OR rg.name = ?)};
push @params, $filter->{name}, $filter->{name};
}
if (exists $filter->{artist_credit_id}) {
@@ -136,11 +136,11 @@ sub find_artist_credits_by_artist
{
my ($self, $artist_id) = @_;
- my $query = "SELECT DISTINCT rel.artist_credit
+ my $query = 'SELECT DISTINCT rel.artist_credit
FROM release_group rel
JOIN artist_credit_name acn
ON acn.artist_credit = rel.artist_credit
- WHERE acn.artist = ?";
+ WHERE acn.artist = ?';
my $ids = $self->sql->select_single_column_array($query, $artist_id);
return $self->c->model('ArtistCredit')->find_by_ids($ids);
}
@@ -243,15 +243,15 @@ sub _find_by_artist_slow
my ($conditions, $extra_joins, $params) = _where_filter($args{filter}, 0);
- push @$conditions, "acn.artist = ?";
+ push @$conditions, 'acn.artist = ?';
# Show only RGs with official releases by default, plus all-status-less ones so people fix the status
unless ($show_all) {
- push @$conditions, "(EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status = '1') OR
- NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status IS NOT NULL))";
+ push @$conditions, q{(EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status = '1') OR
+ NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status IS NOT NULL))};
}
push @$params, $artist_id;
- my $query = "SELECT DISTINCT " . $self->_columns . ",
+ my $query = 'SELECT DISTINCT ' . $self->_columns . ',
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day,
@@ -266,17 +266,17 @@ sub _find_by_artist_slow
WHERE rgstj.release_group = rg.id
ORDER BY name ASC
) secondary_types
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN artist_credit_name acn
ON acn.artist_credit = rg.artist_credit
- " . join(' ', @$extra_joins) . "
- WHERE " . join(" AND ", @$conditions) . "
+ ' . join(' ', @$extra_joins) . '
+ WHERE ' . join(' AND ', @$conditions) . '
ORDER BY
rg.type, secondary_types,
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day,
- rg.name COLLATE musicbrainz";
+ rg.name COLLATE musicbrainz';
$self->query_to_list_limited(
$query,
$params,
@@ -309,7 +309,7 @@ sub _find_by_artist_fast {
push @$conditions, 'arg.artist = ?';
push @$params, $artist_id;
- my $inner_query = "FROM artist_release_group arg " .
+ my $inner_query = 'FROM artist_release_group arg ' .
join(' ', @$extra_joins) . ' ' .
'WHERE ' . join(' AND ', @$conditions);
@@ -416,11 +416,11 @@ sub _find_by_track_artist_slow
my $extra_conditions = '';
# Show only RGs with official releases by default, plus all-status-less ones so people fix the status
unless ($show_all) {
- $extra_conditions = " AND (EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status = '1') OR
- NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status IS NOT NULL)) ";
+ $extra_conditions = q{ AND (EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status = '1') OR
+ NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = rg.id AND release.status IS NOT NULL)) };
}
- my $query = "SELECT DISTINCT " . $self->_columns . ",
+ my $query = 'SELECT DISTINCT ' . $self->_columns . ',
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day,
@@ -435,7 +435,7 @@ sub _find_by_track_artist_slow
WHERE rgstj.release_group = rg.id
ORDER BY name ASC
) secondary_types
- FROM " . $self->_table . "
+ FROM ' . $self->_table . "
JOIN artist_credit_name acn
ON acn.artist_credit = rg.artist_credit
WHERE rg.id IN (
@@ -493,22 +493,22 @@ sub find_by_artist_credit
{
my ($self, $artist_credit_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
rg.name COLLATE musicbrainz AS name_collate
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
WHERE rg.artist_credit = ?
- ORDER BY rg.name COLLATE musicbrainz";
+ ORDER BY rg.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$artist_credit_id], $limit, $offset);
}
sub find_by_release
{
my ($self, $release_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN release ON release.release_group = rg.id
WHERE release.id = ?
ORDER BY
@@ -516,7 +516,7 @@ sub find_by_release
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day,
- rg.name COLLATE musicbrainz";
+ rg.name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$release_id], $limit, $offset, sub {
my ($model, $row) = @_;
my $rg = $model->_new_from_row($row);
@@ -528,19 +528,19 @@ sub find_by_release
sub find_by_release_gids
{
my ($self, @release_gids) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
JOIN release ON release.release_group = rg.id
- WHERE release.gid IN (" . placeholders (@release_gids) . ")
+ WHERE release.gid IN (' . placeholders (@release_gids) . ')
ORDER BY
rg.type,
rgm.first_release_date_year,
rgm.first_release_date_month,
rgm.first_release_date_day,
- rg.name COLLATE musicbrainz";
+ rg.name COLLATE musicbrainz';
$self->query_to_list($query, \@release_gids, sub {
my ($model, $row) = @_;
my $rg = $model->_new_from_row($row);
@@ -552,8 +552,8 @@ sub find_by_release_gids
sub find_by_recording
{
my ($self, $recording) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN release ON release.release_group = rg.id
JOIN medium ON medium.release = release.id
JOIN track ON track.medium = medium.id
@@ -561,7 +561,7 @@ sub find_by_recording
WHERE recording.id = ?
ORDER BY
rg.type,
- rg.name COLLATE musicbrainz";
+ rg.name COLLATE musicbrainz';
$self->query_to_list($query, [$recording]);
}
@@ -569,23 +569,23 @@ sub find_by_recording
sub _order_by {
my ($self, $order) = @_;
- my $extra_join = "";
- my $also_select = "";
+ my $extra_join = '';
+ my $also_select = '';
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "artist" => sub {
- $extra_join = "JOIN artist_credit ac ON ac.id = rg.artist_credit";
- $also_select = "ac.name AS ac_name";
- return "ac_name COLLATE musicbrainz, release_group.name COLLATE musicbrainz";
+ 'artist' => sub {
+ $extra_join = 'JOIN artist_credit ac ON ac.id = rg.artist_credit';
+ $also_select = 'ac.name AS ac_name';
+ return 'ac_name COLLATE musicbrainz, release_group.name COLLATE musicbrainz';
},
- "primary_type" => sub {
- return "primary_type_id, name COLLATE musicbrainz"
+ 'primary_type' => sub {
+ return 'primary_type_id, name COLLATE musicbrainz'
},
- "year" => sub {
- return "first_release_date_year, name COLLATE musicbrainz"
+ 'year' => sub {
+ return 'first_release_date_year, name COLLATE musicbrainz'
}
});
@@ -721,7 +721,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "release_group_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'release_group_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -734,9 +734,9 @@ sub has_cover_art_set
{
my ($self, $rg_id) = @_;
- my $query = "SELECT release
+ my $query = 'SELECT release
FROM cover_art_archive.release_group_cover_art
- WHERE release_group = ?";
+ WHERE release_group = ?';
return $self->sql->select_single_value($query, $rg_id);
}
@@ -744,29 +744,29 @@ sub has_cover_art_set
sub set_cover_art {
my ($self, $rg_id, $release_id) = @_;
- $self->sql->do("
+ $self->sql->do('
UPDATE cover_art_archive.release_group_cover_art
SET release = ? WHERE release_group = ?;
INSERT INTO cover_art_archive.release_group_cover_art (release_group, release)
(SELECT ? AS release_group, ? AS release WHERE NOT EXISTS
(SELECT 1 FROM cover_art_archive.release_group_cover_art
- WHERE release_group = ?));",
+ WHERE release_group = ?));',
$release_id, $rg_id, $rg_id, $release_id, $rg_id);
}
sub unset_cover_art {
my ($self, $rg_id) = @_;
- $self->sql->do("DELETE FROM cover_art_archive.release_group_cover_art
- WHERE release_group = ?", $rg_id);
+ $self->sql->do('DELETE FROM cover_art_archive.release_group_cover_art
+ WHERE release_group = ?', $rg_id);
}
sub merge_releases {
my ($self, $new_id, @old_ids) = @_;
my $rg_ids = $self->c->sql->select_list_of_hashes(
- "SELECT release_group, id FROM release WHERE id IN ("
- . placeholders ($new_id, @old_ids) . ")", $new_id, @old_ids);
+ 'SELECT release_group, id FROM release WHERE id IN ('
+ . placeholders ($new_id, @old_ids) . ')', $new_id, @old_ids);
my %release_rg;
my %release_group_ids;
@@ -777,9 +777,9 @@ sub merge_releases {
my @release_group_ids = keys %release_group_ids;
my $rg_cover_art = $self->c->sql->select_list_of_hashes(
- "SELECT release_group, release
+ 'SELECT release_group, release
FROM cover_art_archive.release_group_cover_art
- WHERE release_group IN (" . placeholders (@release_group_ids) . ")",
+ WHERE release_group IN (' . placeholders (@release_group_ids) . ')',
@release_group_ids);
my %has_cover_art = map { $_->{release_group} => $_->{release} } @$rg_cover_art;
@@ -817,7 +817,7 @@ sub is_empty {
my $used_in_relationship =
used_in_relationship($self->c, release_group => 'release_group_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $release_group_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $release_group_id, $STATUS_OPEN);
SELECT TRUE
FROM release_group release_group_row
WHERE id = ?
@@ -835,7 +835,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
sub series_ordering {
diff --git a/lib/MusicBrainz/Server/Data/ReleaseGroupSecondaryType.pm b/lib/MusicBrainz/Server/Data/ReleaseGroupSecondaryType.pm
index 08914113fcf..696ee9def71 100644
--- a/lib/MusicBrainz/Server/Data/ReleaseGroupSecondaryType.pm
+++ b/lib/MusicBrainz/Server/Data/ReleaseGroupSecondaryType.pm
@@ -70,16 +70,16 @@ sub merge_entities
my ($self, $new_id, @old_ids) = @_;
$self->sql->do(
- "DELETE FROM release_group_secondary_type_join " .
- "WHERE release_group = any(?)", \@old_ids );
+ 'DELETE FROM release_group_secondary_type_join
+ WHERE release_group = any(?)', \@old_ids );
}
sub delete_entities {
my ($self, @ids) = @_;
$self->sql->do(
- "DELETE FROM release_group_secondary_type_join " .
- "WHERE release_group = any(?) ", \@ids);
+ 'DELETE FROM release_group_secondary_type_join
+ WHERE release_group = any(?)', \@ids);
}
sub in_use {
diff --git a/lib/MusicBrainz/Server/Data/ReleaseLabel.pm b/lib/MusicBrainz/Server/Data/ReleaseLabel.pm
index 62d95dc2f71..78efc5c23a5 100644
--- a/lib/MusicBrainz/Server/Data/ReleaseLabel.pm
+++ b/lib/MusicBrainz/Server/Data/ReleaseLabel.pm
@@ -44,11 +44,11 @@ sub load
my %id_to_release = object_to_ids(@releases);
my @ids = keys %id_to_release;
return unless @ids; # nothing to do
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
LEFT JOIN label ON rl.label = label.id
- WHERE release IN (" . placeholders(@ids) . ")
- ORDER BY release, rl_catalog_number, label.name COLLATE musicbrainz";
+ WHERE release IN (' . placeholders(@ids) . ')
+ ORDER BY release, rl_catalog_number, label.name COLLATE musicbrainz';
my @labels = $self->query_to_list($query, \@ids);
foreach my $label (@labels) {
foreach (@{ $id_to_release{$label->release_id} })
@@ -89,12 +89,12 @@ sub merge_releases
$self->sql->do(
'DELETE FROM release_label
- WHERE release IN (' . placeholders(@ids) . ")
+ WHERE release IN (' . placeholders(@ids) . ')
AND id NOT IN (
SELECT DISTINCT ON (label, catalog_number)
id
FROM release_label
- WHERE release IN (" . placeholders(@ids) . ')
+ WHERE release IN (' . placeholders(@ids) . ')
)', @ids, @ids);
$self->sql->do('UPDATE release_label SET release = ?
diff --git a/lib/MusicBrainz/Server/Data/Role/Alias.pm b/lib/MusicBrainz/Server/Data/Role/Alias.pm
index 22b655ad445..cb79fbb25f0 100644
--- a/lib/MusicBrainz/Server/Data/Role/Alias.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Alias.pm
@@ -12,7 +12,7 @@ parameter 'type' => (
parameter 'table' => (
isa => 'Str',
- default => sub { shift->type . "_alias" },
+ default => sub { shift->type . '_alias' },
lazy => 1
);
@@ -60,15 +60,15 @@ role
my $type = $params->type;
my $query =
- "WITH search (term) AS (".
- " VALUES " . join (",", ("(?)") x scalar @names) . "), " .
- " entity_matches (term, entity) AS (" .
+ 'WITH search (term) AS ('.
+ ' VALUES ' . join (',', ('(?)') x scalar @names) . '), ' .
+ ' entity_matches (term, entity) AS (' .
" SELECT term, $type FROM ${type}_alias".
" JOIN search ON lower(musicbrainz_unaccent(${type}_alias.name)) = lower(musicbrainz_unaccent(term))" .
" UNION SELECT term, id FROM $type " .
" JOIN search ON lower(musicbrainz_unaccent(${type}.name)) = lower(musicbrainz_unaccent(term)))" .
- " SELECT term AS search_term, ".$self->_columns.
- " FROM ". $self->_table ." JOIN entity_matches ON entity_matches.entity = $type.id";
+ ' SELECT term AS search_term, '.$self->_columns.
+ ' FROM '. $self->_table ." JOIN entity_matches ON entity_matches.entity = $type.id";
my %ret;
for my $row (@{ $self->sql->select_list_of_hashes($query, @names) }) {
diff --git a/lib/MusicBrainz/Server/Data/Role/Annotation.pm b/lib/MusicBrainz/Server/Data/Role/Annotation.pm
index c38a0d6ec8b..249c64973aa 100644
--- a/lib/MusicBrainz/Server/Data/Role/Annotation.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Annotation.pm
@@ -10,7 +10,7 @@ parameter 'type' => (
parameter 'table' => (
isa => 'Str',
- default => sub { shift->type . "_annotation" },
+ default => sub { shift->type . '_annotation' },
lazy => 1
);
diff --git a/lib/MusicBrainz/Server/Data/Role/Area.pm b/lib/MusicBrainz/Server/Data/Role/Area.pm
index c76b6678401..1c5ef2e2384 100644
--- a/lib/MusicBrainz/Server/Data/Role/Area.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Area.pm
@@ -8,10 +8,10 @@ sub find_by_area
my ($self, $area_id, $limit, $offset) = @_;
my $area_cols = $self->_area_cols;
my $name_column = $self->isa('MusicBrainz::Server::Data::Place') ? 'name' : 'name.name';
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE " . join(" OR ", map { $_ . " = ?" } @$area_cols ) . "
- ORDER BY name COLLATE musicbrainz, id";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE ' . join(' OR ', map { $_ . ' = ?' } @$area_cols ) . '
+ ORDER BY name COLLATE musicbrainz, id';
$self->query_to_list_limited($query, [($area_id) x @$area_cols], $limit, $offset);
}
diff --git a/lib/MusicBrainz/Server/Data/Role/Collection.pm b/lib/MusicBrainz/Server/Data/Role/Collection.pm
index fc9f995fafb..07583535831 100644
--- a/lib/MusicBrainz/Server/Data/Role/Collection.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Collection.pm
@@ -13,12 +13,12 @@ sub find_by_collection {
my $table = $self->_table;
my $type = $self->_type;
- my $query = "
+ my $query = '
SELECT *
FROM (
- SELECT DISTINCT ON (" . $self->_id_column . ")
- " . $self->_columns .
- ($also_select ? ", $also_select" : "") . "
+ SELECT DISTINCT ON (' . $self->_id_column . ')
+ ' . $self->_columns .
+ ($also_select ? ", $also_select" : '') . "
FROM $table
JOIN editor_collection_$type ec ON " . $self->_id_column . " = ec.$type
$extra_join
diff --git a/lib/MusicBrainz/Server/Data/Role/DeleteAndLog.pm b/lib/MusicBrainz/Server/Data/Role/DeleteAndLog.pm
index 681d6f78980..8d9bbbfc4a2 100644
--- a/lib/MusicBrainz/Server/Data/Role/DeleteAndLog.pm
+++ b/lib/MusicBrainz/Server/Data/Role/DeleteAndLog.pm
@@ -22,9 +22,9 @@ role {
my $table = $self->_main_table;
- my $query = "DELETE FROM $table WHERE id IN (" .placeholders(@ids) . ")
- RETURNING gid AS entity_gid, id AS entity_id, name AS last_known_name";
- $query .= ", comment AS last_known_comment"
+ my $query = "DELETE FROM $table WHERE id IN (" .placeholders(@ids) . ')
+ RETURNING gid AS entity_gid, id AS entity_id, name AS last_known_name';
+ $query .= ', comment AS last_known_comment'
if $ENTITIES{$type}{disambiguation};
state $json = JSON::XS->new;
@@ -39,7 +39,7 @@ role {
}
}
@{ $self->sql->select_list_of_hashes($query, @ids) };
- $self->sql->insert_many("deleted_entity", @deleted);
+ $self->sql->insert_many('deleted_entity', @deleted);
return [ map { $_->{gid} } @deleted ];
};
diff --git a/lib/MusicBrainz/Server/Data/Role/Editable.pm b/lib/MusicBrainz/Server/Data/Role/Editable.pm
index ef9c042f21f..11bdd141c23 100644
--- a/lib/MusicBrainz/Server/Data/Role/Editable.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Editable.pm
@@ -18,7 +18,7 @@ role {
method 'adjust_edit_pending' => sub
{
my ($self, $adjust, @ids) = @_;
- my $query = "UPDATE $table SET edits_pending = numeric_larger(0, edits_pending + ?) WHERE id IN (" . placeholders(@ids) . ")";
+ my $query = "UPDATE $table SET edits_pending = numeric_larger(0, edits_pending + ?) WHERE id IN (" . placeholders(@ids) . ')';
$self->sql->do($query, $adjust, @ids);
if ($self->does('MusicBrainz::Server::Data::Role::EntityCache')) {
$self->_delete_from_cache(@ids);
diff --git a/lib/MusicBrainz/Server/Data/Role/GetByGID.pm b/lib/MusicBrainz/Server/Data/Role/GetByGID.pm
index 2b12fa53776..278b555da7b 100644
--- a/lib/MusicBrainz/Server/Data/Role/GetByGID.pm
+++ b/lib/MusicBrainz/Server/Data/Role/GetByGID.pm
@@ -8,7 +8,7 @@ requires '_get_by_keys';
sub get_by_gid {
my ($self, $gid) = @_;
return unless is_guid($gid);
- my @result = $self->_get_by_keys("gid", $gid);
+ my @result = $self->_get_by_keys('gid', $gid);
if (scalar(@result)) {
return $result[0];
}
diff --git a/lib/MusicBrainz/Server/Data/Role/IPI.pm b/lib/MusicBrainz/Server/Data/Role/IPI.pm
index 8ab5781b908..9162bd116a7 100644
--- a/lib/MusicBrainz/Server/Data/Role/IPI.pm
+++ b/lib/MusicBrainz/Server/Data/Role/IPI.pm
@@ -23,7 +23,8 @@ role
method find_reused_ipis => sub {
my ($self, @ipis) = @_;
- my $query = "SELECT 'artist' AS entity_type, artist_ipi.ipi, COUNT(*) AS count
+
+ my $query = q{SELECT 'artist' AS entity_type, artist_ipi.ipi, COUNT(*) AS count
FROM artist
JOIN artist_ipi ON artist.id = artist_ipi.artist
WHERE artist_ipi.ipi = any(?)
@@ -33,8 +34,9 @@ role
FROM label
JOIN label_ipi ON label.id = label_ipi.label
WHERE label_ipi.ipi = any(?)
- GROUP BY label_ipi.ipi";
+ GROUP BY label_ipi.ipi};
my $results = $self->sql->select_list_of_hashes($query, \@ipis, \@ipis);
+
my %reused_ipis;
for my $result (@$results) {
my $ipi = $result->{ipi};
diff --git a/lib/MusicBrainz/Server/Data/Role/ISNI.pm b/lib/MusicBrainz/Server/Data/Role/ISNI.pm
index 86e0d6472bb..c248b54c97e 100644
--- a/lib/MusicBrainz/Server/Data/Role/ISNI.pm
+++ b/lib/MusicBrainz/Server/Data/Role/ISNI.pm
@@ -23,7 +23,8 @@ role
method find_reused_isnis => sub {
my ($self, @isnis) = @_;
- my $query = "SELECT 'artist' AS entity_type, artist_isni.isni, COUNT(*) AS count
+
+ my $query = q{SELECT 'artist' AS entity_type, artist_isni.isni, COUNT(*) AS count
FROM artist
JOIN artist_isni ON artist.id = artist_isni.artist
WHERE artist_isni.isni = any(?)
@@ -33,8 +34,9 @@ role
FROM label
JOIN label_isni ON label.id = label_isni.label
WHERE label_isni.isni = any(?)
- GROUP BY label_isni.isni";
+ GROUP BY label_isni.isni};
my $results = $self->sql->select_list_of_hashes($query, \@isnis, \@isnis);
+
my %reused_isnis;
for my $result (@$results) {
my $isni = $result->{isni};
diff --git a/lib/MusicBrainz/Server/Data/Role/MediaWikiAPI.pm b/lib/MusicBrainz/Server/Data/Role/MediaWikiAPI.pm
index 275bf34d94a..035abf6b923 100644
--- a/lib/MusicBrainz/Server/Data/Role/MediaWikiAPI.pm
+++ b/lib/MusicBrainz/Server/Data/Role/MediaWikiAPI.pm
@@ -53,7 +53,7 @@ sub _get_and_process_json
}
# decode JSON depending on the action
- my $content = decode_json(encode("utf-8", $response->content));
+ my $content = decode_json(encode('utf-8', $response->content));
if ($content->{query}) {
# Wikipedia (action: query)
$content = $content->{query};
diff --git a/lib/MusicBrainz/Server/Data/Role/Merge.pm b/lib/MusicBrainz/Server/Data/Role/Merge.pm
index 635be1b89fb..39da325ffdb 100644
--- a/lib/MusicBrainz/Server/Data/Role/Merge.pm
+++ b/lib/MusicBrainz/Server/Data/Role/Merge.pm
@@ -22,10 +22,10 @@ around merge => sub {
unless $new_id && $new_id > 0;
my @to_merge = grep { $_ != $new_id } @old_ids
- or croak("Attempted to merge empty list of IDs into target");
+ or croak('Attempted to merge empty list of IDs into target');
@to_merge == @old_ids
- or croak("Attempted to merge an object into itself");
+ or croak('Attempted to merge an object into itself');
$self->_merge_impl($new_id, @to_merge);
};
diff --git a/lib/MusicBrainz/Server/Data/Role/NewFromRow.pm b/lib/MusicBrainz/Server/Data/Role/NewFromRow.pm
index 62268336321..0956846626d 100644
--- a/lib/MusicBrainz/Server/Data/Role/NewFromRow.pm
+++ b/lib/MusicBrainz/Server/Data/Role/NewFromRow.pm
@@ -5,7 +5,7 @@ use namespace::autoclean;
sub _entity_class
{
- die("Not implemented");
+ die('Not implemented');
}
sub _column_mapping
diff --git a/lib/MusicBrainz/Server/Data/Role/SelectAll.pm b/lib/MusicBrainz/Server/Data/Role/SelectAll.pm
index df6ebe302cf..46cec9be355 100644
--- a/lib/MusicBrainz/Server/Data/Role/SelectAll.pm
+++ b/lib/MusicBrainz/Server/Data/Role/SelectAll.pm
@@ -14,15 +14,15 @@ role
method '_get_all_from_db' => sub {
my ($self, $p) = @_;
- my $query = "SELECT " . $self->_columns .
- " FROM " . $self->_table .
- " ORDER BY " . (join ", ", @{ $p->order_by });
+ my $query = 'SELECT ' . $self->_columns .
+ ' FROM ' . $self->_table .
+ ' ORDER BY ' . (join ', ', @{ $p->order_by });
$self->query_to_list($query);
};
method '_delete_all_from_cache' => sub {
my $self = shift;
- $self->c->cache->delete($self->_type . ":all");
+ $self->c->cache->delete($self->_type . ':all');
};
# Clear cached data if the list of all entities has changed.
@@ -34,7 +34,7 @@ role
method 'get_all' => sub
{
my $self = shift;
- my $key = $self->_type . ":all";
+ my $key = $self->_type . ':all';
my $cache = $self->c->cache($self->_type);
my $all = $cache->get($key);
diff --git a/lib/MusicBrainz/Server/Data/Search.pm b/lib/MusicBrainz/Server/Data/Search.pm
index d42ff134d6c..f1e635c7633 100644
--- a/lib/MusicBrainz/Server/Data/Search.pm
+++ b/lib/MusicBrainz/Server/Data/Search.pm
@@ -64,9 +64,9 @@ use MusicBrainz::Server::Constants qw( entities_with $DARTIST_ID $DLABEL_ID );
use MusicBrainz::Server::Data::Utils qw( type_to_model );
use MusicBrainz::Server::ExternalUtils qw( get_chunked_with_retry );
use DateTime::Format::ISO8601;
-use feature "switch";
+use feature 'switch';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Data::Entity';
@@ -88,9 +88,9 @@ sub search
my @where_args;
- if ($type eq "artist") {
+ if ($type eq 'artist') {
- my $where_deleted = "WHERE entity.id != ?";
+ my $where_deleted = 'WHERE entity.id != ?';
$deleted_entity = $DARTIST_ID;
my $extra_columns = 'entity.gender, entity.area, entity.begin_area, entity.end_area,' if $type eq 'artist';
@@ -137,12 +137,12 @@ sub search
$hard_search_limit = $offset * 2;
}
elsif ($type ~~ [qw(recording release release_group)]) {
- my $extra_columns = "";
+ my $extra_columns = '';
$extra_columns .= 'entity.type AS primary_type_id,'
if ($type eq 'release_group');
- $extra_columns = "entity.length, entity.video,"
- if ($type eq "recording");
+ $extra_columns = 'entity.length, entity.video,'
+ if ($type eq 'recording');
$extra_columns .= 'entity.language, entity.script, entity.barcode,
entity.release_group, entity.status,'
@@ -167,9 +167,9 @@ sub search
elsif ($type eq 'recording') {
if ($where && exists $where->{artist})
{
- $join_sql .= " JOIN artist_credit ON artist_credit.id = entity.artist_credit";
+ $join_sql .= ' JOIN artist_credit ON artist_credit.id = entity.artist_credit';
$where_sql = 'WHERE artist_credit.name LIKE ?';
- push @where_args, "%".$where->{artist}."%";
+ push @where_args, '%'.$where->{artist}.'%';
}
}
my $extra_groupby_columns = $extra_columns =~ s/[^ ,]+ AS //gr;
@@ -209,11 +209,11 @@ sub search
}
elsif ($type ~~ [qw(area event instrument label place series work)]) {
- my $where_deleted = "WHERE entity.id != ?";
- if ($type eq "label") {
+ my $where_deleted = 'WHERE entity.id != ?';
+ if ($type eq 'label') {
$deleted_entity = $DLABEL_ID;
} else {
- $where_deleted = "";
+ $where_deleted = '';
}
my $extra_columns = '';
@@ -275,7 +275,7 @@ sub search
elsif ($type eq 'genre') {
- $query = "
+ $query = q{
SELECT
entity.id,
entity.gid,
@@ -297,29 +297,33 @@ sub search
rank DESC, entity.name, entity.gid
OFFSET
?
- ";
+ };
$use_hard_search_limit = 0;
}
- elsif ($type eq "tag") {
- $query = "
+ elsif ($type eq 'tag') {
+ $query = q{
SELECT tag.id, tag.name, genre.id AS genre_id,
ts_rank_cd(mb_simple_tsvector(tag.name), query, 2) AS rank
FROM tag LEFT JOIN genre USING (name), plainto_tsquery('mb_simple', mb_lower(?)) AS query
WHERE mb_simple_tsvector(tag.name) @@ query
ORDER BY rank DESC, tag.name
OFFSET ?
- ";
+ };
+
$use_hard_search_limit = 0;
}
elsif ($type eq 'editor') {
- $query = "SELECT id, name, ts_rank_cd(mb_simple_tsvector(name), query, 2) AS rank,
- email
- FROM editor, plainto_tsquery('mb_simple', mb_lower(?)) AS query
- WHERE mb_simple_tsvector(name) @@ query
- ORDER BY rank DESC
- OFFSET ?";
+ $query = q{
+ SELECT id, name, ts_rank_cd(mb_simple_tsvector(name), query, 2) AS rank,
+ email
+ FROM editor, plainto_tsquery('mb_simple', mb_lower(?)) AS query
+ WHERE mb_simple_tsvector(name) @@ query
+ ORDER BY rank DESC
+ OFFSET ?
+ };
+
$use_hard_search_limit = 0;
}
@@ -472,39 +476,39 @@ sub schema_fixup
}
if ($type eq 'release')
{
- if (defined $data->{"release-events"})
+ if (defined $data->{'release-events'})
{
$data->{events} = [];
- for my $release_event_data (@{$data->{"release-events"}})
+ for my $release_event_data (@{$data->{'release-events'}})
{
my $release_event = MusicBrainz::Server::Entity::ReleaseEvent->new(
country => defined($release_event_data->{area}) ?
MusicBrainz::Server::Entity::Area->new( gid => $release_event_data->{area}->{id},
- iso_3166_1 => $release_event_data->{area}->{"iso-3166-1-codes"},
+ iso_3166_1 => $release_event_data->{area}->{'iso-3166-1-codes'},
name => $release_event_data->{area}->{name} )
: undef,
date => MusicBrainz::Server::Entity::PartialDate->new( $release_event_data->{date} ));
push @{$data->{events}}, $release_event;
}
- delete $data->{"release-events"};
+ delete $data->{'release-events'};
}
if (defined $data->{barcode})
{
$data->{barcode} = MusicBrainz::Server::Entity::Barcode->new( $data->{barcode} );
}
- if (defined $data->{"text-representation"} &&
- defined $data->{"text-representation"}->{language})
+ if (defined $data->{'text-representation'} &&
+ defined $data->{'text-representation'}->{language})
{
$data->{language} = $self->c->model('Language')->find_by_code(
- $data->{"text-representation"}{language}
+ $data->{'text-representation'}{language}
);
}
- if (defined $data->{"text-representation"} &&
- defined $data->{"text-representation"}->{script})
+ if (defined $data->{'text-representation'} &&
+ defined $data->{'text-representation'}->{script})
{
$data->{script} = $self->c->model('Script')->find_by_code(
- $data->{"text-representation"}{script}
+ $data->{'text-representation'}{script}
);
}
@@ -523,14 +527,14 @@ sub schema_fixup
];
}
- if (defined $data->{"media"})
+ if (defined $data->{'media'})
{
$data->{mediums} = [];
- for my $medium_data (@{$data->{"media"}})
+ for my $medium_data (@{$data->{'media'}})
{
my $format = $medium_data->{format};
my $medium = MusicBrainz::Server::Entity::Medium->new(
- track_count => $medium_data->{"track-count"},
+ track_count => $medium_data->{'track-count'},
format => $format &&
MusicBrainz::Server::Entity::MediumFormat->new(
name => $format
@@ -540,7 +544,7 @@ sub schema_fixup
push @{$data->{mediums}}, $medium;
}
$data->{mediums_loaded} = 1;
- delete $data->{"media"};
+ delete $data->{'media'};
}
my $release_group = delete $data->{'release-group'};
@@ -583,27 +587,27 @@ sub schema_fixup
fixup_rg($data, $data);
}
if ($type eq 'recording' &&
- defined $data->{"releases"} &&
- defined $data->{"releases"}->[0] &&
- defined $data->{"releases"}->[0]->{"media"} &&
- defined $data->{"releases"}->[0]->{"media"}->[0])
+ defined $data->{'releases'} &&
+ defined $data->{'releases'}->[0] &&
+ defined $data->{'releases'}->[0]->{'media'} &&
+ defined $data->{'releases'}->[0]->{'media'}->[0])
{
my @releases;
- foreach my $release (@{$data->{"releases"}})
+ foreach my $release (@{$data->{'releases'}})
{
my $medium = MusicBrainz::Server::Entity::Medium->new(
- position => $release->{"media"}->[0]->{"position"},
- track_count => $release->{"media"}->[0]->{"track-count"},
+ position => $release->{'media'}->[0]->{'position'},
+ track_count => $release->{'media'}->[0]->{'track-count'},
tracks => [ MusicBrainz::Server::Entity::Track->new(
- position => $release->{"media"}->[0]->{"track-offset"} + 1,
+ position => $release->{'media'}->[0]->{'track-offset'} + 1,
recording => MusicBrainz::Server::Entity::Recording->new(
gid => $data->{gid}
)
) ]
);
my $release_group = MusicBrainz::Server::Entity::ReleaseGroup->new(
- fixup_rg($release->{"release-group"})
+ fixup_rg($release->{'release-group'})
);
push @releases, {
release => MusicBrainz::Server::Entity::Release->new(
@@ -632,12 +636,12 @@ sub schema_fixup
$data->{video} = defined $data->{video} && $data->{video} == 1;
}
- if (defined $data->{"relations"} &&
- defined $data->{"relations"}->[0])
+ if (defined $data->{'relations'} &&
+ defined $data->{'relations'}->[0])
{
my @relationships;
- foreach my $rel (@{ $data->{"relations"} })
+ foreach my $rel (@{ $data->{'relations'} })
{
my $target_type;
for (entities_with(['mbid', 'relatable'], take => 'url')) {
@@ -695,7 +699,7 @@ sub schema_fixup
if (defined $data->{'artist_credit'}) {
my @credits;
- foreach my $namecredit (@{$data->{"artist_credit"}})
+ foreach my $namecredit (@{$data->{'artist_credit'}})
{
my $artist = MusicBrainz::Server::Entity::Artist->new($namecredit->{artist});
push @credits, MusicBrainz::Server::Entity::ArtistCreditName->new( {
@@ -780,7 +784,7 @@ sub escape_query
{
my $str = shift;
- return "" unless defined $str;
+ return '' unless defined $str;
$str =~ s/([+\-&|!(){}\[\]\^"~*?:\\\/])/\\$1/g;
return $str;
@@ -802,16 +806,16 @@ sub external_search
my $dismax = $adv ? 'false' : 'true';
$search_url_string = "http://%s/ws/2/%s/?query=%s&offset=%s&max=%s&fmt=jsonnew&dismax=$dismax&web=1";
} else {
- my $endpoint = "advanced";
+ my $endpoint = 'advanced';
if (!$adv)
{
# Solr has a bug where the dismax end point behaves differently
# from edismax (advanced) when the query size is 1. This is a fix
# for that. See https://issues.apache.org/jira/browse/SOLR-12409
if (split(/[\P{Word}_]+/, $query, 2) == 1) {
- $endpoint = "basic";
+ $endpoint = 'basic';
} else {
- $endpoint = "select";
+ $endpoint = 'select';
}
}
$search_url_string = "http://%s/%s/$endpoint?q=%s&start=%s&rows=%s&wt=mbjson";
@@ -833,7 +837,7 @@ sub external_search
{
return { code => $response->code, error => $response->content };
}
- elsif ($response->status_line eq "200 Assumed OK")
+ elsif ($response->status_line eq '200 Assumed OK')
{
if ($response->content =~ /
([0-9]{3})/)
{
@@ -868,7 +872,7 @@ sub external_search
# Use types as provided by jsonnew format
if ($type ~~ [qw(area artist event instrument label place recording release release-group work annotation cdstub editor)]) {
- $xmltype .= "s";
+ $xmltype .= 's';
}
foreach my $t (@{$data->{$xmltype}})
diff --git a/lib/MusicBrainz/Server/Data/Series.pm b/lib/MusicBrainz/Server/Data/Series.pm
index 29b09274cb0..3e194bc8b81 100644
--- a/lib/MusicBrainz/Server/Data/Series.pm
+++ b/lib/MusicBrainz/Server/Data/Series.pm
@@ -75,12 +75,12 @@ sub _hash_to_row {
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
}
});
@@ -161,7 +161,7 @@ sub update {
if ($existing_entity_type ne $new_entity_type) {
my ($items, $hits) = $self->c->model('Series')->get_entities($series, 1, 0);
- die "Cannot change the entity type of a non-empty series" if scalar(@$items);
+ die 'Cannot change the entity type of a non-empty series' if scalar(@$items);
}
}
@@ -206,9 +206,9 @@ sub get_entities {
my $entity_type = $series->type->item_entity_type;
my $model = $self->c->model(type_to_model($entity_type));
- my $query = "
+ my $query = '
SELECT e.*, es.text_value AS ordering_key
- FROM (SELECT " . $model->_columns . " FROM " . $model->_table . ") e
+ FROM (SELECT ' . $model->_columns . ' FROM ' . $model->_table . ") e
JOIN (SELECT * FROM ${entity_type}_series) es ON e.id = es.$entity_type
WHERE es.series = ?
ORDER BY es.link_order, e.name COLLATE musicbrainz ASC";
@@ -227,11 +227,11 @@ sub get_entities {
sub find_by_subscribed_editor
{
my ($self, $editor_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN editor_subscribe_series s ON series.id = s.series
WHERE s.editor = ?
- ORDER BY series.name COLLATE musicbrainz, series.id";
+ ORDER BY series.name COLLATE musicbrainz, series.id';
$self->query_to_list_limited($query, [$editor_id], $limit, $offset);
}
@@ -336,7 +336,7 @@ sub automatically_reorder {
} @{ $relationships_by_link_order{$link_order} // [] };
unless ($conflicting_relationship) {
- push @from_values, "(?, ?)";
+ push @from_values, '(?, ?)';
push @from_args, $relationship->id, $link_order;
push @{$relationships_by_link_order{$link_order}}, $relationship;
}
@@ -355,8 +355,8 @@ sub automatically_reorder {
$self->c->sql->do("
UPDATE l_${type0}_${type1} SET link_order = x.link_order::integer
- FROM (VALUES " . join(", ", @from_values) . ") AS x (relationship, link_order)
- WHERE id = x.relationship::integer",
+ FROM (VALUES " . join(', ', @from_values) . ') AS x (relationship, link_order)
+ WHERE id = x.relationship::integer',
@from_args
);
}
diff --git a/lib/MusicBrainz/Server/Data/Statistics.pm b/lib/MusicBrainz/Server/Data/Statistics.pm
index 0dee83a2632..d7d5edb648f 100644
--- a/lib/MusicBrainz/Server/Data/Statistics.pm
+++ b/lib/MusicBrainz/Server/Data/Statistics.pm
@@ -86,19 +86,19 @@ sub last_refreshed {
}
my %stats = (
- "editor.top_recently_active" => {
- DESC => "Top recently active editors",
+ 'editor.top_recently_active' => {
+ DESC => 'Top recently active editors',
CALC => sub {
my ($self, $sql) = @_;
my $id_edits = $sql->select_list_of_lists(
- "SELECT editor, count(edit.id) FROM edit
+ q{SELECT editor, count(edit.id) FROM edit
JOIN editor ON edit.editor = editor.id
WHERE status IN (?, ?)
AND open_time >= now() - '1 week'::INTERVAL
AND cast(privs AS bit(2)) & B'10' = B'00'
GROUP BY edit.editor, editor.name
ORDER BY count(edit.id) DESC, editor.name COLLATE musicbrainz
- LIMIT 25",
+ LIMIT 25},
$STATUS_OPEN, $STATUS_APPLIED
);
@@ -113,18 +113,18 @@ my %stats = (
return \%map;
}
},
- "editor.top_active" => {
- DESC => "Top active editors",
+ 'editor.top_active' => {
+ DESC => 'Top active editors',
CALC => sub {
my ($self, $sql) = @_;
my $id_edits = $sql->select_list_of_lists(
- "SELECT edit.editor, COUNT(edit.id)
+ q{SELECT edit.editor, COUNT(edit.id)
FROM edit JOIN editor ON edit.editor = editor.id
WHERE status = ?
AND cast(editor.privs AS bit(2)) & B'10' = B'00'
GROUP BY edit.editor, editor.name
ORDER BY COUNT(edit.id) DESC, editor.name COLLATE musicbrainz
- LIMIT 25",
+ LIMIT 25},
$STATUS_APPLIED,
);
@@ -139,19 +139,19 @@ my %stats = (
return \%map;
}
},
- "editor.top_recently_active_voters" => {
- DESC => "Top recently active voters",
+ 'editor.top_recently_active_voters' => {
+ DESC => 'Top recently active voters',
CALC => sub {
my ($self, $sql) = @_;
my $id_edits = $sql->select_list_of_lists(
- "SELECT editor, count(vote.id) FROM vote
+ q{SELECT editor, count(vote.id) FROM vote
JOIN editor ON vote.editor = editor.id
WHERE NOT superseded AND vote != -1
AND vote_time >= now() - '1 week'::INTERVAL
AND cast(privs AS bit(10)) & 2::bit(10) = 0::bit(10)
GROUP BY vote.editor, editor.name
ORDER BY count(vote.id) DESC, editor.name COLLATE musicbrainz
- LIMIT 25"
+ LIMIT 25}
);
my %map;
@@ -165,18 +165,18 @@ my %stats = (
return \%map;
}
},
- "editor.top_active_voters" => {
- DESC => "Top active voters",
+ 'editor.top_active_voters' => {
+ DESC => 'Top active voters',
CALC => sub {
my ($self, $sql) = @_;
my $id_edits = $sql->select_list_of_lists(
- "SELECT editor, count(vote.id) FROM vote
+ 'SELECT editor, count(vote.id) FROM vote
JOIN editor ON vote.editor = editor.id
WHERE NOT superseded AND vote != -1
AND cast(privs AS bit(10)) & 2::bit(10) = 0::bit(10)
GROUP BY editor, editor.name
ORDER BY count(vote.id) DESC, editor.name COLLATE musicbrainz
- LIMIT 25"
+ LIMIT 25'
);
my %map;
@@ -190,39 +190,39 @@ my %stats = (
return \%map;
}
},
- "count.mbid" => {
- DESC => "Count of all MBIDs known/allocated",
- SQL => "SELECT " .
+ 'count.mbid' => {
+ DESC => 'Count of all MBIDs known/allocated',
+ SQL => 'SELECT ' .
join(' + ',
(map { "(SELECT COUNT(gid) FROM $_)" } entities_with('mbid', take => sub { my $type = shift; return shift->{table} // $type })),
(map { "(SELECT COUNT(gid) FROM ${_}_gid_redirect)" } entities_with(['mbid', 'multiple'], take => sub { my $type = shift; return shift->{table} // $type })))
},
- "count.release" => {
- DESC => "Count of all releases",
- SQL => "SELECT COUNT(*) FROM release",
+ 'count.release' => {
+ DESC => 'Count of all releases',
+ SQL => 'SELECT COUNT(*) FROM release',
},
- "count.releasegroup" => {
- DESC => "Count of all release groups",
- SQL => "SELECT COUNT(*) FROM release_group",
+ 'count.releasegroup' => {
+ DESC => 'Count of all release groups',
+ SQL => 'SELECT COUNT(*) FROM release_group',
},
- "count.area" => {
- DESC => "Count of all areas",
- SQL => "SELECT COUNT(*) FROM area",
+ 'count.area' => {
+ DESC => 'Count of all areas',
+ SQL => 'SELECT COUNT(*) FROM area',
},
- "count.country_area" => {
- DESC => "Count of all areas eligible for release country use",
- SQL => "SELECT COUNT(*) FROM country_area",
+ 'count.country_area' => {
+ DESC => 'Count of all areas eligible for release country use',
+ SQL => 'SELECT COUNT(*) FROM country_area',
},
- "count.area.type" => {
- DESC => "Distribution of areas by type",
+ 'count.area.type' => {
+ DESC => 'Distribution of areas by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(area.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(area.id) AS count
FROM area_type type
FULL OUTER JOIN area ON area.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -230,112 +230,110 @@ my %stats = (
+{
map {
- "count.area.type.".$_ => $dist{$_}
+ 'count.area.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.artist" => {
- DESC => "Count of all artists",
- SQL => "SELECT COUNT(*) FROM artist",
+ 'count.artist' => {
+ DESC => 'Count of all artists',
+ SQL => 'SELECT COUNT(*) FROM artist',
},
- "count.artist.type.person" => {
+ 'count.artist.type.person' => {
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type::text, 'null'), COUNT(*) AS count
+ q{SELECT COALESCE(type::text, 'null'), COUNT(*) AS count
FROM artist
- GROUP BY type
- ",
+ GROUP BY type},
);
my %dist = map { @$_ } @$data;
+{
- "count.artist.type.person" => $dist{1} || 0,
- "count.artist.type.group" => $dist{2} || 0,
- "count.artist.type.other" => $dist{3} || 0,
- "count.artist.type.character" => $dist{4} || 0,
- "count.artist.type.orchestra" => $dist{5} || 0,
- "count.artist.type.choir" => $dist{6} || 0,
- "count.artist.type.null" => $dist{null} || 0
+ 'count.artist.type.person' => $dist{1} || 0,
+ 'count.artist.type.group' => $dist{2} || 0,
+ 'count.artist.type.other' => $dist{3} || 0,
+ 'count.artist.type.character' => $dist{4} || 0,
+ 'count.artist.type.orchestra' => $dist{5} || 0,
+ 'count.artist.type.choir' => $dist{6} || 0,
+ 'count.artist.type.null' => $dist{null} || 0
};
},
},
- "count.artist.type.group" => {
+ 'count.artist.type.group' => {
PREREQ => [qw[ count.artist.type.person ]],
PREREQ_ONLY => 1,
},
- "count.artist.type.other" => {
+ 'count.artist.type.other' => {
PREREQ => [qw[ count.artist.type.person ]],
PREREQ_ONLY => 1,
},
- "count.artist.type.null" => {
+ 'count.artist.type.null' => {
PREREQ => [qw[ count.artist.type.person ]],
PREREQ_ONLY => 1,
},
- "count.artist.gender.male" => {
+ 'count.artist.gender.male' => {
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(gender::text, 'null'), COUNT(*) AS count
+ q{SELECT COALESCE(gender::text, 'null'), COUNT(*) AS count
FROM artist
WHERE (type NOT IN (2, 5, 6) OR type IS NULL)
- GROUP BY gender
- ",
+ GROUP BY gender},
);
my %dist = map { @$_ } @$data;
+{
- "count.artist.gender.male" => $dist{1} || 0,
- "count.artist.gender.female" => $dist{2} || 0,
- "count.artist.gender.other" => $dist{3} || 0,
- "count.artist.gender.not_applicable" => $dist{4} || 0,
- "count.artist.gender.null" => $dist{null} || 0
+ 'count.artist.gender.male' => $dist{1} || 0,
+ 'count.artist.gender.female' => $dist{2} || 0,
+ 'count.artist.gender.other' => $dist{3} || 0,
+ 'count.artist.gender.not_applicable' => $dist{4} || 0,
+ 'count.artist.gender.null' => $dist{null} || 0
};
},
},
- "count.artist.gender.female" => {
+ 'count.artist.gender.female' => {
PREREQ => [qw[ count.artist.gender.male ]],
PREREQ_ONLY => 1,
},
- "count.artist.gender.other" => {
+ 'count.artist.gender.other' => {
PREREQ => [qw[ count.artist.gender.male ]],
PREREQ_ONLY => 1,
},
- "count.artist.gender.not_applicable" => {
+ 'count.artist.gender.not_applicable' => {
PREREQ => [qw[ count.artist.gender.male ]],
PREREQ_ONLY => 1,
},
- "count.artist.gender.null" => {
+ 'count.artist.gender.null' => {
PREREQ => [qw[ count.artist.gender.male ]],
PREREQ_ONLY => 1,
},
- "count.artist.has_credits" => {
- DESC => "Artists in at least one artist credit",
- SQL => "SELECT COUNT(DISTINCT artist) FROM artist_credit_name",
+ 'count.artist.has_credits' => {
+ DESC => 'Artists in at least one artist credit',
+ SQL => 'SELECT COUNT(DISTINCT artist) FROM artist_credit_name',
},
- "count.artist.0credits" => {
- DESC => "Artists in no artist credits",
- SQL => "SELECT COUNT(DISTINCT artist.id) FROM artist LEFT OUTER JOIN artist_credit_name ON artist.id = artist_credit_name.artist WHERE artist_credit_name.artist_credit IS NULL",
+ 'count.artist.0credits' => {
+ DESC => 'Artists in no artist credits',
+ SQL => 'SELECT COUNT(DISTINCT artist.id) FROM artist LEFT OUTER JOIN artist_credit_name ON artist.id = artist_credit_name.artist WHERE artist_credit_name.artist_credit IS NULL',
},
- "count.event" => {
- DESC => "Count of all events",
- SQL => "SELECT COUNT(*) FROM event",
+ 'count.event' => {
+ DESC => 'Count of all events',
+ SQL => 'SELECT COUNT(*) FROM event',
},
- "count.event.type" => {
- DESC => "Distribution of events by type",
+ 'count.event.type' => {
+ DESC => 'Distribution of events by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(event.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(event.id) AS count
FROM event_type type
FULL OUTER JOIN event ON event.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -343,29 +341,29 @@ my %stats = (
+{
map {
- "count.event.type.".$_ => $dist{$_}
+ 'count.event.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.genre" => {
- DESC => "Count of all genres",
- SQL => "SELECT COUNT(*) FROM genre",
+ 'count.genre' => {
+ DESC => 'Count of all genres',
+ SQL => 'SELECT COUNT(*) FROM genre',
},
- "count.instrument" => {
- DESC => "Count of all instruments",
- SQL => "SELECT COUNT(*) FROM instrument",
+ 'count.instrument' => {
+ DESC => 'Count of all instruments',
+ SQL => 'SELECT COUNT(*) FROM instrument',
},
- "count.instrument.type" => {
- DESC => "Distribution of instruments by type",
+ 'count.instrument.type' => {
+ DESC => 'Distribution of instruments by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(instrument.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(instrument.id) AS count
FROM instrument_type type
FULL OUTER JOIN instrument ON instrument.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -373,25 +371,25 @@ my %stats = (
+{
map {
- "count.instrument.type.".$_ => $dist{$_}
+ 'count.instrument.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.place" => {
- DESC => "Count of all places",
- SQL => "SELECT COUNT(*) FROM place",
+ 'count.place' => {
+ DESC => 'Count of all places',
+ SQL => 'SELECT COUNT(*) FROM place',
},
- "count.place.type" => {
- DESC => "Distribution of places by type",
+ 'count.place.type' => {
+ DESC => 'Distribution of places by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(place.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(place.id) AS count
FROM place_type type
FULL OUTER JOIN place ON place.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -399,71 +397,71 @@ my %stats = (
+{
map {
- "count.place.type.".$_ => $dist{$_}
+ 'count.place.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.series" => {
- DESC => "Count of all series",
- SQL => "SELECT COUNT(*) FROM series",
+ 'count.series' => {
+ DESC => 'Count of all series',
+ SQL => 'SELECT COUNT(*) FROM series',
},
- "count.series.type" => {
- DESC => "Distribution of series by type",
+ 'count.series.type' => {
+ DESC => 'Distribution of series by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT type.id::text, COUNT(series.id) AS count
+ 'SELECT type.id::text, COUNT(series.id) AS count
FROM series_type type
FULL OUTER JOIN series ON series.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id',
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.series.type.".$_ => $dist{$_}
+ 'count.series.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.url" => {
+ 'count.url' => {
DESC => 'Count of all URLs',
SQL => 'SELECT count(*) FROM url',
},
- "count.coverart" => {
+ 'count.coverart' => {
DESC => 'Count of all cover art images',
SQL => 'SELECT count(*) FROM cover_art_archive.cover_art',
},
- "count.coverart.type" => {
- DESC => "Distribution of cover art by type",
+ 'count.coverart.type' => {
+ DESC => 'Distribution of cover art by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT art_type.name, COUNT(cover_art_type.id) AS count
+ 'SELECT art_type.name, COUNT(cover_art_type.id) AS count
FROM cover_art_archive.cover_art_type
JOIN cover_art_archive.art_type ON art_type.id = cover_art_type.type_id
- GROUP BY art_type.name",
+ GROUP BY art_type.name',
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.coverart.type.".$_ => $dist{$_}
+ 'count.coverart.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.coverart.amazon" => {
- DESC => "Releases whose cover art comes from Amazon",
+ 'count.release.coverart.amazon' => {
+ DESC => 'Releases whose cover art comes from Amazon',
CALC => sub {
my ($self, $sql) = @_;
- my $data = $sql->select_list_of_lists(<<~'EOSQL');
+ my $data = $sql->select_list_of_lists(<<~'SQL');
SELECT (cover_art_url ~ '^https?://.*.images-amazon.com')::int AS is_amazon, COUNT(*) FROM release_coverart
WHERE cover_art_url IS NOT NULL
AND NOT EXISTS (
@@ -471,32 +469,32 @@ my %stats = (
JOIN cover_art_archive.cover_art_type cat ON ca.id = cat.id
WHERE ca.release = release_coverart.id AND cat.type_id = 1)
GROUP BY is_amazon
- EOSQL
+ SQL
my %dist = map { @$_ } @$data;
+{
- "count.release.coverart.amazon" => $dist{1} // 0,
- "count.release.coverart.relationship" => $dist{0} // 0
+ 'count.release.coverart.amazon' => $dist{1} // 0,
+ 'count.release.coverart.relationship' => $dist{0} // 0
};
},
NONREPLICATED => 1,
},
- "count.release.coverart.relationship" => {
- DESC => "Releases whose cover art comes from relationships",
+ 'count.release.coverart.relationship' => {
+ DESC => 'Releases whose cover art comes from relationships',
PREREQ => [qw[ count.release.coverart.amazon ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.release.coverart.caa" => {
- DESC => "Releases whose cover art comes from the CAA",
+ 'count.release.coverart.caa' => {
+ DESC => 'Releases whose cover art comes from the CAA',
SQL => 'SELECT COUNT(distinct release) FROM cover_art_archive.cover_art ca
JOIN cover_art_archive.cover_art_type cat ON ca.id = cat.id
WHERE cat.type_id = 1',
},
- "count.release.coverart.none" => {
+ 'count.release.coverart.none' => {
PREREQ => [qw[ count.release count.release.coverart.amazon count.release.coverart.caa count.release.coverart.relationship ]],
- DESC => "Releases with no cover art",
+ DESC => 'Releases with no cover art',
CALC => sub {
my ($self, $sql) = @_;
@@ -507,38 +505,38 @@ my %stats = (
},
NONREPLICATED => 1,
},
- "count.release.status.statname.has_coverart" => {
- DESC => "Count of releases with cover art, by status",
+ 'count.release.status.statname.has_coverart' => {
+ DESC => 'Count of releases with cover art, by status',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT
+ q{SELECT
coalesce(release_status.name, 'null'),
count(DISTINCT cover_art.release)
FROM cover_art_archive.cover_art
JOIN release ON release.id = cover_art.release
FULL OUTER JOIN release_status
ON release_status.id = release.status
- GROUP BY coalesce(release_status.name, 'null')",
+ GROUP BY coalesce(release_status.name, 'null')},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.status.".$_.".has_coverart" => $dist{$_}
+ 'count.release.status.'.$_. '.has_coverart' => $dist{$_}
} keys %dist
};
},
},
- "count.release.type.typename.has_coverart" => {
- DESC => "Count of releases with cover art, by release group type",
+ 'count.release.type.typename.has_coverart' => {
+ DESC => 'Count of releases with cover art, by release group type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT
+ q{SELECT
coalesce(release_group_primary_type.name, 'null'),
count(DISTINCT cover_art.release)
FROM cover_art_archive.cover_art
@@ -547,25 +545,25 @@ my %stats = (
ON release.release_group = release_group.id
FULL OUTER JOIN release_group_primary_type
ON release_group_primary_type.id = release_group.type
- GROUP BY coalesce(release_group_primary_type.name, 'null')"
+ GROUP BY coalesce(release_group_primary_type.name, 'null')}
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.type.".$_.".has_coverart" => $dist{$_}
+ 'count.release.type.'.$_. '.has_coverart' => $dist{$_}
} keys %dist
};
},
},
- "count.release.format.fname.has_coverart" => {
- DESC => "Count of releases with cover art, by medium format",
+ 'count.release.format.fname.has_coverart' => {
+ DESC => 'Count of releases with cover art, by medium format',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT
+ q{SELECT
coalesce(medium_format.name, 'null'),
count(DISTINCT cover_art.release)
FROM cover_art_archive.cover_art
@@ -573,34 +571,33 @@ my %stats = (
JOIN medium ON medium.release = release.id
FULL OUTER JOIN medium_format
ON medium_format.id = medium.format
- GROUP BY coalesce(medium_format.name, 'null')",
+ GROUP BY coalesce(medium_format.name, 'null')},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.format.".$_.".has_coverart" => $dist{$_}
+ 'count.release.format.'.$_. '.has_coverart' => $dist{$_}
} keys %dist
};
},
},
- "count.coverart.per_release.Nimages" => {
- DESC => "Distribution of cover art images per release",
+ 'count.coverart.per_release.Nimages' => {
+ DESC => 'Distribution of cover art images per release',
CALC => sub {
my ($self, $sql) = @_;
my $max_dist_tail = 30;
my $data = $sql->select_list_of_lists(
- "SELECT c, COUNT(*) AS freq
+ 'SELECT c, COUNT(*) AS freq
FROM (
SELECT release, COUNT(*) AS c
FROM cover_art_archive.cover_art
GROUP BY release
) AS t
- GROUP BY c
- ",
+ GROUP BY c',
);
my %dist = map { $_ => 0 } 1 .. $max_dist_tail;
@@ -615,26 +612,26 @@ my %stats = (
+{
map {
- "count.coverart.per_release.".$_."images" => $dist{$_}
+ 'count.coverart.per_release.'.$_. 'images' => $dist{$_}
} keys %dist
};
},
},
- "count.label" => {
- DESC => "Count of all labels",
- SQL => "SELECT COUNT(*) FROM label",
+ 'count.label' => {
+ DESC => 'Count of all labels',
+ SQL => 'SELECT COUNT(*) FROM label',
},
- "count.label.type" => {
- DESC => "Distribution of labels by type",
+ 'count.label.type' => {
+ DESC => 'Distribution of labels by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(label.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(label.id) AS count
FROM label_type type
FULL OUTER JOIN label ON label.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -642,26 +639,26 @@ my %stats = (
+{
map {
- "count.label.type.".$_ => $dist{$_}
+ 'count.label.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.discid" => {
- DESC => "Count of all disc IDs",
- SQL => "SELECT COUNT(*) FROM cdtoc",
+ 'count.discid' => {
+ DESC => 'Count of all disc IDs',
+ SQL => 'SELECT COUNT(*) FROM cdtoc',
},
- "count.edit" => {
- DESC => "Count of all edits",
- SQL => "SELECT COUNT(*) FROM edit",
+ 'count.edit' => {
+ DESC => 'Count of all edits',
+ SQL => 'SELECT COUNT(*) FROM edit',
NONREPLICATED => 1,
},
- "count.editor" => {
- DESC => "Count of all editors, and assorted sub-pieces",
+ 'count.editor' => {
+ DESC => 'Count of all editors, and assorted sub-pieces',
CALC => sub {
my ($self, $sql) = @_;
- my $data = $sql->select_list_of_hashes(qq{
+ my $data = $sql->select_list_of_hashes('
WITH tag_editors AS (
SELECT editor FROM artist_tag_raw
UNION SELECT editor FROM area_tag_raw
@@ -694,9 +691,9 @@ my %stats = (
UNION SELECT editor FROM editor_subscribe_series_deleted
),
collection_editors AS (SELECT DISTINCT editor FROM editor_collection
- WHERE } . join(' OR ', map {
+ WHERE ' . join(' OR ', map {
"EXISTS (SELECT TRUE FROM editor_collection_$_ WHERE collection=editor_collection.id LIMIT 1)"
- } entities_with('collections')) . qq{ ),
+ } entities_with('collections')) . ' ),
voters AS (SELECT DISTINCT editor FROM vote),
noters AS (SELECT DISTINCT editor FROM edit_note),
application_editors AS (SELECT DISTINCT owner FROM application)
@@ -719,22 +716,22 @@ my %stats = (
LEFT JOIN voters ON editor.id = voters.editor
LEFT JOIN noters ON editor.id = noters.editor
LEFT JOIN application_editors ON editor.id = application_editors.owner
- GROUP BY valid, validated, edits, tags, ratings, subscriptions, collections, votes, notes, applications});
+ GROUP BY valid, validated, edits, tags, ratings, subscriptions, collections, votes, notes, applications');
my @active_markers = qw(edits tags ratings subscriptions collections votes notes applications);
my $stats = {
- "count.editor" => sub { return 1 },
- "count.editor.deleted" => sub { return !shift->{valid}},
- "count.editor.valid" => sub { return shift->{valid} },
- "count.editor.valid.inactive" => sub {
+ 'count.editor' => sub { return 1 },
+ 'count.editor.deleted' => sub { return !shift->{valid}},
+ 'count.editor.valid' => sub { return shift->{valid} },
+ 'count.editor.valid.inactive' => sub {
my $row = shift;
return $row->{valid} && !$row->{validated} && !(grep { $row->{$_} } @active_markers)
},
- "count.editor.valid.active" => sub {
+ 'count.editor.valid.active' => sub {
my $row = shift;
return $row->{valid} && (grep { $row->{$_} } @active_markers)
},
- "count.editor.valid.validated_only" => sub {
+ 'count.editor.valid.validated_only' => sub {
my $row = shift;
return $row->{valid} && $row->{validated} && !(grep { $row->{$_} } @active_markers)
}
@@ -758,73 +755,72 @@ my %stats = (
PRIVATE => 1,
},
- "count.barcode" => {
- DESC => "Count of all unique Barcodes",
- SQL => "SELECT COUNT(distinct barcode) FROM release",
+ 'count.barcode' => {
+ DESC => 'Count of all unique barcodes',
+ SQL => 'SELECT COUNT(distinct barcode) FROM release',
},
- "count.medium" => {
- DESC => "Count of all mediums",
- SQL => "SELECT COUNT(*) FROM medium",
+ 'count.medium' => {
+ DESC => 'Count of all mediums',
+ SQL => 'SELECT COUNT(*) FROM medium',
},
- "count.track" => {
- DESC => "Count of all tracks",
- SQL => "SELECT COUNT(*) FROM track",
+ 'count.track' => {
+ DESC => 'Count of all tracks',
+ SQL => 'SELECT COUNT(*) FROM track',
},
- "count.recording" => {
- DESC => "Count of all recordings",
- SQL => "SELECT COUNT(*) FROM recording",
+ 'count.recording' => {
+ DESC => 'Count of all recordings',
+ SQL => 'SELECT COUNT(*) FROM recording',
},
- "count.recording.standalone" => {
- DESC => "Count of all standalone recordings",
- SQL => "SELECT COUNT(*) FROM recording WHERE NOT EXISTS (
+ 'count.recording.standalone' => {
+ DESC => 'Count of all standalone recordings',
+ SQL => 'SELECT COUNT(*) FROM recording WHERE NOT EXISTS (
SELECT 1 FROM track WHERE track.recording = recording.id
- )",
+ )',
},
- "count.video" => {
- DESC => "Count of all video recordings",
- SQL => "SELECT COUNT(*) FROM recording WHERE video",
+ 'count.video' => {
+ DESC => 'Count of all video recordings',
+ SQL => 'SELECT COUNT(*) FROM recording WHERE video',
},
- "count.work" => {
- DESC => "Count of all works",
- SQL => "SELECT COUNT(*) FROM work",
+ 'count.work' => {
+ DESC => 'Count of all works',
+ SQL => 'SELECT COUNT(*) FROM work',
},
- "count.work.has_iswc" => {
- DESC => "Count of all works with at least one ISWC",
- SQL => "SELECT COUNT(DISTINCT work) FROM iswc",
+ 'count.work.has_iswc' => {
+ DESC => 'Count of all works with at least one ISWC',
+ SQL => 'SELECT COUNT(DISTINCT work) FROM iswc',
},
- "count.work.language" => {
- DESC => "Distribution of works by lyrics language",
+ 'count.work.language' => {
+ DESC => 'Distribution of works by lyrics language',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(l.iso_code_3::text, 'null'), COUNT(wl.work) AS count
+ q{SELECT COALESCE(l.iso_code_3::text, 'null'), COUNT(wl.work) AS count
FROM work_language wl FULL OUTER JOIN language l
ON wl.language=l.id
WHERE l.iso_code_2t IS NOT NULL OR l.frequency > 0
- GROUP BY l.iso_code_3
- ",
+ GROUP BY l.iso_code_3},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.work.language.".$_ => $dist{$_}
+ 'count.work.language.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.work.type" => {
- DESC => "Distribution of works by type",
+ 'count.work.type' => {
+ DESC => 'Distribution of works by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(type.id::text, 'null'), COUNT(work.id) AS count
+ q{SELECT COALESCE(type.id::text, 'null'), COUNT(work.id) AS count
FROM work_type type
FULL OUTER JOIN work ON work.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id},
);
my %dist = map { @$_ } @$data;
@@ -832,94 +828,94 @@ my %stats = (
+{
map {
- "count.work.type.".$_ => $dist{$_}
+ 'count.work.type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.work.attribute" => {
- DESC => "Distribution of works by attributes",
+ 'count.work.attribute' => {
+ DESC => 'Distribution of works by attributes',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(work_attribute_type.id::text, 'null'),
+ q{SELECT COALESCE(work_attribute_type.id::text, 'null'),
COUNT(DISTINCT work.id) AS count
FROM work_attribute
FULL OUTER JOIN work_attribute_type ON work_attribute_type.id = work_attribute.work_attribute_type
FULL OUTER JOIN work ON work.id = work_attribute.work
- GROUP BY work_attribute_type.id",
+ GROUP BY work_attribute_type.id},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.work.attribute.".$_ => $dist{$_}
+ 'count.work.attribute.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.artistcredit" => {
- DESC => "Count of all artist credits",
- SQL => "SELECT COUNT(*) FROM artist_credit",
+ 'count.artistcredit' => {
+ DESC => 'Count of all artist credits',
+ SQL => 'SELECT COUNT(*) FROM artist_credit',
},
- "count.ipi" => {
- DESC => "Count of IPI codes",
+ 'count.ipi' => {
+ DESC => 'Count of IPI codes',
PREREQ => [qw[ count.ipi.artist count.ipi.label ]],
CALC => sub {
my ($self, $sql) = @_;
- return $self->fetch("count.ipi.artist") + $self->fetch("count.ipi.label");
+ return $self->fetch('count.ipi.artist') + $self->fetch('count.ipi.label');
},
},
- "count.ipi.artist" => {
- DESC => "Count of artists with an IPI code",
- SQL => "SELECT COUNT(DISTINCT artist) FROM artist_ipi",
+ 'count.ipi.artist' => {
+ DESC => 'Count of artists with an IPI code',
+ SQL => 'SELECT COUNT(DISTINCT artist) FROM artist_ipi',
},
- "count.ipi.label" => {
- DESC => "Count of labels with an IPI code",
- SQL => "SELECT COUNT(DISTINCT label) FROM label_ipi",
+ 'count.ipi.label' => {
+ DESC => 'Count of labels with an IPI code',
+ SQL => 'SELECT COUNT(DISTINCT label) FROM label_ipi',
},
- "count.isni" => {
- DESC => "Count of ISNI codes",
+ 'count.isni' => {
+ DESC => 'Count of ISNI codes',
PREREQ => [qw[ count.isni.artist count.isni.label ]],
CALC => sub {
my ($self, $sql) = @_;
- return $self->fetch("count.isni.artist") + $self->fetch("count.isni.label");
+ return $self->fetch('count.isni.artist') + $self->fetch('count.isni.label');
},
},
- "count.isni.artist" => {
- DESC => "Count of artists with an ISNI code",
- SQL => "SELECT COUNT(DISTINCT artist) FROM artist_isni",
+ 'count.isni.artist' => {
+ DESC => 'Count of artists with an ISNI code',
+ SQL => 'SELECT COUNT(DISTINCT artist) FROM artist_isni',
},
- "count.isni.label" => {
- DESC => "Count of labels with an ISNI code",
- SQL => "SELECT COUNT(DISTINCT label) FROM label_isni",
+ 'count.isni.label' => {
+ DESC => 'Count of labels with an ISNI code',
+ SQL => 'SELECT COUNT(DISTINCT label) FROM label_isni',
},
- "count.isrc.all" => {
- DESC => "Count of all ISRCs joined to recordings",
- SQL => "SELECT COUNT(*) FROM isrc",
+ 'count.isrc.all' => {
+ DESC => 'Count of all ISRCs joined to recordings',
+ SQL => 'SELECT COUNT(*) FROM isrc',
},
- "count.isrc" => {
- DESC => "Count of unique ISRCs",
- SQL => "SELECT COUNT(distinct isrc) FROM isrc",
+ 'count.isrc' => {
+ DESC => 'Count of unique ISRCs',
+ SQL => 'SELECT COUNT(distinct isrc) FROM isrc',
},
- "count.iswc.all" => {
- DESC => "Count of all ISWCs",
- SQL => "SELECT COUNT(*) FROM iswc",
+ 'count.iswc.all' => {
+ DESC => 'Count of all ISWCs',
+ SQL => 'SELECT COUNT(*) FROM iswc',
},
- "count.iswc" => {
- DESC => "Count of unique ISWCs",
- SQL => "SELECT COUNT(distinct iswc) FROM iswc",
+ 'count.iswc' => {
+ DESC => 'Count of unique ISWCs',
+ SQL => 'SELECT COUNT(distinct iswc) FROM iswc',
},
- "count.vote" => {
- DESC => "Count of all votes",
- SQL => "SELECT COUNT(*) FROM vote",
+ 'count.vote' => {
+ DESC => 'Count of all votes',
+ SQL => 'SELECT COUNT(*) FROM vote',
NONREPLICATED => 1,
},
- "count.label.country" => {
- DESC => "Distribution of labels per country",
+ 'count.label.country' => {
+ DESC => 'Distribution of labels per country',
CALC => sub {
my ($self, $sql) = @_;
@@ -947,179 +943,171 @@ my %stats = (
+{
map {
- "count.label.country.".$_ => $dist{$_}
+ 'count.label.country.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.country" => {
- DESC => "Distribution of releases per country",
+ 'count.release.country' => {
+ DESC => 'Distribution of releases per country',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(iso.code::text, 'null'), COUNT(r.gid) AS count
+ q{SELECT COALESCE(iso.code::text, 'null'), COUNT(r.gid) AS count
FROM release r
LEFT JOIN release_country rc ON r.id = rc.release
FULL OUTER JOIN country_area c ON rc.country = c.area
LEFT JOIN iso_3166_1 iso ON c.area = iso.area
- GROUP BY iso.code
- ",
+ GROUP BY iso.code},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.country.".$_ => $dist{$_}
+ 'count.release.country.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.format" => {
- DESC => "Distribution of releases by format",
+ 'count.release.format' => {
+ DESC => 'Distribution of releases by format',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(medium_format.id::text, 'null'), count(DISTINCT medium.release) AS count
+ q{SELECT COALESCE(medium_format.id::text, 'null'), count(DISTINCT medium.release) AS count
FROM medium FULL OUTER JOIN medium_format
ON medium.format = medium_format.id
- GROUP BY medium_format.id
- ",
+ GROUP BY medium_format.id},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.format.".$_ => $dist{$_}
+ 'count.release.format.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.medium.format" => {
- DESC => "Distribution of mediums by format",
+ 'count.medium.format' => {
+ DESC => 'Distribution of mediums by format',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(medium_format.id::text, 'null'), count(DISTINCT medium.id) AS count
+ q{SELECT COALESCE(medium_format.id::text, 'null'), count(DISTINCT medium.id) AS count
FROM medium FULL OUTER JOIN medium_format
ON medium.format = medium_format.id
- GROUP BY medium_format.id
- ",
+ GROUP BY medium_format.id},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.medium.format.".$_ => $dist{$_}
+ 'count.medium.format.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.language" => {
- DESC => "Distribution of releases by language",
+ 'count.release.language' => {
+ DESC => 'Distribution of releases by language',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(l.iso_code_3::text, 'null'), COUNT(r.gid) AS count
+ q{SELECT COALESCE(l.iso_code_3::text, 'null'), COUNT(r.gid) AS count
FROM release r FULL OUTER JOIN language l
ON r.language=l.id
WHERE l.iso_code_2t IS NOT NULL OR l.frequency > 0
- GROUP BY l.iso_code_3
- ",
+ GROUP BY l.iso_code_3},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.language.".$_ => $dist{$_}
+ 'count.release.language.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.script" => {
- DESC => "Distribution of releases by script",
+ 'count.release.script' => {
+ DESC => 'Distribution of releases by script',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(s.iso_code::text, 'null'), COUNT(r.gid) AS count
+ q{SELECT COALESCE(s.iso_code::text, 'null'), COUNT(r.gid) AS count
FROM release r FULL OUTER JOIN script s
ON r.script=s.id
- GROUP BY s.iso_code
- ",
+ GROUP BY s.iso_code},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.script.".$_ => $dist{$_}
+ 'count.release.script.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.status" => {
- DESC => "Distribution of releases by status",
+ 'count.release.status' => {
+ DESC => 'Distribution of releases by status',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(s.id::text, 'null'), COUNT(r.gid) AS count
+ q{SELECT COALESCE(s.id::text, 'null'), COUNT(r.gid) AS count
FROM release r FULL OUTER JOIN release_status s
ON r.status=s.id
- GROUP BY s.id
- ",
+ GROUP BY s.id},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.status.".$_ => $dist{$_}
+ 'count.release.status.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.release.packaging" => {
- DESC => "Distribution of releases by packaging",
+ 'count.release.packaging' => {
+ DESC => 'Distribution of releases by packaging',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT COALESCE(p.id::text, 'null'), COUNT(r.gid) AS count
+ q{SELECT COALESCE(p.id::text, 'null'), COUNT(r.gid) AS count
FROM release r FULL OUTER JOIN release_packaging p
ON r.packaging=p.id
- GROUP BY p.id
- ",
+ GROUP BY p.id},
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.release.packaging.".$_ => $dist{$_}
+ 'count.release.packaging.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.releasegroup.Nreleases" => {
- DESC => "Distribution of releases per releasegroup",
+ 'count.releasegroup.Nreleases' => {
+ DESC => 'Distribution of releases per releasegroup',
CALC => sub {
my ($self, $sql) = @_;
my $max_dist_tail = 10;
my $data = $sql->select_list_of_lists(
- "SELECT release_count, COUNT(*) AS freq
+ 'SELECT release_count, COUNT(*) AS freq
FROM release_group_meta
- GROUP BY release_count
- ",
+ GROUP BY release_count',
);
my %dist = map { $_ => 0 } 0 .. $max_dist_tail;
@@ -1134,57 +1122,57 @@ my %stats = (
+{
map {
- "count.releasegroup.".$_."releases" => $dist{$_}
+ 'count.releasegroup.'.$_.'releases' => $dist{$_}
} keys %dist
};
},
},
- "count.releasegroup.primary_type" => {
- DESC => "Distribution of release groups by primary type",
+ 'count.releasegroup.primary_type' => {
+ DESC => 'Distribution of release groups by primary type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT type.id, COUNT(rg.id) AS count
+ 'SELECT type.id, COUNT(rg.id) AS count
FROM release_group_primary_type type
LEFT JOIN release_group rg ON rg.type = type.id
- GROUP BY type.id",
+ GROUP BY type.id',
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.releasegroup.primary_type.".$_ => $dist{$_}
+ 'count.releasegroup.primary_type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.releasegroup.secondary_type" => {
- DESC => "Distribution of release groups by secondary type",
+ 'count.releasegroup.secondary_type' => {
+ DESC => 'Distribution of release groups by secondary type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT type.id, COUNT(rg.id) AS count
+ 'SELECT type.id, COUNT(rg.id) AS count
FROM release_group_secondary_type type
LEFT JOIN release_group_secondary_type_join type_join
ON type.id = type_join.secondary_type
JOIN release_group rg ON rg.id = type_join.release_group
- GROUP BY type.id",
+ GROUP BY type.id',
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.releasegroup.secondary_type.".$_ => $dist{$_}
+ 'count.releasegroup.secondary_type.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.releasegroup.caa" => {
- DESC => "Count of release groups that have CAA artwork",
+ 'count.releasegroup.caa' => {
+ DESC => 'Count of release groups that have CAA artwork',
SQL => q{
SELECT count(DISTINCT release.release_group)
FROM cover_art_archive.index_listing
@@ -1193,177 +1181,176 @@ my %stats = (
WHERE is_front = true
}
},
- "count.releasegroup.caa.manually_selected" => {
- DESC => "Count of release groups that have CAA artwork manually selected",
+ 'count.releasegroup.caa.manually_selected' => {
+ DESC => 'Count of release groups that have CAA artwork manually selected',
SQL => 'SELECT count(DISTINCT release_group)
FROM cover_art_archive.release_group_cover_art'
},
- "count.releasegroup.caa.inferred" => {
+ 'count.releasegroup.caa.inferred' => {
PREREQ => [qw[ count.releasegroup.caa count.releasegroup.caa.manually_selected ]],
- DESC => "Releases groups with CAA artwork inferred from release artwork",
+ DESC => 'Releases groups with CAA artwork inferred from release artwork',
CALC => sub {
my ($self, $sql) = @_;
return $self->fetch('count.releasegroup.caa') -
$self->fetch('count.releasegroup.caa.manually_selected');
}
},
- "count.release.various" => {
- DESC => "Count of all 'Various Artists' releases",
+ 'count.release.various' => {
+ DESC => q(Count of all 'Various Artists' releases),
SQL => 'SELECT COUNT(*) FROM release
JOIN artist_credit ac ON ac.id = artist_credit
JOIN artist_credit_name acn ON acn.artist_credit = ac.id
WHERE artist_count = 1 AND artist = ' . $VARTIST_ID,
},
- "count.release.nonvarious" => {
- DESC => "Count of all releases, other than 'Various Artists'",
+ 'count.release.nonvarious' => {
+ DESC => q(Count of all releases, other than 'Various Artists'),
PREREQ => [qw[ count.release count.release.various ]],
CALC => sub {
my ($self, $sql) = @_;
- $self->fetch("count.release")
- - $self->fetch("count.release.various")
+ $self->fetch('count.release')
+ - $self->fetch('count.release.various')
},
},
- "count.medium.has_discid" => {
- DESC => "Count of media with at least one disc ID",
- SQL => "SELECT COUNT(DISTINCT medium)
- FROM medium_cdtoc",
+ 'count.medium.has_discid' => {
+ DESC => 'Count of media with at least one disc ID',
+ SQL => 'SELECT COUNT(DISTINCT medium) FROM medium_cdtoc',
},
- "count.release.has_discid" => {
- DESC => "Count of releases with at least one disc ID",
- SQL => "SELECT COUNT(DISTINCT medium.release)
+ 'count.release.has_discid' => {
+ DESC => 'Count of releases with at least one disc ID',
+ SQL => 'SELECT COUNT(DISTINCT medium.release)
FROM medium_cdtoc
- JOIN medium ON medium_cdtoc.medium = medium.id",
+ JOIN medium ON medium_cdtoc.medium = medium.id',
},
- "count.release.has_caa" => {
+ 'count.release.has_caa' => {
DESC => 'Count of releases that have cover art at the Cover Art Archive',
SQL => 'SELECT count(DISTINCT release) FROM cover_art_archive.cover_art',
PRIVATE => 1,
},
- "count.recording.has_isrc" => {
- DESC => "Count of recordings with at least one ISRC",
- SQL => "SELECT COUNT(DISTINCT recording) FROM isrc",
+ 'count.recording.has_isrc' => {
+ DESC => 'Count of recordings with at least one ISRC',
+ SQL => 'SELECT COUNT(DISTINCT recording) FROM isrc',
},
- "count.edit.open" => {
- DESC => "Count of open edits",
+ 'count.edit.open' => {
+ DESC => 'Count of open edits',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT status, COUNT(*) FROM edit GROUP BY status",
+ 'SELECT status, COUNT(*) FROM edit GROUP BY status',
);
my %dist = map { @$_ } @$data;
+{
- "count.edit.open" => $dist{$STATUS_OPEN} || 0,
- "count.edit.applied" => $dist{$STATUS_APPLIED} || 0,
- "count.edit.failedvote" => $dist{$STATUS_FAILEDVOTE} || 0,
- "count.edit.faileddep" => $dist{$STATUS_FAILEDDEP} || 0,
- "count.edit.error" => $dist{$STATUS_ERROR} || 0,
- "count.edit.failedprereq" => $dist{$STATUS_FAILEDPREREQ} || 0,
- "count.edit.evalnochange" => 0,
- "count.edit.deleted" => $dist{$STATUS_DELETED} || 0,
+ 'count.edit.open' => $dist{$STATUS_OPEN} || 0,
+ 'count.edit.applied' => $dist{$STATUS_APPLIED} || 0,
+ 'count.edit.failedvote' => $dist{$STATUS_FAILEDVOTE} || 0,
+ 'count.edit.faileddep' => $dist{$STATUS_FAILEDDEP} || 0,
+ 'count.edit.error' => $dist{$STATUS_ERROR} || 0,
+ 'count.edit.failedprereq' => $dist{$STATUS_FAILEDPREREQ} || 0,
+ 'count.edit.evalnochange' => 0,
+ 'count.edit.deleted' => $dist{$STATUS_DELETED} || 0,
};
},
NONREPLICATED => 1,
},
- "count.edit.applied" => {
- DESC => "Count of applied edits",
+ 'count.edit.applied' => {
+ DESC => 'Count of applied edits',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.failedvote" => {
- DESC => "Count of edits which were voted down",
+ 'count.edit.failedvote' => {
+ DESC => 'Count of edits which were voted down',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.faileddep" => {
- DESC => "Count of edits which failed their dependency check",
+ 'count.edit.faileddep' => {
+ DESC => 'Count of edits which failed their dependency check',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.error" => {
- DESC => "Count of edits which failed because of an internal error",
+ 'count.edit.error' => {
+ DESC => 'Count of edits which failed because of an internal error',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.failedprereq" => {
- DESC => "Count of edits which failed because a prerequisitite moderation failed",
+ 'count.edit.failedprereq' => {
+ DESC => 'Count of edits which failed because a prerequisitite moderation failed',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.evalnochange" => {
- DESC => "Count of evalnochange edits",
+ 'count.edit.evalnochange' => {
+ DESC => 'Count of evalnochange edits',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.deleted" => {
- DESC => "Count of deleted edits",
+ 'count.edit.deleted' => {
+ DESC => 'Count of deleted edits',
PREREQ => [qw[ count.edit.open ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.edit.perday" => {
- DESC => "Count of edits per day",
- SQL => "SELECT count(id) FROM edit
+ 'count.edit.perday' => {
+ DESC => 'Count of edits per day',
+ SQL => q{SELECT count(id) FROM edit
WHERE open_time >= (now() - interval '1 day')
- AND editor NOT IN (". $EDITOR_FREEDB .", ". $EDITOR_MODBOT .")",
+ AND editor NOT IN (}. $EDITOR_FREEDB .', '. $EDITOR_MODBOT .')',
NONREPLICATED => 1,
},
- "count.edit.perweek" => {
- DESC => "Count of edits per week",
- SQL => "SELECT count(id) FROM edit
+ 'count.edit.perweek' => {
+ DESC => 'Count of edits per week',
+ SQL => q{SELECT count(id) FROM edit
WHERE open_time >= (now() - interval '7 days')
- AND editor NOT IN (". $EDITOR_FREEDB .", ". $EDITOR_MODBOT .")",
+ AND editor NOT IN (}. $EDITOR_FREEDB .', '. $EDITOR_MODBOT .')',
NONREPLICATED => 1,
},
- "count.edit.type" => {
- DESC => "Count of edits by type",
+ 'count.edit.type' => {
+ DESC => 'Count of edits by type',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT type, count(id) AS count
- FROM edit GROUP BY type",
+ 'SELECT type, count(id) AS count
+ FROM edit GROUP BY type',
);
my %dist = map { @$_ } @$data;
+{
map {
- "count.edit.type.".$_ => $dist{$_}
+ 'count.edit.type.'.$_ => $dist{$_}
} keys %dist
};
}
},
- "count.cdstub" => {
- DESC => "Count of all existing CD Stubs",
- SQL => "SELECT COUNT(*) FROM release_raw",
+ 'count.cdstub' => {
+ DESC => 'Count of all existing CD Stubs',
+ SQL => 'SELECT COUNT(*) FROM release_raw',
NONREPLICATED => 1,
},
- "count.cdstub.submitted" => {
- DESC => "Count of all submitted CD Stubs",
- SQL => "SELECT MAX(id) FROM release_raw",
+ 'count.cdstub.submitted' => {
+ DESC => 'Count of all submitted CD Stubs',
+ SQL => 'SELECT MAX(id) FROM release_raw',
NONREPLICATED => 1,
},
- "count.cdstub.track" => {
- DESC => "Count of all CD Stub tracks",
- SQL => "SELECT COUNT(*) FROM track_raw",
+ 'count.cdstub.track' => {
+ DESC => 'Count of all CD Stub tracks',
+ SQL => 'SELECT COUNT(*) FROM track_raw',
NONREPLICATED => 1,
},
- "count.artist.country" => {
- DESC => "Distribution of artists per country",
+ 'count.artist.country' => {
+ DESC => 'Distribution of artists per country',
CALC => sub {
my ($self, $sql) = @_;
@@ -1391,101 +1378,101 @@ my %stats = (
+{
map {
- "count.artist.country.".$_ => $dist{$_}
+ 'count.artist.country.'.$_ => $dist{$_}
} keys %dist
};
},
},
- "count.vote.yes" => {
- DESC => "Count of 'yes' votes",
+ 'count.vote.yes' => {
+ DESC => q(Count of 'yes' votes),
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT vote, COUNT(*) FROM vote GROUP BY vote",
+ 'SELECT vote, COUNT(*) FROM vote GROUP BY vote',
);
my %dist = map { @$_ } @$data;
+{
- "count.vote.yes" => $dist{$VOTE_YES} || 0,
- "count.vote.no" => $dist{$VOTE_NO} || 0,
- "count.vote.abstain" => $dist{$VOTE_ABSTAIN} || 0,
- "count.vote.approve" => $dist{$VOTE_APPROVE} || 0,
+ 'count.vote.yes' => $dist{$VOTE_YES} || 0,
+ 'count.vote.no' => $dist{$VOTE_NO} || 0,
+ 'count.vote.abstain' => $dist{$VOTE_ABSTAIN} || 0,
+ 'count.vote.approve' => $dist{$VOTE_APPROVE} || 0,
};
},
NONREPLICATED => 1,
},
- "count.vote.no" => {
- DESC => "Count of 'no' votes",
+ 'count.vote.no' => {
+ DESC => q(Count of 'no' votes),
PREREQ => [qw[ count.vote.yes ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.vote.abstain" => {
- DESC => "Count of 'abstain' votes",
+ 'count.vote.abstain' => {
+ DESC => q(Count of 'abstain' votes),
PREREQ => [qw[ count.vote.yes ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.vote.approve" => {
- DESC => "Count of auto-editor approvals",
+ 'count.vote.approve' => {
+ DESC => 'Count of auto-editor approvals',
PREREQ => [qw[ count.vote.yes ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.vote.perday" => {
- DESC => "Count of votes per day",
- SQL => "SELECT count(id) FROM vote
+ 'count.vote.perday' => {
+ DESC => 'Count of votes per day',
+ SQL => q{SELECT count(id) FROM vote
WHERE vote_time >= (now() - interval '1 day')
- AND vote <> ". $VOTE_ABSTAIN,
+ AND vote <> } . $VOTE_ABSTAIN,
NONREPLICATED => 1,
},
- "count.vote.perweek" => {
- DESC => "Count of votes per week",
- SQL => "SELECT count(id) FROM vote
+ 'count.vote.perweek' => {
+ DESC => 'Count of votes per week',
+ SQL => q{SELECT count(id) FROM vote
WHERE vote_time >= (now() - interval '7 days')
- AND vote <> ". $VOTE_ABSTAIN,
+ AND vote <> } . $VOTE_ABSTAIN,
NONREPLICATED => 1,
},
# count active moderators in last week(?)
# editing / voting / overall
- "count.editor.editlastweek" => {
- DESC => "Count of editors who have submitted edits during the last week",
+ 'count.editor.editlastweek' => {
+ DESC => 'Count of editors who have submitted edits during the last week',
CALC => sub {
my ($self, $sql) = @_;
my $threshold_id = $sql->select_single_value(
- "SELECT MAX(id) FROM edit
- WHERE open_time <= (now() - interval '7 days')",
+ q{SELECT MAX(id) FROM edit
+ WHERE open_time <= (now() - interval '7 days')},
);
# Active voters
my $voters = $sql->select_single_value(
- "SELECT COUNT(DISTINCT editor)
+ 'SELECT COUNT(DISTINCT editor)
FROM vote
WHERE edit > ?
- AND editor != ?",
+ AND editor != ?',
$threshold_id,
$EDITOR_FREEDB,
);
# Editors
my $editors = $sql->select_single_value(
- "SELECT COUNT(DISTINCT editor)
+ 'SELECT COUNT(DISTINCT editor)
FROM edit
WHERE id > ?
- AND editor != ?",
+ AND editor != ?',
$threshold_id,
$EDITOR_FREEDB,
);
# Either
my $both = $sql->select_single_value(
- "SELECT COUNT(DISTINCT m) FROM (
+ 'SELECT COUNT(DISTINCT m) FROM (
SELECT editor AS m
FROM edit
WHERE id > ?
@@ -1493,28 +1480,28 @@ my %stats = (
SELECT editor AS m
FROM vote
WHERE edit > ?
- ) t WHERE m != ?",
+ ) t WHERE m != ?',
$threshold_id,
$threshold_id,
$EDITOR_FREEDB,
);
+{
- "count.editor.editlastweek" => $editors,
- "count.editor.votelastweek" => $voters,
- "count.editor.activelastweek"=> $both,
+ 'count.editor.editlastweek' => $editors,
+ 'count.editor.votelastweek' => $voters,
+ 'count.editor.activelastweek'=> $both,
};
},
NONREPLICATED => 1,
},
- "count.editor.votelastweek" => {
- DESC => "Count of editors who have voted on edits during the last week",
+ 'count.editor.votelastweek' => {
+ DESC => 'Count of editors who have voted on edits during the last week',
PREREQ => [qw[ count.editor.editlastweek ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
},
- "count.editor.activelastweek" => {
- DESC => "Count of active editors (editing or voting) during the last week",
+ 'count.editor.activelastweek' => {
+ DESC => 'Count of active editors (editing or voting) during the last week',
PREREQ => [qw[ count.editor.editlastweek ]],
PREREQ_ONLY => 1,
NONREPLICATED => 1,
@@ -1527,9 +1514,9 @@ my %stats = (
# Top 10 voters all time
# Tags
- "count.tag" => {
- DESC => "Count of all tags",
- SQL => "SELECT COUNT(*) FROM tag",
+ 'count.tag' => {
+ DESC => 'Count of all tags',
+ SQL => 'SELECT COUNT(*) FROM tag',
},
(map {
@@ -1547,8 +1534,8 @@ my %stats = (
})
} entities_with(['tags'])),
- "count.tag.raw" => {
- DESC => "Count of all raw tags",
+ 'count.tag.raw' => {
+ DESC => 'Count of all raw tags',
PREREQ => [ map { $_ =~ s/_//; "count.tag.raw.$_" } entities_with(['tags']) ],
CALC => sub {
my ($self, $sql) = @_;
@@ -1565,153 +1552,155 @@ my %stats = (
},
# Ratings
- "count.rating.artist" => {
- DESC => "Count of artist ratings",
+ 'count.rating.artist' => {
+ DESC => 'Count of artist ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM artist_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM artist_meta WHERE rating_count > 0',
);
+{
- "count.rating.artist" => $data->[0] || 0,
- "count.rating.raw.artist" => $data->[1] || 0,
+ 'count.rating.artist' => $data->[0] || 0,
+ 'count.rating.raw.artist' => $data->[1] || 0,
};
},
},
- "count.rating.raw.artist" => {
- DESC => "Count of all artist raw ratings",
+ 'count.rating.raw.artist' => {
+ DESC => 'Count of all artist raw ratings',
PREREQ => [qw[ count.rating.artist ]],
PREREQ_ONLY => 1,
},
- "count.rating.releasegroup" => {
- DESC => "Count of release group ratings",
+ 'count.rating.releasegroup' => {
+ DESC => 'Count of release group ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM release_group_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM release_group_meta WHERE rating_count > 0',
);
+{
- "count.rating.releasegroup" => $data->[0] || 0,
- "count.rating.raw.releasegroup" => $data->[1] || 0,
+ 'count.rating.releasegroup' => $data->[0] || 0,
+ 'count.rating.raw.releasegroup' => $data->[1] || 0,
};
},
},
- "count.rating.raw.releasegroup" => {
- DESC => "Count of all release group raw ratings",
+ 'count.rating.raw.releasegroup' => {
+ DESC => 'Count of all release group raw ratings',
PREREQ => [qw[ count.rating.releasegroup ]],
PREREQ_ONLY => 1,
},
- "count.rating.recording" => {
- DESC => "Count of recording ratings",
+ 'count.rating.recording' => {
+ DESC => 'Count of recording ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM recording_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM recording_meta WHERE rating_count > 0',
);
+{
- "count.rating.recording" => $data->[0] || 0,
- "count.rating.raw.recording" => $data->[1] || 0,
+ 'count.rating.recording' => $data->[0] || 0,
+ 'count.rating.raw.recording' => $data->[1] || 0,
};
},
},
- "count.rating.raw.recording" => {
- DESC => "Count of all recording raw ratings",
+ 'count.rating.raw.recording' => {
+ DESC => 'Count of all recording raw ratings',
PREREQ => [qw[ count.rating.recording ]],
PREREQ_ONLY => 1,
},
- "count.rating.label" => {
- DESC => "Count of label ratings",
+ 'count.rating.label' => {
+ DESC => 'Count of label ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM label_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM label_meta WHERE rating_count > 0',
);
+{
- "count.rating.label" => $data->[0] || 0,
- "count.rating.raw.label" => $data->[1] || 0,
+ 'count.rating.label' => $data->[0] || 0,
+ 'count.rating.raw.label' => $data->[1] || 0,
};
},
},
- "count.rating.raw.label" => {
- DESC => "Count of all label raw ratings",
+ 'count.rating.raw.label' => {
+ DESC => 'Count of all label raw ratings',
PREREQ => [qw[ count.rating.label ]],
PREREQ_ONLY => 1,
},
- "count.rating.place" => {
- DESC => "Count of place ratings",
+ 'count.rating.place' => {
+ DESC => 'Count of place ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM place_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM place_meta WHERE rating_count > 0',
);
+{
- "count.rating.place" => $data->[0] || 0,
- "count.rating.raw.place" => $data->[1] || 0,
+ 'count.rating.place' => $data->[0] || 0,
+ 'count.rating.raw.place' => $data->[1] || 0,
};
},
},
- "count.rating.raw.place" => {
- DESC => "Count of all place raw ratings",
+ 'count.rating.raw.place' => {
+ DESC => 'Count of all place raw ratings',
PREREQ => [qw[ count.rating.place ]],
PREREQ_ONLY => 1,
},
- "count.rating.work" => {
- DESC => "Count of work ratings",
+ 'count.rating.work' => {
+ DESC => 'Count of work ratings',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_single_row_array(
- "SELECT COUNT(*), SUM(rating_count) FROM work_meta WHERE rating_count > 0",
+ 'SELECT COUNT(*), SUM(rating_count) FROM work_meta WHERE rating_count > 0',
);
+{
- "count.rating.work" => $data->[0] || 0,
- "count.rating.raw.work" => $data->[1] || 0,
+ 'count.rating.work' => $data->[0] || 0,
+ 'count.rating.raw.work' => $data->[1] || 0,
};
},
},
- "count.rating.raw.work" => {
- DESC => "Count of all work raw ratings",
+ 'count.rating.raw.work' => {
+ DESC => 'Count of all work raw ratings',
PREREQ => [qw[ count.rating.work ]],
PREREQ_ONLY => 1,
},
- "count.rating" => {
- DESC => "Count of all ratings",
- PREREQ => [qw[ count.rating.artist count.rating.label count.rating.releasegroup count.rating.recording count.rating.work ]],
+ 'count.rating' => {
+ DESC => 'Count of all ratings',
+ PREREQ => [qw[ count.rating.artist count.rating.label count.rating.place count.rating.releasegroup count.rating.recording count.rating.work ]],
CALC => sub {
my ($self, $sql) = @_;
return $self->fetch('count.rating.artist') +
$self->fetch('count.rating.label') +
+ $self->fetch('count.rating.place') +
$self->fetch('count.rating.releasegroup') +
$self->fetch('count.rating.work') +
$self->fetch('count.rating.recording');
},
},
- "count.rating.raw" => {
- DESC => "Count of all raw ratings",
- PREREQ => [qw[ count.rating.raw.artist count.rating.raw.label count.rating.raw.releasegroup count.rating.raw.recording count.rating.raw.work ]],
+ 'count.rating.raw' => {
+ DESC => 'Count of all raw ratings',
+ PREREQ => [qw[ count.rating.raw.artist count.rating.raw.label count.rating.raw.place count.rating.raw.releasegroup count.rating.raw.recording count.rating.raw.work ]],
CALC => sub {
my ($self, $sql) = @_;
return $self->fetch('count.rating.raw.artist') +
$self->fetch('count.rating.raw.label') +
+ $self->fetch('count.rating.raw.place') +
$self->fetch('count.rating.raw.releasegroup') +
$self->fetch('count.rating.raw.work') +
$self->fetch('count.rating.raw.recording');
},
},
- "count.release.Ndiscids" => {
- DESC => "Distribution of disc IDs per release (varying disc IDs)",
+ 'count.release.Ndiscids' => {
+ DESC => 'Distribution of disc IDs per release (varying disc IDs)',
PREREQ => [qw[ count.release count.release.has_discid ]],
CALC => sub {
my ($self, $sql) = @_;
@@ -1719,15 +1708,14 @@ my %stats = (
my $max_dist_tail = 10;
my $data = $sql->select_list_of_lists(
- "SELECT c, COUNT(*) AS freq
+ 'SELECT c, COUNT(*) AS freq
FROM (
SELECT medium.release, COUNT(*) AS c
FROM medium_cdtoc
JOIN medium ON medium_cdtoc.medium = medium.id
GROUP BY medium.release
) AS t
- GROUP BY c
- ",
+ GROUP BY c',
);
my %dist = map { $_ => 0 } 1 .. $max_dist_tail;
@@ -1740,19 +1728,19 @@ my %stats = (
$dist{$max_dist_tail} += $_->[1];
}
- $dist{0} = $self->fetch("count.release")
- - $self->fetch("count.release.has_discid");
+ $dist{0} = $self->fetch('count.release')
+ - $self->fetch('count.release.has_discid');
+{
map {
- "count.release.".$_."discids" => $dist{$_}
+ 'count.release.'.$_.'discids' => $dist{$_}
} keys %dist
};
},
},
- "count.medium.Ndiscids" => {
- DESC => "Distribution of disc IDs per medium (varying disc IDs)",
+ 'count.medium.Ndiscids' => {
+ DESC => 'Distribution of disc IDs per medium (varying disc IDs)',
PREREQ => [qw[ count.medium count.medium.has_discid ]],
CALC => sub {
my ($self, $sql) = @_;
@@ -1760,14 +1748,13 @@ my %stats = (
my $max_dist_tail = 10;
my $data = $sql->select_list_of_lists(
- "SELECT c, COUNT(*) AS freq
+ 'SELECT c, COUNT(*) AS freq
FROM (
SELECT medium, COUNT(*) AS c
FROM medium_cdtoc
GROUP BY medium
) AS t
- GROUP BY c
- ",
+ GROUP BY c',
);
my %dist = map { $_ => 0 } 1 .. $max_dist_tail;
@@ -1780,66 +1767,67 @@ my %stats = (
$dist{$max_dist_tail} += $_->[1];
}
- $dist{0} = $self->fetch("count.medium")
- - $self->fetch("count.medium.has_discid");
+ $dist{0} = $self->fetch('count.medium')
+ - $self->fetch('count.medium.has_discid');
+{
map {
- "count.medium.".$_."discids" => $dist{$_}
+ 'count.medium.'.$_.'discids' => $dist{$_}
} keys %dist
};
},
},
- "count.quality.release.high" => {
- DESC => "Count of high quality releases",
+ 'count.quality.release.high' => {
+ DESC => 'Count of high quality releases',
CALC => sub {
my ($self, $sql) = @_;
my $data = $sql->select_list_of_lists(
- "SELECT quality, COUNT(*) FROM release GROUP BY quality",
+ 'SELECT quality, COUNT(*) FROM release GROUP BY quality',
);
+
my %dist = map { @$_ } @$data;
+{
- "count.quality.release.high" => $dist{$QUALITY_HIGH} || 0,
- "count.quality.release.low" => $dist{$QUALITY_LOW} || 0,
- "count.quality.release.normal" => $dist{$QUALITY_NORMAL} || 0,
- "count.quality.release.unknown" => $dist{$QUALITY_UNKNOWN} || 0,
- "count.quality.release.default" => ($dist{$QUALITY_UNKNOWN} || 0) + ($dist{$QUALITY_NORMAL} || 0),
+ 'count.quality.release.high' => $dist{$QUALITY_HIGH} || 0,
+ 'count.quality.release.low' => $dist{$QUALITY_LOW} || 0,
+ 'count.quality.release.normal' => $dist{$QUALITY_NORMAL} || 0,
+ 'count.quality.release.unknown' => $dist{$QUALITY_UNKNOWN} || 0,
+ 'count.quality.release.default' => ($dist{$QUALITY_UNKNOWN} || 0) + ($dist{$QUALITY_NORMAL} || 0),
};
},
},
- "count.quality.release.low" => {
- DESC => "Count of low quality releases",
+ 'count.quality.release.low' => {
+ DESC => 'Count of low quality releases',
PREREQ => [qw[ count.quality.release.high ]],
PREREQ_ONLY => 1,
},
- "count.quality.release.normal" => {
- DESC => "Count of normal quality releases",
+ 'count.quality.release.normal' => {
+ DESC => 'Count of normal quality releases',
PREREQ => [qw[ count.quality.release.high ]],
PREREQ_ONLY => 1,
},
- "count.quality.release.unknown" => {
- DESC => "Count of unknow quality releases",
+ 'count.quality.release.unknown' => {
+ DESC => 'Count of unknow quality releases',
PREREQ => [qw[ count.quality.release.high ]],
PREREQ_ONLY => 1,
},
- "count.quality.release.default" => {
- DESC => "Count of default quality releases",
+ 'count.quality.release.default' => {
+ DESC => 'Count of default quality releases',
PREREQ => [qw[ count.quality.release.high ]],
PREREQ_ONLY => 1,
},
- "count.recording.Nreleases" => {
- DESC => "Distribution of appearances on releases per recording",
+ 'count.recording.Nreleases' => {
+ DESC => 'Distribution of appearances on releases per recording',
CALC => sub {
my ($self, $sql) = @_;
my $max_dist_tail = 10;
my $data = $sql->select_list_of_lists(
- "SELECT c, COUNT(*) AS freq
+ 'SELECT c, COUNT(*) AS freq
FROM (
SELECT r.id, count(distinct release.id) AS c
FROM recording r
@@ -1848,8 +1836,7 @@ my %stats = (
LEFT JOIN release ON m.release = release.id
GROUP BY r.id
) AS t
- GROUP BY c
- ",
+ GROUP BY c',
);
my %dist = map { $_ => 0 } 0 .. $max_dist_tail;
@@ -1864,14 +1851,14 @@ my %stats = (
+{
map {
- "count.recording.".$_."releases" => $dist{$_}
+ 'count.recording.'.$_.'releases' => $dist{$_}
} keys %dist
};
},
},
- "count.ar.links.table.type_name" => {
- DESC => "Count of advanced relationship links by type, inclusive of child counts and exclusive",
+ 'count.ar.links.table.type_name' => {
+ DESC => 'Count of advanced relationship links by type, inclusive of child counts and exclusive',
CALC => sub {
my ($self, $sql) = @_;
my %dist;
@@ -1886,6 +1873,7 @@ my %stats = (
AS lt ON link.link_type = lt.id
GROUP BY lt.name, lt.id, lt.parent", @$t
);
+
for (@$data) {
$dist{ $table . '.' . $_->{name} } = $_->{count};
$dist{ $table . '.' . $_->{name} . '.inclusive' } = $_->{count};
@@ -1907,14 +1895,14 @@ my %stats = (
+{
map {
- "count.ar.links.".$_ => $dist{$_}
+ 'count.ar.links.'.$_ => $dist{$_}
} keys %dist
};
}
},
- "count.ar.links" => {
- DESC => "Count of all advanced relationships links",
+ 'count.ar.links' => {
+ DESC => 'Count of all advanced relationships links',
CALC => sub {
my ($self, $sql) = @_;
my %r;
@@ -1922,8 +1910,7 @@ my %stats = (
for my $t ($self->c->model('Relationship')->all_pairs) {
my $table = join('_', 'l', @$t);
- my $n = $sql->select_single_value(
- "SELECT count(*) FROM $table");
+ my $n = $sql->select_single_value("SELECT count(*) FROM $table");
$r{"count.ar.links.$table"} = $n;
$r{'count.ar.links'} += $n;
}
@@ -1941,7 +1928,70 @@ my %stats = (
PREREQ_ONLY => 1
}
} MusicBrainz::Server::Data::Relationship->all_pairs
- )
+ ),
+
+ 'count.collection' => {
+ DESC => 'Count of all collections',
+ SQL => 'SELECT COUNT(*) FROM editor_collection',
+ },
+
+ 'count.collection.type.release' => {
+ CALC => sub {
+ my ($self, $sql) = @_;
+
+ my $data = $sql->select_list_of_lists(<<~'SQL');
+ SELECT type, COUNT(*) AS count
+ FROM editor_collection
+ GROUP BY type
+ SQL
+
+ my %dist = map { @$_ } @$data;
+
+ +{
+ 'count.collection.type.release' => $dist{1} || 0,
+ 'count.collection.type.owned' => $dist{2} || 0,
+ 'count.collection.type.wishlist' => $dist{3} || 0,
+ 'count.collection.type.release.all' => ($dist{1} || 0) + ($dist{2} || 0) + ($dist{3} || 0),
+ 'count.collection.type.event' => $dist{4} || 0,
+ 'count.collection.type.attending' => $dist{5} || 0,
+ 'count.collection.type.maybe_attending' => $dist{6} || 0,
+ 'count.collection.type.event.all' => ($dist{4} || 0) + ($dist{5} || 0) + ($dist{6} || 0),
+ 'count.collection.type.area' => $dist{7} || 0,
+ 'count.collection.type.artist' => $dist{8} || 0,
+ 'count.collection.type.instrument' => $dist{9} || 0,
+ 'count.collection.type.label' => $dist{10} || 0,
+ 'count.collection.type.place' => $dist{11} || 0,
+ 'count.collection.type.recording' => $dist{12} || 0,
+ 'count.collection.type.release_group' => $dist{13} || 0,
+ 'count.collection.type.series' => $dist{14} || 0,
+ 'count.collection.type.work' => $dist{15} || 0,
+ };
+ },
+ },
+
+ 'count.collection.public' => {
+ CALC => sub {
+ my ($self, $sql) = @_;
+
+ my $data = $sql->select_list_of_lists(<<~'SQL');
+ SELECT public, COUNT(*) AS count
+ FROM editor_collection
+ GROUP BY public
+ SQL
+
+ my %dist = map { @$_ } @$data;
+
+ +{
+ 'count.collection.public' => $dist{1} || 0,
+ 'count.collection.private' => $dist{0} || 0,
+ };
+ },
+ },
+
+ 'count.collection.has_collaborators' => {
+ DESC => 'Count of collections with at least one collaborator',
+ SQL => 'SELECT COUNT(DISTINCT collection) FROM editor_collection_collaborator',
+ },
);
sub recalculate {
@@ -1966,7 +2016,7 @@ sub recalculate {
if (my $calculate = $definition->{CALC}) {
my $output = $calculate->($self, $sql);
- if (ref($output) eq "HASH")
+ if (ref($output) eq 'HASH')
{
$self->insert($output_file, %$output);
} else {
@@ -1990,7 +2040,7 @@ sub recalculate_all
if (%unsatisfiable_prereqs) {
printf "Statistics cannot be computed due to missing dependencies\n";
- printf "$_ depends on " . join(", ", @{$unsatisfiable_prereqs{$_}}) . ", but these dependencies do not exist\n"
+ printf "$_ depends on " . join(', ', @{$unsatisfiable_prereqs{$_}}) . ", but these dependencies do not exist\n"
for keys %unsatisfiable_prereqs;
exit(1);
}
@@ -2017,7 +2067,7 @@ sub recalculate_all
next if $count;
- my $s = join ", ", keys %notdone;
+ my $s = join ', ', keys %notdone;
die "Failed to solve stats dependencies: circular dependency? ($s)";
}
}
diff --git a/lib/MusicBrainz/Server/Data/Statistics/ByDate.pm b/lib/MusicBrainz/Server/Data/Statistics/ByDate.pm
index d4ea6e0569c..e4f6a750ffa 100644
--- a/lib/MusicBrainz/Server/Data/Statistics/ByDate.pm
+++ b/lib/MusicBrainz/Server/Data/Statistics/ByDate.pm
@@ -20,9 +20,9 @@ sub _entity_class
sub get_latest_statistics {
my $self = shift;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE date_collected = (SELECT MAX(date_collected) FROM ". $self->_table .")";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE date_collected = (SELECT MAX(date_collected) FROM '. $self->_table .')';
my @statistics = @{ $self->sql->select_list_of_hashes($query) }
or return undef;
diff --git a/lib/MusicBrainz/Server/Data/Statistics/ByName.pm b/lib/MusicBrainz/Server/Data/Statistics/ByName.pm
index 597a1efa59b..15fd625c2e5 100644
--- a/lib/MusicBrainz/Server/Data/Statistics/ByName.pm
+++ b/lib/MusicBrainz/Server/Data/Statistics/ByName.pm
@@ -21,9 +21,9 @@ sub _entity_class
sub get_statistic {
my ($self, $statistic) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE name = ?";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE name = ?';
my @stats = @{ $self->sql->select_list_of_hashes($query, $statistic) };
my $stats = MusicBrainz::Server::Entity::Statistics::ByName->new(
diff --git a/lib/MusicBrainz/Server/Data/Subscription.pm b/lib/MusicBrainz/Server/Data/Subscription.pm
index b0e9df147dc..63a60e94777 100644
--- a/lib/MusicBrainz/Server/Data/Subscription.pm
+++ b/lib/MusicBrainz/Server/Data/Subscription.pm
@@ -94,7 +94,7 @@ sub unsubscribe
$self->sql->do("
DELETE FROM $table WHERE editor = ? AND $column IN (".
- placeholders(@ids) . ")",
+ placeholders(@ids) . ')',
$user_id, @ids);
}, $self->c->sql);
@@ -121,18 +121,18 @@ sub find_subscribed_editors
my $table = $self->table;
my $column = $self->column;
- my $extra_cond = "";
+ my $extra_cond = '';
- $extra_cond = " AND s.available"
- if ($column eq "collection");
+ $extra_cond = ' AND s.available'
+ if ($column eq 'collection');
my $editor_model = $self->c->model('Editor');
- my $query = "
- SELECT " . $editor_model->_columns . "
- FROM " . $editor_model->_table . "
+ my $query = '
+ SELECT ' . $editor_model->_columns . '
+ FROM ' . $editor_model->_table . "
JOIN $table s ON editor.id = s.editor
- WHERE s.$column = ?" . $extra_cond . "
- ORDER BY editor.name, editor.id";
+ WHERE s.$column = ?" . $extra_cond . '
+ ORDER BY editor.name, editor.id';
$editor_model->query_to_list($query, [$entity_id]);
}
@@ -205,7 +205,7 @@ sub merge
my $column = $self->column;
$self->sql->do("UPDATE $table SET merged_by_edit = ?
- WHERE $column IN (".placeholders(@ids).")",
+ WHERE $column IN (".placeholders(@ids).')',
$edit_id, @ids);
}
diff --git a/lib/MusicBrainz/Server/Data/Track.pm b/lib/MusicBrainz/Server/Data/Track.pm
index 98c8a1d575e..666fdcbf2f2 100644
--- a/lib/MusicBrainz/Server/Data/Track.pm
+++ b/lib/MusicBrainz/Server/Data/Track.pm
@@ -54,9 +54,9 @@ sub _medium_ids
{
my ($self, @track_ids) = @_;
return $self->sql->select_single_column_array(
- "SELECT distinct(medium)
+ 'SELECT distinct(medium)
FROM track
- WHERE id IN (" . placeholders(@track_ids) . ")", @track_ids);
+ WHERE id IN (' . placeholders(@track_ids) . ')', @track_ids);
}
sub load
@@ -91,10 +91,10 @@ sub load_for_mediums
my %id_to_medium = object_to_ids(@media);
my @ids = keys %id_to_medium;
return unless @ids; # nothing to do
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE medium IN (" . placeholders(@ids) . ")
- ORDER BY medium, position";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE medium IN (' . placeholders(@ids) . ')
+ ORDER BY medium, position';
my @tracks = $self->query_to_list($query, \@ids);
foreach my $track (@tracks) {
@@ -115,16 +115,16 @@ sub load_for_medium_paged
my $table = $self->_table;
my $offset = ($page - 1) * $MAX_INITIAL_TRACKS;
- my $total_tracks = $self->sql->select_single_value(<<~'EOSQL', $medium_id);
+ my $total_tracks = $self->sql->select_single_value(<<~'SQL', $medium_id);
SELECT count(*) FROM track WHERE medium = ?
- EOSQL
+ SQL
- my @tracks = $self->query_to_list(<<~"EOSQL", [$medium_id, $MAX_INITIAL_TRACKS, $offset]);
+ my @tracks = $self->query_to_list(<<~"SQL", [$medium_id, $MAX_INITIAL_TRACKS, $offset]);
SELECT $columns FROM $table
WHERE medium = ?
ORDER BY position
LIMIT ? OFFSET ?
- EOSQL
+ SQL
my $pager = Data::Page->new;
$pager->entries_per_page($MAX_INITIAL_TRACKS);
@@ -138,22 +138,22 @@ sub find_by_artist_credit
{
my ($self, $artist_credit_id, $limit, $offset) = @_;
- my $query = "SELECT " . $self->_columns . ",
+ my $query = 'SELECT ' . $self->_columns . ',
name COLLATE musicbrainz AS name_collate
- FROM " . $self->_table . "
+ FROM ' . $self->_table . '
WHERE artist_credit = ?
- ORDER BY name COLLATE musicbrainz";
+ ORDER BY name COLLATE musicbrainz';
$self->query_to_list_limited($query, [$artist_credit_id], $limit, $offset);
}
sub find_by_recording
{
my ($self, $recording_id, $limit, $offset) = @_;
- my $query = "
+ my $query = '
SELECT *
FROM (
SELECT DISTINCT ON (track.id, medium.id)
- " . $self->_columns . ",
+ ' . $self->_columns . ',
medium.id AS m_id, medium.format AS m_format,
medium.position AS m_position, medium.name AS m_name,
medium.release AS m_release,
@@ -179,7 +179,7 @@ sub find_by_recording
WHERE track.recording = ?
ORDER BY track.id, medium.id, date_year, date_month, date_day, release.name COLLATE musicbrainz
) s
- ORDER BY date_year, date_month, date_day, r_name COLLATE musicbrainz";
+ ORDER BY date_year, date_month, date_day, r_name COLLATE musicbrainz';
$self->query_to_list_limited(
$query,
diff --git a/lib/MusicBrainz/Server/Data/URL.pm b/lib/MusicBrainz/Server/Data/URL.pm
index a57c84e1c80..26052966c25 100644
--- a/lib/MusicBrainz/Server/Data/URL.pm
+++ b/lib/MusicBrainz/Server/Data/URL.pm
@@ -161,10 +161,11 @@ my %URL_SPECIALIZATIONS = (
'SpiritOfMetal' => qr{^https?://(?:www\.)?spirit-of-metal\.com/}i,
'SpiritOfRock' => qr{^https?://(?:www\.)?spirit-of-rock\.com/}i,
'Stage48' => qr{^https?://(?:www\.)?stage48\.net/}i,
- 'Tipeee' => qr{^https?://(?:www\.)?tipeee\.com/}i,
'Theatricalia' => qr{^https?://(?:www\.)?theatricalia\.com/}i,
'TheDanceGypsy' => qr{^https?://(?:www\.)?thedancegypsy\.com/}i,
'TheSession' => qr{^https?://(?:www\.)?thesession\.org/}i,
+ 'Tidal' => qr{^https?://(?:[^/]+\.)?tidal\.com/}i,
+ 'Tipeee' => qr{^https?://(?:www\.)?tipeee\.com/}i,
'TouhouDB' => qr{^https?://(?:www\.)?touhoudb\.com/}i,
'Traxsource' => qr{^https?://(?:www\.)?traxsource.com/}i,
'TripleJUnearthed' => qr{^https?://(?:www\.)?triplejunearthed\.com/}i,
@@ -179,7 +180,8 @@ my %URL_SPECIALIZATIONS = (
'VGMdb' => qr{^https?://(?:www\.)?vgmdb\.net/}i,
'VIAF' => qr{^https?://(?:www\.)?viaf\.org/}i,
'Videogamin' => qr{^https?://(?:www\.)?videogam\.in/}i,
- 'Vimeo' => qr{^https?://(?:www\.)?vimeo\.com/}i,
+ 'Vimeo' => qr{^https?://(?:www\.)?vimeo\.com/(?!ondemand)}i,
+ 'VimeoOnDemand' => qr{^https?://(?:www\.)?vimeo\.com/ondemand}i,
'VK' => qr{^https?://(?:www\.)?vk\.com/}i,
'Vkdb' => qr{^https?://(?:www\.)?vkdb\.jp/}i,
'VocaDB' => qr{^https?://(?:www\.)?vocadb\.net/}i,
@@ -296,7 +298,7 @@ sub _hash_to_row
});
}
-sub insert { confess "Should not be used for URLs" }
+sub insert { confess 'Should not be used for URLs' }
sub find_or_insert {
my ($self, $url) = @_;
diff --git a/lib/MusicBrainz/Server/Data/Utils.pm b/lib/MusicBrainz/Server/Data/Utils.pm
index 38aa2d10dae..644c12ad917 100644
--- a/lib/MusicBrainz/Server/Data/Utils.pm
+++ b/lib/MusicBrainz/Server/Data/Utils.pm
@@ -183,7 +183,7 @@ sub load_meta
for my $row (@{
$c->sql->select_list_of_hashes(
"SELECT * FROM $table
- WHERE id IN (" . placeholders(@ids) . ")",
+ WHERE id IN (" . placeholders(@ids) . ')',
@ids
)
}) {
@@ -214,7 +214,7 @@ sub coordinates_to_hash
sub placeholders
{
- return join ",", ("?") x scalar(@_);
+ return join ',', ('?') x scalar(@_);
}
sub load_everything_for_edits
@@ -228,7 +228,7 @@ sub load_everything_for_edits
$c->model('Editor')->load(map { ($_, @{ $_->votes }, @{ $_->edit_notes }) } @$edits);
} catch {
use Data::Dumper;
- croak "Failed loading edits (" . (join ', ', map { $_->id } @$edits) . ")\n" .
+ croak 'Failed loading edits (' . (join ', ', map { $_->id } @$edits) . ")\n" .
"Exception:\n" . Dumper($_) . "\n";
};
}
@@ -261,8 +261,8 @@ sub is_valid_token {
sub get_area_containment_query {
my ($link_type_param, $descendant_param, %args) = @_;
- my $levels_condition = $args{check_all_levels}
- ? ''
+ my $levels_condition = $args{check_all_levels}
+ ? ''
: ' JOIN area a ON a.id = ad.parent WHERE a.type IN (1, 2, 3) ';
return ("
@@ -608,7 +608,7 @@ sub merge_table_attributes {
}
sub merge_string_attributes {
- _merge_attributes(shift, _conditional_merge("!= ''", default => ''), @_);
+ _merge_attributes(shift, _conditional_merge(q(!= ''), default => ''), @_);
}
sub merge_boolean_attributes {
@@ -621,8 +621,8 @@ sub merge_boolean_attributes {
"$_ = (
SELECT bool_or($_)
FROM $table
- WHERE id IN (" . placeholders(@$all_ids) . ")
- )";
+ WHERE id IN (" . placeholders(@$all_ids) . ')
+ )';
} @$columns) . '
WHERE id = ?',
(@$all_ids) x @$columns, $new_id)
@@ -725,7 +725,7 @@ sub split_relationship_by_attributes {
sub non_empty {
my $value = shift;
- return defined($value) && $value ne "";
+ return defined($value) && $value ne '';
}
sub boolean_to_json {
diff --git a/lib/MusicBrainz/Server/Data/Utils/Uniqueness.pm b/lib/MusicBrainz/Server/Data/Utils/Uniqueness.pm
index 0e404ed6591..76403053b04 100644
--- a/lib/MusicBrainz/Server/Data/Utils/Uniqueness.pm
+++ b/lib/MusicBrainz/Server/Data/Utils/Uniqueness.pm
@@ -34,10 +34,10 @@ sub assert_uniqueness_conserved {
}
my $query =
- "SELECT " . $model->_columns .
+ 'SELECT ' . $model->_columns .
' FROM ' . $model->_table .
" WHERE (name, comment) IN (SELECT $new_name, $new_comment)".
- " AND " . $model->_id_column . " != ?";
+ ' AND ' . $model->_id_column . ' != ?';
my ($conflict) = $model->query_to_list($query, [@params, $id]);
diff --git a/lib/MusicBrainz/Server/Data/Vote.pm b/lib/MusicBrainz/Server/Data/Vote.pm
index 76b6d1b26e7..4f47906f7e4 100644
--- a/lib/MusicBrainz/Server/Data/Vote.pm
+++ b/lib/MusicBrainz/Server/Data/Vote.pm
@@ -58,7 +58,7 @@ sub enter_votes
@votes = grep { defined $edits->{ $_->{edit_id} } } @votes;
if (any { $_->{vote} == $VOTE_APPROVE && !$edits->{ $_->{edit_id} }->editor_may_approve($editor) } @votes) {
# not sufficient to filter the vote because the actual approval is happening elsewhere
- confess "Unauthorized editor " . $editor->id . " tried to approve edit #" . $_->{edit_id};
+ confess 'Unauthorized editor ' . $editor->id . ' tried to approve edit #' . $_->{edit_id};
}
@votes = grep {
$_->{vote} == $VOTE_APPROVE || $edits->{ $_->{edit_id} }->editor_may_vote($editor)
@@ -97,7 +97,7 @@ sub enter_votes
# Insert our new votes
$query = 'INSERT INTO vote (editor, edit, vote) VALUES ';
- $query .= join ", ", (('(?, ?, ?)') x @votes);
+ $query .= join ', ', (('(?, ?, ?)') x @votes);
$query .= ' RETURNING edit, vote';
my $voted = $self->sql->select_list_of_hashes($query, map { $editor_id, $_->{edit_id}, $_->{vote} } @votes);
my %edit_to_vote = map { $_->{edit} => $_->{vote} } @$voted;
@@ -131,14 +131,14 @@ sub editor_statistics
{
my ($self, $editor) = @_;
- my $base_query = "SELECT vote, count(vote) AS count " .
- "FROM vote " .
- "WHERE NOT superseded AND editor = ? ";
+ my $base_query = 'SELECT vote, count(vote) AS count ' .
+ 'FROM vote ' .
+ 'WHERE NOT superseded AND editor = ? ';
- my $q_all_votes = $base_query . "GROUP BY vote";
+ my $q_all_votes = $base_query . 'GROUP BY vote';
my $q_recent_votes = $base_query .
- " AND vote_time > NOW() - INTERVAL '28 day' " .
- " GROUP BY vote";
+ q{ AND vote_time > NOW() - INTERVAL '28 day' } .
+ ' GROUP BY vote';
my $all_votes = map_query($self->c->sql, 'vote' => 'count', $q_all_votes, $editor->id);
my $recent_votes = map_query($self->c->sql, 'vote' => 'count', $q_recent_votes, $editor->id);
@@ -198,10 +198,10 @@ sub load_for_edits
my %id_to_edit = map { $_->id => $_ } @edits;
my @ids = keys %id_to_edit;
return unless @ids; # nothing to do
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
- WHERE edit IN (" . placeholders(@ids) . ")
- ORDER BY vote_time";
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
+ WHERE edit IN (' . placeholders(@ids) . ')
+ ORDER BY vote_time';
my @votes = $self->query_to_list($query, \@ids, sub {
my ($model, $row) = @_;
diff --git a/lib/MusicBrainz/Server/Data/WatchArtist.pm b/lib/MusicBrainz/Server/Data/WatchArtist.pm
index f77865650a1..ec6d867495b 100644
--- a/lib/MusicBrainz/Server/Data/WatchArtist.pm
+++ b/lib/MusicBrainz/Server/Data/WatchArtist.pm
@@ -39,9 +39,9 @@ sub find_watched_artists {
sub watch_artist {
my ($self, %params) = @_;
my $artist_id = delete $params{artist_id}
- or confess "Missing required parameter 'artist_id'";
+ or confess q(Missing required parameter 'artist_id');
my $editor_id = delete $params{editor_id}
- or confess "Missing required parameter 'editor_id'";
+ or confess q(Missing required parameter 'editor_id');
try {
$self->sql->auto_commit(1);
@@ -64,9 +64,9 @@ sub watch_artist {
sub stop_watching_artist {
my ($self, %params) = @_;
my $artist_ids = delete $params{artist_ids}
- or confess "Missing required parameter 'artist_ids'";
+ or confess q(Missing required parameter 'artist_ids');
my $editor_id = delete $params{editor_id}
- or confess "Missing required parameter 'editor_id'";
+ or confess q(Missing required parameter 'editor_id');
$self->sql->auto_commit(1);
$self->sql->do(
@@ -80,9 +80,9 @@ sub stop_watching_artist {
sub is_watching {
my ($self, %params) = @_;
my $artist_id = delete $params{artist_id}
- or confess "Missing required parameter 'artist_id'";
+ or confess q(Missing required parameter 'artist_id');
my $editor_id = delete $params{editor_id}
- or confess "Missing required parameter 'editor_id'";
+ or confess q(Missing required parameter 'editor_id');
return $self->sql->select_single_value(
'SELECT 1 FROM editor_watch_artist
@@ -97,7 +97,7 @@ sub find_new_releases {
my $query =
'SELECT DISTINCT ' . $self->c->model('Release')->_columns . '
- FROM ' . $self->c->model('Release')->_table . "
+ FROM ' . $self->c->model('Release')->_table . q(
JOIN release_group rg ON release_group = rg.id
JOIN artist_credit_name acn
ON acn.artist_credit = release.artist_credit
@@ -113,7 +113,7 @@ sub find_new_releases {
COALESCE(date_month, '01') || '-' ||
COALESCE(date_day, '01'), 'YYYY-MM-DD')
BETWEEN (NOW() - ?::INTERVAL) AND
- (NOW() + ewp.notification_timeframe)";
+ (NOW() + ewp.notification_timeframe));
$self->c->model('Release')->query_to_list(
$query,
diff --git a/lib/MusicBrainz/Server/Data/WebService.pm b/lib/MusicBrainz/Server/Data/WebService.pm
index 67e976ebe8c..6756998f601 100644
--- a/lib/MusicBrainz/Server/Data/WebService.pm
+++ b/lib/MusicBrainz/Server/Data/WebService.pm
@@ -25,7 +25,7 @@ sub xml_search
{
my ($self, $resource, $args) = @_;
- my $query = "";
+ my $query = '';
my $dur = 0;
my $offset = 0;
my $limit = 0;
@@ -41,11 +41,11 @@ sub xml_search
$limit = 25 if ($limit < 1 || $limit > 100);
- if (defined $args->{query} && $args->{query} ne "")
+ if (defined $args->{query} && $args->{query} ne '')
{
if (ref($args->{query})) {
return {
- error => "Must specify at most 1 query argument",
+ error => 'Must specify at most 1 query argument',
code => HTTP_BAD_REQUEST
};
}
@@ -77,16 +77,16 @@ sub xml_search
}
elsif ($resource eq 'release')
{
- $query = "";
+ $query = '';
my $term = escape_query($args->{release});
$term =~ s/\s*(.*?)\s*$/$1/;
if ($args->{release})
{
- $query = "(" . join(" AND ", split /\s+/, $term) . ")";
+ $query = '(' . join(' AND ', split /\s+/, $term) . ')';
}
if ($args->{artistid})
{
- $query .= " AND arid:" . escape_query($args->{artistid});
+ $query .= ' AND arid:' . escape_query($args->{artistid});
}
else
{
@@ -94,54 +94,54 @@ sub xml_search
$term =~ s/\s*(.*?)\s*$/$1/;
if (not $term =~ /^\s*$/)
{
- $query .= " AND artist:(" . join(" AND ", split /\s+/, $term) . ")";
+ $query .= ' AND artist:(' . join(' AND ', split /\s+/, $term) . ')';
}
}
if (defined $args->{releasetype} && $args->{releasetype} =~ /^\d+$/)
{
- $query .= " AND type:" . $args->{releasetype} . "^0.0001";
+ $query .= ' AND type:' . $args->{releasetype} . '^0.0001';
}
if (defined $args->{releasestatus} && $args->{releasestatus} =~ /^\d+$/)
{
- $query .= " AND status:" . ($args->{releasestatus} - MusicBrainz::Server::Release::RELEASE_ATTR_SECTION_STATUS_START + 1) . "^0.0001";
+ $query .= ' AND status:' . ($args->{releasestatus} - MusicBrainz::Server::Release::RELEASE_ATTR_SECTION_STATUS_START + 1) . '^0.0001';
}
if (is_positive_integer($args->{count}))
{
- $query .= " AND tracks:" . $args->{count};
+ $query .= ' AND tracks:' . $args->{count};
}
if (is_positive_integer($args->{discids}))
{
- $query .= " AND discids:" . $args->{discids};
+ $query .= ' AND discids:' . $args->{discids};
}
if ($args->{date})
{
- $query .= " AND date:" . $args->{date};
+ $query .= ' AND date:' . $args->{date};
}
if ($args->{asin})
{
- $query .= " AND asin:" . $args->{asin};
+ $query .= ' AND asin:' . $args->{asin};
}
if ($args->{lang})
{
- $query .= " AND lang:" . $args->{lang};
+ $query .= ' AND lang:' . $args->{lang};
}
if ($args->{script})
{
- $query .= " AND script:" . $args->{script};
+ $query .= ' AND script:' . $args->{script};
}
}
elsif ($resource eq 'recording')
{
- $query = "";
+ $query = '';
my $term = escape_query($args->{track});
$term =~ s/\s*(.*?)\s*$/$1/;
if ($args->{track})
{
- $query = "(" . join(" AND ", split /\s+/, $term) . ")";
+ $query = '(' . join(' AND ', split /\s+/, $term) . ')';
}
if ($args->{artistid})
{
- $query .= " AND arid:" . escape_query($args->{artistid});
+ $query .= ' AND arid:' . escape_query($args->{artistid});
}
else
{
@@ -149,12 +149,12 @@ sub xml_search
$term =~ s/\s*(.*?)\s*$/$1/;
if (not $term =~ /^\s*$/)
{
- $query .= " AND artist:(" . join(" AND ", split /\s+/, $term) . ")";
+ $query .= ' AND artist:(' . join(' AND ', split /\s+/, $term) . ')';
}
}
if ($args->{releaseid})
{
- $query .= " AND reid:" . escape_query($args->{releaseid});
+ $query .= ' AND reid:' . escape_query($args->{releaseid});
}
else
{
@@ -162,25 +162,25 @@ sub xml_search
$term =~ s/\s*(.*?)\s*$/$1/;
if (not $term =~ /^\s*$/)
{
- $query .= " AND release:(" . join(" AND ", split /\s+/, $term) . ")";
+ $query .= ' AND release:(' . join(' AND ', split /\s+/, $term) . ')';
}
}
if ($args->{duration})
{
my $qdur = int($args->{duration} / 2000);
- $query .= " AND (qdur:$qdur OR qdur:" . ($qdur - 1) . " OR qdur:" . ($qdur + 1) . ")" if ($qdur);
+ $query .= " AND (qdur:$qdur OR qdur:" . ($qdur - 1) . ' OR qdur:' . ($qdur + 1) . ')' if ($qdur);
}
if (is_non_negative_integer($args->{tracknumber}))
{
- $query .= " AND tnum:" . $args->{tracknumber};
+ $query .= ' AND tnum:' . $args->{tracknumber};
}
if ($args->{releasetype})
{
- $query .= " AND type:" . $args->{releasetype};
+ $query .= ' AND type:' . $args->{releasetype};
}
if (is_positive_integer($args->{count}))
{
- $query .= " AND tracks:" . $args->{count};
+ $query .= ' AND tracks:' . $args->{count};
}
}
elsif ($resource eq 'work')
@@ -205,34 +205,34 @@ sub xml_search
if ($query =~ /^(?:\s*|"\s*")$/)
{
return {
- error => "You submitted a blank search query. You must include a non-blank 'query=' parameter with your search.",
+ error => q(You submitted a blank search query. You must include a non-blank 'query=' parameter with your search.),
code => HTTP_BAD_REQUEST
};
}
my $url_ext;
if (DBDefs->SEARCH_ENGINE eq 'LUCENE' || DBDefs->SEARCH_SERVER eq DBDefs::Default->SEARCH_SERVER) {
- my $format = ($args->{fmt} // "") eq "json" ? "jsonnew" : "xml";
+ my $format = ($args->{fmt} // '') eq 'json' ? 'jsonnew' : 'xml';
$url_ext = "/ws/2/$resource/?" .
"max=$limit&type=$resource&fmt=$format&offset=$offset" .
- "&query=" . uri_escape_utf8($query) . "&dismax=$dismax";
+ '&query=' . uri_escape_utf8($query) . "&dismax=$dismax";
} else {
- my $format = ($args->{fmt} // "") eq "json" ? "mbjson" : "mbxml";
- my $endpoint = "advanced";
+ my $format = ($args->{fmt} // '') eq 'json' ? 'mbjson' : 'mbxml';
+ my $endpoint = 'advanced';
if ($dismax eq 'true')
{
# Solr has a bug where the dismax end point behaves differently
# from edismax (advanced) when the query size is 1. This is a fix
# for that. See https://issues.apache.org/jira/browse/SOLR-12409
if (split(/[\P{Word}_]+/, $query, 2) == 1) {
- $endpoint = "basic";
+ $endpoint = 'basic';
} else {
- $endpoint = "select";
+ $endpoint = 'select';
}
}
$url_ext = "/$resource/$endpoint?" .
"rows=$limit&wt=$format&start=$offset" .
- "&q=" . uri_escape_utf8($query);
+ '&q=' . uri_escape_utf8($query);
}
if (DBDefs->SEARCH_X_ACCEL_REDIRECT) {
@@ -249,7 +249,7 @@ sub xml_search
if ($response->code == HTTP_BAD_REQUEST)
{
return {
- error => "Search server could not complete query: Bad request",
+ error => 'Search server could not complete query: Bad request',
code => HTTP_BAD_REQUEST
}
}
diff --git a/lib/MusicBrainz/Server/Data/WikiDoc.pm b/lib/MusicBrainz/Server/Data/WikiDoc.pm
index 0a1a1ca0d3d..fe131b5fdad 100644
--- a/lib/MusicBrainz/Server/Data/WikiDoc.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDoc.pm
@@ -21,7 +21,7 @@ sub _fix_html_links
my $wiki_server = DBDefs->WIKITRANS_SERVER;
- my $class = $node->attr('class') || "";
+ my $class = $node->attr('class') || '';
# Remove the title attribute from all links
$node->attr('title', undef);
@@ -29,7 +29,7 @@ sub _fix_html_links
# if this is not a link to _our_ wikidocs server, don't mess with it.
return if ($class =~ m/external/ || $class =~ m/extiw/);
- my $href = $node->attr('href') || "";
+ my $href = $node->attr('href') || '';
# Remove broken links & links to images in the wiki
if ($href =~ m,^(?:https?:)?//$wiki_server/(File|Image):, || $class =~ m/new/)
@@ -55,7 +55,7 @@ sub _fix_html_markup
my $wiki_server = DBDefs->WIKITRANS_SERVER;
my $tree = HTML::TreeBuilder::XPath->new;
- $tree->parse_content("".$content."");
+ $tree->parse_content(''.$content.'');
for my $node ($tree->findnodes(
'//span[contains(@class, "editsection")]')->get_nodelist)
{
@@ -69,16 +69,16 @@ sub _fix_html_markup
for my $node ($tree->findnodes('//img')->get_nodelist)
{
- my $src = $node->attr('src') || "";
+ my $src = $node->attr('src') || '';
$node->attr('src', $src) if ($src =~ s,$WIKI_IMAGE_PREFIX,//$wiki_server$WIKI_IMAGE_PREFIX,);
# Also re-write srcset values
- my $srcset = $node->attr('srcset') || "";
+ my $srcset = $node->attr('srcset') || '';
$node->attr('srcset', $srcset) if ($srcset =~ s,$WIKI_IMAGE_PREFIX,//$wiki_server$WIKI_IMAGE_PREFIX,g);
}
for my $node ($tree->findnodes('//table')->get_nodelist)
{
- my $class = $node->attr('class') || "";
+ my $class = $node->attr('class') || '';
# Special cases where we don't want this class added
next if ($class =~ /(\btoc\b|\btbl\b)/);
@@ -119,10 +119,10 @@ sub _load_page
{
my ($self, $id, $version, $index) = @_;
- return MusicBrainz::Server::Entity::WikiDocPage->new({ canonical => "MusicBrainz_Documentation" })
- if ($id eq "");
+ return MusicBrainz::Server::Entity::WikiDocPage->new({ canonical => 'MusicBrainz_Documentation' })
+ if ($id eq '');
- my $doc_url = sprintf "http://%s/%s?action=render&redirect=no", DBDefs->WIKITRANS_SERVER, uri_escape($id);
+ my $doc_url = sprintf 'http://%s/%s?action=render&redirect=no', DBDefs->WIKITRANS_SERVER, uri_escape($id);
if (defined $version) {
$doc_url .= "&oldid=$version";
}
@@ -132,13 +132,13 @@ sub _load_page
return undef unless $response;
if (!$response->is_success) {
- if ($response->is_redirect && $response->header("Location") =~ /https?:\/\/(.*?)\/(.*)$/) {
+ if ($response->is_redirect && $response->header('Location') =~ /https?:\/\/(.*?)\/(.*)$/) {
return $self->get_page(uri_unescape($2));
}
return undef;
}
- my $content = decode "utf-8", $response->content;
+ my $content = decode 'utf-8', $response->content;
if ($content =~ /Error/s) {
return undef;
}
diff --git a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
index 453303d3a77..eeca1716a62 100644
--- a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
@@ -13,8 +13,8 @@ use MusicBrainz::Server::Replication ':replication_type';
with 'MusicBrainz::Server::Data::Role::Sql';
-Readonly my $CACHE_PREFIX => "wikidoc";
-Readonly my $CACHE_KEY => "wikidoc-index";
+Readonly my $CACHE_PREFIX => 'wikidoc';
+Readonly my $CACHE_KEY => 'wikidoc-index';
sub _load_index_from_db {
my $self = shift;
@@ -61,14 +61,14 @@ sub set_page_version
my $index = $self->_load_index;
if (defined $version) {
my $query =
- qq{INSERT INTO wikidocs.wikidocs_index (revision, page_name)
- VALUES (?, ?)
- ON CONFLICT (page_name) DO UPDATE
- SET revision = EXCLUDED.revision};
+ 'INSERT INTO wikidocs.wikidocs_index (revision, page_name)
+ VALUES (?, ?)
+ ON CONFLICT (page_name) DO UPDATE
+ SET revision = EXCLUDED.revision';
$self->sql->do($query, $version, $page);
}
else {
- my $query = "DELETE FROM wikidocs.wikidocs_index WHERE page_name = ?";
+ my $query = 'DELETE FROM wikidocs.wikidocs_index WHERE page_name = ?';
$self->sql->do($query, $page);
}
@@ -98,7 +98,7 @@ sub get_wiki_versions
return undef;
}
- my $doc_url = sprintf "https://%s?action=query&prop=info&format=xml&titles=%s", DBDefs->WIKITRANS_SERVER_API, join('|', @queries);
+ my $doc_url = sprintf 'https://%s?action=query&prop=info&format=xml&titles=%s', DBDefs->WIKITRANS_SERVER_API, join('|', @queries);
my $ua = LWP::UserAgent->new(max_redirect => 0, timeout => 5);
$ua->env_proxy;
@@ -108,7 +108,7 @@ sub get_wiki_versions
return undef;
}
- my $content = decode "utf-8", $response->content;
+ my $content = decode 'utf-8', $response->content;
# Parse the XML and make it easier to use.
my $xml = XMLin(
diff --git a/lib/MusicBrainz/Server/Data/WikidataProperties.pm b/lib/MusicBrainz/Server/Data/WikidataProperties.pm
index 33247ab23de..2c25f0dfb22 100644
--- a/lib/MusicBrainz/Server/Data/WikidataProperties.pm
+++ b/lib/MusicBrainz/Server/Data/WikidataProperties.pm
@@ -11,9 +11,9 @@ Readonly my $WIKIDATA_CACHE_TIMEOUT => 60 * 60 * 24 * 3; # 3 days
sub get_wikidata_properties {
my ($self, $entity, $property) = @_;
- my $url_pattern = "https://www.wikidata.org/w/api.php?action=wbgetclaims&format=json&entity=%s%s";
+ my $url_pattern = 'https://www.wikidata.org/w/api.php?action=wbgetclaims&format=json&entity=%s%s';
return $self->_fetch_cache_or_url($url_pattern,
- "wikidata_property",
+ 'wikidata_property',
$WIKIDATA_CACHE_TIMEOUT,
$entity,
undef,
diff --git a/lib/MusicBrainz/Server/Data/WikipediaExtract.pm b/lib/MusicBrainz/Server/Data/WikipediaExtract.pm
index 8c0ae1ceb46..02867cc501d 100644
--- a/lib/MusicBrainz/Server/Data/WikipediaExtract.pm
+++ b/lib/MusicBrainz/Server/Data/WikipediaExtract.pm
@@ -111,7 +111,7 @@ sub get_extract
sub get_extract_by_language
{
my ($self, $title, $language, %opts) = @_;
- my $url_pattern = "https://%s.wikipedia.org/w/api.php?action=query&prop=extracts&exintro=1&format=json&redirects=1&titles=%s";
+ my $url_pattern = 'https://%s.wikipedia.org/w/api.php?action=query&prop=extracts&exintro=1&format=json&redirects=1&titles=%s';
return $self->_fetch_cache_or_url($url_pattern, 'extract',
$EXTRACT_CACHE_TIMEOUT,
$title, $language,
@@ -125,11 +125,11 @@ sub get_available_languages
for my $link (@$links) {
my ($url_pattern, $key, $callback, $language, $ret);
if ($link->isa('MusicBrainz::Server::Entity::URL::Wikidata')) {
- $url_pattern = "https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&props=sitelinks&ids=%s%s";
+ $url_pattern = 'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&props=sitelinks&ids=%s%s';
$key = 'sitelinks';
$callback = \&_wikidata_languages_callback;
} else {
- $url_pattern = "https://%s.wikipedia.org/w/api.php?action=query&prop=langlinks&lllimit=max&format=json&redirects=1&titles=%s";
+ $url_pattern = 'https://%s.wikipedia.org/w/api.php?action=query&prop=langlinks&lllimit=max&format=json&redirects=1&titles=%s';
$key = 'langlinks';
$callback = \&_wikipedia_languages_callback;
$language = $link->language;
@@ -158,7 +158,7 @@ sub _wikidata_languages_callback
if ($wiki =~ /wiki$/ and $wiki ne 'commonswiki') {
my $lang = $wiki =~ s/wiki$//r;
my $page = $opts{fetched}{content}{sitelinks}{$wiki}{title};
- push @langs, {"lang" => $lang, "title" => $page}
+ push @langs, {'lang' => $lang, 'title' => $page}
}
}
return \@langs;
@@ -168,7 +168,7 @@ sub _wikidata_languages_callback
sub _wikipedia_languages_callback
{
my (%opts) = @_;
- my @langs = map { {"lang" => $_->{lang}, "title" => $_->{"*"}} } @{ $opts{fetched}{content} };
+ my @langs = map { {'lang' => $_->{lang}, 'title' => $_->{'*'}} } @{ $opts{fetched}{content} };
return \@langs;
}
@@ -180,7 +180,7 @@ sub _extract_by_language_callback
content => $opts{fetched}{content},
canonical => $opts{fetched}{canonical},
language => $opts{language},
- url => sprintf "https://%s.wikipedia.org/wiki/%s",
+ url => sprintf 'https://%s.wikipedia.org/wiki/%s',
$opts{language},
uri_escape_utf8($opts{fetched}{title} =~ tr/ /_/r)
);
@@ -192,7 +192,7 @@ sub _check_for_redirect
my ($self, $title, $language, %opts) = @_;
return 1 if exists $redirected_languages{$language};
# We use formatversion=2 so that "redirect" is returned as an actual boolean, not the empty string
- my $url_pattern = "https://%s.wikipedia.org/w/api.php?action=query&prop=info&format=json&formatversion=2&titles=%s";
+ my $url_pattern = 'https://%s.wikipedia.org/w/api.php?action=query&prop=info&format=json&formatversion=2&titles=%s';
my $return = $self->_fetch_cache_or_url($url_pattern, 'redirect',
$EXTRACT_CACHE_TIMEOUT,
$title, $language,
diff --git a/lib/MusicBrainz/Server/Data/Work.pm b/lib/MusicBrainz/Server/Data/Work.pm
index 0422d0eafea..9fd0869f961 100644
--- a/lib/MusicBrainz/Server/Data/Work.pm
+++ b/lib/MusicBrainz/Server/Data/Work.pm
@@ -103,23 +103,23 @@ L objects.
sub find_by_iswc
{
my ($self, $iswc) = @_;
- my $query = "SELECT " . $self->_columns . "
- FROM " . $self->_table . "
+ my $query = 'SELECT ' . $self->_columns . '
+ FROM ' . $self->_table . '
JOIN iswc ON work.id = iswc.work
WHERE iswc.iswc = ?
- ORDER BY work.name COLLATE musicbrainz";
+ ORDER BY work.name COLLATE musicbrainz';
$self->query_to_list($query, [$iswc]);
}
sub _order_by {
my ($self, $order) = @_;
- my $order_by = order_by($order, "name", {
- "name" => sub {
- return "name COLLATE musicbrainz"
+ my $order_by = order_by($order, 'name', {
+ 'name' => sub {
+ return 'name COLLATE musicbrainz'
},
- "type" => sub {
- return "type, name COLLATE musicbrainz"
+ 'type' => sub {
+ return 'type, name COLLATE musicbrainz'
},
});
@@ -219,7 +219,7 @@ sub _hash_to_row
sub load_meta
{
my $self = shift;
- MusicBrainz::Server::Data::Utils::load_meta($self->c, "work_meta", sub {
+ MusicBrainz::Server::Data::Utils::load_meta($self->c, 'work_meta', sub {
my ($obj, $row) = @_;
$obj->rating($row->{rating}) if defined $row->{rating};
$obj->rating_count($row->{rating_count}) if defined $row->{rating_count};
@@ -252,10 +252,10 @@ sub load_ids
my @gids = map { $_->gid } @works;
return () unless @gids;
- my $query = "
+ my $query = '
SELECT gid, id FROM work
- WHERE gid IN (" . placeholders(@gids) . ")
- ";
+ WHERE gid IN (' . placeholders(@gids) . ')
+ ';
my %map = map { $_->[0] => $_->[1] }
@{ $self->sql->select_list_of_lists($query, @gids) };
@@ -337,16 +337,16 @@ sub _find_writers
my ($self, $ids, $map) = @_;
return unless @$ids;
- my $query = "
+ my $query = '
SELECT law.entity1 AS work, law.entity0 AS artist,
law.entity0_credit AS credit, array_agg(lt.name) AS roles
FROM l_artist_work law
JOIN link l ON law.link = l.id
JOIN link_type lt ON l.link_type = lt.id
- WHERE law.entity1 IN (" . placeholders(@$ids) . ")
+ WHERE law.entity1 IN (' . placeholders(@$ids) . ')
GROUP BY law.entity1, law.entity0, law.entity0_credit
ORDER BY count(*) DESC, artist, credit
- ";
+ ';
my $rows = $self->sql->select_list_of_lists($query, @$ids);
@@ -394,15 +394,15 @@ sub _find_recording_artists
my ($self, $ids, $map) = @_;
return unless @$ids;
- my $query = "
+ my $query = '
SELECT lrw.entity1 AS work, r.artist_credit
FROM l_recording_work lrw
JOIN recording r ON lrw.entity0 = r.id
LEFT JOIN track t ON r.id = t.recording
- WHERE lrw.entity1 IN (" . placeholders(@$ids) . ")
+ WHERE lrw.entity1 IN (' . placeholders(@$ids) . ')
GROUP BY lrw.entity1, r.artist_credit
ORDER BY count(*) DESC, artist_credit
- ";
+ ';
my $rows = $self->sql->select_list_of_lists($query, @$ids);
@@ -429,7 +429,7 @@ sub is_empty {
my ($self, $work_id) = @_;
my $used_in_relationship = used_in_relationship($self->c, work => 'work_row.id');
- return $self->sql->select_single_value(<<~"EOSQL", $work_id, $STATUS_OPEN);
+ return $self->sql->select_single_value(<<~"SQL", $work_id, $STATUS_OPEN);
SELECT TRUE
FROM work work_row
WHERE id = ?
@@ -442,7 +442,7 @@ sub is_empty {
) OR
$used_in_relationship
)
- EOSQL
+ SQL
}
sub set_attributes {
diff --git a/lib/MusicBrainz/Server/Database.pm b/lib/MusicBrainz/Server/Database.pm
index fffb0b32362..5a2fe735451 100644
--- a/lib/MusicBrainz/Server/Database.pm
+++ b/lib/MusicBrainz/Server/Database.pm
@@ -46,7 +46,7 @@ sub shell_args
}
else {
require String::ShellQuote;
- return join " ", map { String::ShellQuote::shell_quote($_) } @args;
+ return join ' ', map { String::ShellQuote::shell_quote($_) } @args;
}
}
diff --git a/lib/MusicBrainz/Server/Edit.pm b/lib/MusicBrainz/Server/Edit.pm
index c372f1e16d4..429994ff9e3 100644
--- a/lib/MusicBrainz/Server/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit.pm
@@ -267,7 +267,7 @@ sub adjust_edit_pending
while ( my ($model_name, $ids) = each %$to_inc) {
my $model = $self->c->model($model_name);
$model->does('MusicBrainz::Server::Data::Role::Editable')
- or croak "Model must do MusicBrainz::Server::Data::Role::Editable";
+ or croak 'Model must do MusicBrainz::Server::Data::Role::Editable';
$model->adjust_edit_pending($adjust, @$ids);
}
}
diff --git a/lib/MusicBrainz/Server/Edit/Alias/Add.pm b/lib/MusicBrainz/Server/Edit/Alias/Add.pm
index 6e65ce7c738..16093437ee7 100644
--- a/lib/MusicBrainz/Server/Edit/Alias/Add.pm
+++ b/lib/MusicBrainz/Server/Edit/Alias/Add.pm
@@ -159,6 +159,6 @@ role {
};
};
-sub edit_template_react { "AddRemoveAlias" };
+sub edit_template_react { 'AddRemoveAlias' };
1;
diff --git a/lib/MusicBrainz/Server/Edit/Alias/Delete.pm b/lib/MusicBrainz/Server/Edit/Alias/Delete.pm
index ddd5d587518..0ef65091804 100644
--- a/lib/MusicBrainz/Server/Edit/Alias/Delete.pm
+++ b/lib/MusicBrainz/Server/Edit/Alias/Delete.pm
@@ -94,7 +94,7 @@ sub initialize
});
}
-sub edit_template_react { "AddRemoveAlias" };
+sub edit_template_react { 'AddRemoveAlias' };
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Edit/Alias/Edit.pm b/lib/MusicBrainz/Server/Edit/Alias/Edit.pm
index 68f969e415a..d16c41210c2 100644
--- a/lib/MusicBrainz/Server/Edit/Alias/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Alias/Edit.pm
@@ -22,7 +22,7 @@ use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
use aliased 'MusicBrainz::Server::Entity::PartialDate';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::WithDifferences';
with 'MusicBrainz::Server::Edit::Alias';
@@ -169,7 +169,7 @@ sub initialize
{
my ($self, %opts) = @_;
my $alias = delete $opts{alias};
- die "You must specify the alias object to edit" unless defined $alias;
+ die 'You must specify the alias object to edit' unless defined $alias;
my $entity = delete $opts{entity} or die 'Missing "entity" argument';
$self->enforce_dependencies(\%opts);
@@ -189,7 +189,7 @@ sub current_instance {
$self->_load_alias;
}
-sub edit_template_react { "EditAlias" };
+sub edit_template_react { 'EditAlias' };
around TO_JSON => sub {
my ($orig, $self) = @_;
diff --git a/lib/MusicBrainz/Server/Edit/Area/Create.pm b/lib/MusicBrainz/Server/Edit/Area/Create.pm
index 65d6c5107b6..34d53317ebc 100644
--- a/lib/MusicBrainz/Server/Edit/Area/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Area/Create.pm
@@ -52,9 +52,9 @@ sub foreign_keys
before initialize => sub {
my ($self, %opts) = @_;
- die "You must specify iso_3166_1" unless defined $opts{iso_3166_1};
- die "You must specify iso_3166_2" unless defined $opts{iso_3166_2};
- die "You must specify iso_3166_3" unless defined $opts{iso_3166_3};
+ die 'You must specify iso_3166_1' unless defined $opts{iso_3166_1};
+ die 'You must specify iso_3166_2' unless defined $opts{iso_3166_2};
+ die 'You must specify iso_3166_3' unless defined $opts{iso_3166_3};
};
sub build_display_data
diff --git a/lib/MusicBrainz/Server/Edit/Area/Edit.pm b/lib/MusicBrainz/Server/Edit/Area/Edit.pm
index d70a235fe1b..4d750e88117 100644
--- a/lib/MusicBrainz/Server/Edit/Area/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Area/Edit.pm
@@ -22,7 +22,7 @@ use MooseX::Types::Structured qw( Dict Optional );
use aliased 'MusicBrainz::Server::Entity::Area';
use aliased 'MusicBrainz::Server::Entity::PartialDate';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::CheckForConflicts';
@@ -132,13 +132,13 @@ sub _mapping
begin_date => date_closure('begin_date'),
end_date => date_closure('end_date'),
iso_3166_1 => sub {
- return $self->c->sql->select_single_column_array("SELECT code FROM iso_3166_1 WHERE area = ?", shift->id);
+ return $self->c->sql->select_single_column_array('SELECT code FROM iso_3166_1 WHERE area = ?', shift->id);
},
iso_3166_2 => sub {
- return $self->c->sql->select_single_column_array("SELECT code FROM iso_3166_2 WHERE area = ?", shift->id);
+ return $self->c->sql->select_single_column_array('SELECT code FROM iso_3166_2 WHERE area = ?', shift->id);
},
iso_3166_3 => sub {
- return $self->c->sql->select_single_column_array("SELECT code FROM iso_3166_3 WHERE area = ?", shift->id);
+ return $self->c->sql->select_single_column_array('SELECT code FROM iso_3166_3 WHERE area = ?', shift->id);
},
);
}
diff --git a/lib/MusicBrainz/Server/Edit/Artist/Create.pm b/lib/MusicBrainz/Server/Edit/Artist/Create.pm
index 6566a2d0d0f..ad5dc69a16f 100644
--- a/lib/MusicBrainz/Server/Edit/Artist/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Artist/Create.pm
@@ -51,8 +51,8 @@ has '+data' => (
before initialize => sub {
my ($self, %opts) = @_;
- die "You must specify ipi_codes" unless defined $opts{ipi_codes};
- die "You must specify isni_codes" unless defined $opts{isni_codes};
+ die 'You must specify ipi_codes' unless defined $opts{ipi_codes};
+ die 'You must specify isni_codes' unless defined $opts{isni_codes};
};
around initialize => sub {
diff --git a/lib/MusicBrainz/Server/Edit/Artist/Edit.pm b/lib/MusicBrainz/Server/Edit/Artist/Edit.pm
index 3fc19168bb9..2b9c095f0e3 100644
--- a/lib/MusicBrainz/Server/Edit/Artist/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Artist/Edit.pm
@@ -27,7 +27,7 @@ use aliased 'MusicBrainz::Server::Entity::Artist';
use aliased 'MusicBrainz::Server::Entity::Area';
use aliased 'MusicBrainz::Server::Entity::PartialDate';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::Artist';
@@ -44,7 +44,7 @@ with 'MusicBrainz::Server::Edit::Role::AllowAmending' => {
sub edit_name { N_l('Edit artist') }
sub edit_type { $EDIT_ARTIST_EDIT }
-sub edit_template_react { "EditArtist" }
+sub edit_template_react { 'EditArtist' }
sub _edit_model { 'Artist' }
@@ -219,7 +219,7 @@ around allow_auto_edit => sub {
return 0;
}
}
-
+
if (defined $self->data->{new}{isni_codes}) {
# If there's already ISNIs for the artist, not an autoedit
if (@{ $self->data->{old}{isni_codes} // [] }) {
diff --git a/lib/MusicBrainz/Server/Edit/Event/Edit.pm b/lib/MusicBrainz/Server/Edit/Event/Edit.pm
index a0f7278c808..e9687182ec4 100644
--- a/lib/MusicBrainz/Server/Edit/Event/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Event/Edit.pm
@@ -28,7 +28,7 @@ use MooseX::Types::Structured qw( Dict Optional );
use aliased 'MusicBrainz::Server::Entity::Event';
use aliased 'MusicBrainz::Server::Entity::PartialDate';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::CheckForConflicts';
@@ -41,7 +41,7 @@ with 'MusicBrainz::Server::Edit::Role::DatePeriod';
sub edit_name { N_l('Edit event') }
sub edit_type { $EDIT_EVENT_EDIT }
-sub edit_template_react { "EditEvent" }
+sub edit_template_react { 'EditEvent' }
sub _edit_model { 'Event' }
diff --git a/lib/MusicBrainz/Server/Edit/Generic/Delete.pm b/lib/MusicBrainz/Server/Edit/Generic/Delete.pm
index 723c7dcd044..d2befeaa926 100644
--- a/lib/MusicBrainz/Server/Edit/Generic/Delete.pm
+++ b/lib/MusicBrainz/Server/Edit/Generic/Delete.pm
@@ -81,7 +81,7 @@ sub build_display_data
sub initialize
{
my ($self, %args) = @_;
- my $entity = delete $args{to_delete} or die "Required 'to_delete' object";
+ my $entity = delete $args{to_delete} or die q(Required 'to_delete' object);
$self->data({
name => $entity->name,
diff --git a/lib/MusicBrainz/Server/Edit/Generic/Edit.pm b/lib/MusicBrainz/Server/Edit/Generic/Edit.pm
index eefd1014416..3655a789a53 100644
--- a/lib/MusicBrainz/Server/Edit/Generic/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Generic/Edit.pm
@@ -51,7 +51,7 @@ sub initialize {
my ($self, %opts) = @_;
my $entity = delete $opts{to_edit};
- die "You must specify the object to edit" unless defined $entity;
+ die 'You must specify the object to edit' unless defined $entity;
my $entity_properties = $ENTITIES{model_to_type($self->_edit_model)};
diff --git a/lib/MusicBrainz/Server/Edit/Generic/Merge.pm b/lib/MusicBrainz/Server/Edit/Generic/Merge.pm
index 48f7db8ebee..8278ba453a2 100644
--- a/lib/MusicBrainz/Server/Edit/Generic/Merge.pm
+++ b/lib/MusicBrainz/Server/Edit/Generic/Merge.pm
@@ -64,17 +64,38 @@ sub build_display_data
{
my ($self, $loaded) = @_;
my $model = $self->_merge_model;
+ my @releases = values %{ $loaded->{Release} };
+
+ # For release merges, we need to load additional data
+ # before turning the releases to JSON
+ if ($model eq 'Release') {
+ $self->c->model('Label')->load(
+ grep { $_->label_id && !defined($_->label) }
+ map { $_->all_labels }
+ @releases
+ );
+
+ $self->c->model('Medium')->load_for_releases(
+ grep { $_->medium_count < 1 }
+ @releases
+ );
- my $new_entity = (
+ $self->c->model('MediumFormat')->load(
+ grep { $_->format_id && !defined($_->format) }
+ map { $_->all_mediums }
+ @releases
+ );
+
+ $self->c->model('Release')->load_release_events(
+ @releases
+ );
+ }
+
+ my $new_entity = to_json_object(
$loaded->{$model}{ $self->new_entity->{id} } ||
$self->_build_missing_entity($loaded, $self->new_entity)
);
- # XXX: root/edit/details/merge_releases.tt is not converted to React yet.
- if ($model ne 'Release') {
- $new_entity = to_json_object($new_entity);
- }
-
my $data = {
new => $new_entity,
old => []
@@ -84,9 +105,7 @@ sub build_display_data
my $ent = $loaded->{$model}{ $old->{id} } ||
$self->_build_missing_entity($loaded, $old);
- push @{ $data->{old} }, (
- $model ne 'Release' ? to_json_object($ent) : $ent
- );
+ push @{ $data->{old} }, to_json_object($ent);
}
return $data;
diff --git a/lib/MusicBrainz/Server/Edit/Historic.pm b/lib/MusicBrainz/Server/Edit/Historic.pm
index 0451f64222f..d41ff164999 100644
--- a/lib/MusicBrainz/Server/Edit/Historic.pm
+++ b/lib/MusicBrainz/Server/Edit/Historic.pm
@@ -66,7 +66,7 @@ sub _decode_value
my ($scheme, $data) = $value =~ /\A\x1B(\w+);(.*)\z/s
or return $value;
- return uri_unescape($data) if $scheme eq "URI";
+ return uri_unescape($data) if $scheme eq 'URI';
die "Unknown encoding scheme '$scheme'";
}
diff --git a/lib/MusicBrainz/Server/Edit/Historic/EditTrackNum.pm b/lib/MusicBrainz/Server/Edit/Historic/EditTrackNum.pm
index 6f711155713..07633db9481 100644
--- a/lib/MusicBrainz/Server/Edit/Historic/EditTrackNum.pm
+++ b/lib/MusicBrainz/Server/Edit/Historic/EditTrackNum.pm
@@ -55,7 +55,7 @@ sub upgrade
my $self = shift;
unless (looks_like_number($self->new_value) &&
looks_like_number($self->previous_value)) {
- die "This data is corrupt and cannot be upgraded";
+ die 'This data is corrupt and cannot be upgraded';
}
$self->data({
diff --git a/lib/MusicBrainz/Server/Edit/Historic/Utils.pm b/lib/MusicBrainz/Server/Edit/Historic/Utils.pm
index 3e43fa2721d..6d08843aa5c 100644
--- a/lib/MusicBrainz/Server/Edit/Historic/Utils.pm
+++ b/lib/MusicBrainz/Server/Edit/Historic/Utils.pm
@@ -60,7 +60,7 @@ sub upgrade_release_status
# Status' have their own table, so they don't have the 100 offset as before.
# They are also indexed from 1, not 0
- return unless defined $status_id && $status_id ne "";
+ return unless defined $status_id && $status_id ne '';
return $status_id - 99;
}
@@ -86,7 +86,7 @@ sub get_historic_type {
if (!$type_id) {
return undef;
}
-
+
my $loaded_type = to_json_object($loaded->{ReleaseGroupType}{ $type_id });
if ($loaded_type) {
diff --git a/lib/MusicBrainz/Server/Edit/Instrument/Edit.pm b/lib/MusicBrainz/Server/Edit/Instrument/Edit.pm
index d866492729d..d601e5c7a29 100644
--- a/lib/MusicBrainz/Server/Edit/Instrument/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Instrument/Edit.pm
@@ -26,7 +26,7 @@ with 'MusicBrainz::Server::Edit::Role::AlwaysAutoEdit';
sub edit_name { N_l('Edit instrument') }
sub edit_type { $EDIT_INSTRUMENT_EDIT }
-sub edit_template_react { "EditInstrument" }
+sub edit_template_react { 'EditInstrument' }
sub _edit_model { 'Instrument' }
diff --git a/lib/MusicBrainz/Server/Edit/Label/Create.pm b/lib/MusicBrainz/Server/Edit/Label/Create.pm
index 6975e258828..0e4958c03bd 100644
--- a/lib/MusicBrainz/Server/Edit/Label/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Label/Create.pm
@@ -50,8 +50,8 @@ has '+data' => (
before initialize => sub {
my ($self, %opts) = @_;
- die "You must specify ipi_codes" unless defined $opts{ipi_codes};
- die "You must specify isni_codes" unless defined $opts{isni_codes};
+ die 'You must specify ipi_codes' unless defined $opts{ipi_codes};
+ die 'You must specify isni_codes' unless defined $opts{isni_codes};
};
sub foreign_keys
diff --git a/lib/MusicBrainz/Server/Edit/Label/Edit.pm b/lib/MusicBrainz/Server/Edit/Label/Edit.pm
index b4ea5c47034..2f6a5ecf038 100644
--- a/lib/MusicBrainz/Server/Edit/Label/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Label/Edit.pm
@@ -26,7 +26,7 @@ use MooseX::Types::Structured qw( Dict Optional );
use aliased 'MusicBrainz::Server::Entity::Label';
use aliased 'MusicBrainz::Server::Entity::Area';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::Label';
@@ -192,7 +192,7 @@ around allow_auto_edit => sub {
return 0;
}
}
-
+
if (defined $self->data->{new}{isni_codes}) {
# If there's already ISNIs for the label, not an autoedit
if (@{ $self->data->{old}{isni_codes} // [] }) {
diff --git a/lib/MusicBrainz/Server/Edit/Medium.pm b/lib/MusicBrainz/Server/Edit/Medium.pm
index fc39c28eaa5..6323c87268c 100644
--- a/lib/MusicBrainz/Server/Edit/Medium.pm
+++ b/lib/MusicBrainz/Server/Edit/Medium.pm
@@ -16,14 +16,14 @@ sub check_tracks_against_format {
return unless any { $_->{is_data_track} } @tracklist;
my $format = $self->c->model('MediumFormat')->get_by_id($format_id);
- die "Format does not support pregap or data tracks" unless $format->has_discids;
+ die 'Format does not support pregap or data tracks' unless $format->has_discids;
my $data_tracks_started;
for (@tracklist) {
if ($_->{is_data_track}) {
$data_tracks_started = 1;
} elsif ($data_tracks_started) {
- die "All data tracks must be contiguous at the end of the medium";
+ die 'All data tracks must be contiguous at the end of the medium';
}
}
}
diff --git a/lib/MusicBrainz/Server/Edit/Medium/AddDiscID.pm b/lib/MusicBrainz/Server/Edit/Medium/AddDiscID.pm
index b18cbd03a1c..532842c93f7 100644
--- a/lib/MusicBrainz/Server/Edit/Medium/AddDiscID.pm
+++ b/lib/MusicBrainz/Server/Edit/Medium/AddDiscID.pm
@@ -51,7 +51,7 @@ method alter_edit_pending
sub initialize {
my ($self, %opts) = @_;
- my $release_name = delete $opts{release_name} // "";
+ my $release_name = delete $opts{release_name} // '';
# For linkedEntities to work with edit previews
my $fake_release_id = 1000000000000;
@@ -104,7 +104,7 @@ method build_display_data ($loaded)
Medium->new( release_id => $self->release_id,
release => $loaded->{Release}{ $self->release_id } //
Release->new(
- id => $self->release_id,
+ id => $self->release_id,
name => $self->data->{release}{name},
),
$pos ? ( position => $pos ) : (),
diff --git a/lib/MusicBrainz/Server/Edit/Medium/Edit.pm b/lib/MusicBrainz/Server/Edit/Medium/Edit.pm
index 86dd10a1b88..b18ae3a9dfd 100644
--- a/lib/MusicBrainz/Server/Edit/Medium/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Medium/Edit.pm
@@ -146,7 +146,7 @@ sub initialize
my $entity = delete $opts{to_edit};
my $tracklist = delete $opts{tracklist};
- my $delete_tracklist = delete $opts{delete_tracklist};
+ my $delete_tracklist = delete $opts{delete_tracklist};
my $data;
$self->check_tracks_against_format($tracklist, $opts{format_id});
@@ -162,7 +162,7 @@ sub initialize
}
else
{
- die "You must specify the object to edit" unless defined $entity;
+ die 'You must specify the object to edit' unless defined $entity;
unless ($entity->release) {
$self->c->model('Release')->load($entity);
diff --git a/lib/MusicBrainz/Server/Edit/Medium/Util.pm b/lib/MusicBrainz/Server/Edit/Medium/Util.pm
index ad65eecba1a..e5c0798820e 100644
--- a/lib/MusicBrainz/Server/Edit/Medium/Util.pm
+++ b/lib/MusicBrainz/Server/Edit/Medium/Util.pm
@@ -65,16 +65,16 @@ sub check_track_hash {
my $tracks = shift;
my @track_ids = grep { defined $_ } map { $_->{id} } @$tracks;
- die "Track IDs are not unique (MBS-7303)"
+ die 'Track IDs are not unique (MBS-7303)'
unless scalar @track_ids == scalar uniq @track_ids;
my @track_pos = sort { $a <=> $b } map { $_->{position} } @$tracks;
- die "No tracks" unless @track_pos;
- die "Track positions not given for all tracks"
+ die 'No tracks' unless @track_pos;
+ die 'Track positions not given for all tracks'
unless all { defined $_ } @track_pos;
- die "Track positions are not unique (MBS-7721)"
+ die 'Track positions are not unique (MBS-7721)'
unless scalar @track_pos == scalar uniq @track_pos;
- die "Track positions are non-contiguous (MBS-7846)"
+ die 'Track positions are non-contiguous (MBS-7846)'
unless ($track_pos[0] == 0 || $track_pos[0] == 1)
&& scalar @track_pos == $track_pos[-1] - $track_pos[0] + 1;
}
diff --git a/lib/MusicBrainz/Server/Edit/Place/Create.pm b/lib/MusicBrainz/Server/Edit/Place/Create.pm
index 8faadae0024..3a89dff0624 100644
--- a/lib/MusicBrainz/Server/Edit/Place/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Place/Create.pm
@@ -76,7 +76,7 @@ sub build_display_data
};
}
-sub edit_template_react { "AddPlace" }
+sub edit_template_react { 'AddPlace' }
before restore => sub {
my ($self, $data) = @_;
diff --git a/lib/MusicBrainz/Server/Edit/Place/Edit.pm b/lib/MusicBrainz/Server/Edit/Place/Edit.pm
index e458d7cee09..8a81c5ff388 100644
--- a/lib/MusicBrainz/Server/Edit/Place/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Place/Edit.pm
@@ -30,7 +30,7 @@ use aliased 'MusicBrainz::Server::Entity::Area';
use aliased 'MusicBrainz::Server::Entity::PartialDate';
use aliased 'MusicBrainz::Server::Entity::Coordinates';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::CheckForConflicts';
@@ -186,7 +186,7 @@ sub _edit_hash {
return $self->merge_changes;
}
-sub edit_template_react { "EditPlace" }
+sub edit_template_react { 'EditPlace' }
around extract_property => sub {
my ($orig, $self) = splice(@_, 0, 2);
diff --git a/lib/MusicBrainz/Server/Edit/Recording/Create.pm b/lib/MusicBrainz/Server/Edit/Recording/Create.pm
index 224704c759a..39b508ac945 100644
--- a/lib/MusicBrainz/Server/Edit/Recording/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Recording/Create.pm
@@ -25,7 +25,7 @@ with 'MusicBrainz::Server::Edit::Role::AlwaysAutoEdit';
sub edit_type { $EDIT_RECORDING_CREATE }
sub edit_name { N_l('Add standalone recording') }
-sub edit_template_react { "AddStandaloneRecording" }
+sub edit_template_react { 'AddStandaloneRecording' }
sub _create_model { 'Recording' }
sub recording_id { return shift->entity_id }
diff --git a/lib/MusicBrainz/Server/Edit/Recording/Edit.pm b/lib/MusicBrainz/Server/Edit/Recording/Edit.pm
index 34ef935e230..50c3e5a68f4 100644
--- a/lib/MusicBrainz/Server/Edit/Recording/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Recording/Edit.pm
@@ -26,7 +26,7 @@ use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
use MusicBrainz::Server::Track;
use MusicBrainz::Server::Translation qw( N_l );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::Recording::RelatedEntities';
@@ -43,7 +43,7 @@ use aliased 'MusicBrainz::Server::Entity::Recording';
sub edit_type { $EDIT_RECORDING_EDIT }
sub edit_name { N_l('Edit recording') }
-sub edit_template_react { "EditRecording" }
+sub edit_template_react { 'EditRecording' }
sub _edit_model { 'Recording' }
sub recording_id { return shift->entity_id }
diff --git a/lib/MusicBrainz/Server/Edit/Recording/RemoveISRC.pm b/lib/MusicBrainz/Server/Edit/Recording/RemoveISRC.pm
index fec4b1f1f93..c85aeec4a34 100644
--- a/lib/MusicBrainz/Server/Edit/Recording/RemoveISRC.pm
+++ b/lib/MusicBrainz/Server/Edit/Recording/RemoveISRC.pm
@@ -74,7 +74,7 @@ sub initialize
{
my ($self, %opts) = @_;
- my $isrc = $opts{isrc} or die "Required 'isrc' object missing";
+ my $isrc = $opts{isrc} or die q(Required 'isrc' object missing);
$self->c->model('Recording')->load($isrc) unless defined $isrc->recording;
$self->data({
isrc => {
diff --git a/lib/MusicBrainz/Server/Edit/Relationship.pm b/lib/MusicBrainz/Server/Edit/Relationship.pm
index ce31b051a34..51f021d1c2d 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship.pm
+++ b/lib/MusicBrainz/Server/Edit/Relationship.pm
@@ -13,7 +13,7 @@ use namespace::autoclean;
use MusicBrainz::Server::Translation 'l';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
sub edit_category { l('Relationship') }
@@ -100,7 +100,7 @@ sub serialize_link_attributes {
sub editor_may_edit_types {
my ($self, $type0, $type1) = @_;
- my $types = join "_", sort($type0, $type1);
+ my $types = join '_', sort($type0, $type1);
if ($types ~~ [qw(area_area area_url)]) {
return $self->editor->is_location_editor;
} elsif ($types ~~ [qw(area_instrument instrument_instrument instrument_url)]) {
diff --git a/lib/MusicBrainz/Server/Edit/Relationship/Create.pm b/lib/MusicBrainz/Server/Edit/Relationship/Create.pm
index 91c296c80ba..7826e2624bf 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Relationship/Create.pm
@@ -67,9 +67,9 @@ sub link_type { shift->data->{link_type} }
sub initialize
{
my ($self, %opts) = @_;
- my $e0 = delete $opts{entity0} or die "No entity0";
- my $e1 = delete $opts{entity1} or die "No entity1";
- my $lt = delete $opts{link_type} or die "No link type";
+ my $e0 = delete $opts{entity0} or die 'No entity0';
+ my $e1 = delete $opts{entity1} or die 'No entity1';
+ my $lt = delete $opts{link_type} or die 'No link type';
my $link_type_id = $lt->id;
die "Link type $link_type_id is only used for grouping" unless $lt->description;
@@ -82,7 +82,7 @@ sub initialize
}
}
- die "Entities in a relationship cannot be the same"
+ die 'Entities in a relationship cannot be the same'
if $lt->entity0_type eq $lt->entity1_type && $e0->id == $e1->id;
$opts{entity0} = {
diff --git a/lib/MusicBrainz/Server/Edit/Relationship/Delete.pm b/lib/MusicBrainz/Server/Edit/Relationship/Delete.pm
index 63dea33fe3b..4762b173cab 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship/Delete.pm
+++ b/lib/MusicBrainz/Server/Edit/Relationship/Delete.pm
@@ -29,7 +29,7 @@ with 'MusicBrainz::Server::Edit::Relationship::RelatedEntities';
with 'MusicBrainz::Server::Edit::Role::Preview';
sub edit_type { $EDIT_RELATIONSHIP_DELETE }
-sub edit_name { N_l("Remove relationship") }
+sub edit_name { N_l('Remove relationship') }
sub edit_kind { 'remove' }
sub edit_template_react { 'RemoveRelationship' }
diff --git a/lib/MusicBrainz/Server/Edit/Relationship/Edit.pm b/lib/MusicBrainz/Server/Edit/Relationship/Edit.pm
index e4e67836189..92c920efea0 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Relationship/Edit.pm
@@ -33,7 +33,7 @@ with 'MusicBrainz::Server::Edit::Role::Preview';
with 'MusicBrainz::Server::Edit::Role::DatePeriod';
sub edit_type { $EDIT_RELATIONSHIP_EDIT }
-sub edit_name { N_l("Edit relationship") }
+sub edit_name { N_l('Edit relationship') }
sub edit_kind { 'edit' }
sub edit_template_react { 'EditRelationship' }
diff --git a/lib/MusicBrainz/Server/Edit/Relationship/Reorder.pm b/lib/MusicBrainz/Server/Edit/Relationship/Reorder.pm
index fbb63d92289..495bf91c6bb 100644
--- a/lib/MusicBrainz/Server/Edit/Relationship/Reorder.pm
+++ b/lib/MusicBrainz/Server/Edit/Relationship/Reorder.pm
@@ -195,7 +195,7 @@ sub initialize {
my $relationship = delete $_->{relationship};
my $link = $relationship->link;
- die "Relationship link type mismatch" if $link->type_id != $lt->id;
+ die 'Relationship link type mismatch' if $link->type_id != $lt->id;
$_->{relationship} = {
id => $relationship->id,
diff --git a/lib/MusicBrainz/Server/Edit/Release.pm b/lib/MusicBrainz/Server/Edit/Release.pm
index 594ac14ceb0..1be30507f88 100644
--- a/lib/MusicBrainz/Server/Edit/Release.pm
+++ b/lib/MusicBrainz/Server/Edit/Release.pm
@@ -17,7 +17,7 @@ sub check_event_countries {
for (@$events) {
my $country_id = $_->{country_id} // 'undef';
if (exists $countries->{$country_id}) {
- die "Duplicate release country: " . $country_id;
+ die "Duplicate release country: $country_id";
}
$countries->{$country_id} = 1;
}
diff --git a/lib/MusicBrainz/Server/Edit/Release/AddCoverArt.pm b/lib/MusicBrainz/Server/Edit/Release/AddCoverArt.pm
index 4221c8c2639..9c1d0867000 100644
--- a/lib/MusicBrainz/Server/Edit/Release/AddCoverArt.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/AddCoverArt.pm
@@ -119,7 +119,7 @@ sub build_display_data {
my $suffix = $self->data->{cover_art_mime_type}
? $self->c->model('CoverArt')->image_type_suffix($self->data->{cover_art_mime_type})
- : "jpg";
+ : 'jpg';
my $artwork = Artwork->new(release => $artwork_release,
id => $self->data->{cover_art_id},
diff --git a/lib/MusicBrainz/Server/Edit/Release/Create.pm b/lib/MusicBrainz/Server/Edit/Release/Create.pm
index e8397e38e75..b351f81c638 100644
--- a/lib/MusicBrainz/Server/Edit/Release/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/Create.pm
@@ -62,7 +62,7 @@ after 'initialize' => sub {
$self->check_event_countries($self->data->{events} // []);
- croak "No release_group_id specified" unless $self->data->{release_group_id};
+ croak 'No release_group_id specified' unless $self->data->{release_group_id};
};
sub foreign_keys
diff --git a/lib/MusicBrainz/Server/Edit/Release/DeleteReleaseLabel.pm b/lib/MusicBrainz/Server/Edit/Release/DeleteReleaseLabel.pm
index 7c2427fc588..e68a3a6e54b 100644
--- a/lib/MusicBrainz/Server/Edit/Release/DeleteReleaseLabel.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/DeleteReleaseLabel.pm
@@ -101,7 +101,7 @@ sub initialize
{
my ($self, %opts) = @_;
my $release_label = delete $opts{release_label};
- die "You must specify the release label object to delete"
+ die 'You must specify the release label object to delete'
unless defined $release_label;
unless ($release_label->release) {
diff --git a/lib/MusicBrainz/Server/Edit/Release/Edit.pm b/lib/MusicBrainz/Server/Edit/Release/Edit.pm
index 07f4e6a75df..4f5770e605b 100644
--- a/lib/MusicBrainz/Server/Edit/Release/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/Edit.pm
@@ -31,7 +31,7 @@ use MusicBrainz::Server::Entity::PartialDate;
use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array to_json_object );
use MusicBrainz::Server::Translation qw( N_l );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::Role::EditArtistCredit';
diff --git a/lib/MusicBrainz/Server/Edit/Release/EditReleaseLabel.pm b/lib/MusicBrainz/Server/Edit/Release/EditReleaseLabel.pm
index ac6b31e4f52..13768a4b5e3 100644
--- a/lib/MusicBrainz/Server/Edit/Release/EditReleaseLabel.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/EditReleaseLabel.pm
@@ -16,7 +16,7 @@ use MusicBrainz::Server::Translation qw( N_l l lp );
use MusicBrainz::Server::Entity::Util::MediumFormat qw( combined_medium_format_name );
use Scalar::Util qw( looks_like_number );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::WithDifferences';
with 'MusicBrainz::Server::Edit::Role::Preview';
@@ -201,7 +201,7 @@ sub initialize
{
my ($self, %opts) = @_;
my $release_label = delete $opts{release_label};
- die "You must specify the release label object to edit"
+ die 'You must specify the release label object to edit'
unless defined $release_label;
unless ($release_label->release) {
diff --git a/lib/MusicBrainz/Server/Edit/Release/Merge.pm b/lib/MusicBrainz/Server/Edit/Release/Merge.pm
index 4e619c8c00a..c25ce4c8eb7 100644
--- a/lib/MusicBrainz/Server/Edit/Release/Merge.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/Merge.pm
@@ -5,7 +5,7 @@ use 5.18.2;
use Moose;
use List::AllUtils qw( any );
use MusicBrainz::Server::Constants qw( $EDIT_RELEASE_MERGE );
-use MusicBrainz::Server::Data::Utils qw( localized_note );
+use MusicBrainz::Server::Data::Utils qw( boolean_to_json localized_note );
use MusicBrainz::Server::Edit::Exceptions;
use MusicBrainz::Server::Edit::Types qw(
ArtistCreditDefinition
@@ -14,6 +14,7 @@ use MusicBrainz::Server::Edit::Types qw(
RecordingMergesArray
);
use MusicBrainz::Server::Edit::Utils qw( large_spread );
+use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array to_json_object );
use MusicBrainz::Server::Translation qw( N_l );
use Try::Tiny;
@@ -140,6 +141,7 @@ sub _build_recording_merges {
sub edit_name { N_l('Merge releases') }
sub edit_type { $EDIT_RELEASE_MERGE }
sub _merge_model { 'Release' }
+sub edit_template_react { 'MergeReleases' }
sub release_ids { @{ shift->_entity_ids } }
@@ -188,7 +190,7 @@ sub alter_edit_pending
my @recording_ids = map { $_->{id} } map { $_->{destination}, @{ $_->{sources} } } @{ $self->recording_merges // [] };
return {
Release => [ $self->release_ids ],
- @recording_ids ? (Recording => [ @recording_ids ]) : (),
+ @recording_ids ? (Recording => [ @recording_ids ]) : (),
}
}
@@ -240,40 +242,22 @@ override build_display_data => sub
my $data = super();
- $self->c->model('Label')->load(
- grep { $_->label_id && !defined($_->label) }
- map { $_->all_labels }
- values %{ $loaded->{Release} }
- );
-
- $self->c->model('Medium')->load_for_releases(
- grep { $_->medium_count < 1 }
- values %{ $loaded->{Release} }
- );
-
- $self->c->model('MediumFormat')->load(
- grep { $_->format_id && !defined($_->format) }
- map { $_->all_mediums }
- values %{ $loaded->{Release} }
- );
-
- $self->c->model('Release')->load_release_events(
- values %{ $loaded->{Release} }
- );
-
if ($self->data->{merge_strategy} == $MusicBrainz::Server::Data::Release::MERGE_APPEND) {
$data->{changes} = [
map +{
- release => $loaded->{Release}{ $_->{release}{id} }
- || Release->new( name => $_->{release}{name} ),
- mediums => $_->{mediums}
+ release => to_json_object(
+ $loaded->{Release}{ $_->{release}{id} }
+ || Release->new( name => $_->{release}{name} )
+ ),
+ mediums => to_json_array($_->{mediums})
}, @{ $self->data->{medium_changes} }
];
- $data->{empty_releases} = [
- map +{
- release => $loaded->{Release}{ $_->{id} } // Release->new(name => $_->{name}),
- }, grep { defined $_->{mediums} && scalar @{ $_->{mediums} } == 0 } @{ $self->data->{old_entities} }
- ];
+ $data->{empty_releases} = to_json_array([
+ map {
+ $loaded->{Release}{ $_->{id} } //
+ Release->new(name => $_->{name}),
+ } grep { defined $_->{mediums} && scalar @{ $_->{mediums} } == 0 } @{ $self->data->{old_entities} }
+ ]);
} elsif ($self->data->{merge_strategy} == $MusicBrainz::Server::Data::Release::MERGE_MERGE) {
my $recording_merges = $self->recording_merges;
@@ -289,15 +273,23 @@ override build_display_data => sub
)
} @{$_->{sources}}];
{
- medium => $_->{medium},
- track => $_->{track},
- destination => $destination,
- sources => $sources,
- large_spread => (large_spread(map { $_->length } $destination, @{$sources}) ? 1 : 0),
+ medium => to_json_object($_->{medium}),
+ track => to_json_object($_->{track}),
+ destination => to_json_object($destination),
+ sources => to_json_array($sources),
+ large_spread => boolean_to_json(large_spread(map { $_->length } $destination, @{$sources}) ? 1 : 0),
}
} @{$recording_merges}] if defined $recording_merges;
}
+ $data->{merge_strategy} = $self->data->{merge_strategy} == $MusicBrainz::Server::Data::Release::MERGE_APPEND
+ ? 'append'
+ : 'merge';
+
+ $data->{edit_version} = $self->data->{_edit_version};
+
+ $data->{cannot_merge_recordings_reason} = $self->{cannot_merge_recordings_reason};
+
return $data;
};
diff --git a/lib/MusicBrainz/Server/Edit/Release/RemoveCoverArt.pm b/lib/MusicBrainz/Server/Edit/Release/RemoveCoverArt.pm
index 47a50f08706..34666452d84 100644
--- a/lib/MusicBrainz/Server/Edit/Release/RemoveCoverArt.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/RemoveCoverArt.pm
@@ -42,7 +42,7 @@ has '+data' => (
sub initialize {
my ($self, %opts) = @_;
my $release = $opts{release} or die 'Release missing';
- my $cover_art = $opts{to_delete} or die "Required 'to_delete' object";
+ my $cover_art = $opts{to_delete} or die q(Required 'to_delete' object);
my %type_map = map { $_->name => $_ }
$self->c->model('CoverArtType')->get_by_name(@{ $cover_art->types });
diff --git a/lib/MusicBrainz/Server/Edit/Release/ReorderCoverArt.pm b/lib/MusicBrainz/Server/Edit/Release/ReorderCoverArt.pm
index e732a9603ff..69466411197 100644
--- a/lib/MusicBrainz/Server/Edit/Release/ReorderCoverArt.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/ReorderCoverArt.pm
@@ -78,7 +78,7 @@ sub accept {
my @current_ids = sort(map { $_->id } @$current);
my @edit_ids = sort(map { $_->{id} } @{ $self->data->{old} });
- if (join(",", @current_ids) ne join (",", @edit_ids))
+ if (join(',', @current_ids) ne join (',', @edit_ids))
{
MusicBrainz::Server::Edit::Exceptions::FailedDependency
->throw('Cover art has been added or removed since this edit was created, which conflicts ' .
diff --git a/lib/MusicBrainz/Server/Edit/Release/ReorderMediums.pm b/lib/MusicBrainz/Server/Edit/Release/ReorderMediums.pm
index 8fbbe9adcd4..78dda9bb481 100644
--- a/lib/MusicBrainz/Server/Edit/Release/ReorderMediums.pm
+++ b/lib/MusicBrainz/Server/Edit/Release/ReorderMediums.pm
@@ -90,10 +90,10 @@ sub build_display_data {
map {
my $entity = $loaded->{Medium}{ $_->{medium_id} };
{
- old => $_->{old} ? $_->{old} : "new",
+ old => $_->{old} ? $_->{old} : 'new',
# For some reason older edits have old as int but new as string
new => $_->{new} + 0,
- title => $entity ? $entity->name : ""
+ title => $entity ? $entity->name : ''
}
}
sort { $a->{new} <=> $b->{new} }
@@ -121,12 +121,12 @@ sub accept {
my $new_positions = [values %medium_positions];
my $possible_conflicts =
- $self->c->sql->select_list_of_hashes(<<~'EOSQL', $self->release_id, $new_positions);
+ $self->c->sql->select_list_of_hashes(<<~'SQL', $self->release_id, $new_positions);
SELECT id, position
FROM medium
WHERE release = ?
AND position = any(?)
- EOSQL
+ SQL
for my $row (@$possible_conflicts) {
unless (exists $medium_positions{$row->{id}}) {
diff --git a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm
index 963b4a2ea22..9295a2ae63e 100644
--- a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm
@@ -91,7 +91,7 @@ sub _insert_hash
return $data;
}
-sub edit_template_react { "AddReleaseGroup" }
+sub edit_template_react { 'AddReleaseGroup' }
before accept => sub {
my ($self) = @_;
diff --git a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Delete.pm b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Delete.pm
index c87aa4f9435..485c6535a4a 100644
--- a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Delete.pm
+++ b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Delete.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Edit::ReleaseGroup::RelatedEntities';
with 'MusicBrainz::Server::Edit::ReleaseGroup';
sub edit_type { $EDIT_RELEASEGROUP_DELETE }
-sub edit_name { N_l("Remove release group") }
+sub edit_name { N_l('Remove release group') }
sub _delete_model { 'ReleaseGroup' }
sub release_group_id { shift->entity_id }
diff --git a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Edit.pm b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Edit.pm
index cbe674d5f39..829ed503051 100644
--- a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Edit.pm
@@ -30,7 +30,7 @@ use Scalar::Util qw( looks_like_number );
use aliased 'MusicBrainz::Server::Entity::ReleaseGroup';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::ReleaseGroup::RelatedEntities';
@@ -44,7 +44,7 @@ with 'MusicBrainz::Server::Edit::Role::EditArtistCredit';
with 'MusicBrainz::Server::Edit::Role::Preview';
sub edit_type { $EDIT_RELEASEGROUP_EDIT }
-sub edit_name { N_l("Edit release group") }
+sub edit_name { N_l('Edit release group') }
sub _edit_model { 'ReleaseGroup' }
sub release_group_id { shift->data->{entity}{id} }
@@ -230,7 +230,7 @@ sub _edit_hash
return $data;
}
-sub edit_template_react { "EditReleaseGroup" }
+sub edit_template_react { 'EditReleaseGroup' }
before accept => sub {
my ($self) = @_;
@@ -240,7 +240,7 @@ before accept => sub {
if (my $type_id = $self->data->{new}{type_id}) {
if (!$self->c->model('ReleaseGroupType')->get_by_id($type_id)) {
MusicBrainz::Server::Edit::Exceptions::FailedDependency->throw(
- "This edit changes the release group's primary type to a type that no longer exists."
+ q(This edit changes the release group's primary type to a type that no longer exists.)
);
}
}
diff --git a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Merge.pm b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Merge.pm
index b4a94e87a43..22b0f2b09a3 100644
--- a/lib/MusicBrainz/Server/Edit/ReleaseGroup/Merge.pm
+++ b/lib/MusicBrainz/Server/Edit/ReleaseGroup/Merge.pm
@@ -10,7 +10,7 @@ with 'MusicBrainz::Server::Edit::ReleaseGroup::RelatedEntities' => {
};
with 'MusicBrainz::Server::Edit::ReleaseGroup';
-sub edit_name { N_l("Merge release groups") }
+sub edit_name { N_l('Merge release groups') }
sub edit_type { $EDIT_RELEASEGROUP_MERGE }
sub _merge_model { 'ReleaseGroup' }
sub release_group_ids { @{ shift->_entity_ids } }
diff --git a/lib/MusicBrainz/Server/Edit/Role/IPI.pm b/lib/MusicBrainz/Server/Edit/Role/IPI.pm
index 9848361ec9e..c973e1bead4 100644
--- a/lib/MusicBrainz/Server/Edit/Role/IPI.pm
+++ b/lib/MusicBrainz/Server/Edit/Role/IPI.pm
@@ -74,7 +74,7 @@ after post_insert => sub {
editor_id => $EDITOR_MODBOT,
text => $edit_note
}
- );
+ );
}
if ($label_dupe_count) {
diff --git a/lib/MusicBrainz/Server/Edit/Role/ISNI.pm b/lib/MusicBrainz/Server/Edit/Role/ISNI.pm
index 761d007763a..f1a88fdc9e0 100644
--- a/lib/MusicBrainz/Server/Edit/Role/ISNI.pm
+++ b/lib/MusicBrainz/Server/Edit/Role/ISNI.pm
@@ -74,7 +74,7 @@ after post_insert => sub {
editor_id => $EDITOR_MODBOT,
text => $edit_note
}
- );
+ );
}
if ($label_dupe_count) {
diff --git a/lib/MusicBrainz/Server/Edit/Role/Insert.pm b/lib/MusicBrainz/Server/Edit/Role/Insert.pm
index 39b6e2e5188..46fc2d9af6a 100644
--- a/lib/MusicBrainz/Server/Edit/Role/Insert.pm
+++ b/lib/MusicBrainz/Server/Edit/Role/Insert.pm
@@ -16,7 +16,7 @@ override 'to_hash' => sub
{
my $self = shift;
my $hash = super(@_);
- die "Role::Insert used without setting entity_id!"
+ die 'Role::Insert used without setting entity_id!'
unless $self->entity_id;
$hash->{entity_id} = $self->entity_id;
$hash->{entity_gid} = $self->entity_gid if $self->entity_gid;
diff --git a/lib/MusicBrainz/Server/Edit/Role/ValueSet.pm b/lib/MusicBrainz/Server/Edit/Role/ValueSet.pm
index 0985f4c3d57..5fd080c4059 100644
--- a/lib/MusicBrainz/Server/Edit/Role/ValueSet.pm
+++ b/lib/MusicBrainz/Server/Edit/Role/ValueSet.pm
@@ -24,7 +24,7 @@ role {
before initialize => sub {
my ($self, %opts) = @_;
- die "You must specify " . $prop_name unless defined $opts{$prop_name};
+ die 'You must specify ' . $prop_name unless defined $opts{$prop_name};
};
around new_data => sub {
diff --git a/lib/MusicBrainz/Server/Edit/Series/Create.pm b/lib/MusicBrainz/Server/Edit/Series/Create.pm
index 7761359a6fd..06264f54838 100644
--- a/lib/MusicBrainz/Server/Edit/Series/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Series/Create.pm
@@ -70,7 +70,7 @@ sub build_display_data {
};
}
-sub edit_template_react { "AddSeries" }
+sub edit_template_react { 'AddSeries' }
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Edit/Series/Edit.pm b/lib/MusicBrainz/Server/Edit/Series/Edit.pm
index fcc917db46c..289c994367f 100644
--- a/lib/MusicBrainz/Server/Edit/Series/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Series/Edit.pm
@@ -17,7 +17,7 @@ use MooseX::Types::Structured qw( Dict Optional );
use aliased 'MusicBrainz::Server::Entity::Series';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::Series';
@@ -148,7 +148,7 @@ sub _changes_ordering_type {
return ($self->data->{old}{ordering_type_id} // 0) != ($self->data->{new}{ordering_type_id} // 0);
}
-sub edit_template_react { "EditSeries" }
+sub edit_template_react { 'EditSeries' }
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Edit/URL/Edit.pm b/lib/MusicBrainz/Server/Edit/URL/Edit.pm
index 6eabf276a42..0035a54c031 100644
--- a/lib/MusicBrainz/Server/Edit/URL/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/URL/Edit.pm
@@ -14,7 +14,7 @@ use MusicBrainz::Server::Edit::Utils qw( changed_display_data );
use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
use MusicBrainz::Server::Translation qw( l N_l );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Edit::Generic::Edit';
with 'MusicBrainz::Server::Edit::URL';
diff --git a/lib/MusicBrainz/Server/Edit/WikiDoc/Change.pm b/lib/MusicBrainz/Server/Edit/WikiDoc/Change.pm
index 64683f4c4ed..1682a94ab6e 100644
--- a/lib/MusicBrainz/Server/Edit/WikiDoc/Change.pm
+++ b/lib/MusicBrainz/Server/Edit/WikiDoc/Change.pm
@@ -14,7 +14,7 @@ with 'MusicBrainz::Server::Edit::WikiDoc';
with 'MusicBrainz::Server::Edit::Role::AlwaysAutoEdit';
sub edit_type { $EDIT_WIKIDOC_CHANGE }
-sub edit_name { N_l("Change WikiDoc") }
+sub edit_name { N_l('Change WikiDoc') }
sub edit_kind { 'other' }
sub edit_template_react { 'ChangeWikiDoc' }
diff --git a/lib/MusicBrainz/Server/Edit/Work/Create.pm b/lib/MusicBrainz/Server/Edit/Work/Create.pm
index 63a336c3985..012b15e7452 100644
--- a/lib/MusicBrainz/Server/Edit/Work/Create.pm
+++ b/lib/MusicBrainz/Server/Edit/Work/Create.pm
@@ -5,7 +5,7 @@ use MooseX::Types::Moose qw( ArrayRef Int Maybe Str );
use MooseX::Types::Structured qw( Dict Optional );
use MusicBrainz::Server::Constants qw( $EDIT_WORK_CREATE );
use MusicBrainz::Server::Edit::Types qw( Nullable );
-use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
+use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array to_json_object );
use MusicBrainz::Server::Translation qw( l N_l );
extends 'MusicBrainz::Server::Edit::Generic::Create';
@@ -71,22 +71,13 @@ sub build_display_data
if (defined $data->{language_id}) {
my $language = $loaded->{Language}{$data->{language_id}};
- if ($language->iso_code_3 eq "zxx") {
- $language->name(l("[No lyrics]"));
- }
$display->{language} = to_json_object($language);
}
if (defined $data->{languages}) {
- $display->{languages} = [
- map {
- my $language = $loaded->{Language}{$_};
- if ($language && $language->iso_code_3 eq "zxx") {
- $language->name(l("[No lyrics]"));
- }
- $language ? $language->name : l('[removed]')
- } @{ $data->{languages} }
- ];
+ $display->{languages} = to_json_array([
+ map { $loaded->{Language}{$_} } @{ $data->{languages} }
+ ]);
}
return $display;
diff --git a/lib/MusicBrainz/Server/Edit/Work/Edit.pm b/lib/MusicBrainz/Server/Edit/Work/Edit.pm
index deed486578f..f3c4b13b025 100644
--- a/lib/MusicBrainz/Server/Edit/Work/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit/Work/Edit.pm
@@ -16,7 +16,7 @@ use MusicBrainz::Server::Edit::Utils qw(
changed_display_data
);
use MusicBrainz::Server::Edit::Exceptions;
-use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
+use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array to_json_object );
use MusicBrainz::Server::Translation qw( l N_l );
use Set::Scalar;
@@ -177,14 +177,8 @@ sub build_display_data
if (exists $data->{new}{languages}) {
for my $side (qw( old new )) {
- $display->{languages}{$side} = [
- map {
- my $language = $loaded->{Language}{$_};
- if ($language && $language->iso_code_3 eq "zxx") {
- $language->name(l("[No lyrics]"));
- }
- $language ? $language->name : l('[removed]');
- } @{ $data->{$side}{languages} // [] }
+ $display->{languages}{$side} = to_json_array[
+ map { $loaded->{Language}{$_} } @{ $data->{$side}{languages} // [] }
];
}
}
diff --git a/lib/MusicBrainz/Server/Edit/Work/Merge.pm b/lib/MusicBrainz/Server/Edit/Work/Merge.pm
index 72a90a6e45e..5bfd007fb7c 100644
--- a/lib/MusicBrainz/Server/Edit/Work/Merge.pm
+++ b/lib/MusicBrainz/Server/Edit/Work/Merge.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Edit::Work::RelatedEntities';
with 'MusicBrainz::Server::Edit::Work';
sub edit_type { $EDIT_WORK_MERGE }
-sub edit_name { N_l("Merge works") }
+sub edit_name { N_l('Merge works') }
sub work_ids { @{ shift->_entity_ids } }
sub _merge_model { 'Work' }
diff --git a/lib/MusicBrainz/Server/Edit/Work/RemoveISWC.pm b/lib/MusicBrainz/Server/Edit/Work/RemoveISWC.pm
index eeb2d3bc062..3fd1d5c2102 100644
--- a/lib/MusicBrainz/Server/Edit/Work/RemoveISWC.pm
+++ b/lib/MusicBrainz/Server/Edit/Work/RemoveISWC.pm
@@ -76,7 +76,7 @@ sub build_display_data {
sub initialize {
my ($self, %opts) = @_;
- my $iswc = $opts{iswc} or die "Required 'iswc' object missing";
+ my $iswc = $opts{iswc} or die q(Required 'iswc' object missing);
$self->c->model('Work')->load($iswc) unless defined $iswc->work;
$self->data({
iswc => {
diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index e8edda2fc11..e2bbf1b7274 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -58,7 +58,7 @@ sub process_edits
$self->log->debug("Selecting eligible edit IDs\n");
my $interval = DateTime::Format::Pg->format_interval($MINIMUM_RESPONSE_PERIOD);
- my $edit_ids = $sql->select_single_column_array("
+ my $edit_ids = $sql->select_single_column_array('
SELECT id
FROM edit
LEFT JOIN (
@@ -74,7 +74,7 @@ sub process_edits
AND (expire_time < now() OR
(vote_info.yes_votes >= ? AND vote_info.no_votes = 0) OR
(vote_info.no_votes >= ? AND vote_info.yes_votes = 0 AND vote_info.first_no_vote < NOW() - interval ?))
- ORDER BY id",
+ ORDER BY id',
$VOTE_NO, $VOTE_YES, $VOTE_NO,
$STATUS_OPEN, $REQUIRED_VOTES, $REQUIRED_VOTES, $interval);
@@ -84,7 +84,7 @@ sub process_edits
capture_exceptions(sub {
my $action;
Sql::run_in_transaction(sub {
- $action = $self->_process_edit($edit_id) || "no change"
+ $action = $self->_process_edit($edit_id) || 'no change'
}, $sql);
$stats{$action} += 1;
}, sub {
@@ -164,7 +164,7 @@ sub _process_open_edit
$edit->id,
{
editor_id => $EDITOR_MODBOT,
- text => "This edit failed because it affected high quality data and did not receive any votes."
+ text => 'This edit failed because it affected high quality data and did not receive any votes.'
}
);
$self->c->model('Edit')->reject($edit, $status);
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/AppliedEdits.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/AppliedEdits.pm
index 30f4b83cb5a..98e144d8f80 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/AppliedEdits.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/AppliedEdits.pm
@@ -12,7 +12,7 @@ extends 'MusicBrainz::Server::EditSearch::Predicate::ID';
sub combine_with_query {
my ($self, $query) = @_;
- my $subquery = "(SELECT COUNT(*) FROM edit H WHERE H.editor = edit.editor AND H.status = ?)";
+ my $subquery = '(SELECT COUNT(*) FROM edit H WHERE H.editor = edit.editor AND H.status = ?)';
my $sql;
given ($self->operator) {
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/Date.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/Date.pm
index c3f5f710e4d..fc9b84d9bd9 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/Date.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/Date.pm
@@ -22,8 +22,8 @@ override combine_with_query => sub {
if ($self->operator eq '=') {
$query->add_where([
'edit.' . $self->field_name . ' BETWEEN '.
- "date_trunc('day', ? AT TIME ZONE 'UTC') AND " .
- "date_trunc('day', ? AT TIME ZONE 'UTC') + interval '1 day'",
+ q(date_trunc('day', ? AT TIME ZONE 'UTC') AND ) .
+ q(date_trunc('day', ? AT TIME ZONE 'UTC') + interval '1 day'),
[ $self->sql_arguments->[0], @{ $self->sql_arguments } ]
]);
}
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/EditorFlag.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/EditorFlag.pm
index 1c35b2cff2c..c65a404d0e2 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/EditorFlag.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/EditorFlag.pm
@@ -34,10 +34,10 @@ sub combine_with_query {
return unless @flags;
$query->add_where([
- "EXISTS (SELECT 1 FROM editor WHERE id = edit.editor AND privs & (" . join(" | ", map { "?::integer" } @flags) . ") " .
+ 'EXISTS (SELECT 1 FROM editor WHERE id = edit.editor AND privs & (' . join(' | ', map { '?::integer' } @flags) . ') ' .
($self->operator eq '=' ? '!=' :
$self->operator eq '!=' ? '=' : die 'Shouldnt get here')
- . " 0)",
+ . ' 0)',
\@flags,
]);
}
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/ID.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/ID.pm
index fe34b5fabb5..416df4896fc 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/ID.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/ID.pm
@@ -4,7 +4,7 @@ use MusicBrainz::Server::Validation qw( is_database_row_id is_integer );
use namespace::autoclean;
use feature 'switch';
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
with 'MusicBrainz::Server::EditSearch::Predicate';
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseLanguage.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseLanguage.pm
index 31553b2087c..0e2aee3bd4b 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseLanguage.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseLanguage.pm
@@ -10,7 +10,7 @@ sub combine_with_query {
$query->add_where([
'EXISTS (SELECT 1 FROM edit_release A JOIN release B ON A.release = B.id WHERE A.edit = edit.id AND ' .
- join(' ', "B.language", $self->operator,
+ join(' ', 'B.language', $self->operator,
$self->operator eq '=' ? 'any(?)' :
$self->operator eq '!=' ? 'all(?)' : die q(Shouldn't get here)) . ')',
$self->sql_arguments
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseQuality.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseQuality.pm
index e776075b185..1b568b8f6fd 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseQuality.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/ReleaseQuality.pm
@@ -10,7 +10,7 @@ sub combine_with_query {
$query->add_where([
'EXISTS (SELECT 1 FROM edit_release A JOIN release B ON A.release = B.id WHERE A.edit = edit.id AND ' .
- join(' ', "B.quality", $self->operator,
+ join(' ', 'B.quality', $self->operator,
$self->operator eq '=' ? 'any(?)' :
$self->operator eq '!=' ? 'all(?)' : die q(Shouldn't get here)) . ')',
$self->sql_arguments
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/EntityArea.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/EntityArea.pm
index 0b12e806b5d..e7255a8ac44 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/EntityArea.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/EntityArea.pm
@@ -41,7 +41,7 @@ role {
$clause .= "JOIN $extra_join C ON B.$type_col = C.$extra_col ";
}
- $clause .= "WHERE A.edit = edit.id AND ";
+ $clause .= 'WHERE A.edit = edit.id AND ';
$query->add_where([
$clause .
join(' ', "$final_table_alias.$column", $self->operator,
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/Subscribed.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/Subscribed.pm
index cfb88dd8a5b..9cc2935585b 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/Subscribed.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/Subscribed.pm
@@ -3,7 +3,7 @@ use 5.10.0;
use MooseX::Role::Parameterized;
use namespace::autoclean;
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
parameter type => (
isa => 'Str',
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/User.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/User.pm
index 475c8228310..ce889de24ea 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/Role/User.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/Role/User.pm
@@ -49,7 +49,7 @@ role {
$query->add_where([ $sql, [ $self->user->id ] ]);
} elsif ($self->operator eq 'limited') {
# Please keep the logic in sync with Report::LimitedEditors and Entity::Editor
- $sql = "
+ $sql = q{
edit.editor != ?
AND (
NOT EXISTS (
@@ -75,7 +75,7 @@ role {
AND member_since > NOW() - INTERVAL '2 weeks'
)
)
- ";
+ };
$query->add_where([ $sql, [ $EDITOR_MODBOT, $STATUS_APPLIED ] ]);
} elsif ($self->operator eq 'not_edit_author') {
$query->add_where([
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/VoteCount.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/VoteCount.pm
index 147ce429b6b..0629467d8de 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/VoteCount.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/VoteCount.pm
@@ -16,12 +16,12 @@ has vote => (
sub combine_with_query {
my ($self, $query) = @_;
- my $sql = "COALESCE((
+ my $sql = 'COALESCE((
SELECT SUM(CASE WHEN vote = ? THEN 1 ELSE 0 END)
FROM vote
WHERE superseded = FALSE AND edit = edit.id
GROUP BY edit
- ), 0)";
+ ), 0)';
if ($self->operator eq 'BETWEEN') {
$sql .= ' BETWEEN SYMMETRIC ? AND ?';
diff --git a/lib/MusicBrainz/Server/EditSearch/Predicate/Voter.pm b/lib/MusicBrainz/Server/EditSearch/Predicate/Voter.pm
index 120de6bba9c..fa8b9936882 100644
--- a/lib/MusicBrainz/Server/EditSearch/Predicate/Voter.pm
+++ b/lib/MusicBrainz/Server/EditSearch/Predicate/Voter.pm
@@ -45,17 +45,17 @@ sub voter_clause {
my $sql = 'vote.editor ';
if ($self->operator eq 'subscribed') {
- $sql .= "IN (
+ $sql .= 'IN (
SELECT subscribed_editor
FROM editor_subscribe_editor
WHERE editor = ?
- )";
+ )';
} elsif ($self->operator eq 'not_subscribed') {
- $sql .= "NOT IN (
+ $sql .= 'NOT IN (
SELECT subscribed_editor
FROM editor_subscribe_editor
WHERE editor = ?
- )";
+ )';
} elsif ($self->operator eq '!=' || $self->operator eq 'not_me') {
$sql .= '!= ?';
} else {
@@ -84,8 +84,8 @@ sub combine_with_query {
if (@votes && $no_vote_option) {
$query->add_where([
join(' OR ',
- sprintf($sql, "vote.vote = any(?)"),
- sprintf("NOT $sql", "TRUE")
+ sprintf($sql, 'vote.vote = any(?)'),
+ sprintf("NOT $sql", 'TRUE')
),
[
$voter_id,
@@ -95,7 +95,7 @@ sub combine_with_query {
]);
} elsif (@votes && !$no_vote_option) {
$query->add_where([
- sprintf($sql, "vote.vote = any(?)"),
+ sprintf($sql, 'vote.vote = any(?)'),
[
$voter_id,
\@votes,
@@ -103,7 +103,7 @@ sub combine_with_query {
]);
} elsif (!@votes && $no_vote_option) {
$query->add_where([
- sprintf("NOT $sql", "TRUE"),
+ sprintf("NOT $sql", 'TRUE'),
[
$voter_id,
]
diff --git a/lib/MusicBrainz/Server/Email.pm b/lib/MusicBrainz/Server/Email.pm
index b222060f984..1058fb3a1e3 100644
--- a/lib/MusicBrainz/Server/Email.pm
+++ b/lib/MusicBrainz/Server/Email.pm
@@ -43,7 +43,7 @@ sub _encode_header {
my $header = shift;
if ($header =~ /[^\x20-\x7E]/) {
- return encode("MIME-Q", $header);
+ return encode('MIME-Q', $header);
} else {
return $header;
}
@@ -70,16 +70,16 @@ sub _create_email
my ($self, $headers, $body) = @_;
# Add a Message-Id header if there isn't one.
- if ( !(grep { "$_" eq "Message-Id" } @$headers) ) {
+ if ( !(grep { "$_" eq 'Message-Id' } @$headers) ) {
push @$headers, 'Message-Id', _message_id('uncategorized-email-%d', time());
}
return Email::MIME->create(
header => $headers,
body => encode('utf-8', $body),
attributes => {
- content_type => "text/plain",
- charset => "UTF-8",
- encoding => "quoted-printable",
+ content_type => 'text/plain',
+ charset => 'UTF-8',
+ encoding => 'quoted-printable',
});
}
@@ -87,10 +87,10 @@ sub _create_message_to_editor_email
{
my ($self, %opts) = @_;
- my $from = $opts{from} or die "Missing 'from' argument";
- my $to = $opts{to} or die "Missing 'to' argument";
- my $subject = $opts{subject} or die "Missing 'subject' argument";
- my $message = $opts{message} or die "Missing 'message' argument";
+ my $from = $opts{from} or die q(Missing 'from' argument);
+ my $to = $opts{to} or die q(Missing 'to' argument);
+ my $subject = $opts{subject} or die q(Missing 'subject' argument);
+ my $message = $opts{message} or die q(Missing 'message' argument);
my $time = $opts{time} || time();
@@ -272,9 +272,9 @@ sub _create_no_vote_email
{
my ($self, %opts) = @_;
- my $edit_id = $opts{edit_id} or die "Missing 'edit_id' argument";
- my $voter = $opts{voter} or die "Missing 'voter' argument";
- my $editor = $opts{editor} or die "Missing 'editor' argument";
+ my $edit_id = $opts{edit_id} or die q(Missing 'edit_id' argument);
+ my $voter = $opts{voter} or die q(Missing 'voter' argument);
+ my $editor = $opts{editor} or die q(Missing 'editor' argument);
my @headers = (
'To' => _user_address($opts{editor}),
@@ -363,10 +363,10 @@ sub _create_edit_note_email
{
my ($self, %opts) = @_;
- my $from_editor = $opts{from_editor} or die "Missing 'from_editor' argument";
- my $edit_id = $opts{edit_id} or die "Missing 'edit_id' argument";
- my $editor = $opts{editor} or die "Missing 'editor' argument";
- my $note_text = $opts{note_text} or die "Missing 'note_text' argument";
+ my $from_editor = $opts{from_editor} or die q(Missing 'from_editor' argument);
+ my $edit_id = $opts{edit_id} or die q(Missing 'edit_id' argument);
+ my $editor = $opts{editor} or die q(Missing 'editor' argument);
+ my $note_text = $opts{note_text} or die q(Missing 'note_text' argument);
my $own_edit = $opts{own_edit};
if ($from_editor->id == $EDITOR_MODBOT) {
@@ -528,42 +528,42 @@ sub send_election_nomination
{
my ($self, $election) = @_;
- return $self->_send_election_mail("Nomination", $election);
+ return $self->_send_election_mail('Nomination', $election);
}
sub send_election_voting_open
{
my ($self, $election) = @_;
- return $self->_send_election_mail("VotingOpen", $election);
+ return $self->_send_election_mail('VotingOpen', $election);
}
sub send_election_timeout
{
my ($self, $election) = @_;
- return $self->_send_election_mail("Timeout", $election);
+ return $self->_send_election_mail('Timeout', $election);
}
sub send_election_canceled
{
my ($self, $election) = @_;
- return $self->_send_election_mail("Canceled", $election);
+ return $self->_send_election_mail('Canceled', $election);
}
sub send_election_accepted
{
my ($self, $election) = @_;
- return $self->_send_election_mail("Accepted", $election);
+ return $self->_send_election_mail('Accepted', $election);
}
sub send_election_rejected
{
my ($self, $election) = @_;
- return $self->_send_election_mail("Rejected", $election);
+ return $self->_send_election_mail('Rejected', $election);
}
sub send_edit_note
@@ -611,7 +611,7 @@ sub send_editor_report {
if ($opts{reveal_address}) {
$body .= "You can reply to this message directly.\n";
} else {
- $body .= "The reporter chose not to reveal their email address. ";
+ $body .= 'The reporter chose not to reveal their email address. ';
$body .= "You’ll have to contact them through their user page if necessary.\n";
}
diff --git a/lib/MusicBrainz/Server/Email/Role.pm b/lib/MusicBrainz/Server/Email/Role.pm
index 372216e1ea0..9c2d6659168 100644
--- a/lib/MusicBrainz/Server/Email/Role.pm
+++ b/lib/MusicBrainz/Server/Email/Role.pm
@@ -63,9 +63,9 @@ sub create_email {
header => \@headers,
body => encode('utf-8', $self->body),
attributes => {
- content_type => "text/plain",
- charset => "UTF-8",
- encoding => "quoted-printable",
+ content_type => 'text/plain',
+ charset => 'UTF-8',
+ encoding => 'quoted-printable',
}
);
}
diff --git a/lib/MusicBrainz/Server/Entity/Artwork.pm b/lib/MusicBrainz/Server/Entity/Artwork.pm
index e8a63f13dbb..31595ab7d4b 100644
--- a/lib/MusicBrainz/Server/Entity/Artwork.pm
+++ b/lib/MusicBrainz/Server/Entity/Artwork.pm
@@ -109,7 +109,7 @@ sub filename
return undef unless $self->release->gid && $self->suffix;
- return sprintf("mbid-%s-%d.%s", $self->release->gid, $self->id, $self->suffix);
+ return sprintf('mbid-%s-%d.%s', $self->release->gid, $self->id, $self->suffix);
}
sub image {
diff --git a/lib/MusicBrainz/Server/Entity/Barcode.pm b/lib/MusicBrainz/Server/Entity/Barcode.pm
index 9472d94a7c2..b1a88ed0ac4 100644
--- a/lib/MusicBrainz/Server/Entity/Barcode.pm
+++ b/lib/MusicBrainz/Server/Entity/Barcode.pm
@@ -39,7 +39,7 @@ around BUILDARGS => sub {
sub new_from_row {
my ($class, $row, $prefix) = @_;
- return $class->new($row->{$prefix."barcode"});
+ return $class->new($row->{$prefix.'barcode'});
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Entity/CDTOC.pm b/lib/MusicBrainz/Server/Entity/CDTOC.pm
index 426c92d6eef..78d62284a18 100644
--- a/lib/MusicBrainz/Server/Entity/CDTOC.pm
+++ b/lib/MusicBrainz/Server/Entity/CDTOC.pm
@@ -103,14 +103,14 @@ sub new_from_toc
return unless $leadout_offset > $track_offsets[-1];
- my $message = "";
- $message .= sprintf("%02X", $first_track);
- $message .= sprintf("%02X", $last_track);
- $message .= sprintf("%08X", $leadout_offset);
- $message .= sprintf("%08X", ($track_offsets[$_-1] || 0)) for 1 .. 99;
+ my $message = '';
+ $message .= sprintf('%02X', $first_track);
+ $message .= sprintf('%02X', $last_track);
+ $message .= sprintf('%08X', $leadout_offset);
+ $message .= sprintf('%08X', ($track_offsets[$_-1] || 0)) for 1 .. 99;
my $discid = sha1_base64($message);
- $discid .= "="; # bring up to 28 characters, like the client
+ $discid .= '='; # bring up to 28 characters, like the client
$discid =~ tr[+/=][._-];
my @lengths = map {
@@ -139,7 +139,7 @@ sub _compute_freedb_id
my $t = int($frames[-1]/75) - int($frames[0]/75);
- sprintf "%08x", ((($n % 0xFF) << 24) | ($t << 8) | $tracks);
+ sprintf '%08x', ((($n % 0xFF) << 24) | ($t << 8) | $tracks);
}
with 'MusicBrainz::Server::Entity::Role::TOC';
diff --git a/lib/MusicBrainz/Server/Entity/CommonsImage.pm b/lib/MusicBrainz/Server/Entity/CommonsImage.pm
index 3ab50c22912..b07c205d0f8 100644
--- a/lib/MusicBrainz/Server/Entity/CommonsImage.pm
+++ b/lib/MusicBrainz/Server/Entity/CommonsImage.pm
@@ -20,7 +20,7 @@ has 'thumb_url' => (
sub page_url
{
my $self = shift;
- return sprintf "https://commons.wikimedia.org/wiki/%s", $self->title;
+ return sprintf 'https://commons.wikimedia.org/wiki/%s', $self->title;
}
sub TO_JSON {
diff --git a/lib/MusicBrainz/Server/Entity/EditNote.pm b/lib/MusicBrainz/Server/Entity/EditNote.pm
index 42aff0d2bc2..a54db248049 100644
--- a/lib/MusicBrainz/Server/Entity/EditNote.pm
+++ b/lib/MusicBrainz/Server/Entity/EditNote.pm
@@ -9,6 +9,7 @@ use namespace::autoclean;
use MusicBrainz::Server::Constants qw( $EDITOR_MODBOT );
use MusicBrainz::Server::Data::Utils qw( datetime_to_iso8601 );
use MusicBrainz::Server::Entity::Types;
+use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object );
use MusicBrainz::Server::Filters qw( format_editnote );
use MusicBrainz::Server::Types qw( DateTime );
@@ -125,7 +126,7 @@ around TO_JSON => sub {
my $json = $self->$orig;
$json->{editor_id} = $self->editor_id + 0;
- $json->{editor} = $self->editor->TO_JSON;
+ $json->{editor} = to_json_object($self->editor);
$json->{post_time} = datetime_to_iso8601($self->post_time);
$json->{formatted_text} = $self->editor_id == $EDITOR_MODBOT
? $self->localize : format_editnote($self->text);
diff --git a/lib/MusicBrainz/Server/Entity/ISNI.pm b/lib/MusicBrainz/Server/Entity/ISNI.pm
index e13b875a518..fffd471b4ab 100644
--- a/lib/MusicBrainz/Server/Entity/ISNI.pm
+++ b/lib/MusicBrainz/Server/Entity/ISNI.pm
@@ -11,7 +11,7 @@ has 'isni' => (
sub url {
my ($self) = @_;
- return "http://www.isni.org/" . $self->isni;
+ return 'http://www.isni.org/' . $self->isni;
}
sub TO_JSON {
diff --git a/lib/MusicBrainz/Server/Entity/Label.pm b/lib/MusicBrainz/Server/Entity/Label.pm
index 954db49e26f..beb65975193 100644
--- a/lib/MusicBrainz/Server/Entity/Label.pm
+++ b/lib/MusicBrainz/Server/Entity/Label.pm
@@ -29,9 +29,9 @@ sub format_label_code
{
my $self = shift;
if ($self->label_code) {
- return sprintf "LC %05d", $self->label_code;
+ return sprintf 'LC %05d', $self->label_code;
}
- return "";
+ return '';
}
sub is_special_purpose {
diff --git a/lib/MusicBrainz/Server/Entity/Relationship.pm b/lib/MusicBrainz/Server/Entity/Relationship.pm
index 1d99e039b5a..7c87be7cee0 100644
--- a/lib/MusicBrainz/Server/Entity/Relationship.pm
+++ b/lib/MusicBrainz/Server/Entity/Relationship.pm
@@ -223,7 +223,7 @@ sub _interpolate {
my ($name, $alt) = @_;
# placeholders for entity names which are processed elsewhere
- return "{$name}" if $name eq "entity0" || $name eq "entity1";
+ return "{$name}" if $name eq 'entity0' || $name eq 'entity1';
delete $extra_attrs{$name} unless $for_grouping;
if (!$alt) {
diff --git a/lib/MusicBrainz/Server/Entity/Release.pm b/lib/MusicBrainz/Server/Entity/Release.pm
index 1bb9abc5174..56bbfc096b5 100644
--- a/lib/MusicBrainz/Server/Entity/Release.pm
+++ b/lib/MusicBrainz/Server/Entity/Release.pm
@@ -169,19 +169,19 @@ sub combined_track_count
{
my ($self) = @_;
my @mediums = @{$self->mediums};
- return "" if !@mediums;
+ return '' if !@mediums;
my @counts;
foreach my $medium (@mediums) {
push @counts, $medium->track_count;
}
- return join " + ", @counts;
+ return join ' + ', @counts;
}
sub combined_format_name
{
my ($self) = @_;
my @mediums = @{$self->mediums};
- return "" if !@mediums;
+ return '' if !@mediums;
return combined_medium_format_name(map { $_->l_format_name() || lp('(unknown)', 'medium format') } @mediums );
}
diff --git a/lib/MusicBrainz/Server/Entity/Role/OptionsTree.pm b/lib/MusicBrainz/Server/Entity/Role/OptionsTree.pm
index e8b0296314f..a4705b53ce8 100644
--- a/lib/MusicBrainz/Server/Entity/Role/OptionsTree.pm
+++ b/lib/MusicBrainz/Server/Entity/Role/OptionsTree.pm
@@ -71,11 +71,11 @@ role {
method sorted_children => sub {
my ($self, $coll) = @_;
- $coll or die "No collator given";
+ $coll or die 'No collator given';
my $attr = $params->sort_criterion;
return sort_by {
- (sprintf "%+012d", $_->child_order) .
+ (sprintf '%+012d', $_->child_order) .
$coll->getSortKey($_->$attr)
}
$self->all_children;
diff --git a/lib/MusicBrainz/Server/Entity/Series.pm b/lib/MusicBrainz/Server/Entity/Series.pm
index 5aac1bed756..f4f83a082ff 100644
--- a/lib/MusicBrainz/Server/Entity/Series.pm
+++ b/lib/MusicBrainz/Server/Entity/Series.pm
@@ -3,7 +3,7 @@ package MusicBrainz::Server::Entity::Series;
use Moose;
use MusicBrainz::Server::Entity::Types;
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
extends 'MusicBrainz::Server::Entity::CoreEntity';
with 'MusicBrainz::Server::Entity::Role::Taggable';
diff --git a/lib/MusicBrainz/Server/Entity/URL.pm b/lib/MusicBrainz/Server/Entity/URL.pm
index 0df46344d00..5783cf25a73 100644
--- a/lib/MusicBrainz/Server/Entity/URL.pm
+++ b/lib/MusicBrainz/Server/Entity/URL.pm
@@ -111,7 +111,7 @@ sub href_url {
if ($self->url_is_scheme_independent) {
$url = $url->clone;
- $url->scheme("");
+ $url->scheme('');
}
return $url->as_string;
diff --git a/lib/MusicBrainz/Server/Entity/URL/CDJapan.pm b/lib/MusicBrainz/Server/Entity/URL/CDJapan.pm
index c7790655998..de803b3f263 100644
--- a/lib/MusicBrainz/Server/Entity/URL/CDJapan.pm
+++ b/lib/MusicBrainz/Server/Entity/URL/CDJapan.pm
@@ -5,10 +5,6 @@ use Moose;
extends 'MusicBrainz::Server::Entity::URL';
with 'MusicBrainz::Server::Entity::URL::Sidebar';
-override href_url => sub {
- shift->url->as_string =~ s{^http:}{https:}r;
-};
-
sub sidebar_name { 'CDJapan' }
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Entity/URL/Tidal.pm b/lib/MusicBrainz/Server/Entity/URL/Tidal.pm
new file mode 100644
index 00000000000..3e94b4d6084
--- /dev/null
+++ b/lib/MusicBrainz/Server/Entity/URL/Tidal.pm
@@ -0,0 +1,24 @@
+package MusicBrainz::Server::Entity::URL::Tidal;
+
+use Moose;
+
+extends 'MusicBrainz::Server::Entity::URL';
+with 'MusicBrainz::Server::Entity::URL::Sidebar';
+
+sub sidebar_name { 'Tidal' };
+
+sub url_is_scheme_independent { 1 }
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+1;
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2020 MetaBrainz Foundation
+
+This file is part of MusicBrainz, the open internet music database,
+and is licensed under the GPL version 2, or (at your option) any
+later version: http://www.gnu.org/licenses/gpl-2.0.txt
+
+=cut
diff --git a/lib/MusicBrainz/Server/Entity/URL/VimeoOnDemand.pm b/lib/MusicBrainz/Server/Entity/URL/VimeoOnDemand.pm
new file mode 100644
index 00000000000..618f6b315e2
--- /dev/null
+++ b/lib/MusicBrainz/Server/Entity/URL/VimeoOnDemand.pm
@@ -0,0 +1,22 @@
+package MusicBrainz::Server::Entity::URL::VimeoOnDemand;
+
+use Moose;
+
+extends 'MusicBrainz::Server::Entity::URL';
+with 'MusicBrainz::Server::Entity::URL::Sidebar';
+
+sub sidebar_name { 'Vimeo On Demand' }
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+1;
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2021 MetaBrainz Foundation
+
+This file is part of MusicBrainz, the open internet music database,
+and is licensed under the GPL version 2, or (at your option) any
+later version: http://www.gnu.org/licenses/gpl-2.0.txt
+
+=cut
diff --git a/lib/MusicBrainz/Server/Entity/Util/MediumFormat.pm b/lib/MusicBrainz/Server/Entity/Util/MediumFormat.pm
index e51f996ed61..d21c5dad5a6 100644
--- a/lib/MusicBrainz/Server/Entity/Util/MediumFormat.pm
+++ b/lib/MusicBrainz/Server/Entity/Util/MediumFormat.pm
@@ -10,7 +10,7 @@ use Sub::Exporter -setup => { exports => [qw(
sub combined_medium_format_name
{
my (@medium_format_names) = @_;
- return "" if !@medium_format_names;
+ return '' if !@medium_format_names;
my %formats_count;
my @formats_order;
foreach my $format_name (@medium_format_names) {
@@ -30,7 +30,7 @@ sub combined_medium_format_name
}
push @formats, $format;
}
- return join " + ", @formats;
+ return join ' + ', @formats;
}
1;
diff --git a/lib/MusicBrainz/Server/ExternalUtils.pm b/lib/MusicBrainz/Server/ExternalUtils.pm
index d213063519d..58ebdb9926e 100644
--- a/lib/MusicBrainz/Server/ExternalUtils.pm
+++ b/lib/MusicBrainz/Server/ExternalUtils.pm
@@ -17,7 +17,7 @@ sub get_chunked_with_retry {
# delayed, and the LWP timeout fires causing the response to only be
# partially completed. In this case, the X-Died header is set. If this
# happens, we retry the request.
- my $x_died = $response->headers->header("X-Died");
+ my $x_died = $response->headers->header('X-Died');
$response = undef if ($x_died && $x_died =~ /read timeout/);
}
return $response;
diff --git a/lib/MusicBrainz/Server/Filters.pm b/lib/MusicBrainz/Server/Filters.pm
index 8cbe61ce1f4..1b05884829c 100644
--- a/lib/MusicBrainz/Server/Filters.pm
+++ b/lib/MusicBrainz/Server/Filters.pm
@@ -50,7 +50,7 @@ sub format_wikitext
'utf-8',
Text::WikiFormat::format(
encode('utf-8' => $text), {}, {
- prefix => "//wiki.musicbrainz.org/",
+ prefix => '//wiki.musicbrainz.org/',
extended => 1,
nofollow_extended => 1,
absolute_links => 1,
@@ -81,7 +81,7 @@ sub _display_trimmed {
# shorten url's that are longer 50 characters
my $display_url = length($url) > 50
- ? encode_square_brackets(encode_entities(substr($url, 0, 48))) . "…"
+ ? encode_square_brackets(encode_entities(substr($url, 0, 48))) . '…'
: $encoded_url;
$encoded_url = "http://$encoded_url"
diff --git a/lib/MusicBrainz/Server/Form.pm b/lib/MusicBrainz/Server/Form.pm
index e7028c4ba7b..da67b2f22e7 100644
--- a/lib/MusicBrainz/Server/Form.pm
+++ b/lib/MusicBrainz/Server/Form.pm
@@ -18,7 +18,7 @@ sub _init_from_object
$node ||= $self;
return unless $item;
- warn "HFH: init_from_object ", $self->name, "\n" if $self->verbose;
+ warn 'HFH: init_from_object ', $self->name, "\n" if $self->verbose;
my $my_value;
for my $field ( $node->fields ) {
next if $field->parent && $field->parent != $node;
diff --git a/lib/MusicBrainz/Server/Form/CDStub.pm b/lib/MusicBrainz/Server/Form/CDStub.pm
index 87fb4391e27..e746221776b 100644
--- a/lib/MusicBrainz/Server/Form/CDStub.pm
+++ b/lib/MusicBrainz/Server/Form/CDStub.pm
@@ -80,7 +80,7 @@ sub validate
my $self = shift;
if ($self->field('multiple_artists')->value) {
$self->field('artist')->add_error(l('You may not specify a release artist while also specifying track artists.'))
- if $self->field('artist')->value && $self->field('artist')->value ne "Various Artists";
+ if $self->field('artist')->value && $self->field('artist')->value ne 'Various Artists';
for my $field ($self->field('tracks')->fields) {
$field = $field->field('artist');
diff --git a/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm b/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
index b1f4d23d13a..369d0d4cd4b 100644
--- a/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
+++ b/lib/MusicBrainz/Server/Form/Field/ArtistCredit.pm
@@ -73,7 +73,7 @@ around 'validate_field' => sub {
# properly (i.e. environments where AC fields aren't generated).
unless ($artists || $self->form->init_object)
{
- $self->add_error(l("Artist credit field is required"));
+ $self->add_error(l('Artist credit field is required'));
}
return !$self->has_errors;
diff --git a/lib/MusicBrainz/Server/Form/Field/PartialDate.pm b/lib/MusicBrainz/Server/Form/Field/PartialDate.pm
index 007c5bf5a91..ed861b90a44 100644
--- a/lib/MusicBrainz/Server/Form/Field/PartialDate.pm
+++ b/lib/MusicBrainz/Server/Form/Field/PartialDate.pm
@@ -62,7 +62,7 @@ sub validate {
return 1 if is_valid_partial_date($year, $month, $day);
- return $self->add_error(l("invalid date"));
+ return $self->add_error(l('invalid date'));
}
1;
diff --git a/lib/MusicBrainz/Server/Form/Recording.pm b/lib/MusicBrainz/Server/Form/Recording.pm
index 5687a31294e..5e9fa05e316 100644
--- a/lib/MusicBrainz/Server/Form/Recording.pm
+++ b/lib/MusicBrainz/Server/Form/Recording.pm
@@ -62,8 +62,8 @@ after 'validate' => sub {
if ($self->used_by_tracks && defined($length->value) &&
$length->value != $length->init_value) {
$length->add_error(l(
- "This recording’s duration is determined by the tracks that are " .
- "linked to it, and cannot be changed directly."
+ 'This recording’s duration is determined by the tracks that are ' .
+ 'linked to it, and cannot be changed directly.'
));
}
};
diff --git a/lib/MusicBrainz/Server/Form/Role/UserProfile.pm b/lib/MusicBrainz/Server/Form/Role/UserProfile.pm
index 8a61a3df288..10a47639eb8 100644
--- a/lib/MusicBrainz/Server/Form/Role/UserProfile.pm
+++ b/lib/MusicBrainz/Server/Form/Role/UserProfile.pm
@@ -91,7 +91,7 @@ sub validate_birth_date {
$field->field('year')->add_error(l('Birth year must be after 1900'));
}
- return $field->add_error(l("invalid date")) unless Date::Calc::check_date($year, $month, $day);
+ return $field->add_error(l('invalid date')) unless Date::Calc::check_date($year, $month, $day);
}
1;
diff --git a/lib/MusicBrainz/Server/Form/User/Register.pm b/lib/MusicBrainz/Server/Form/User/Register.pm
index 07f8b75553b..c120863d8de 100644
--- a/lib/MusicBrainz/Server/Form/User/Register.pm
+++ b/lib/MusicBrainz/Server/Form/User/Register.pm
@@ -14,7 +14,7 @@ my $text_too_long_message = N_l('The value of this field cannot be longer than {
sub localize_method_with_text_maxlength {
my ($self, $message, @args) = @_;
-
+
if ($message eq $text_too_long_message) {
return l($message, { max => $args[0], actual => $args[1] });
}
diff --git a/lib/MusicBrainz/Server/Form/Utils.pm b/lib/MusicBrainz/Server/Form/Utils.pm
index 13f522a642c..62571a012d6 100644
--- a/lib/MusicBrainz/Server/Form/Utils.pm
+++ b/lib/MusicBrainz/Server/Form/Utils.pm
@@ -26,7 +26,7 @@ use Sub::Exporter -setup => {
sub language_options {
my $c = shift;
- my $context = shift // "";
+ my $context = shift // '';
# group list of languages in .
# most frequently used languages have hardcoded value 2.
@@ -36,16 +36,16 @@ sub language_options {
my $skip = 0;
my @languages = $c->model('Language')->get_all;
- if ($context eq "editor") {
+ if ($context eq 'editor') {
for my $language (@languages) {
if ($language->iso_code_3 && $language->iso_code_3 eq 'mul') {
$language->frequency($skip);
}
}
- } elsif ($context eq "work") {
+ } elsif ($context eq 'work') {
for my $language (@languages) {
- if ($language->iso_code_3 && $language->iso_code_3 eq "zxx") {
- $language->name(l("[No lyrics]"));
+ if ($language->iso_code_3 && $language->iso_code_3 eq 'zxx') {
+ $language->name(l('[No lyrics]'));
$language->frequency($frequent);
}
}
diff --git a/lib/MusicBrainz/Server/Log.pm b/lib/MusicBrainz/Server/Log.pm
index 7fd56a93cd7..1bcefa90ec0 100644
--- a/lib/MusicBrainz/Server/Log.pm
+++ b/lib/MusicBrainz/Server/Log.pm
@@ -39,7 +39,7 @@ sub logger { $logger }
sub _prefix_message {
my %args = @_;
- return sprintf "[%s] %s", $args{level}, $args{message};
+ return sprintf '[%s] %s', $args{level}, $args{message};
}
sub _truncate_message {
@@ -80,7 +80,7 @@ sub log_assertion (&$) {
my ($package, $filename, $line) = caller(0);
log_error { "Failed assertion: $message ($filename:$line)" };
log_debug {
- "Stacktrace: " .
+ 'Stacktrace: ' .
Devel::StackTrace->new( ignore_class => 'MusicBrainz::Server::Log' )->as_string
}
}
diff --git a/lib/MusicBrainz/Server/PagedReport.pm b/lib/MusicBrainz/Server/PagedReport.pm
index d69bea0cc99..18029062e9d 100644
--- a/lib/MusicBrainz/Server/PagedReport.pm
+++ b/lib/MusicBrainz/Server/PagedReport.pm
@@ -30,7 +30,7 @@ use strict;
package MusicBrainz::Server::PagedReport;
use Storable qw( freeze thaw );
-my $intlen = length(pack "i", 0);
+my $intlen = length(pack 'i', 0);
################################################################################
# Save
@@ -60,9 +60,9 @@ sub Print
my $pos = tell $dat;
die if $pos < 0;
- print $dat pack("i", length($record)), $record
+ print $dat pack('i', length($record)), $record
or die $!;
- print $idx pack "i", $pos
+ print $idx pack 'i', $pos
or die $!;
++$self->{NUM};
@@ -117,7 +117,7 @@ sub Seek
} else {
read($idx, my $idxpos, $intlen)
or die $!;
- seek($dat, unpack("i", $idxpos), 0)
+ seek($dat, unpack('i', $idxpos), 0)
or die $!;
}
@@ -137,7 +137,7 @@ sub Get
read($dat, my $reclen, $intlen)
or die $!;
- read($dat, my $record, unpack("i", $reclen))
+ read($dat, my $record, unpack('i', $reclen))
or die $!;
++$self->{CUR};
diff --git a/lib/MusicBrainz/Server/Plugin/Diff.pm b/lib/MusicBrainz/Server/Plugin/Diff.pm
index eb929fc1210..f6d3b26904b 100644
--- a/lib/MusicBrainz/Server/Plugin/Diff.pm
+++ b/lib/MusicBrainz/Server/Plugin/Diff.pm
@@ -15,7 +15,7 @@ use Scalar::Util qw( blessed );
use MusicBrainz::Server::Translation qw( l );
use MusicBrainz::Server::Validation qw( encode_entities trim_in_place );
-no if $] >= 5.018, warnings => "experimental::smartmatch";
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
sub new {
my ($class, $context) = @_;
@@ -56,7 +56,7 @@ sub _html_token {
sub _split_text {
my ($text, $split) = @_;
- defined $split or confess "No split pattern";
+ defined $split or confess 'No split pattern';
$split = "($split)" unless $split eq '';
# the capture group becomes a separate part of the split output
return split /$split/, $text;
diff --git a/lib/MusicBrainz/Server/Plugin/FormRenderer.pm b/lib/MusicBrainz/Server/Plugin/FormRenderer.pm
index b265efcfb06..5e4994cacd1 100644
--- a/lib/MusicBrainz/Server/Plugin/FormRenderer.pm
+++ b/lib/MusicBrainz/Server/Plugin/FormRenderer.pm
@@ -45,7 +45,7 @@ sub _lookup_field
sub _id {
my ($self, $field) = @_;
- return $self->{id_prefix} . "id-" . $field->html_name;
+ return $self->{id_prefix} . 'id-' . $field->html_name;
}
sub _render_input
@@ -53,7 +53,7 @@ sub _render_input
my ($self, $field, $type, %attrs) = @_;
return unless ref $field;
if ($field->required && $type !~ /^hidden|image|submit|reset|button$/) {
- $attrs{required} = "required";
+ $attrs{required} = 'required';
}
my $class = delete $attrs{class} || '';
return $self->h->input({
@@ -173,7 +173,7 @@ sub select
my $option_html = $self->h->option(
{
- %$option, selected => $selected ? "selected" : undef,
+ %$option, selected => $selected ? 'selected' : undef,
}, $self->h->entity_encode($label));
if ($grp)
@@ -199,15 +199,15 @@ sub select
if (!$field->required || delete $attrs->{no_default})
{
unshift @options, $self->h->option({
- selected => !defined $field->value ? "selected" : undef,
+ selected => !defined $field->value ? 'selected' : undef,
}, ' ')
}
return $self->h->select({
id => $self->_id($field),
name => $field->html_name,
- multiple => $field->multiple ? "multiple" : undef,
- disabled => $field->disabled ? "disabled" : undef,
+ multiple => $field->multiple ? 'multiple' : undef,
+ disabled => $field->disabled ? 'disabled' : undef,
class => $attrs->{class},
%{ $attrs || {} }
}, \@options);
@@ -225,7 +225,7 @@ sub radio
id => $self->_id($field) . "-$option" ,
name => $field->html_name,
checked => $field->value && $value eq $field->value ? 'checked' : undef,
- disabled => $field->disabled ? "disabled" : undef,
+ disabled => $field->disabled ? 'disabled' : undef,
value => $value,
%{ $attrs || {} }
});
@@ -236,7 +236,7 @@ sub checkbox
my ($self, $field_name, $attrs) = @_;
my $field = $self->_lookup_field($field_name) or return;
return $self->_render_input($field, 'checkbox',
- checked => $field->value ? "checked" : undef,
+ checked => $field->value ? 'checked' : undef,
value => $field->checkbox_value,
%$attrs
);
diff --git a/lib/MusicBrainz/Server/Release.pm b/lib/MusicBrainz/Server/Release.pm
index f4ec02eac08..cf2d36ab277 100644
--- a/lib/MusicBrainz/Server/Release.pm
+++ b/lib/MusicBrainz/Server/Release.pm
@@ -50,23 +50,23 @@ use constant RELEASE_ATTR_SECTION_STATUS_START => RELEASE_ATTR_OFFICIAL;
use constant RELEASE_ATTR_SECTION_STATUS_END => RELEASE_ATTR_PSEUDO_RELEASE;
my %AlbumAttributeNames = (
- 0 => [ "Non-Album Track", "Non-Album Tracks", l("(Special case)")],
- 1 => [ "Album", "Albums", l("An album release primarily consists of previously unreleased material. This includes album re-issues, with or without bonus tracks.")],
- 2 => [ "Single", "Singles", l("A single typically has one main song and possibly a handful of additional tracks or remixes of the main track. A single is usually named after its main song.")],
- 3 => [ "EP", "EPs", l("An EP is an Extended Play release and often contains the letters EP in the title.")],
- 4 => [ "Compilation", "Compilations", l("A compilation is a collection of previously released tracks by one or more artists.")],
- 5 => [ "Soundtrack", "Soundtracks", l("A soundtrack is the musical score to a movie, TV series, stage show, computer game etc.")],
- 6 => [ "Spokenword", "Spokenword", l("Non-music spoken word releases.")],
- 7 => [ "Interview", "Interviews", l("An interview release contains an interview with the Artist.")],
- 8 => [ "Audiobook", "Audiobooks", l("An audiobook is a book read by a narrator without music.")],
- 9 => [ "Live", "Live Releases", l("A release that was recorded live.")],
- 10 => [ "Remix", "Remixes", l("A release that was (re)mixed from previously released material.")],
- 11 => [ "Other", "Other Releases", l("Any release that does not fit any of the categories above.")],
+ 0 => [ 'Non-Album Track', 'Non-Album Tracks', l('(Special case)')],
+ 1 => [ 'Album', 'Albums', l('An album release primarily consists of previously unreleased material. This includes album re-issues, with or without bonus tracks.')],
+ 2 => [ 'Single', 'Singles', l('A single typically has one main song and possibly a handful of additional tracks or remixes of the main track. A single is usually named after its main song.')],
+ 3 => [ 'EP', 'EPs', l('An EP is an Extended Play release and often contains the letters EP in the title.')],
+ 4 => [ 'Compilation', 'Compilations', l('A compilation is a collection of previously released tracks by one or more artists.')],
+ 5 => [ 'Soundtrack', 'Soundtracks', l('A soundtrack is the musical score to a movie, TV series, stage show, computer game etc.')],
+ 6 => [ 'Spokenword', 'Spokenword', l('Non-music spoken word releases.')],
+ 7 => [ 'Interview', 'Interviews', l('An interview release contains an interview with the Artist.')],
+ 8 => [ 'Audiobook', 'Audiobooks', l('An audiobook is a book read by a narrator without music.')],
+ 9 => [ 'Live', 'Live Releases', l('A release that was recorded live.')],
+ 10 => [ 'Remix', 'Remixes', l('A release that was (re)mixed from previously released material.')],
+ 11 => [ 'Other', 'Other Releases', l('Any release that does not fit any of the categories above.')],
- 100 => [ "Official", "Official", l("Any release officially sanctioned by the artist and/or their record company. (Most releases will fit into this category.)") ],
- 101 => [ "Promotion", "Promotions", l("A giveaway release or a release intended to promote an upcoming official release. (e.g. prerelease albums or releases included with a magazine)")],
- 102 => [ "Bootleg", "Bootlegs", l("An unofficial/underground release that was not sanctioned by the artist and/or the record company.")],
- 103 => [ "Pseudo-Release", "PseudoReleases", l("A pseudo-release is a duplicate release for translation/transliteration purposes.")]
+ 100 => [ 'Official', 'Official', l('Any release officially sanctioned by the artist and/or their record company. (Most releases will fit into this category.)') ],
+ 101 => [ 'Promotion', 'Promotions', l('A giveaway release or a release intended to promote an upcoming official release. (e.g. prerelease albums or releases included with a magazine)')],
+ 102 => [ 'Bootleg', 'Bootlegs', l('An unofficial/underground release that was not sanctioned by the artist and/or the record company.')],
+ 103 => [ 'Pseudo-Release', 'PseudoReleases', l('A pseudo-release is a duplicate release for translation/transliteration purposes.')]
);
sub attribute_name { $AlbumAttributeNames{$_[0]}->[0]; }
diff --git a/lib/MusicBrainz/Server/Replication/Packet.pm b/lib/MusicBrainz/Server/Replication/Packet.pm
index fc6d44bc749..40f4ab6deb2 100644
--- a/lib/MusicBrainz/Server/Replication/Packet.pm
+++ b/lib/MusicBrainz/Server/Replication/Packet.pm
@@ -47,7 +47,7 @@ sub retrieve_remote_file {
# Fetch the file and inform the user about what is being done
print localtime() . " : Downloading $url to $file\n";
- my $f_url_token = $url . "?token=" . uri_escape(DBDefs->REPLICATION_ACCESS_TOKEN);
+ my $f_url_token = $url . '?token=' . uri_escape(DBDefs->REPLICATION_ACCESS_TOKEN);
my $f_resp = $ua->mirror($f_url_token, $file);
# We do not want to validate signature for non-existent files
@@ -58,7 +58,7 @@ sub retrieve_remote_file {
# Fetch file signature and inform the user about what is being done
print localtime() . " : Downloading $url to $signature\n";
- my $s_url_token = $url . "?token=" . uri_escape(DBDefs->REPLICATION_ACCESS_TOKEN);
+ my $s_url_token = $url . '?token=' . uri_escape(DBDefs->REPLICATION_ACCESS_TOKEN);
my $s_resp = $ua->mirror($s_url_token, $signature);
validate_file_signature($file, $signature);
diff --git a/lib/MusicBrainz/Server/Report.pm b/lib/MusicBrainz/Server/Report.pm
index e2b3f755dbe..7c3b371895d 100644
--- a/lib/MusicBrainz/Server/Report.pm
+++ b/lib/MusicBrainz/Server/Report.pm
@@ -43,7 +43,7 @@ sub _load {
($self->inflate_rows($rows, $c), $hits);
}
-sub ordering { "row_number" }
+sub ordering { 'row_number' }
sub inflate_rows {
my ($self, $rows) = @_;
diff --git a/lib/MusicBrainz/Server/Report/ASINsWithMultipleReleases.pm b/lib/MusicBrainz/Server/Report/ASINsWithMultipleReleases.pm
index 708f2398377..cb1ef01cea2 100644
--- a/lib/MusicBrainz/Server/Report/ASINsWithMultipleReleases.pm
+++ b/lib/MusicBrainz/Server/Report/ASINsWithMultipleReleases.pm
@@ -9,7 +9,7 @@ sub table { 'asins_with_multiple_releases' }
sub component_name { 'AsinsWithMultipleReleases' }
sub query {
- " SELECT r.id AS release_id, q.id AS url_id,
+ q{ SELECT r.id AS release_id, q.id AS url_id,
row_number() OVER (
ORDER BY q.count DESC, q.url,
ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz
@@ -27,7 +27,7 @@ sub query {
) AS q
JOIN l_release_url lru ON lru.entity1 = q.id
JOIN release r ON r.id = lru.entity0
- JOIN artist_credit ac ON r.artist_credit = ac.id";
+ JOIN artist_credit ac ON r.artist_credit = ac.id};
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ArtistCreditsWithDubiousTrailingPhrases.pm b/lib/MusicBrainz/Server/Report/ArtistCreditsWithDubiousTrailingPhrases.pm
index f6bd2338b70..73131f123e6 100644
--- a/lib/MusicBrainz/Server/Report/ArtistCreditsWithDubiousTrailingPhrases.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistCreditsWithDubiousTrailingPhrases.pm
@@ -4,14 +4,14 @@ use Moose;
with 'MusicBrainz::Server::Report::ArtistCreditReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistCreditID';
-sub query {<<~'EOSQL'}
+sub query {<<~'SQL'}
SELECT ac.id AS artist_credit_id, ac.name,
row_number() OVER (ORDER BY ac.id)
FROM artist_credit ac
JOIN artist_credit_name acn ON acn.artist_credit = ac.id
WHERE acn.position = (ac.artist_count - 1)
AND acn.join_phrase ~* '(?:ft\.?|feat\.?|[;:,])\s*$'
- EOSQL
+ SQL
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Report/ArtistsContainingDisambiguationComments.pm b/lib/MusicBrainz/Server/Report/ArtistsContainingDisambiguationComments.pm
index 257b6aa515b..1edd57eedc4 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsContainingDisambiguationComments.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsContainingDisambiguationComments.pm
@@ -5,11 +5,11 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "SELECT artist.id AS artist_id,
+ q{SELECT artist.id AS artist_id,
row_number() OVER (ORDER BY artist.name COLLATE musicbrainz)
FROM artist
WHERE (name LIKE '%(%' OR name LIKE '%)%')
- AND name NOT LIKE '(%'";
+ AND name NOT LIKE '(%'};
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ArtistsDisambiguationSameName.pm b/lib/MusicBrainz/Server/Report/ArtistsDisambiguationSameName.pm
index 68f2a8ac9be..39d83ff6c95 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsDisambiguationSameName.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsDisambiguationSameName.pm
@@ -5,13 +5,13 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "
+ '
SELECT
artist.id AS artist_id,
row_number() OVER (ORDER BY artist.name COLLATE musicbrainz, artist.id)
FROM artist
WHERE artist.name = artist.comment
- "
+ '
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ArtistsThatMayBeGroups.pm b/lib/MusicBrainz/Server/Report/ArtistsThatMayBeGroups.pm
index 54f29d63492..22d69a1ea19 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsThatMayBeGroups.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsThatMayBeGroups.pm
@@ -5,14 +5,14 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "SELECT DISTINCT ON (artist.id) artist.id AS artist_id,
+ q{SELECT DISTINCT ON (artist.id) artist.id AS artist_id,
row_number() OVER (ORDER BY artist.name COLLATE musicbrainz, artist.id)
FROM artist
JOIN l_artist_artist ON l_artist_artist.entity1=artist.id
JOIN link ON link.id=l_artist_artist.link
JOIN link_type ON link_type.id=link.link_type
WHERE (artist.type NOT IN (2, 5, 6) OR artist.type IS NULL)
- AND link_type.name IN ('collaboration', 'member of band', 'conductor position')"
+ AND link_type.name IN ('collaboration', 'member of band', 'conductor position')}
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ArtistsThatMayBePersons.pm b/lib/MusicBrainz/Server/Report/ArtistsThatMayBePersons.pm
index 65867584eec..c7ef3745e99 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsThatMayBePersons.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsThatMayBePersons.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "
+ q{
WITH groups AS (
SELECT DISTINCT ON (artist.id) artist.id, artist.name FROM
artist
@@ -39,7 +39,7 @@ WITH groups AS (
SELECT * FROM groups)
SELECT DISTINCT ON (artists.id) artists.id AS artist_id, row_number() OVER (ORDER BY artists.name COLLATE musicbrainz, artists.id)
FROM artists
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ArtistsWithMultipleOccurrencesInArtistCredits.pm b/lib/MusicBrainz/Server/Report/ArtistsWithMultipleOccurrencesInArtistCredits.pm
index 9e4680e974d..2b395f42619 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsWithMultipleOccurrencesInArtistCredits.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsWithMultipleOccurrencesInArtistCredits.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "SELECT artist AS artist_id,
+ 'SELECT artist AS artist_id,
row_number() OVER (ORDER BY artist.name COLLATE musicbrainz)
FROM (
SELECT DISTINCT artist
@@ -13,7 +13,7 @@ sub query {
GROUP BY artist_credit, artist
HAVING count(position) > 1
) q
- JOIN artist ON artist.id = q.artist";
+ JOIN artist ON artist.id = q.artist';
}
diff --git a/lib/MusicBrainz/Server/Report/ArtistsWithNoSubscribers.pm b/lib/MusicBrainz/Server/Report/ArtistsWithNoSubscribers.pm
index a923b9242ac..40f165e6ea6 100644
--- a/lib/MusicBrainz/Server/Report/ArtistsWithNoSubscribers.pm
+++ b/lib/MusicBrainz/Server/Report/ArtistsWithNoSubscribers.pm
@@ -4,13 +4,13 @@ use Moose;
with 'MusicBrainz::Server::Report::ArtistReport';
sub query {
- "SELECT artist.id AS artist_id,
+ 'SELECT artist.id AS artist_id,
row_number() OVER (ORDER BY count(distinct release_group.id) DESC, artist.edits_pending DESC)
FROM artist
LEFT JOIN editor_subscribe_artist ON artist.id=editor_subscribe_artist.artist
JOIN artist_credit_name ON artist.id = artist_credit_name.artist
LEFT JOIN release_group ON release_group.artist_credit = artist_credit_name.artist_credit
- WHERE editor_subscribe_artist.editor IS NULL GROUP BY artist_id";
+ WHERE editor_subscribe_artist.editor IS NULL GROUP BY artist_id';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/CatNoLooksLikeASIN.pm b/lib/MusicBrainz/Server/Report/CatNoLooksLikeASIN.pm
index 0184f6a8b0e..20f08f5d42e 100644
--- a/lib/MusicBrainz/Server/Report/CatNoLooksLikeASIN.pm
+++ b/lib/MusicBrainz/Server/Report/CatNoLooksLikeASIN.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
sub component_name { 'CatNoLooksLikeAsin' }
sub query {
- "
+ q{
SELECT
r.id AS release_id, rl.catalog_number,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -17,7 +17,7 @@ sub query {
ON r.id = rl.release
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE rl.catalog_number ~ '^B0[0-9A-Z]{8}\$'
- "
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/CatNoLooksLikeISRC.pm b/lib/MusicBrainz/Server/Report/CatNoLooksLikeISRC.pm
index 48979c8c466..7bcffcdaf74 100644
--- a/lib/MusicBrainz/Server/Report/CatNoLooksLikeISRC.pm
+++ b/lib/MusicBrainz/Server/Report/CatNoLooksLikeISRC.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
sub component_name { 'CatNoLooksLikeIsrc' }
sub query {
- "
+ q{
SELECT
r.id AS release_id, rl.catalog_number,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -17,7 +17,7 @@ sub query {
ON r.id = rl.release
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE rl.catalog_number ~ '^[A-Z]{2}-?[A-Z0-9]{3}-?[0-9]{2}-?[0-9]{5}\$'
- "
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/CatNoLooksLikeLabelCode.pm b/lib/MusicBrainz/Server/Report/CatNoLooksLikeLabelCode.pm
index 865eed98c4f..7cd9795004b 100644
--- a/lib/MusicBrainz/Server/Report/CatNoLooksLikeLabelCode.pm
+++ b/lib/MusicBrainz/Server/Report/CatNoLooksLikeLabelCode.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
sub component_name { 'CatNoLooksLikeLabelCode' }
sub query {
- "
+ q{
SELECT
r.id AS release_id, rl.catalog_number,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -17,7 +17,7 @@ sub query {
ON r.id = rl.release
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE rl.catalog_number ~ '^LC[\\s-]*\\d{4,5}\$'
- "
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/CollaborationRelationships.pm b/lib/MusicBrainz/Server/Report/CollaborationRelationships.pm
index 5baa38c146d..2b59269b4d2 100644
--- a/lib/MusicBrainz/Server/Report/CollaborationRelationships.pm
+++ b/lib/MusicBrainz/Server/Report/CollaborationRelationships.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::QueryReport',
'MusicBrainz::Server::Report::FilterForEditor';
sub query {
- "
+ q{
SELECT
artist0.id AS id0, artist0.name AS name0, artist1.id AS id1, artist1.name AS name1,
row_number() OVER (
@@ -22,7 +22,7 @@ sub query {
WHERE
link_type.name = 'collaboration' AND
l_artist_url.id IS NULL
- ";
+ };
}
sub inflate_rows
diff --git a/lib/MusicBrainz/Server/Report/DeprecatedRelationshipReport.pm b/lib/MusicBrainz/Server/Report/DeprecatedRelationshipReport.pm
index 5307d13f71d..b164596077c 100644
--- a/lib/MusicBrainz/Server/Report/DeprecatedRelationshipReport.pm
+++ b/lib/MusicBrainz/Server/Report/DeprecatedRelationshipReport.pm
@@ -21,7 +21,7 @@ sub query {
if ($first) {
$first = 0;
} else {
- $query .= " UNION ";
+ $query .= ' UNION ';
}
$query .= "SELECT link_type.name AS name, link_type.gid AS gid, $type_column AS entity
@@ -29,15 +29,15 @@ sub query {
JOIN link ON link.link_type = link_type.id
JOIN $table l_table ON l_table.link = link.id
WHERE (link_type.is_deprecated OR link_type.description = '')";
-
+
# For URL relationships, ignore ended ones (that means the link is no longer
# valid, yet being kept for history)
if (grep(/^$table/, @url_table_names)) {
$query .= ' AND link.ended IS FALSE';
}
-
+
}
- $query .= ") l ON l.entity = entity.id";
+ $query .= ') l ON l.entity = entity.id';
return $query;
}
diff --git a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleArtists.pm b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleArtists.pm
index 8d04e293d07..9a0a9a83ec0 100644
--- a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleArtists.pm
+++ b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleArtists.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "
+ q{
SELECT
a.id AS artist_id, q.id AS url_id, q.count,
row_number() OVER (ORDER BY q.count DESC, q.url, a.name COLLATE musicbrainz)
@@ -26,7 +26,7 @@ sub query {
) AS q
JOIN l_artist_url lau ON lau.entity1 = q.id
JOIN artist a ON a.id = lau.entity0
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleLabels.pm b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleLabels.pm
index 6da38403248..154ae94f1ea 100644
--- a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleLabels.pm
+++ b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleLabels.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Report::LabelReport',
'MusicBrainz::Server::Report::FilterForEditor::LabelID';
sub query {
- "
+ q{
SELECT
l.id AS label_id, q.id AS url_id,
row_number() OVER (ORDER BY q.count DESC, q.url, l.name COLLATE musicbrainz)
@@ -26,7 +26,7 @@ sub query {
) AS q
JOIN l_label_url llu ON llu.entity1 = q.id
JOIN label l ON l.id = llu.entity0
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleaseGroups.pm b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleaseGroups.pm
index e0725a53793..f3848fdbf23 100644
--- a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleaseGroups.pm
+++ b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleaseGroups.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseGroupID';
sub query {
- "
+ q{
SELECT
r.id AS release_group_id, q.id AS url_id,
row_number() OVER (ORDER BY q.count DESC, q.url, ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -24,7 +24,7 @@ sub query {
JOIN l_release_group_url lru ON lru.entity1 = q.id
JOIN release_group r ON r.id = lru.entity0
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleases.pm b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleases.pm
index 9ebbe5b52ee..a4487af364a 100644
--- a/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleases.pm
+++ b/lib/MusicBrainz/Server/Report/DiscogsLinksWithMultipleReleases.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT
r.id AS release_id, q.id AS url_id,
row_number() OVER (ORDER BY q.count DESC, q.url, ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -24,7 +24,7 @@ sub query {
JOIN l_release_url lru ON lru.entity1 = q.id
JOIN release r ON r.id = lru.entity0
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateArtists.pm b/lib/MusicBrainz/Server/Report/DuplicateArtists.pm
index feb0c9f5793..4edd745aee2 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateArtists.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateArtists.pm
@@ -40,7 +40,7 @@ sub run
}
my $aliases = $sql->select_list_of_hashes(
- "SELECT artist.gid, artist.id, artist.name, artist.sort_name,
+ q{SELECT artist.gid, artist.id, artist.name, artist.sort_name,
musicbrainz_unaccent(alias.name) AS alias,
CASE
WHEN artist.comment = '' THEN
@@ -50,7 +50,7 @@ sub run
(artist.comment != '') AS has_comment,
artist.type
FROM artist
- JOIN artist_alias alias ON alias.artist = artist.id"
+ JOIN artist_alias alias ON alias.artist = artist.id}
);
for my $r (@$aliases) {
@@ -90,7 +90,7 @@ sub inflate_rows
];
}
-sub ordering { "key" }
+sub ordering { 'key' }
sub load_filtered {
my ($self, $c, $editor_id, $limit, $offset) = @_;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateEvents.pm b/lib/MusicBrainz/Server/Report/DuplicateEvents.pm
index 2a34723f308..486c0fe6bad 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateEvents.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateEvents.pm
@@ -4,7 +4,7 @@ use Moose;
with 'MusicBrainz::Server::Report::EventReport',
'MusicBrainz::Server::Report::FilterForEditor::EventID';
-sub query { "
+sub query { q{
WITH duplicates AS (
SELECT event.begin_date_year AS begin_date_year, event.begin_date_month AS begin_date_month,
event.begin_date_day AS begin_date_day, l_event_place.entity1 AS entity1
@@ -36,7 +36,7 @@ SELECT event.id AS event_id,
AND lep2.entity1 = duplicates.entity1
AND e2.comment = ''
)
-";
+};
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsArtists.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsArtists.pm
index de9f948293f..538b28b9aaf 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsArtists.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsArtists.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "
+ '
SELECT q.entity AS artist_id, row_number() OVER (ORDER BY artist.name COLLATE musicbrainz) FROM (
SELECT link.link_type, lxx.entity1, lxx.entity0 AS entity
@@ -38,7 +38,7 @@ SELECT q.entity AS artist_id, row_number() OVER (ORDER BY artist.name COLLATE mu
JOIN artist ON q.entity = artist.id
GROUP BY q.entity, artist.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsLabels.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsLabels.pm
index dad68d659ee..0f755bc1569 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsLabels.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsLabels.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::LabelReport',
'MusicBrainz::Server::Report::FilterForEditor::LabelID';
sub query {
- "
+ '
SELECT q.entity AS label_id, row_number() OVER (ORDER BY label.name COLLATE musicbrainz) FROM (
@@ -67,7 +67,7 @@ SELECT q.entity AS label_id, row_number() OVER (ORDER BY label.name COLLATE musi
JOIN label ON q.entity = label.id
GROUP BY q.entity, label.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsRecordings.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsRecordings.pm
index 705adacd681..4ee02413dd8 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsRecordings.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsRecordings.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';
sub query {
- "
+ '
SELECT q.entity AS recording_id, row_number() OVER (ORDER BY recording.name COLLATE musicbrainz) FROM (
@@ -68,7 +68,7 @@ SELECT q.entity AS recording_id, row_number() OVER (ORDER BY recording.name COLL
JOIN recording ON q.entity = recording.id
GROUP BY q.entity, recording.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleaseGroups.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleaseGroups.pm
index 3796c732bbc..f5dd2746773 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleaseGroups.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleaseGroups.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseGroupID';
sub query {
- "
+ '
SELECT q.entity AS release_group_id, row_number() OVER (ORDER BY release_group.name COLLATE musicbrainz) FROM (
@@ -67,7 +67,7 @@ SELECT q.entity AS release_group_id, row_number() OVER (ORDER BY release_group.n
JOIN release_group ON q.entity = release_group.id
GROUP BY q.entity, release_group.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleases.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleases.pm
index 8f016e10351..92cd6748b61 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleases.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsReleases.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ '
SELECT q.entity AS release_id, row_number() OVER (ORDER BY release.name COLLATE musicbrainz) FROM (
@@ -67,7 +67,7 @@ SELECT q.entity AS release_id, row_number() OVER (ORDER BY release.name COLLATE
JOIN release ON q.entity = release.id
GROUP BY q.entity, release.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsWorks.pm b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsWorks.pm
index 0d775c7755e..157c504c405 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateRelationshipsWorks.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateRelationshipsWorks.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::WorkReport',
'MusicBrainz::Server::Report::FilterForEditor::WorkID';
sub query {
- "
+ '
SELECT q.entity AS work_id, row_number() OVER (ORDER BY work.name COLLATE musicbrainz) FROM (
@@ -60,7 +60,7 @@ SELECT q.entity AS work_id, row_number() OVER (ORDER BY work.name COLLATE musicb
JOIN work ON q.entity = work.id
GROUP BY q.entity, work.name
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/DuplicateReleaseGroups.pm b/lib/MusicBrainz/Server/Report/DuplicateReleaseGroups.pm
index 8abf0baf489..1328a80ec7b 100644
--- a/lib/MusicBrainz/Server/Report/DuplicateReleaseGroups.pm
+++ b/lib/MusicBrainz/Server/Report/DuplicateReleaseGroups.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseGroupID';
sub query {
- "
+ q{
WITH normalised_names AS (
SELECT musicbrainz_unaccent(regexp_replace(lower(rg.name), ' \((disc [0-9]+|bonus disc)(: .*)?\)\$', '')) AS normalised_name, rg.artist_credit
FROM release_group rg
@@ -23,7 +23,7 @@ SELECT q.rgid AS release_group_id, q.key, row_number() OVER (ORDER BY ac COLLATE
GROUP BY artist_credit.name COLLATE musicbrainz, nn.normalised_name||nn.artist_credit, artist_credit.name, release_group.id, release_group.name
) q
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/FeaturingRecordings.pm b/lib/MusicBrainz/Server/Report/FeaturingRecordings.pm
index 5ae37bc7ddb..f55d668f4f3 100644
--- a/lib/MusicBrainz/Server/Report/FeaturingRecordings.pm
+++ b/lib/MusicBrainz/Server/Report/FeaturingRecordings.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';
sub query {
- "
+ q{
SELECT
r.id AS recording_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -14,7 +14,7 @@ sub query {
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE
r.name COLLATE musicbrainz ~* E' \\\\(((f|w)/|(feat|feat|ft|συμμ)(\\\\.|.)|(duet with|συμμετέχει|featuring|featuring) )'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/FeaturingReleaseGroups.pm b/lib/MusicBrainz/Server/Report/FeaturingReleaseGroups.pm
index 3ee95d7ae4f..6bc5333e10c 100644
--- a/lib/MusicBrainz/Server/Report/FeaturingReleaseGroups.pm
+++ b/lib/MusicBrainz/Server/Report/FeaturingReleaseGroups.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseGroupID';
sub query {
- "
+ q{
SELECT
rg.id AS release_group_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, rg.name COLLATE musicbrainz)
@@ -16,7 +16,7 @@ sub query {
JOIN release_group_meta rm ON rg.id = rm.id
WHERE
rg.name COLLATE musicbrainz ~* E' \\\\(((f|w)/|(feat|feat|ft|συμμ)(\\\\.|.)|(duet with|συμμετέχει|featuring|featuring) )'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/FeaturingReleases.pm b/lib/MusicBrainz/Server/Report/FeaturingReleases.pm
index 228288455cd..5d81cf92643 100644
--- a/lib/MusicBrainz/Server/Report/FeaturingReleases.pm
+++ b/lib/MusicBrainz/Server/Report/FeaturingReleases.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -16,7 +16,7 @@ sub query {
JOIN release_meta rm ON r.id = rm.id
WHERE
r.name COLLATE musicbrainz ~* E' \\\\(((f|w)/|(feat|feat|ft|συμμ)(\\\\.|.)|(duet with|συμμετέχει|featuring|featuring) )'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistCreditID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistCreditID.pm
index 28dc762a207..e973fbdb3fc 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistCreditID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistCreditID.pm
@@ -6,11 +6,11 @@ with 'MusicBrainz::Server::Report::FilterForEditor';
sub filter_sql {
my ($self, $editor_id) = @_;
- my $filter_query = <<~'EOSQL';
+ my $filter_query = <<~'SQL';
JOIN artist_credit_name ON artist_credit_id = artist_credit_name.artist_credit
JOIN editor_subscribe_artist esa ON esa.artist = artist_credit_name.artist
WHERE esa.editor = ?
- EOSQL
+ SQL
return ($filter_query, $editor_id);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistID.pm
index 467170ce78d..574e0a86a0e 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/ArtistID.pm
@@ -7,8 +7,8 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN editor_subscribe_artist esa ON esa.artist = report.artist_id
- WHERE esa.editor = ?",
+ 'JOIN editor_subscribe_artist esa ON esa.artist = report.artist_id
+ WHERE esa.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/EventID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/EventID.pm
index 7f9c8275afa..e60cd8e9047 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/EventID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/EventID.pm
@@ -7,9 +7,9 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN l_artist_event ON l_artist_event.entity1 = event_id
+ 'JOIN l_artist_event ON l_artist_event.entity1 = event_id
JOIN editor_subscribe_artist esa ON esa.artist = l_artist_event.entity0
- WHERE esa.editor = ?",
+ WHERE esa.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/LabelID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/LabelID.pm
index e224385da97..66916935ea9 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/LabelID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/LabelID.pm
@@ -7,8 +7,8 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN editor_subscribe_label esl ON esl.label = label_id
- WHERE esl.editor = ?",
+ 'JOIN editor_subscribe_label esl ON esl.label = label_id
+ WHERE esl.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/RecordingID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/RecordingID.pm
index 896c9d0d66f..e7764ecde9f 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/RecordingID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/RecordingID.pm
@@ -7,10 +7,10 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN recording ON recording.id = recording_id
+ 'JOIN recording ON recording.id = recording_id
JOIN artist_credit_name ON recording.artist_credit = artist_credit_name.artist_credit
JOIN editor_subscribe_artist esa ON esa.artist = artist_credit_name.artist
- WHERE esa.editor = ?",
+ WHERE esa.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseGroupID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseGroupID.pm
index 80f211f05e2..19c65b33921 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseGroupID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseGroupID.pm
@@ -7,10 +7,10 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN release_group ON release_group.id = release_group_id
+ 'JOIN release_group ON release_group.id = release_group_id
JOIN artist_credit_name ON release_group.artist_credit = artist_credit_name.artist_credit
JOIN editor_subscribe_artist esa ON esa.artist = artist_credit_name.artist
- WHERE esa.editor = ?",
+ WHERE esa.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseID.pm
index 27b31e37a63..5f400de304f 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/ReleaseID.pm
@@ -7,12 +7,12 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN release ON release.id = release_id
+ 'JOIN release ON release.id = release_id
JOIN artist_credit_name ON release.artist_credit = artist_credit_name.artist_credit
LEFT JOIN release_label ON release_label.release = release.id
LEFT JOIN editor_subscribe_artist esa ON esa.artist = artist_credit_name.artist
LEFT JOIN editor_subscribe_label esl ON esl.label = release_label.label
- WHERE (esa.editor IS NOT DISTINCT FROM ?) OR (esl.editor IS NOT DISTINCT FROM ?)",
+ WHERE (esa.editor IS NOT DISTINCT FROM ?) OR (esl.editor IS NOT DISTINCT FROM ?)',
$editor_id, $editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/SeriesID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/SeriesID.pm
index 096fcdf5b24..c49e5b44bdc 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/SeriesID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/SeriesID.pm
@@ -7,8 +7,8 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN editor_subscribe_series ess ON ess.series = series_id
- WHERE ess.editor = ?",
+ 'JOIN editor_subscribe_series ess ON ess.series = series_id
+ WHERE ess.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/FilterForEditor/WorkID.pm b/lib/MusicBrainz/Server/Report/FilterForEditor/WorkID.pm
index 1d4b0eff44d..56e6d832665 100644
--- a/lib/MusicBrainz/Server/Report/FilterForEditor/WorkID.pm
+++ b/lib/MusicBrainz/Server/Report/FilterForEditor/WorkID.pm
@@ -7,9 +7,9 @@ sub filter_sql {
my ($self, $editor_id) = @_;
return (
- "JOIN l_artist_work ON l_artist_work.entity1 = work_id
+ 'JOIN l_artist_work ON l_artist_work.entity1 = work_id
JOIN editor_subscribe_artist esa ON esa.artist = l_artist_work.entity0
- WHERE esa.editor = ?",
+ WHERE esa.editor = ?',
$editor_id
);
}
diff --git a/lib/MusicBrainz/Server/Report/ISRCsWithManyRecordings.pm b/lib/MusicBrainz/Server/Report/ISRCsWithManyRecordings.pm
index 5bdca6712d8..b5dc016bee8 100644
--- a/lib/MusicBrainz/Server/Report/ISRCsWithManyRecordings.pm
+++ b/lib/MusicBrainz/Server/Report/ISRCsWithManyRecordings.pm
@@ -8,7 +8,7 @@ sub table { 'isrc_with_many_recordings' }
sub component_name { 'IsrcsWithManyRecordings' }
sub query {
- "
+ '
SELECT i.isrc, recordingcount, r.id AS recording_id, r.name, r.length,
row_number() OVER (ORDER BY i.isrc)
FROM isrc i
@@ -18,7 +18,7 @@ sub query {
FROM isrc
GROUP BY isrc HAVING count(*) > 1
) t ON t.isrc = i.isrc
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ISWCsWithManyWorks.pm b/lib/MusicBrainz/Server/Report/ISWCsWithManyWorks.pm
index 4c2c5345c9b..5002524e364 100644
--- a/lib/MusicBrainz/Server/Report/ISWCsWithManyWorks.pm
+++ b/lib/MusicBrainz/Server/Report/ISWCsWithManyWorks.pm
@@ -17,7 +17,7 @@ sub table { 'iswc_with_many_works' }
sub component_name { 'IswcsWithManyWorks' }
sub query {
- "
+ '
SELECT i.iswc, workcount, w.id AS work_id,
row_number() OVER (ORDER BY i.iswc)
FROM iswc i
@@ -27,7 +27,7 @@ sub query {
FROM iswc
GROUP BY iswc HAVING count(*) > 1
) t ON t.iswc = i.iswc
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/LabelsDisambiguationSameName.pm b/lib/MusicBrainz/Server/Report/LabelsDisambiguationSameName.pm
index f8400d25746..dddef490ada 100644
--- a/lib/MusicBrainz/Server/Report/LabelsDisambiguationSameName.pm
+++ b/lib/MusicBrainz/Server/Report/LabelsDisambiguationSameName.pm
@@ -5,13 +5,13 @@ with 'MusicBrainz::Server::Report::LabelReport',
'MusicBrainz::Server::Report::FilterForEditor::LabelID';
sub query {
- "
+ '
SELECT
label.id AS label_id,
row_number() OVER (ORDER BY label.name COLLATE musicbrainz, label.id)
FROM label
WHERE label.name = label.comment
- "
+ '
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/LinksWithMultipleEntities.pm b/lib/MusicBrainz/Server/Report/LinksWithMultipleEntities.pm
index ac15d273e72..0622b5b5d74 100644
--- a/lib/MusicBrainz/Server/Report/LinksWithMultipleEntities.pm
+++ b/lib/MusicBrainz/Server/Report/LinksWithMultipleEntities.pm
@@ -10,17 +10,17 @@ sub query {
my $inner_table = join(
' UNION ',
- map {<<~"EOSQL"} @tables
+ map {<<~"SQL"} @tables
SELECT DISTINCT ON (url, other_entity) -- ignore several rel types between same entity pair
link_type.id AS link_type_id, link_type.gid AS link_type_gid,
l_table.id AS rel_id, ${\$_->[1]} AS url, ${\$_->[2]} AS other_entity
FROM link_type
JOIN link ON link.link_type = link_type.id
JOIN ${\$_->[0]} l_table ON l_table.link = link.id
- EOSQL
+ SQL
);
- my $query = <<~"EOSQL";
+ my $query = <<~"SQL";
SELECT url.id AS url_id, count(*) AS count, row_number() OVER (ORDER BY count(*) DESC, url.id DESC)
FROM url JOIN ($inner_table) l ON l.url = url.id
WHERE url.url NOT LIKE 'https://www.wikidata.org%' -- has its own report
@@ -32,7 +32,7 @@ sub query {
'770ea9f4-cba0-4194-b77f-fe2740055e34') -- work license
GROUP BY url_id
HAVING count(*) > 1
- EOSQL
+ SQL
return $query
}
diff --git a/lib/MusicBrainz/Server/Report/MediumsWithSequenceIssues.pm b/lib/MusicBrainz/Server/Report/MediumsWithSequenceIssues.pm
index 7620c78605f..4a6eb40682b 100644
--- a/lib/MusicBrainz/Server/Report/MediumsWithSequenceIssues.pm
+++ b/lib/MusicBrainz/Server/Report/MediumsWithSequenceIssues.pm
@@ -16,7 +16,7 @@ sub query
# E.g. If the medium had mediums: 1, 2, 3, 3, 5 then
# the following will *not* hold:
# 1 + 2 + 3 + 3 + 5 = 1 + 2 + 3 + 4 + 5
- <<~'EOSQL'
+ <<~'SQL'
SELECT DISTINCT release.id AS release_id,
release.name,
row_number() OVER (ORDER BY release.name COLLATE musicbrainz)
@@ -34,7 +34,7 @@ sub query
WHERE first_medium != 1
OR last_medium != medium_count
OR (medium_count * (1 + medium_count)) / 2 <> medium_pos_acc
- EOSQL
+ SQL
}
1;
diff --git a/lib/MusicBrainz/Server/Report/MislinkedPseudoReleases.pm b/lib/MusicBrainz/Server/Report/MislinkedPseudoReleases.pm
index 02f8bd30982..0176ee87322 100644
--- a/lib/MusicBrainz/Server/Report/MislinkedPseudoReleases.pm
+++ b/lib/MusicBrainz/Server/Report/MislinkedPseudoReleases.pm
@@ -4,7 +4,7 @@ use Moose;
with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
-sub query {<<~'EOSQL'}
+sub query {<<~'SQL'}
SELECT r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
FROM release r
@@ -14,7 +14,7 @@ sub query {<<~'EOSQL'}
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE lt.gid = 'fc399d47-23a7-4c28-bfcf-0607a562b644' --transl(iter)ation
AND r.status = 4 --pseudo-release
- EOSQL
+ SQL
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Report/MultipleASINs.pm b/lib/MusicBrainz/Server/Report/MultipleASINs.pm
index 391b112d8d7..967afa346e9 100644
--- a/lib/MusicBrainz/Server/Report/MultipleASINs.pm
+++ b/lib/MusicBrainz/Server/Report/MultipleASINs.pm
@@ -9,7 +9,7 @@ sub component_name { 'MultipleAsins' }
sub query
{
- "
+ q{
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -24,7 +24,7 @@ sub query
GROUP BY
r.id, r.name, ac.name, r.artist_credit
HAVING COUNT(r.gid) > 1
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/MultipleDiscogsLinks.pm b/lib/MusicBrainz/Server/Report/MultipleDiscogsLinks.pm
index 0e2062112fe..e6345375e46 100644
--- a/lib/MusicBrainz/Server/Report/MultipleDiscogsLinks.pm
+++ b/lib/MusicBrainz/Server/Report/MultipleDiscogsLinks.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -20,7 +20,7 @@ sub query {
GROUP BY
r.id, r.name, ac.name, r.artist_credit
HAVING COUNT(r.gid) > 1
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/NoLanguage.pm b/lib/MusicBrainz/Server/Report/NoLanguage.pm
index 0da67788401..859a1c2b1b1 100644
--- a/lib/MusicBrainz/Server/Report/NoLanguage.pm
+++ b/lib/MusicBrainz/Server/Report/NoLanguage.pm
@@ -12,14 +12,14 @@ after _load_extra_release_info => sub {
};
sub query {
- "
+ '
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY artist_credit.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
FROM release r
JOIN artist_credit ON r.artist_credit = artist_credit.id
WHERE language IS NULL
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/NoScript.pm b/lib/MusicBrainz/Server/Report/NoScript.pm
index d08eca3692e..34dff501f92 100644
--- a/lib/MusicBrainz/Server/Report/NoScript.pm
+++ b/lib/MusicBrainz/Server/Report/NoScript.pm
@@ -12,13 +12,13 @@ after _load_extra_release_info => sub {
};
sub query {
- "
+ '
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY r.artist_credit, r.name)
FROM release r
WHERE script IS NULL
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/PartOfSetRelationships.pm b/lib/MusicBrainz/Server/Report/PartOfSetRelationships.pm
index a4e3fb71056..405b02d99d4 100644
--- a/lib/MusicBrainz/Server/Report/PartOfSetRelationships.pm
+++ b/lib/MusicBrainz/Server/Report/PartOfSetRelationships.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -28,7 +28,7 @@ sub query {
WHERE link_type.name = 'part of set'
) r
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/PossibleCollaborations.pm b/lib/MusicBrainz/Server/Report/PossibleCollaborations.pm
index a4a21086d59..2941f6e4ffb 100644
--- a/lib/MusicBrainz/Server/Report/PossibleCollaborations.pm
+++ b/lib/MusicBrainz/Server/Report/PossibleCollaborations.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ArtistReport',
'MusicBrainz::Server::Report::FilterForEditor::ArtistID';
sub query {
- "
+ q{
SELECT artist.id AS artist_id, row_number() OVER ( ORDER BY artist.name COLLATE musicbrainz )
FROM
artist
@@ -22,7 +22,7 @@ sub query {
AND link_type.name IN
('collaboration', 'conductor position', 'founder', 'member of band', 'subgroup') )
GROUP BY artist.id, artist.name
- "
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/RecordingTrackDifferentName.pm b/lib/MusicBrainz/Server/Report/RecordingTrackDifferentName.pm
index 20aafefd827..7907bd7c115 100644
--- a/lib/MusicBrainz/Server/Report/RecordingTrackDifferentName.pm
+++ b/lib/MusicBrainz/Server/Report/RecordingTrackDifferentName.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
sub statement_timeout { '120s' }
sub query {
- "
+ '
SELECT
r.id AS recording_id, t.id AS track_id,
row_number() OVER (ORDER BY r.name COLLATE musicbrainz, t.name COLLATE musicbrainz)
@@ -19,7 +19,7 @@ sub query {
ON r.id = t.recording
WHERE (SELECT COUNT(*) FROM track WHERE recording = r.id) = 1
AND r.name != t.name
- "
+ '
}
sub inflate_rows
diff --git a/lib/MusicBrainz/Server/Report/RecordingsSameNameDifferentArtistsSameName.pm b/lib/MusicBrainz/Server/Report/RecordingsSameNameDifferentArtistsSameName.pm
index 540b60adf2d..7006b6a41ef 100644
--- a/lib/MusicBrainz/Server/Report/RecordingsSameNameDifferentArtistsSameName.pm
+++ b/lib/MusicBrainz/Server/Report/RecordingsSameNameDifferentArtistsSameName.pm
@@ -9,7 +9,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
# production.
sub query {
- "
+ '
SELECT
recording_id,
row_number() OVER (ORDER BY rname COLLATE musicbrainz, artist_id)
@@ -27,7 +27,7 @@ sub query {
JOIN artist a2 ON (acn2.artist = a2.id AND a1.id != a2.id)
WHERE (acn1.name = acn2.name OR a1.name = a2.name)
) r
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/RecordingsWithEarliestReleaseRelationships.pm b/lib/MusicBrainz/Server/Report/RecordingsWithEarliestReleaseRelationships.pm
index f2121755a22..4b7cd84bfc0 100644
--- a/lib/MusicBrainz/Server/Report/RecordingsWithEarliestReleaseRelationships.pm
+++ b/lib/MusicBrainz/Server/Report/RecordingsWithEarliestReleaseRelationships.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';
sub query {
- "
+ q{
SELECT
r.id AS recording_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -26,7 +26,7 @@ sub query {
JOIN artist_credit ac ON r.artist_credit = ac.id
WHERE
link_type.name = 'first track release'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/RecordingsWithFutureDates.pm b/lib/MusicBrainz/Server/Report/RecordingsWithFutureDates.pm
index 3f517237a3a..d57b7680649 100644
--- a/lib/MusicBrainz/Server/Report/RecordingsWithFutureDates.pm
+++ b/lib/MusicBrainz/Server/Report/RecordingsWithFutureDates.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';
sub query {
- "
+ q{
WITH
link AS (
SELECT
@@ -49,7 +49,7 @@ sub query {
UNION ALL
SELECT link, entity0, entity1 FROM l_recording_work
) AS l_ ON l_.link = link.id
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/RecordingsWithoutVALink.pm b/lib/MusicBrainz/Server/Report/RecordingsWithoutVALink.pm
index bea62651d68..f3dcd56f99a 100644
--- a/lib/MusicBrainz/Server/Report/RecordingsWithoutVALink.pm
+++ b/lib/MusicBrainz/Server/Report/RecordingsWithoutVALink.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::RecordingReport';
sub component_name { 'RecordingsWithoutVaLink' }
sub query {
- "
+ q{
SELECT
r.id AS recording_id,
row_number() OVER (ORDER BY r.artist_credit, r.name)
@@ -16,7 +16,7 @@ sub query {
JOIN artist a ON a.id = acn.artist
WHERE acn.name = 'Various Artists'
AND a.name != 'Various Artists'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleaseGroupsWithoutVALink.pm b/lib/MusicBrainz/Server/Report/ReleaseGroupsWithoutVALink.pm
index 1443ffe02e3..c1f6d3fc1d7 100644
--- a/lib/MusicBrainz/Server/Report/ReleaseGroupsWithoutVALink.pm
+++ b/lib/MusicBrainz/Server/Report/ReleaseGroupsWithoutVALink.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport';
sub component_name { 'ReleaseGroupsWithoutVaLink' }
sub query {
- "
+ q{
SELECT
rg.id AS release_group_id,
row_number() OVER (ORDER BY rg.artist_credit, rg.name)
@@ -16,7 +16,7 @@ sub query {
JOIN artist a ON a.id = acn.artist
WHERE acn.name = 'Various Artists'
AND a.name != 'Various Artists'
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleaseRGDifferentName.pm b/lib/MusicBrainz/Server/Report/ReleaseRGDifferentName.pm
index e796f05f101..9c0d6b02307 100644
--- a/lib/MusicBrainz/Server/Report/ReleaseRGDifferentName.pm
+++ b/lib/MusicBrainz/Server/Report/ReleaseRGDifferentName.pm
@@ -9,7 +9,7 @@ sub table { 'release_rg_different_name' }
sub component_name { 'ReleaseRgDifferentName' }
sub query {
- "
+ '
SELECT
r.id AS release_id, rg.id AS release_group_id,
row_number() OVER (ORDER BY r.name COLLATE musicbrainz, rg.name COLLATE musicbrainz)
@@ -21,7 +21,7 @@ sub query {
ON rgm.id = rg.id
WHERE rgm.release_count = 1
AND r.name != rg.name
- "
+ '
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasedTooEarly.pm b/lib/MusicBrainz/Server/Report/ReleasedTooEarly.pm
index 349531f3aa1..cd588b2b3e0 100644
--- a/lib/MusicBrainz/Server/Report/ReleasedTooEarly.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasedTooEarly.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT DISTINCT ON (r.id)
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -28,7 +28,7 @@ sub query {
(mf.year IS NOT NULL AND date_year < mf.year)
) r
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasesSameBarcode.pm b/lib/MusicBrainz/Server/Report/ReleasesSameBarcode.pm
index 5c90da7c7ed..4103a1f2610 100644
--- a/lib/MusicBrainz/Server/Report/ReleasesSameBarcode.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesSameBarcode.pm
@@ -9,7 +9,7 @@ sub table { 'releases_same_barcode' }
sub component_name { 'ReleasesSameBarcode' }
sub query {
- "
+ q{
SELECT DISTINCT ON (r.id)
r.barcode AS barcode, r.id AS release_id, r.release_group AS release_group_id,
row_number() OVER (ORDER BY r.barcode, r.name COLLATE musicbrainz)
@@ -24,7 +24,7 @@ sub query {
AND r2.status != 3 -- skip bootlegs
AND r.release_group != r2.release_group
)
- "
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasesToConvert.pm b/lib/MusicBrainz/Server/Report/ReleasesToConvert.pm
index a2b45b4b04e..a5ad42a124d 100755
--- a/lib/MusicBrainz/Server/Report/ReleasesToConvert.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesToConvert.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT DISTINCT release.id AS release_id,
row_number() OVER (ORDER BY artist_credit.name COLLATE musicbrainz, release.name COLLATE musicbrainz)
FROM track
@@ -15,7 +15,7 @@ sub query {
WHERE track.name ~* E'[^\\\\d]-[^\\\\d]' OR track.name LIKE '%/%'
GROUP BY release.id, release.name, medium.id, medium.track_count, artist_credit.name
HAVING count(*) = medium.track_count
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasesWithCAANoTypes.pm b/lib/MusicBrainz/Server/Report/ReleasesWithCAANoTypes.pm
index 0634c781596..d47e1896a6a 100644
--- a/lib/MusicBrainz/Server/Report/ReleasesWithCAANoTypes.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesWithCAANoTypes.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
sub component_name { 'ReleasesWithCaaNoTypes' }
sub query {
- "
+ '
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -21,7 +21,7 @@ sub query {
)
) r
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ ';
}
sub table { 'releases_with_caa_no_types' }
diff --git a/lib/MusicBrainz/Server/Report/ReleasesWithDownloadRelationships.pm b/lib/MusicBrainz/Server/Report/ReleasesWithDownloadRelationships.pm
index 00b539d890b..75a521fb9a0 100644
--- a/lib/MusicBrainz/Server/Report/ReleasesWithDownloadRelationships.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesWithDownloadRelationships.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ '
SELECT
DISTINCT r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -25,7 +25,7 @@ sub query {
WHERE lru.entity0 = r.id
AND link.link_type IN (74, 75, 85, 980) -- paid/free download, free/paid streaming
)
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasesWithUnlikelyLanguageScript.pm b/lib/MusicBrainz/Server/Report/ReleasesWithUnlikelyLanguageScript.pm
index c8551fc7076..e6489434025 100644
--- a/lib/MusicBrainz/Server/Report/ReleasesWithUnlikelyLanguageScript.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesWithUnlikelyLanguageScript.pm
@@ -12,7 +12,7 @@ after _load_extra_release_info => sub {
};
sub query {
- "
+ q{
SELECT
DISTINCT r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -32,7 +32,7 @@ sub query {
language.iso_code_3 = 'jpn' AND
script.iso_code NOT IN ('Brai', 'Hira', 'Hrkt', 'Kana', 'Jpan', 'Latn', 'Qaaa')
)
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/ReleasesWithoutVALink.pm b/lib/MusicBrainz/Server/Report/ReleasesWithoutVALink.pm
index df64a094b6b..db1482e4177 100644
--- a/lib/MusicBrainz/Server/Report/ReleasesWithoutVALink.pm
+++ b/lib/MusicBrainz/Server/Report/ReleasesWithoutVALink.pm
@@ -7,7 +7,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport';
sub component_name { 'ReleasesWithoutVaLink' }
sub query {
- "
+ q{
SELECT DISTINCT ON (r.id)
r.id AS release_id,
row_number() OVER (ORDER BY r.artist_credit, r.name)
@@ -30,7 +30,7 @@ sub query {
WHERE acn.name = 'Various Artists'
AND a.name != 'Various Artists'
) r
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/SeparateDiscs.pm b/lib/MusicBrainz/Server/Report/SeparateDiscs.pm
index 41f034b343f..b6763421e6b 100644
--- a/lib/MusicBrainz/Server/Report/SeparateDiscs.pm
+++ b/lib/MusicBrainz/Server/Report/SeparateDiscs.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT DISTINCT ON (r.id)
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -17,7 +17,7 @@ sub query {
WHERE
r.name ~ E'\\\\((disc [0-9]+|bonus disc)(: .*)?\\\\)'
AND NOT (rg.type = 2 AND release_country.country = 221)
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/SetInDifferentRG.pm b/lib/MusicBrainz/Server/Report/SetInDifferentRG.pm
index 536524c67a0..f9841dd6bb1 100644
--- a/lib/MusicBrainz/Server/Report/SetInDifferentRG.pm
+++ b/lib/MusicBrainz/Server/Report/SetInDifferentRG.pm
@@ -8,7 +8,7 @@ with 'MusicBrainz::Server::Report::ReleaseGroupReport',
sub component_name { 'SetInDifferentRg' }
sub query {
- "
+ q{
SELECT DISTINCT
rg.id AS release_group_id,
row_number() OVER (ORDER BY rg.name COLLATE musicbrainz)
@@ -33,7 +33,7 @@ sub query {
WHERE link_type.gid IN ('6d08ec1e-a292-4dac-90f3-c398a39defd5', 'fc399d47-23a7-4c28-bfcf-0607a562b644')
AND r0.release_group <> r1.release_group
)
- ";
+ };
}
1;
diff --git a/lib/MusicBrainz/Server/Report/SingleMediumReleasesWithMediumTitles.pm b/lib/MusicBrainz/Server/Report/SingleMediumReleasesWithMediumTitles.pm
index 02dc8f6d75b..ecdded7b2ac 100644
--- a/lib/MusicBrainz/Server/Report/SingleMediumReleasesWithMediumTitles.pm
+++ b/lib/MusicBrainz/Server/Report/SingleMediumReleasesWithMediumTitles.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "SELECT DISTINCT ON (release.id)
+ q{SELECT DISTINCT ON (release.id)
release.id AS release_id,
row_number() OVER (
ORDER BY artist_credit.name COLLATE musicbrainz, release.name COLLATE musicbrainz
@@ -18,7 +18,7 @@ sub query {
FROM medium
GROUP BY release
HAVING count(id) = 1
- ) AND medium.name != ''";
+ ) AND medium.name != ''};
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/SomeFormatsUnset.pm b/lib/MusicBrainz/Server/Report/SomeFormatsUnset.pm
index 9c94694d4de..da39a721d15 100644
--- a/lib/MusicBrainz/Server/Report/SomeFormatsUnset.pm
+++ b/lib/MusicBrainz/Server/Report/SomeFormatsUnset.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ '
SELECT
r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
@@ -21,7 +21,7 @@ sub query {
) AS q
JOIN release r ON r.id = q.release
JOIN artist_credit ac ON r.artist_credit = ac.id
- ";
+ ';
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/SuperfluousDataTracks.pm b/lib/MusicBrainz/Server/Report/SuperfluousDataTracks.pm
index 695a91796be..c7bab18522f 100644
--- a/lib/MusicBrainz/Server/Report/SuperfluousDataTracks.pm
+++ b/lib/MusicBrainz/Server/Report/SuperfluousDataTracks.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- <<~'EOSQL'
+ <<~'SQL'
SELECT
release.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, release.name COLLATE musicbrainz)
@@ -25,7 +25,7 @@ sub query {
)
) release
JOIN artist_credit ac ON release.artist_credit = ac.id
- EOSQL
+ SQL
}
1;
diff --git a/lib/MusicBrainz/Server/Report/TracksNamedWithSequence.pm b/lib/MusicBrainz/Server/Report/TracksNamedWithSequence.pm
index 0d7f6f94ab1..abec27e9bcf 100644
--- a/lib/MusicBrainz/Server/Report/TracksNamedWithSequence.pm
+++ b/lib/MusicBrainz/Server/Report/TracksNamedWithSequence.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- <<~'EOSQL'
+ <<~'SQL'
SELECT release.id AS release_id,
row_number() OVER (ORDER BY release.name COLLATE musicbrainz)
FROM (
@@ -20,7 +20,7 @@ sub query {
HAVING count(*) > 2
) s
JOIN release ON s.id = release.id
- EOSQL
+ SQL
}
1;
diff --git a/lib/MusicBrainz/Server/Report/TracksWithSequenceIssues.pm b/lib/MusicBrainz/Server/Report/TracksWithSequenceIssues.pm
index 1c0ca92fd15..41ceb12fab1 100644
--- a/lib/MusicBrainz/Server/Report/TracksWithSequenceIssues.pm
+++ b/lib/MusicBrainz/Server/Report/TracksWithSequenceIssues.pm
@@ -16,7 +16,7 @@ sub query {
# E.g. If the tracklist had tracks: 1, 2, 3, 3, 5 then
# the following will *not* hold:
# 1 + 2 + 3 + 3 + 5 = 1 + 2 + 3 + 4 + 5
- <<~'EOSQL'
+ <<~'SQL'
SELECT release.id AS release_id,
row_number() OVER (ORDER BY release.name COLLATE musicbrainz)
FROM
@@ -40,7 +40,7 @@ sub query {
OR last_track <> s.track_count - (1 - first_track)
OR (last_track * (1 + last_track)) <> 2 * track_pos_acc
) release
- EOSQL
+ SQL
}
1;
diff --git a/lib/MusicBrainz/Server/Report/TracksWithoutTimes.pm b/lib/MusicBrainz/Server/Report/TracksWithoutTimes.pm
index f41412cf328..884c4a5279c 100644
--- a/lib/MusicBrainz/Server/Report/TracksWithoutTimes.pm
+++ b/lib/MusicBrainz/Server/Report/TracksWithoutTimes.pm
@@ -6,7 +6,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- <<~'EOSQL'
+ <<~'SQL'
SELECT release.id AS release_id,
row_number() OVER (ORDER BY release.name COLLATE musicbrainz)
FROM (
@@ -18,7 +18,7 @@ sub query {
GROUP BY release.id
) s
JOIN release ON s.id = release.id
- EOSQL
+ SQL
}
1;
diff --git a/lib/MusicBrainz/Server/Report/UnlinkedPseudoReleases.pm b/lib/MusicBrainz/Server/Report/UnlinkedPseudoReleases.pm
index 494542b549e..8cfe78932e6 100644
--- a/lib/MusicBrainz/Server/Report/UnlinkedPseudoReleases.pm
+++ b/lib/MusicBrainz/Server/Report/UnlinkedPseudoReleases.pm
@@ -5,7 +5,7 @@ with 'MusicBrainz::Server::Report::ReleaseReport',
'MusicBrainz::Server::Report::FilterForEditor::ReleaseID';
sub query {
- "
+ q{
SELECT r.id AS release_id,
row_number() OVER (ORDER BY ac.name COLLATE musicbrainz, r.name COLLATE musicbrainz)
FROM release r
@@ -22,7 +22,7 @@ WHERE r.status IN (
FROM release_status rs
WHERE rs.name = 'Pseudo-Release'
) AND lrr.link IS NULL
- ";
+ };
}
__PACKAGE__->meta->make_immutable;
diff --git a/lib/MusicBrainz/Server/Report/WikidataLinksWithMultipleEntities.pm b/lib/MusicBrainz/Server/Report/WikidataLinksWithMultipleEntities.pm
index 6dccc5dfe57..43b177128aa 100644
--- a/lib/MusicBrainz/Server/Report/WikidataLinksWithMultipleEntities.pm
+++ b/lib/MusicBrainz/Server/Report/WikidataLinksWithMultipleEntities.pm
@@ -10,21 +10,21 @@ sub query {
my $inner_table = join(
' UNION ',
- map {<<~"EOSQL"} @tables
+ map {<<~"SQL"} @tables
SELECT link_type.id AS link_type_id, l_table.id AS rel_id, ${\$_->[1]} AS url
FROM link_type
JOIN link ON link.link_type = link_type.id
JOIN ${\$_->[0]} l_table ON l_table.link = link.id
- EOSQL
+ SQL
);
- my $query = <<~"EOSQL";
+ my $query = <<~"SQL";
SELECT url.id AS url_id, count(*) AS count, row_number() OVER (ORDER BY count(*) DESC, url.id DESC)
FROM url JOIN ($inner_table) l ON l.url = url.id
WHERE url.url LIKE 'https://www.wikidata.org%'
GROUP BY url_id
HAVING count(*) > 1
- EOSQL
+ SQL
return $query
}
diff --git a/lib/MusicBrainz/Server/Report/WorkSameTypeAsParent.pm b/lib/MusicBrainz/Server/Report/WorkSameTypeAsParent.pm
index 8f762272da2..2b059010632 100644
--- a/lib/MusicBrainz/Server/Report/WorkSameTypeAsParent.pm
+++ b/lib/MusicBrainz/Server/Report/WorkSameTypeAsParent.pm
@@ -4,7 +4,7 @@ use Moose;
with 'MusicBrainz::Server::Report::WorkReport',
'MusicBrainz::Server::Report::FilterForEditor::WorkID';
-sub query {<<~'EOSQL'}
+sub query {<<~'SQL'}
SELECT DISTINCT w.id AS work_id,
row_number() OVER (ORDER BY w.type, w.name COLLATE musicbrainz)
FROM work w
@@ -18,7 +18,7 @@ sub query {<<~'EOSQL'}
AND lt.gid = 'ca8d3642-ce5f-49f8-91f2-125d72524e6a' --parts
AND w2.type = w.type
)
- EOSQL
+ SQL
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/MusicBrainz/Server/Role/Translation.pm b/lib/MusicBrainz/Server/Role/Translation.pm
index 321cc3fd12e..0135d226fd1 100644
--- a/lib/MusicBrainz/Server/Role/Translation.pm
+++ b/lib/MusicBrainz/Server/Role/Translation.pm
@@ -28,7 +28,7 @@ role {
{
my ($self, $msgid, $vars) = @_;
- my %vars = %$vars if (ref $vars eq "HASH");
+ my %vars = %$vars if (ref $vars eq 'HASH');
$self->_bind_domain($params->domain) unless $self->bound;
@@ -41,7 +41,7 @@ role {
{
my ($self, $msgid, $msgctxt, $vars) = @_;
- my %vars = %$vars if (ref $vars eq "HASH");
+ my %vars = %$vars if (ref $vars eq 'HASH');
$self->_bind_domain($params->domain) unless $self->bound;
@@ -54,7 +54,7 @@ role {
{
my ($self, $msgid, $msgid_plural, $n, $vars) = @_;
- my %vars = %$vars if (ref $vars eq "HASH");
+ my %vars = %$vars if (ref $vars eq 'HASH');
$self->_bind_domain($params->domain) unless $self->bound;
diff --git a/lib/MusicBrainz/Server/Sitemap/Builder.pm b/lib/MusicBrainz/Server/Sitemap/Builder.pm
index ff1a7603166..c84b607c0c7 100644
--- a/lib/MusicBrainz/Server/Sitemap/Builder.pm
+++ b/lib/MusicBrainz/Server/Sitemap/Builder.pm
@@ -257,7 +257,7 @@ sub build_one_sitemap {
$write_sitemap = 0;
if ($old_sitemap_modtimes{$remote_filename}) {
- print "using previous modtime, since file unchanged...";
+ print 'using previous modtime, since file unchanged...';
$modtime = $old_sitemap_modtimes{$remote_filename};
}
}
diff --git a/lib/MusicBrainz/Server/Sitemap/Constants.pm b/lib/MusicBrainz/Server/Sitemap/Constants.pm
index 5424c5e314c..b47d56b0ab6 100644
--- a/lib/MusicBrainz/Server/Sitemap/Constants.pm
+++ b/lib/MusicBrainz/Server/Sitemap/Constants.pm
@@ -45,78 +45,78 @@ our Readonly %SITEMAP_SUFFIX_INFO = map {
if ($entity_type eq 'artist') {
$suffix_info->{base}{extra_sql} = {
- columns => "(SELECT count(rg) FROM tmp_sitemaps_artist_direct_rgs tsadr WHERE tsadr.artist = artist.id AND is_official) official_rg_count",
+ columns => '(SELECT count(rg) FROM tmp_sitemaps_artist_direct_rgs tsadr WHERE tsadr.artist = artist.id AND is_official) official_rg_count',
};
- $suffix_info->{base}{paginated} = "official_rg_count";
+ $suffix_info->{base}{paginated} = 'official_rg_count';
$suffix_info->{all} = {
- extra_sql => {columns => "(SELECT count(rg) FROM tmp_sitemaps_artist_direct_rgs tsadr WHERE tsadr.artist = artist.id) all_rg_count"},
- paginated => "all_rg_count",
+ extra_sql => {columns => '(SELECT count(rg) FROM tmp_sitemaps_artist_direct_rgs tsadr WHERE tsadr.artist = artist.id) all_rg_count'},
+ paginated => 'all_rg_count',
suffix => 'all=1',
filename_suffix => 'all',
suffix_delimiter => '?'
};
$suffix_info->{va} = {
- extra_sql => {columns => "(SELECT count(rg) FROM tmp_sitemaps_artist_va_rgs tsavr WHERE tsavr.artist = artist.id AND is_official) official_va_rg_count"},
- paginated => "official_va_rg_count",
+ extra_sql => {columns => '(SELECT count(rg) FROM tmp_sitemaps_artist_va_rgs tsavr WHERE tsavr.artist = artist.id AND is_official) official_va_rg_count'},
+ paginated => 'official_va_rg_count',
suffix => 'va=1',
filename_suffix => 'va',
suffix_delimiter => '?',
priority => priority_by_count('official_va_rg_count'),
};
$suffix_info->{all_va} = {
- extra_sql => {columns => "(SELECT count(rg) FROM tmp_sitemaps_artist_va_rgs tsavr WHERE tsavr.artist = artist.id) all_va_rg_count"},
- paginated => "all_va_rg_count",
+ extra_sql => {columns => '(SELECT count(rg) FROM tmp_sitemaps_artist_va_rgs tsavr WHERE tsavr.artist = artist.id) all_va_rg_count'},
+ paginated => 'all_va_rg_count',
suffix => 'va=1&all=1',
filename_suffix => 'va-all',
suffix_delimiter => '?',
priority => priority_by_count('all_va_rg_count'),
};
$suffix_info->{releases} = {
- extra_sql => {columns => "(SELECT count(release) FROM tmp_sitemaps_artist_direct_releases tsadre WHERE tsadre.artist = artist.id) direct_release_count"},
- paginated => "direct_release_count",
+ extra_sql => {columns => '(SELECT count(release) FROM tmp_sitemaps_artist_direct_releases tsadre WHERE tsadre.artist = artist.id) direct_release_count'},
+ paginated => 'direct_release_count',
suffix => 'releases',
priority => priority_by_count('direct_release_count'),
};
$suffix_info->{releases_va} = {
- extra_sql => {columns => "(SELECT count(release) FROM tmp_sitemaps_artist_va_releases tsavre WHERE tsavre.artist = artist.id) va_release_count"},
- paginated => "va_release_count",
+ extra_sql => {columns => '(SELECT count(release) FROM tmp_sitemaps_artist_va_releases tsavre WHERE tsavre.artist = artist.id) va_release_count'},
+ paginated => 'va_release_count',
suffix => 'releases?va=1',
filename_suffix => 'releases-va',
priority => priority_by_count('va_release_count'),
};
$suffix_info->{recordings} = {
- extra_sql => {columns => "(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id) recording_count"},
- paginated => "recording_count",
+ extra_sql => {columns => '(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id) recording_count'},
+ paginated => 'recording_count',
suffix => 'recordings',
priority => priority_by_count('recording_count'),
jsonld_markup => 1,
};
$suffix_info->{recordings_video} = {
- extra_sql => {columns => "(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id AND is_video) video_count"},
- paginated => "video_count",
+ extra_sql => {columns => '(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id AND is_video) video_count'},
+ paginated => 'video_count',
suffix => 'recordings?video=1',
filename_suffix => 'recordings-video',
priority => priority_by_count('video_count'),
jsonld_markup => 1,
};
$suffix_info->{recordings_standalone} = {
- extra_sql => {columns => "(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id AND is_standalone) standalone_count"},
- paginated => "standalone_count",
+ extra_sql => {columns => '(SELECT count(recording) FROM tmp_sitemaps_artist_recordings tsar WHERE tsar.artist = artist.id AND is_standalone) standalone_count'},
+ paginated => 'standalone_count',
suffix => 'recordings?standalone=1',
filename_suffix => 'recordings-standalone',
priority => priority_by_count('standalone_count'),
jsonld_markup => 1,
};
$suffix_info->{works} = {
- extra_sql => {columns => "(SELECT count(work) FROM tmp_sitemaps_artist_works tsaw WHERE tsaw.artist = artist.id) work_count"},
- paginated => "work_count",
+ extra_sql => {columns => '(SELECT count(work) FROM tmp_sitemaps_artist_works tsaw WHERE tsaw.artist = artist.id) work_count'},
+ paginated => 'work_count',
suffix => 'works',
priority => priority_by_count('work_count'),
};
$suffix_info->{events} = {
# NOTE: no temporary table needed, since this can really probably just hit l_artist_event directly, no need to join or union. Can revisit if performance is an issue.
- extra_sql => {columns => "(SELECT count(DISTINCT entity1) FROM l_artist_event WHERE entity0 = artist.id) event_count"},
- paginated => "event_count",
+ extra_sql => {columns => '(SELECT count(DISTINCT entity1) FROM l_artist_event WHERE entity0 = artist.id) event_count'},
+ paginated => 'event_count',
suffix => 'events',
priority => priority_by_count('event_count'),
};
@@ -124,14 +124,14 @@ our Readonly %SITEMAP_SUFFIX_INFO = map {
if ($entity_type eq 'instrument') {
$suffix_info->{recordings} = {
- extra_sql => {columns => "(SELECT count(recording) FROM tmp_sitemaps_instrument_recordings tsir where tsir.instrument = instrument.id) recording_count"},
- paginated => "recording_count",
+ extra_sql => {columns => '(SELECT count(recording) FROM tmp_sitemaps_instrument_recordings tsir where tsir.instrument = instrument.id) recording_count'},
+ paginated => 'recording_count',
suffix => 'recordings',
priority => priority_by_count('recording_count'),
};
$suffix_info->{releases} = {
- extra_sql => {columns => "(SELECT count(release) FROM tmp_sitemaps_instrument_releases tsir where tsir.instrument = instrument.id) release_count"},
- paginated => "release_count",
+ extra_sql => {columns => '(SELECT count(release) FROM tmp_sitemaps_instrument_releases tsir where tsir.instrument = instrument.id) release_count'},
+ paginated => 'release_count',
suffix => 'releases',
priority => priority_by_count('release_count'),
};
@@ -139,16 +139,16 @@ our Readonly %SITEMAP_SUFFIX_INFO = map {
if ($entity_type eq 'label') {
$suffix_info->{base}{extra_sql} = {
- columns => "(SELECT count(DISTINCT release) FROM release_label WHERE release_label.label = label.id) release_count"
+ columns => '(SELECT count(DISTINCT release) FROM release_label WHERE release_label.label = label.id) release_count'
};
- $suffix_info->{base}{paginated} = "release_count";
+ $suffix_info->{base}{paginated} = 'release_count';
}
if ($entity_type eq 'place') {
$suffix_info->{events} = {
# NOTE: no temporary table needed, since this can really probably just hit l_event_place directly, no need to join or union. Can revisit if performance is an issue.
- extra_sql => {columns => "(SELECT count(DISTINCT entity0) FROM l_event_place WHERE entity1 = place.id) event_count"},
- paginated => "event_count",
+ extra_sql => {columns => '(SELECT count(DISTINCT entity0) FROM l_event_place WHERE entity1 = place.id) event_count'},
+ paginated => 'event_count',
suffix => 'events',
priority => priority_by_count('event_count'),
};
@@ -219,15 +219,15 @@ our Readonly %SITEMAP_SUFFIX_INFO = map {
if ($entity_type eq 'release_group') {
$suffix_info->{base}{extra_sql} = {
- columns => "(SELECT count(DISTINCT release.id) FROM release WHERE release.release_group = release_group.id) release_count"
+ columns => '(SELECT count(DISTINCT release.id) FROM release WHERE release.release_group = release_group.id) release_count'
};
- $suffix_info->{base}{paginated} = "release_count";
+ $suffix_info->{base}{paginated} = 'release_count';
}
if ($entity_type eq 'work') {
$suffix_info->{recordings} = {
- extra_sql => {columns => "(SELECT recordings_count FROM tmp_sitemaps_work_recordings_count WHERE work = work.id) recordings_count"},
- paginated => "recordings_count",
+ extra_sql => {columns => '(SELECT recordings_count FROM tmp_sitemaps_work_recordings_count WHERE work = work.id) recordings_count'},
+ paginated => 'recordings_count',
suffix => 'direction=2&link_type_id=278',
suffix_delimiter => '?',
filename_suffix => 'recordings',
diff --git a/lib/MusicBrainz/Server/Sitemap/Incremental.pm b/lib/MusicBrainz/Server/Sitemap/Incremental.pm
index 900fa93a341..40812f49164 100644
--- a/lib/MusicBrainz/Server/Sitemap/Incremental.pm
+++ b/lib/MusicBrainz/Server/Sitemap/Incremental.pm
@@ -109,21 +109,21 @@ sub get_changed_documents {
$last_modified = $c->sql->select_single_value('SELECT now()');
}
- my $old_hash = $c->sql->select_single_value(<<~"EOSQL", $row_id, $url);
+ my $old_hash = $c->sql->select_single_value(<<~"SQL", $row_id, $url);
SELECT encode(jsonld_sha1, 'hex')
FROM sitemaps.${entity_type}_lastmod
WHERE id = ? AND url = ?
- EOSQL
+ SQL
if (defined $old_hash) {
if ($old_hash ne $new_hash) {
log("Found change at $url");
- $c->sql->do(<<~"EOSQL", "\\x$new_hash", $last_modified, $replication_sequence, $row_id, $url);
+ $c->sql->do(<<~"SQL", "\\x$new_hash", $last_modified, $replication_sequence, $row_id, $url);
UPDATE sitemaps.${entity_type}_lastmod
SET jsonld_sha1 = ?, last_modified = ?, replication_sequence = ?
WHERE id = ? AND url = ?
- EOSQL
+ SQL
return 1;
}
log("No change at $url");
@@ -283,7 +283,7 @@ sub run {
);
unless (-f $self->index_localname) {
- log("ERROR: No sitemap index file was found");
+ log('ERROR: No sitemap index file was found');
exit 1;
}
diff --git a/lib/MusicBrainz/Server/Sitemap/Overall.pm b/lib/MusicBrainz/Server/Sitemap/Overall.pm
index 70753b3251d..e4e2873756f 100644
--- a/lib/MusicBrainz/Server/Sitemap/Overall.pm
+++ b/lib/MusicBrainz/Server/Sitemap/Overall.pm
@@ -36,81 +36,81 @@ sub create_temporary_tables {
$sql->begin;
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_direct_rgs
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_direct_rgs
(artist INTEGER,
rg INTEGER,
is_official BOOLEAN NOT NULL,
PRIMARY KEY (artist, rg))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_va_rgs
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_va_rgs
(artist INTEGER,
rg INTEGER,
is_official BOOLEAN NOT NULL,
PRIMARY KEY (artist, rg))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_direct_releases
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_direct_releases
(artist INTEGER,
release INTEGER,
PRIMARY KEY (artist, release))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_va_releases
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_va_releases
(artist INTEGER,
release INTEGER,
PRIMARY KEY (artist, release))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_recordings
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_recordings
(artist INTEGER,
recording INTEGER,
is_video BOOLEAN NOT NULL,
is_standalone BOOLEAN NOT NULL,
PRIMARY KEY (artist, recording))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_artist_works
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_artist_works
(artist INTEGER,
work INTEGER,
PRIMARY KEY (artist, work))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_instrument_recordings
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_instrument_recordings
(instrument INTEGER,
recording INTEGER,
PRIMARY KEY (instrument, recording))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_instrument_releases
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_instrument_releases
(instrument INTEGER,
release INTEGER,
PRIMARY KEY (instrument, release))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->do(
- "CREATE TEMPORARY TABLE tmp_sitemaps_work_recordings_count
+ 'CREATE TEMPORARY TABLE tmp_sitemaps_work_recordings_count
(work INTEGER,
recordings_count INTEGER,
PRIMARY KEY (work))
- ON COMMIT DELETE ROWS");
+ ON COMMIT DELETE ROWS');
$sql->commit;
}
sub fill_temporary_tables {
my ($self, $sql) = @_;
- my $is_official = "(EXISTS (SELECT TRUE FROM release WHERE release.release_group = q.rg AND release.status = '1')
- OR NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = q.rg AND release.status IS NOT NULL))";
+ my $is_official = q{(EXISTS (SELECT TRUE FROM release WHERE release.release_group = q.rg AND release.status = '1')
+ OR NOT EXISTS (SELECT 1 FROM release WHERE release.release_group = q.rg AND release.status IS NOT NULL))};
# Release groups that will appear on the non-VA listings, per artist
log('Filling tmp_sitemaps_artist_direct_rgs');
@@ -121,7 +121,7 @@ sub fill_temporary_tables {
JOIN artist_credit_name ON release_group.artist_credit = artist_credit_name.artist_credit) q");
log('Analyzing tmp_sitemaps_artist_direct_rgs');
- $sql->do("ANALYZE tmp_sitemaps_artist_direct_rgs");
+ $sql->do('ANALYZE tmp_sitemaps_artist_direct_rgs');
# Release groups that will appear on the VA listings, per artist. Uses the above temporary table to exclude non-VA appearances.
log('Filling tmp_sitemaps_artist_va_rgs');
@@ -136,32 +136,32 @@ sub fill_temporary_tables {
WHERE NOT EXISTS (SELECT TRUE FROM tmp_sitemaps_artist_direct_rgs WHERE artist = artist_credit_name.artist AND rg = release_group.id)) q");
log('Analyzing tmp_sitemaps_artist_va_rgs');
- $sql->do("ANALYZE tmp_sitemaps_artist_va_rgs");
+ $sql->do('ANALYZE tmp_sitemaps_artist_va_rgs');
# Releases that will appear in the non-VA part of the artist releases tab, per artist
log('Filling tmp_sitemaps_artist_direct_releases');
- $sql->do("INSERT INTO tmp_sitemaps_artist_direct_releases (artist, release)
+ $sql->do('INSERT INTO tmp_sitemaps_artist_direct_releases (artist, release)
SELECT DISTINCT artist_credit_name.artist AS artist, release.id AS release
- FROM release JOIN artist_credit_name ON release.artist_credit = artist_credit_name.artist_credit");
+ FROM release JOIN artist_credit_name ON release.artist_credit = artist_credit_name.artist_credit');
log('Analyzing tmp_sitemaps_artist_direct_releases');
- $sql->do("ANALYZE tmp_sitemaps_artist_direct_releases");
+ $sql->do('ANALYZE tmp_sitemaps_artist_direct_releases');
# Releases that will appear in the VA listings instead. Uses above table to exclude non-VA appearances.
log('Filling tmp_sitemaps_artist_va_releases');
- $sql->do("INSERT INTO tmp_sitemaps_artist_va_releases (artist, release)
+ $sql->do('INSERT INTO tmp_sitemaps_artist_va_releases (artist, release)
SELECT DISTINCT artist_credit_name.artist AS artist, release.id AS release
FROM release
JOIN medium ON medium.release = release.id
JOIN track ON track.medium = medium.id
JOIN artist_credit_name ON track.artist_credit = artist_credit_name.artist_credit
- WHERE NOT EXISTS (SELECT TRUE FROM tmp_sitemaps_artist_direct_releases WHERE artist = artist_credit_name.artist AND release = release.id)");
+ WHERE NOT EXISTS (SELECT TRUE FROM tmp_sitemaps_artist_direct_releases WHERE artist = artist_credit_name.artist AND release = release.id)');
log('Analyzing tmp_sitemaps_artist_va_releases');
- $sql->do("ANALYZE tmp_sitemaps_artist_va_releases");
+ $sql->do('ANALYZE tmp_sitemaps_artist_va_releases');
log('Filling tmp_sitemaps_artist_recordings');
- $sql->do("INSERT INTO tmp_sitemaps_artist_recordings (artist, recording, is_video, is_standalone)
+ $sql->do('INSERT INTO tmp_sitemaps_artist_recordings (artist, recording, is_video, is_standalone)
WITH track_recordings (recording) AS (
SELECT DISTINCT recording FROM track
)
@@ -170,66 +170,66 @@ sub fill_temporary_tables {
video as is_video, track_recordings.recording IS NULL AS is_standalone
FROM recording
JOIN artist_credit_name ON recording.artist_credit = artist_credit_name.artist_credit
- LEFT JOIN track_recordings ON recording.id = track_recordings.recording");
+ LEFT JOIN track_recordings ON recording.id = track_recordings.recording');
log('Analyzing tmp_sitemaps_artist_recordings');
- $sql->do("ANALYZE tmp_sitemaps_artist_recordings");
+ $sql->do('ANALYZE tmp_sitemaps_artist_recordings');
# Works linked directly to artists as well as via recording ACs.
log('Filling tmp_sitemaps_artist_works');
- $sql->do("INSERT INTO tmp_sitemaps_artist_works (artist, work)
+ $sql->do('INSERT INTO tmp_sitemaps_artist_works (artist, work)
SELECT entity0 AS artist, entity1 AS work from l_artist_work
UNION DISTINCT
SELECT tsar.artist AS artist, entity1 AS work
FROM tmp_sitemaps_artist_recordings tsar
- JOIN l_recording_work ON tsar.recording = l_recording_work.entity0");
+ JOIN l_recording_work ON tsar.recording = l_recording_work.entity0');
log('Analyzing tmp_sitemaps_artist_works');
- $sql->do("ANALYZE tmp_sitemaps_artist_works");
+ $sql->do('ANALYZE tmp_sitemaps_artist_works');
# Instruments linked to recordings via artist-recording relationship
# attributes. Matches Data::Recording, which also ignores other tables
log('Filling tmp_sitemaps_instrument_recordings');
- $sql->do("INSERT INTO tmp_sitemaps_instrument_recordings (instrument, recording)
+ $sql->do('INSERT INTO tmp_sitemaps_instrument_recordings (instrument, recording)
SELECT DISTINCT instrument.id AS instrument, l_artist_recording.entity1 AS recording
FROM instrument
JOIN link_attribute_type ON link_attribute_type.gid = instrument.gid
JOIN link_attribute ON link_attribute.attribute_type = link_attribute_type.id
- JOIN l_artist_recording ON l_artist_recording.link = link_attribute.link");
+ JOIN l_artist_recording ON l_artist_recording.link = link_attribute.link');
log('Analyzing tmp_sitemaps_instrument_recordings');
- $sql->do("ANALYZE tmp_sitemaps_instrument_recordings");
+ $sql->do('ANALYZE tmp_sitemaps_instrument_recordings');
# Instruments linked to releases via artist-release relationship
# attributes. Matches Data::Release, which also ignores other tables
log('Filling tmp_sitemaps_instrument_releases');
- $sql->do("INSERT INTO tmp_sitemaps_instrument_releases (instrument, release)
+ $sql->do('INSERT INTO tmp_sitemaps_instrument_releases (instrument, release)
SELECT DISTINCT instrument.id AS instrument, l_artist_release.entity1 AS release
FROM instrument
JOIN link_attribute_type ON link_attribute_type.gid = instrument.gid
JOIN link_attribute ON link_attribute.attribute_type = link_attribute_type.id
- JOIN l_artist_release ON l_artist_release.link = link_attribute.link");
+ JOIN l_artist_release ON l_artist_release.link = link_attribute.link');
log('Analyzing tmp_sitemaps_instrument_releases');
- $sql->do("ANALYZE tmp_sitemaps_instrument_releases");
+ $sql->do('ANALYZE tmp_sitemaps_instrument_releases');
# Recordings linked to works via performance / "recording of"
# relationships, but only where the number of recordings per work
# exceeds 100 (`DEFAULT_LOAD_PAGED_LIMIT`). We already output the
# first such 100 recordings on the work index page.
log('Filling tmp_sitemaps_work_recordings_count');
- $sql->do("INSERT INTO tmp_sitemaps_work_recordings_count (work, recordings_count)
+ $sql->do('INSERT INTO tmp_sitemaps_work_recordings_count (work, recordings_count)
SELECT DISTINCT q.work, q.recordings_count FROM
(SELECT lrw.entity1 AS work,
count(lrw.entity0) OVER (PARTITION BY lrw.entity1) AS recordings_count
FROM l_recording_work lrw
JOIN link l ON l.id = lrw.link
WHERE l.link_type = 278) q
- WHERE q.recordings_count > ?",
+ WHERE q.recordings_count > ?',
$MusicBrainz::Server::Data::Relationship::DEFAULT_LOAD_PAGED_LIMIT);
log('Analyzing tmp_sitemaps_work_recordings_count');
- $sql->do("ANALYZE tmp_sitemaps_work_recordings_count");
+ $sql->do('ANALYZE tmp_sitemaps_work_recordings_count');
}
sub drop_temporary_tables {
@@ -244,10 +244,10 @@ sub drop_temporary_tables {
artist_works
instrument_recordings
instrument_releases )) {
- $sql->do(<<~"EOSQL");
+ $sql->do(<<~"SQL");
SET client_min_messages TO WARNING;
DROP TABLE IF EXISTS tmp_sitemaps_$table;
- EOSQL
+ SQL
}
$sql->commit;
}
@@ -418,7 +418,7 @@ sub run {
$self->create_temporary_tables($sql);
$sql->begin;
- $sql->do("SET TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ");
+ $sql->do('SET TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ');
$self->fill_temporary_tables($sql);
for my $entity_type (entities_with(['mbid', 'indexable']), 'cdtoc') {
$self->build_one_entity($c, $entity_type);
@@ -433,10 +433,10 @@ sub run {
# `sitemaps.control` so that the incremental sitemap builds know what
# changes to include.
$sql->auto_commit(1);
- $sql->do(<<~'EOSQL');
+ $sql->do(<<~'SQL');
UPDATE sitemaps.control
SET overall_sitemaps_replication_sequence = last_processed_replication_sequence
- EOSQL
+ SQL
# Finally, ping search engines (if the option is turned on) and finish.
$self->ping_search_engines($c);
diff --git a/lib/MusicBrainz/Server/Test.pm b/lib/MusicBrainz/Server/Test.pm
index ec79bd2ba78..299f774af6a 100644
--- a/lib/MusicBrainz/Server/Test.pm
+++ b/lib/MusicBrainz/Server/Test.pm
@@ -2,8 +2,8 @@ package MusicBrainz::Server::Test;
use feature 'state';
-binmode STDOUT, ":utf8";
-binmode STDERR, ":utf8";
+binmode STDOUT, ':utf8';
+binmode STDERR, ':utf8';
use DBDefs;
use Encode qw( encode );
@@ -49,8 +49,8 @@ use Sub::Exporter -setup => {
BEGIN {
no warnings 'redefine';
use DBDefs;
- *DBDefs::WEB_SERVER = sub { "localhost" };
- *DBDefs::WEB_SERVER_USED_IN_EMAIL = sub { "localhost" };
+ *DBDefs::WEB_SERVER = sub { 'localhost' };
+ *DBDefs::WEB_SERVER_USED_IN_EMAIL = sub { 'localhost' };
*DBDefs::RECAPTCHA_PUBLIC_KEY = sub { undef };
*DBDefs::RECAPTCHA_PRIVATE_KEY = sub { undef };
*DBDefs::OAUTH2_ENFORCE_TLS = sub { 0 };
@@ -152,7 +152,7 @@ sub get_latest_edit
my ($class, $c) = @_;
my $ed = MusicBrainz::Server::Data::Edit->new(c => $c);
my $sql = Sql->new($c->conn);
- my $last_id = $sql->select_single_value("SELECT id FROM edit ORDER BY ID DESC LIMIT 1") or return;
+ my $last_id = $sql->select_single_value('SELECT id FROM edit ORDER BY ID DESC LIMIT 1') or return;
return $ed->get_by_id($last_id);
}
@@ -226,7 +226,7 @@ sub xml_ok
{
my ($content, $message) = @_;
- $message ||= "well-formed XML";
+ $message ||= 'well-formed XML';
my $parser = XML::Parser->new(Style => 'Tree');
eval { $parser->parse($content) };
@@ -235,7 +235,7 @@ sub xml_ok
my @lines = split /\n/, $content;
my $line = 1;
foreach (@lines) {
- $Test->diag(sprintf "%03d %s", $line, $_);
+ $Test->diag(sprintf '%03d %s', $line, $_);
$line += 1;
}
$Test->diag("XML::Parser error: $error");
@@ -295,7 +295,7 @@ sub schema_validator
$version = '2.0' if $version == 2 || !$version;
my $mmd_root = $ENV{'MMD_SCHEMA_ROOT'} ||
- Cwd::realpath( File::Basename::dirname(__FILE__) ) . "/../../../../mmd-schema";
+ Cwd::realpath( File::Basename::dirname(__FILE__) ) . '/../../../../mmd-schema';
my $rng_file = "$mmd_root/schema/musicbrainz_mmd-$version.rng";
@@ -307,8 +307,8 @@ sub schema_validator
if ($@)
{
- warn "Cannot find or parse RNG schema. Set environment var MMD_SCHEMA_ROOT to point ".
- "to the mmd-schema directory or check out the mmd-schema in parallel to ".
+ warn 'Cannot find or parse RNG schema. Set environment var MMD_SCHEMA_ROOT to point '.
+ 'to the mmd-schema directory or check out the mmd-schema in parallel to '.
"the mb_server source. No schema validation will happen.\n";
undef $rngschema;
}
@@ -318,11 +318,11 @@ sub schema_validator
my ($xml, $message) = @_;
- $message ||= "Validate against schema";
+ $message ||= 'Validate against schema';
SKIP: {
- skip "schema not found", 1 unless $rngschema;
+ skip 'schema not found', 1 unless $rngschema;
my $doc = XML::LibXML->new()->parse_string($xml);
eval
@@ -348,7 +348,7 @@ sub _build_ws_test_xml {
$opts ||= {};
my $mech = MusicBrainz::WWW::Mechanize->new(catalyst_app => 'MusicBrainz::Server');
- $mech->default_header("Accept" => "application/xml");
+ $mech->default_header('Accept' => 'application/xml');
$Test->subtest($msg => sub {
if (exists $opts->{username} && exists $opts->{password}) {
$mech->credentials('localhost:80', 'musicbrainz.org', $opts->{username}, $opts->{password});
@@ -380,7 +380,7 @@ sub _build_ws_test_json {
$opts ||= {};
my $mech = MusicBrainz::WWW::Mechanize->new(catalyst_app => 'MusicBrainz::Server');
- $mech->default_header("Accept" => "application/json");
+ $mech->default_header('Accept' => 'application/json');
$Test->subtest($msg => sub {
if (exists $opts->{username} && exists $opts->{password}) {
$mech->credentials('localhost:80', 'musicbrainz.org', $opts->{username}, $opts->{password});
@@ -459,7 +459,7 @@ sub commandline_override
my ($prefix, @default_tests) = @_;
my $test_re = '';
- GetOptions("tests=s" => \$test_re);
+ GetOptions('tests=s' => \$test_re);
return grep { $_ =~ /$test_re/ } @default_tests;
}
diff --git a/lib/MusicBrainz/Server/Test/HTML5.pm b/lib/MusicBrainz/Server/Test/HTML5.pm
index c571fd0b235..019edf9fb0d 100644
--- a/lib/MusicBrainz/Server/Test/HTML5.pm
+++ b/lib/MusicBrainz/Server/Test/HTML5.pm
@@ -67,7 +67,7 @@ sub format_message
if ($opts{ignored})
{
- return sprintf("%s (ignored): %s", $msg->{type}, $msg->{message});
+ return sprintf('%s (ignored): %s', $msg->{type}, $msg->{message});
}
else
{
@@ -95,8 +95,8 @@ sub save_html
if ($ENV{SAVE_HTML}) {
my ($fh, $filename) = tempfile(
- "html5_ok_XXXX", SUFFIX => $suffix, TMPDIR => 1);
- print $fh encode("utf-8", $content);
+ 'html5_ok_XXXX', SUFFIX => $suffix, TMPDIR => 1);
+ print $fh encode('utf-8', $content);
close($fh);
$Test->diag("failed output written to $filename");
};
@@ -112,7 +112,7 @@ sub html5_ok
{
my ($Test, $content, $message) = @_;
- $message ||= "valid HTML5";
+ $message ||= 'valid HTML5';
unless (utf8::is_utf8($content)) {
$Test->ok(0, "$message, need to know encoding of content");
@@ -122,7 +122,7 @@ sub html5_ok
my $url = DBDefs->HTML_VALIDATOR;
unless ($url) {
- $Test->skip("No HTML_VALIDATOR configured, skip html validation");
+ $Test->skip('No HTML_VALIDATOR configured, skip html validation');
return;
}
@@ -132,7 +132,7 @@ sub html5_ok
my $request = HTTP::Request->new(POST => $url);
$request->header('Content-Type', 'text/html');
- $request->content(encode("utf-8", $content));
+ $request->content(encode('utf-8', $content));
my $all_ok = 1;
@@ -142,11 +142,11 @@ sub html5_ok
my $report = decode_json($response->content);
for my $msg (@{ $report->{messages} })
{
- next if $msg->{type} eq "info";
+ next if $msg->{type} eq 'info';
if (ignore_warning($msg))
{
- $Test->diag(format_message($msg, "ignored" => 1));
+ $Test->diag(format_message($msg, 'ignored' => 1));
}
else
{
@@ -158,10 +158,10 @@ sub html5_ok
else
{
$all_ok = 0;
- $message .= ", Could not connect to ".$url;
+ $message .= ', Could not connect to '.$url;
}
- save_html($Test, $content, ".html") unless $all_ok;
+ save_html($Test, $content, '.html') unless $all_ok;
$Test->ok($all_ok, $message);
}
diff --git a/lib/MusicBrainz/Server/Track.pm b/lib/MusicBrainz/Server/Track.pm
index c1487f7c8cd..c3ef2a41449 100644
--- a/lib/MusicBrainz/Server/Track.pm
+++ b/lib/MusicBrainz/Server/Track.pm
@@ -13,7 +13,7 @@ use Sub::Exporter -setup => {
sub { UnformatTrackLength(shift) }
},
format_iso_duration => sub {
- sub { FormatTrackLength(shift, print_formats => {hms => "PT%dH%02dM%02dS", ms => "PT%02dM%02dS"}) }
+ sub { FormatTrackLength(shift, print_formats => {hms => 'PT%dH%02dM%02dS', ms => 'PT%02dM%02dS'}) }
},
]
};
@@ -21,9 +21,9 @@ use Sub::Exporter -setup => {
sub FormatTrackLength
{
my ($ms, %opts) = @_;
- my $print_formats = $opts{print_formats} // {hms => "%d:%02d:%02d", ms => "%d:%02d"};
+ my $print_formats = $opts{print_formats} // {hms => '%d:%02d:%02d', ms => '%d:%02d'};
- return "?:??" unless $ms;
+ return '?:??' unless $ms;
return $ms unless looks_like_number($ms);
return "$ms ms" if $ms < 1000;
diff --git a/lib/MusicBrainz/Server/Validation.pm b/lib/MusicBrainz/Server/Validation.pm
index 72bb5708d87..e9bfc45bc8e 100644
--- a/lib/MusicBrainz/Server/Validation.pm
+++ b/lib/MusicBrainz/Server/Validation.pm
@@ -134,11 +134,11 @@ sub is_guid
sub trim_in_place
{
- carp "Uninitialized value passed to trim_in_place"
+ carp 'Uninitialized value passed to trim_in_place'
if grep { not defined } @_;
for (@_)
{
- $_ = "" if not defined;
+ $_ = '' if not defined;
# TODO decode, trim, encode?
s/\A\s+//;
s/\s+\z//;
@@ -172,7 +172,7 @@ sub format_ipi
my $ipi = shift;
return $ipi unless $ipi =~ /^[0-9\s.]{5,}$/;
$ipi =~ s/[\s.]//g;
- return sprintf("%011.0f", $ipi)
+ return sprintf('%011.0f', $ipi)
}
sub is_valid_isni
@@ -382,7 +382,7 @@ sub normalise_strings
$t =~ s/[\x{2026}\x{22EF}]/.../g;
# Unaccent what's left
- decode("utf-16", unaccent_utf16(encode("utf-16", $t)));
+ decode('utf-16', unaccent_utf16(encode('utf-16', $t)));
} @_;
wantarray ? @r : $r[-1];
@@ -405,7 +405,7 @@ sub dms {
$seconds =~ s/,/./;
return
- sprintf("%.6f", ((0+$degrees) + ((0+$minutes) * 60 + (0+$seconds)) / 3600) * direction($dir))
+ sprintf('%.6f', ((0+$degrees) + ((0+$minutes) * 60 + (0+$seconds)) / 3600) * direction($dir))
+ 0; # remove trailing zeroes (MBS-7438)
}
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Area.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Area.pm
index c9ccf6db123..e03e344ecdf 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Area.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Area.pm
@@ -9,8 +9,8 @@ sub serialize
my %body;
$body{name} = $entity->name;
- $body{"sort-name"} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{'sort-name'} = $entity->name;
+ $body{disambiguation} = $entity->comment // '';
$body{'iso-3166-1-codes'} = [$entity->iso_3166_1_codes] if $entity->iso_3166_1_codes;
$body{'iso-3166-2-codes'} = [$entity->iso_3166_2_codes] if $entity->iso_3166_2_codes;
$body{'iso-3166-3-codes'} = [$entity->iso_3166_3_codes] if $entity->iso_3166_3_codes;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
index ab1cebd6224..2fe7f9ba7ea 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Artist.pm
@@ -11,8 +11,8 @@ sub serialize
my %body;
$body{name} = $entity->name;
- $body{"sort-name"} = $entity->sort_name;
- $body{disambiguation} = $entity->comment // "";
+ $body{'sort-name'} = $entity->sort_name;
+ $body{disambiguation} = $entity->comment // '';
if ($toplevel)
{
@@ -28,16 +28,16 @@ sub serialize
$body{begin_area} = $body{'begin-area'};
$body{end_area} = $body{'end-area'};
- $body{recordings} = list_of($entity, $inc, $stash, "recordings")
+ $body{recordings} = list_of($entity, $inc, $stash, 'recordings')
if ($inc && $inc->recordings);
- $body{releases} = list_of($entity, $inc, $stash, "releases")
+ $body{releases} = list_of($entity, $inc, $stash, 'releases')
if ($inc && $inc->releases);
- $body{"release-groups"} = list_of($entity, $inc, $stash, "release_groups")
+ $body{'release-groups'} = list_of($entity, $inc, $stash, 'release_groups')
if ($inc && $inc->release_groups);
- $body{works} = list_of($entity, $inc, $stash, "works")
+ $body{works} = list_of($entity, $inc, $stash, 'works')
if ($inc && $inc->works);
}
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ArtistCredit.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ArtistCredit.pm
index b2d39b3c24f..cf9bdf9445f 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ArtistCredit.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ArtistCredit.pm
@@ -12,9 +12,9 @@ sub serialize
my @body = map {
{
- "name" => $_->name,
- "joinphrase" => $_->join_phrase,
- "artist" => serialize_entity($_->artist, $inc, $stash),
+ 'name' => $_->name,
+ 'joinphrase' => $_->join_phrase,
+ 'artist' => serialize_entity($_->artist, $inc, $stash),
}
} @{ $entity->names };
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDStub.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDStub.pm
index 278eee889c5..5256f41dee7 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDStub.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDStub.pm
@@ -24,7 +24,7 @@ sub serialize
length => $_->length
}, $cdstub->all_tracks
],
- "track-count" => $cdstub->track_count
+ 'track-count' => $cdstub->track_count
};
};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDTOC.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDTOC.pm
index 2526e9bc457..670834ec2e7 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDTOC.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/CDTOC.pm
@@ -10,7 +10,7 @@ sub serialize
my %body;
$body{id} = $entity->discid;
- $body{"offset-count"} = number($entity->track_count);
+ $body{'offset-count'} = number($entity->track_count);
$body{sectors} = number($entity->leadout_offset);
my @list;
@@ -24,7 +24,7 @@ sub serialize
if ($toplevel)
{
- $body{releases} = list_of($entity, $inc, $stash, "releases", $toplevel);
+ $body{releases} = list_of($entity, $inc, $stash, 'releases', $toplevel);
}
return \%body;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Collection.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Collection.pm
index 1b9b56fed0a..e972ed71d7f 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Collection.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Collection.pm
@@ -18,7 +18,7 @@ sub serialize {
$body{name} = $entity->name;
$body{editor} = $entity->editor->name;
- $body{"entity-type"} = $entity_type;
+ $body{'entity-type'} = $entity_type;
my $entity_properties = $ENTITIES{$entity_type};
my $plural = $entity_properties->{plural};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Event.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Event.pm
index f39db86b98c..7b5b919ebaf 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Event.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Event.pm
@@ -10,9 +10,9 @@ sub serialize
my %body;
$body{name} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
- $body{time} = $entity->formatted_time // "";
- $body{setlist} = $entity->setlist // "";
+ $body{disambiguation} = $entity->comment // '';
+ $body{time} = $entity->formatted_time // '';
+ $body{setlist} = $entity->setlist // '';
$body{cancelled} = boolean($entity->cancelled);
return \%body;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Genre.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Genre.pm
index 33f44d3473d..124a4414489 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Genre.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Genre.pm
@@ -8,7 +8,7 @@ sub serialize {
my %body;
$body{name} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
return \%body;
};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Instrument.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Instrument.pm
index 8eefcbac083..403ceba1858 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Instrument.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Instrument.pm
@@ -9,8 +9,8 @@ sub serialize {
my %body;
$body{name} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
- $body{description} = $entity->description // "";
+ $body{disambiguation} = $entity->comment // '';
+ $body{description} = $entity->description // '';
return \%body;
};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
index 46774d28759..768917df4c1 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Label.pm
@@ -10,16 +10,16 @@ sub serialize
my %body;
$body{name} = $entity->name;
- $body{"sort-name"} = $entity->name;
- $body{"label-code"} = number($entity->label_code);
- $body{disambiguation} = $entity->comment // "";
+ $body{'sort-name'} = $entity->name;
+ $body{'label-code'} = number($entity->label_code);
+ $body{disambiguation} = $entity->comment // '';
if ($toplevel)
{
$body{country} = $entity->area && $entity->area->country_code ? $entity->area->country_code : JSON::null;
$body{area} = $entity->area ? serialize_entity($entity->area) : JSON::null;
- $body{releases} = list_of($entity, $inc, $stash, "releases")
+ $body{releases} = list_of($entity, $inc, $stash, 'releases')
if ($inc && $inc->releases);
}
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Medium.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Medium.pm
index f79fed8f8a7..49fc6ed7196 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Medium.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Medium.pm
@@ -23,7 +23,7 @@ sub serialize
} sort_by { $_->cdtoc->discid } $entity->all_cdtocs ];
}
- $body{"track-count"} = number($entity->cdtoc_track_count);
+ $body{'track-count'} = number($entity->cdtoc_track_count);
# Not all tracks in the tracklists may have been loaded. If not all
# tracks have been loaded, only one them will have been loaded which
@@ -44,11 +44,11 @@ sub serialize
if (scalar @list) {
$body{tracks} = \@list ;
- $body{"track-offset"} = number($entity->has_pregap ? 0 : $min - 1);
+ $body{'track-offset'} = number($entity->has_pregap ? 0 : $min - 1);
}
if (my @data_tracks = grep { $_->position > 0 && $_->is_data_track } @tracks) {
- $body{"data-tracks"} = [ map { $self->serialize_track($_, $inc, $stash) } @data_tracks ];
+ $body{'data-tracks'} = [ map { $self->serialize_track($_, $inc, $stash) } @data_tracks ];
}
return \%body;
@@ -70,7 +70,7 @@ sub serialize_track {
$track_output{recording} = serialize_entity($entity->recording, $inc, $stash);
}
- $track_output{"artist-credit"} = serialize_entity($entity->artist_credit, $inc, $stash)
+ $track_output{'artist-credit'} = serialize_entity($entity->artist_credit, $inc, $stash)
if $inc->artist_credits;
return \%track_output;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Place.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Place.pm
index aef7fcd4150..89ef0a1ec32 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Place.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Place.pm
@@ -10,7 +10,7 @@ sub serialize
my %body;
$body{name} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
$body{address} = $entity->address;
$body{area} = $entity->area ? serialize_entity($entity->area) : JSON::null;
$body{coordinates} = $entity->coordinates ?
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Recording.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Recording.pm
index 765e8a2fb1e..eb89f9f9eda 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Recording.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Recording.pm
@@ -16,15 +16,15 @@ sub serialize
my %body;
$body{title} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
$body{length} = number($entity->length);
$body{video} = boolean($entity->video);
if ($entity->artist_credit && ($toplevel || ($inc && $inc->artist_credits))) {
- $body{"artist-credit"} = serialize_entity($entity->artist_credit, $inc, $stash);
+ $body{'artist-credit'} = serialize_entity($entity->artist_credit, $inc, $stash);
}
- $body{releases} = list_of($entity, $inc, $stash, "releases")
+ $body{releases} = list_of($entity, $inc, $stash, 'releases')
if ($toplevel && $inc && $inc->releases);
if ($inc && $inc->isrcs) {
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relationship.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relationship.pm
index 20108772a20..464d206438d 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relationship.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relationship.pm
@@ -21,28 +21,28 @@ sub serialize
serialize_type($body, $entity->link, $inc, $opts, 1);
- $body->{direction} = $entity->direction == 2 ? "backward" : "forward";
+ $body->{direction} = $entity->direction == 2 ? 'backward' : 'forward';
$body->{'ordering-key'} = number($entity->link_order) if $entity->link_order;
serialize_date_period($body, $entity->link);
$body->{attributes} = [ map { $_->type->name } @attributes ];
- $body->{"attribute-values"} = {
+ $body->{'attribute-values'} = {
map {
non_empty($_->text_value) ? ($_->type->name => $_->text_value) : ()
}
@attributes
};
- $body->{"attribute-ids"} = {
+ $body->{'attribute-ids'} = {
map {
$_->type->name => $_->type->gid
}
@attributes
};
- $body->{"attribute-credits"} = {
+ $body->{'attribute-credits'} = {
map {
non_empty($_->credited_as) ? ($_->type->name => $_->credited_as) : ()
}
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Release.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Release.pm
index fba782eaff0..70b0d211f24 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Release.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Release.pm
@@ -57,7 +57,7 @@ sub serialize
$body{asin} = $entity->amazon_asin if ($toplevel);
$body{barcode} = $entity->barcode->code;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
$body{status} = $entity->status ? $entity->status_name : JSON::null;
$body{'status-id'} = $entity->status ? $entity->status->gid : JSON::null;
$body{quality} = _quality($entity->quality);
@@ -76,12 +76,12 @@ sub serialize
};
}
- $body{"text-representation"} = {
+ $body{'text-representation'} = {
script => $entity->script ? $entity->script->iso_code : JSON::null,
language => $entity->language ? $entity->language->iso_code_3 : JSON::null
};
- $body{collections} = list_of($entity, $inc, $stash, "collections")
+ $body{collections} = list_of($entity, $inc, $stash, 'collections')
if $inc && ($inc->collections || $inc->user_collections);
if ($inc && $inc->release_groups)
@@ -95,25 +95,25 @@ sub serialize
# release group artists which already appear in the release artist
# credit.
local $stash->{release_artist_credit} = $entity->artist_credit;
- $body{"release-group"} = serialize_entity($entity->release_group, $inc, $stash);
+ $body{'release-group'} = serialize_entity($entity->release_group, $inc, $stash);
}
if ($toplevel)
{
- $body{"artist-credit"} = serialize_entity($entity->artist_credit, $inc, $stash, $inc->artists)
+ $body{'artist-credit'} = serialize_entity($entity->artist_credit, $inc, $stash, $inc->artists)
if $inc->artist_credits || $inc->artists;
}
else
{
- $body{"artist-credit"} = serialize_entity($entity->artist_credit, $inc, $stash)
+ $body{'artist-credit'} = serialize_entity($entity->artist_credit, $inc, $stash)
if $inc && $inc->artist_credits;
}
- $body{"label-info"} = [
+ $body{'label-info'} = [
map {
my $label = serialize_entity($_->label, $inc, $stash);
{
- "catalog-number" => $_->catalog_number,
+ 'catalog-number' => $_->catalog_number,
label => $label ? $label : JSON::null,
}
} @{ $entity->labels } ] if $toplevel && $inc->labels;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
index 3b5e839906d..b8ef4bc9f3d 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
@@ -10,21 +10,21 @@ sub serialize
my %body;
$body{title} = $entity->name;
- $body{"primary-type"} = $entity->primary_type
+ $body{'primary-type'} = $entity->primary_type
? $entity->primary_type->name : JSON::null;
- $body{"primary-type-id"} = $entity->primary_type
+ $body{'primary-type-id'} = $entity->primary_type
? $entity->primary_type->gid : JSON::null;
- $body{"secondary-types"} = [ map {
+ $body{'secondary-types'} = [ map {
$_->name } $entity->all_secondary_types ];
- $body{"secondary-type-ids"} = [ map {
+ $body{'secondary-type-ids'} = [ map {
$_->gid } $entity->all_secondary_types ];
- $body{"first-release-date"} = $entity->first_release_date->format;
- $body{disambiguation} = $entity->comment // "";
+ $body{'first-release-date'} = $entity->first_release_date->format;
+ $body{disambiguation} = $entity->comment // '';
- $body{"artist-credit"} = serialize_entity($entity->artist_credit, $inc, $stash)
+ $body{'artist-credit'} = serialize_entity($entity->artist_credit, $inc, $stash)
if $inc && ($inc->artist_credits || $inc->artists);
- $body{releases} = list_of($entity, $inc, $stash, "releases")
+ $body{releases} = list_of($entity, $inc, $stash, 'releases')
if $inc && $inc->releases;
return \%body;
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Series.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Series.pm
index 2dd10f0cec2..51a49f91397 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Series.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Series.pm
@@ -8,7 +8,7 @@ sub serialize {
my %body;
$body{name} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
return \%body;
};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
index 30ce6edfeb1..849e79d4a5a 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
@@ -15,7 +15,7 @@ sub serialize
my %body;
$body{title} = $entity->name;
- $body{disambiguation} = $entity->comment // "";
+ $body{disambiguation} = $entity->comment // '';
$body{iswcs} = [ map { $_->iswc } @{ $entity->iswcs } ];
$body{attributes} = [
diff --git a/lib/MusicBrainz/Server/WebService/Validator.pm b/lib/MusicBrainz/Server/WebService/Validator.pm
index 51a0c3ee356..2b4731884df 100644
--- a/lib/MusicBrainz/Server/WebService/Validator.pm
+++ b/lib/MusicBrainz/Server/WebService/Validator.pm
@@ -29,13 +29,13 @@ parameter defs => (
our (%types, %statuses);
our %relation_types = (
1 => {
- "area-rels" => 1,
- "artist-rels" => 1,
- "release-rels" => 1,
- "track-rels" => 1,
- "label-rels" => 1,
- "work-rels" => 1,
- "url-rels" => 1,
+ 'area-rels' => 1,
+ 'artist-rels' => 1,
+ 'release-rels' => 1,
+ 'track-rels' => 1,
+ 'label-rels' => 1,
+ 'work-rels' => 1,
+ 'url-rels' => 1,
},
2 => { entities_with(['mbid', 'relatable'],
take => sub {
@@ -97,7 +97,7 @@ sub validate_type
unless ($inc->releases || $inc->release_groups ||
$resource eq 'release' || $resource eq 'release-group')
{
- $c->stash->{error} = "type is not a valid parameter unless releases or release-groups are requested.";
+ $c->stash->{error} = 'type is not a valid parameter unless releases or release-groups are requested.';
$c->detach('bad_req');
}
@@ -132,7 +132,7 @@ sub validate_status
unless ($inc->releases || $resource eq 'release')
{
- $c->stash->{error} = "status is not a valid parameter unless releases are requested.";
+ $c->stash->{error} = 'status is not a valid parameter unless releases are requested.';
$c->detach('bad_req');
}
@@ -199,7 +199,7 @@ sub validate_inc
my @inc = split(/[+ ]/, $inc || '');
my %acc = map { $_ => 1 } @{ $def };
- my $allow_relations = exists $acc{"_relations"};
+ my $allow_relations = exists $acc{'_relations'};
my @relations_used;
my @filtered;
@@ -230,7 +230,7 @@ sub validate_inc
if (@possible) {
$c->stash->{error} =
"$i is not a valid option for the inc parameter for the $resource resource " .
- "unless you specify one of the following other inc parameters: " .
+ 'unless you specify one of the following other inc parameters: ' .
join(', ', @possible);
}
else {
diff --git a/lib/MusicBrainz/Server/WebService/XMLSerializer.pm b/lib/MusicBrainz/Server/WebService/XMLSerializer.pm
index 05393f96aef..1e9a040bb96 100644
--- a/lib/MusicBrainz/Server/WebService/XMLSerializer.pm
+++ b/lib/MusicBrainz/Server/WebService/XMLSerializer.pm
@@ -1134,7 +1134,7 @@ sub _serialize_relation
unless ($target_type eq 'url')
{
- my $method = "_serialize_" . $target_type;
+ my $method = '_serialize_' . $target_type;
local $in_relation_node = 1;
local $show_aliases = 0;
diff --git a/lib/MusicBrainz/Server/dbmirror.pm b/lib/MusicBrainz/Server/dbmirror.pm
index f7386ebac6c..f27dd3bd3c0 100644
--- a/lib/MusicBrainz/Server/dbmirror.pm
+++ b/lib/MusicBrainz/Server/dbmirror.pm
@@ -40,8 +40,8 @@ sub prepare_insert
%$valuepairs or die;
my @k = sort keys %$valuepairs;
- my $colnames = join ", ", map { qq["$_"] } @k;
- my $params = join ", ", map { "?" } @k;
+ my $colnames = join ', ', map { qq["$_"] } @k;
+ my $params = join ', ', map { '?' } @k;
my @args = @$valuepairs{@k};
my $sql = qq[INSERT INTO $table ($colnames) VALUES ($params)];
@@ -55,7 +55,7 @@ sub prepare_update
%$keypairs or die;
my @k = sort keys %$valuepairs;
- my $setclause = join ", ", map { qq["$_" = ?] } @k;
+ my $setclause = join ', ', map { qq["$_" = ?] } @k;
my @setargs = @$valuepairs{@k};
my ($whereclause, $whereargs) = make_where_clause($keypairs);
@@ -99,7 +99,7 @@ sub make_where_clause
}
}
- my $clause = join " AND ", @conditions;
+ my $clause = join ' AND ', @conditions;
return ($clause, \@args);
}
@@ -123,22 +123,22 @@ sub unpack_data
# Optionally, a quoted string
if ($packed =~ s/\A'//)
{
- $v = "";
+ $v = '';
for (;;)
{
# \\ => \
- $v .= "\\", next if $packed =~ s/\A\\\\//;
+ $v .= '\\', next if $packed =~ s/\A\\\\//;
# \' => '
# '' => '
- $v .= "'", next if $packed =~ s/\A[\\']'//;
+ $v .= q('), next if $packed =~ s/\A[\\']'//;
# End of string
last if $packed =~ s/\A'//;
$packed ne ''
- or warn("Failed to parse: expected string data but found end of string"), return undef;
+ or warn('Failed to parse: expected string data but found end of string'), return undef;
# any other char == itself
$v .= substr($packed, 0, 1, '');
@@ -154,7 +154,7 @@ sub unpack_data
}
if ($seqid == 111117378 || $seqid == 111117379 || $seqid == 111117380 || $seqid == 111404809) {
- $answer{name} = substr($answer{name}, 0, 1000) . "...";
+ $answer{name} = substr($answer{name}, 0, 1000) . '...';
}
return \%answer;
diff --git a/lib/MusicBrainz/WWW/Mechanize.pm b/lib/MusicBrainz/WWW/Mechanize.pm
index 73eb4ce9a03..9d7ca6e3288 100644
--- a/lib/MusicBrainz/WWW/Mechanize.pm
+++ b/lib/MusicBrainz/WWW/Mechanize.pm
@@ -28,7 +28,7 @@ around '_make_request' => sub
$challenge = { @$challenge }; # make rest into a hash
my ($username, $password) = $self->credentials(
- $request->uri->host.":".$request->uri->port, $challenge->{realm});
+ $request->uri->host.':'.$request->uri->port, $challenge->{realm});
my $size = length($request->content);
$response = LWP::Authen::Digest->authenticate(
diff --git a/lib/Plack/Middleware/Debug/DAOLogger.pm b/lib/Plack/Middleware/Debug/DAOLogger.pm
index 5b22a96e186..266e6564c9c 100644
--- a/lib/Plack/Middleware/Debug/DAOLogger.pm
+++ b/lib/Plack/Middleware/Debug/DAOLogger.pm
@@ -21,18 +21,18 @@ sub run {
my $sum = sum(map { $_->[1] } @call_stack);
$panel->content(
- "
This panel shows time spent within the data access layer. Rows ".
- "highlighted in red indicate that time spent within this method ".
- "deviates by more than 1 σ for all calls amongst siblings
".
- "
".
+ '
This panel shows time spent within the data access layer. Rows '.
+ 'highlighted in red indicate that time spent within this method '.
+ 'deviates by more than 1 σ for all calls amongst siblings