19 declare(strict_types=1);
    23     protected \ilDBInterface 
$db;
    35         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'full_name')) {
    36             $this->db->addTableColumn(
    37                 'il_md_cpr_selections',
    49         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'link')) {
    50             $this->db->addTableColumn(
    51                 'il_md_cpr_selections',
    63         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'image_link')) {
    64             $this->db->addTableColumn(
    65                 'il_md_cpr_selections',
    77         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'alt_text')) {
    78             $this->db->addTableColumn(
    79                 'il_md_cpr_selections',
    91         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'migrated')) {
    92             $this->db->addTableColumn(
    93                 'il_md_cpr_selections',
   110         if (!$this->db->tableColumnExists(
'il_md_cpr_selections', 
'image_file')) {
   111             $this->db->addTableColumn(
   112                 'il_md_cpr_selections',
   124         $title = 
"Public Domain";
   125         $full_name = 
"This work is free of known copyright restrictions.";
   126         $link = 
"http://creativecommons.org/publicdomain/zero/1.0/";
   127         $image_link = 
"https://licensebuttons.net/p/zero/1.0/88x31.png";
   130         $next_id = $this->db->nextId(
'il_md_cpr_selections');
   132         $res = $this->db->query(
   133             'SELECT MAX(position) AS max FROM il_md_cpr_selections WHERE is_default = 0'   135         $row = $this->db->fetchAssoc(
$res);
   136         $position = isset($row[
'max']) ? $row[
'max'] + 1 : 0;
   139             'il_md_cpr_selections',
   162         $title = 
"Public Domain";
   163         $full_name = 
"This work is free of known copyright restrictions.";
   164         $old_image_link = 
"https://licensebuttons.net/p/zero/1.0/88x31.png";
   165         $new_image_link = 
"https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg";
   167         $res = $this->db->query(
   168             'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
   173         if (($row = $this->db->fetchAssoc(
$res)) && isset($row[
'entry_id'])) {
   175                 'il_md_cpr_selections',
   188         $title = 
"All rights reserved";
   189         $old_full_name = 
"This work has all rights reserved by the owner.";
   190         $new_full_name = 
"All rights reserved";
   191         $new_description = 
"The copyright holder reserves, or holds for their own use, all the rights provided by copyright law.";
   193         $res = $this->db->query(
   194             'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
   197             " AND COALESCE(link, '') = '' AND COALESCE(description, '') = ''"   199         if (($row = $this->db->fetchAssoc(
$res)) && isset($row[
'entry_id'])) {
   201                 'il_md_cpr_selections',
   217         $title = 
"Public Domain";
   218         $link = 
"http://creativecommons.org/publicdomain/zero/1.0/";
   219         $old_full_name = 
"This work is free of known copyright restrictions.";
   220         $new_full_name = 
"Public Domain";
   221         $new_description = 
"Creative work to which no exclusive intellectual property rights apply.";
   223         $res = $this->db->query(
   224             'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
   228             " AND COALESCE(description, '') = ''"   230         if (($row = $this->db->fetchAssoc(
$res)) && isset($row[
'entry_id'])) {
   232                 'il_md_cpr_selections',
   247         $old_titles_by_link = [
   248             'http://creativecommons.org/licenses/by-nc-nd/4.0/' => 
'Attribution Non-commercial No Derivatives (by-nc-nd)',
   249             'http://creativecommons.org/licenses/by-nc-sa/4.0/' => 
'Attribution Non-commercial Share Alike (by-nc-sa)',
   250             'http://creativecommons.org/licenses/by-nc/4.0/' => 
'Attribution Non-commercial (by-nc)',
   251             'http://creativecommons.org/licenses/by-nd/4.0/' => 
'Attribution No Derivatives (by-nd)',
   252             'http://creativecommons.org/licenses/by-sa/4.0/' => 
'Attribution Share Alike (by-sa)',
   253             'http://creativecommons.org/licenses/by/4.0/' => 
'Attribution (by)'   255         $new_titles_by_link = [
   256             'http://creativecommons.org/licenses/by-nc-nd/4.0/' => 
'Attribution Non-commercial No Derivatives (BY-NC-ND) 4.0',
   257             'http://creativecommons.org/licenses/by-nc-sa/4.0/' => 
'Attribution Non-commercial Share Alike (BY-NC-SA) 4.0',
   258             'http://creativecommons.org/licenses/by-nc/4.0/' => 
'Attribution Non-commercial (BY-NC) 4.0',
   259             'http://creativecommons.org/licenses/by-nd/4.0/' => 
'Attribution No Derivatives (BY-ND) 4.0',
   260             'http://creativecommons.org/licenses/by-sa/4.0/' => 
'Attribution Share Alike (BY-SA) 4.0',
   261             'http://creativecommons.org/licenses/by/4.0/' => 
'Attribution (BY) 4.0'   264         foreach ($old_titles_by_link as $link => $old_title) {
   265             $res = $this->db->query(
   266                 'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
   271                 ($row = $this->db->fetchAssoc(
$res)) &&
   272                 isset($row[
'entry_id']) &&
   273                 isset($new_titles_by_link[$link])
   276                     'il_md_cpr_selections',
   290         $title = 
"All rights reserved";
   291         $old_copyright = 
"This work has all rights reserved by the owner.";
   292         $new_description = 
"The copyright holder reserves, or holds for their own use, all the rights provided by copyright law.";
   294         $res = $this->db->query(
   295             'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
   298             " AND COALESCE(description, '') = ''"   300         if (($row = $this->db->fetchAssoc(
$res)) && isset($row[
'entry_id'])) {
   302                 'il_md_cpr_selections',
 
step_11()
Change title of CC licences, see https://mantis.ilias.de/view.php?id=41898. 
 
step_8()
Replace CC0 image link by svg. 
 
step_12()
Also change description of unmigrated 'All rights reserved', see https://mantis.ilias.de/view.php?id=41301. 
 
step_5()
Add a column to il_md_cpr_selections to track which licences have been migrated. 
 
step_6()
Add a column to il_md_cpr_selections for the string identifier for the licence's image, if it is saved as a file. 
 
step_2()
Add a column to il_md_cpr_selections for the link to the licence. 
 
step_3()
Add a column to il_md_cpr_selections for the link to the licence's image. 
 
step_1()
Add a column to il_md_cpr_selections for the full name of the licence. 
 
step_10()
Change title, description and full name of 'Public Domain', see https://mantis.ilias.de/view.php?id=41301. 
 
prepare(\ilDBInterface $db)
Prepare the execution of the steps. 
 
step_4()
Add a column to il_md_cpr_selections for the alt text of the licence's image. 
 
step_9()
Change title, description and full name of 'All rights reserved', see https://mantis.ilias.de/view.php?id=41301. 
 
step_7()
Add CC0 to the available copyrights.