jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/395673 )

Change subject: Increase rl_title length to account for namespace
......................................................................


Increase rl_title length to account for namespace

Bug: T180092
Change-Id: I30c122b21eb0caf935fabff718eb6bc6f9fdf9fc
---
M i18n/en.json
A sql/patches/05-increase-rle_title-length.sql
M sql/readinglists.sql
M src/Doc/ReadingListEntryRow.php
M src/HookHandler.php
M src/ReadingListRepository.php
6 files changed, 19 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index ce2fbaa..487064b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -76,7 +76,7 @@
        "apihelp-readinglists+createentry-extended-description": "List entries 
must be unique. Pages are not limited to the wiki where the API is accessed. 
The user must have fewer than $1 (non-deleted) {{PLURAL:$1|entry|entries}} in 
the list.",
        "apihelp-readinglists+createentry-param-list": "List ID.",
        "apihelp-readinglists+createentry-param-project": "Project name of the 
wiki hosting the page. (Typically this is the domain name of the wiki.)",
-       "apihelp-readinglists+createentry-param-title": "Page title.",
+       "apihelp-readinglists+createentry-param-title": "Page title (including 
the localised namespace name). Human-readable format (spaces not underscores) 
is recommended. The API treats titles as raw strings; normalization (such as 
title casing) is left to the clients.",
        "apihelp-readinglists+createentry-example-1": "Add the page 
<kbd>Dog</kbd> from project <kbd>en.wikipedia.org</bar> to the list with ID 
<kbd>33</kbd>.",
        "apihelp-readinglists+deleteentry-summary": "Delete a page from a list 
belonging to the current user.",
        "apihelp-readinglists+deleteentry-param-entry": "Entry ID.",
diff --git a/sql/patches/05-increase-rle_title-length.sql 
b/sql/patches/05-increase-rle_title-length.sql
new file mode 100644
index 0000000..55a6ae4
--- /dev/null
+++ b/sql/patches/05-increase-rle_title-length.sql
@@ -0,0 +1,2 @@
+ALTER TABLE reading_list_entry
+MODIFY rle_title VARCHAR(383) BINARY NOT NULL;
\ No newline at end of file
diff --git a/sql/readinglists.sql b/sql/readinglists.sql
index bd61d74..854b4e4 100644
--- a/sql/readinglists.sql
+++ b/sql/readinglists.sql
@@ -48,10 +48,15 @@
     rle_user_id INTEGER UNSIGNED NOT NULL,
     -- Reference to reading_list_project.rlp_id.
     rle_rlp_id INTEGER UNSIGNED NOT NULL,
-    -- Page title.
+    -- Page title (including localised namespace name).
     -- We can't easily use page ids due to the cross-wiki nature of the 
project;
     -- also, page ids don't age well when content is deleted/moved.
-    rle_title VARCHAR(255) BINARY NOT NULL,
+    -- We also can't easily use namespace IDs since most APIs expect the 
namespace name so that's
+    -- what we need to provide to clients; and there is no easy way to map IDs 
to names of a
+    -- different wiki.
+    -- Titles are <=255 byte; we allow 128 more bytes for the namespace name, 
just to be on the
+    -- safe side.
+    rle_title VARCHAR(383) BINARY NOT NULL,
     -- Creation timestamp.
     rle_date_created BINARY(14) NOT NULL default '19700101000000',
     -- Last modification timestamp.
diff --git a/src/Doc/ReadingListEntryRow.php b/src/Doc/ReadingListEntryRow.php
index 277c5e9..c19b637 100644
--- a/src/Doc/ReadingListEntryRow.php
+++ b/src/Doc/ReadingListEntryRow.php
@@ -33,9 +33,12 @@
        public $rlp_project;
 
        /**
-        * Page title.
+        * Page title (including the localised namespace name).
         * We can't easily use page ids due to the cross-wiki nature of the 
project;
         * also, page ids don't age well when content is deleted/moved.
+        * We also can't easily use namespace IDs since most APIs expect the 
namespace name so that's
+        * what we need to provide to clients; and there is no easy way to map 
IDs to names of a
+        * different wiki.
         * @var string
         */
        public $rle_title;
diff --git a/src/HookHandler.php b/src/HookHandler.php
index 5ef6357..5f10e8e 100644
--- a/src/HookHandler.php
+++ b/src/HookHandler.php
@@ -51,6 +51,8 @@
                                "$patchDir/03-add-sort-indexes.sql" );
                        $updater->dropExtensionField( 'reading_list', 
'rl_color',
                                "$patchDir/04-drop-metadata-columns.sql" );
+                       $updater->modifyExtensionField( 'reading_list_entry', 
'rle_title',
+                               "$patchDir/05-increase-rle_title-length.sql" );
                }
                return true;
        }
diff --git a/src/ReadingListRepository.php b/src/ReadingListRepository.php
index f541074..edcac9d 100644
--- a/src/ReadingListRepository.php
+++ b/src/ReadingListRepository.php
@@ -47,7 +47,7 @@
                'rl_name' => 255,
                'rl_description' => 767,
                'rlp_project' => 255,
-               'rle_title' => 255,
+               'rle_title' => 383,
        ];
 
        /** @var int|null Max allowed lists per user */
@@ -336,7 +336,8 @@
         * Add a new page to a list.
         * @param int $id List ID
         * @param string $project Project identifier (typically a domain name)
-        * @param string $title Page title (in localized prefixed DBkey format)
+        * @param string $title Page title (treated as a plain string with no 
normalization;
+        *   in localized namespace-prefixed format with spaces is recommended)
         * @return int The ID of the new list entry
         * @throws ReadingListRepositoryException
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/395673
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I30c122b21eb0caf935fabff718eb6bc6f9fdf9fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ReadingLists
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to