From 2f86cd860231f92213950d439e9a109b7a5f11c4 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 12 Feb 2015 18:18:55 +0100 Subject: [PATCH] utf8mb4 conversion on database with index adjusts --- classes/Attention.php | 4 +- classes/Avatar.php | 8 ++-- classes/Config.php | 4 +- classes/Confirm_address.php | 8 ++-- classes/Consumer.php | 8 ++-- classes/Conversation.php | 4 +- classes/Deleted_notice.php | 4 +- classes/File.php | 14 +++---- classes/File_redirection.php | 4 +- classes/File_thumbnail.php | 8 ++-- classes/Foreign_link.php | 4 +- classes/Foreign_service.php | 4 +- classes/Foreign_user.php | 8 ++-- classes/Group_member.php | 4 +- classes/Invitation.php | 4 +- classes/Location_namespace.php | 4 +- classes/Memcached_DataObject.php | 6 +-- classes/Nonce.php | 4 +- classes/Notice.php | 16 ++++---- classes/Notice_source.php | 8 ++-- classes/Oauth_application.php | 40 +++++++++---------- classes/Oauth_application_user.php | 4 +- classes/Oauth_token_association.php | 4 +- classes/Profile.php | 16 ++++---- classes/Profile_list.php | 8 ++-- classes/Profile_prefs.php | 8 ++-- classes/Sms_carrier.php | 4 +- classes/Status_network.php | 18 ++++----- classes/Subscription.php | 12 +++--- classes/Token.php | 12 +++--- classes/User.php | 20 +++++----- classes/User_group.php | 36 ++++++++--------- classes/User_im_prefs.php | 8 ++-- classes/User_username.php | 8 ++-- db/site.sql | 4 +- extlib/DB.php | 1 + lib/event.php | 5 +++ lib/mysqlschema.php | 9 +++-- .../Blacklist/classes/Homepage_blacklist.php | 4 +- .../Blacklist/classes/Nickname_blacklist.php | 4 +- plugins/Blog/classes/Blog_entry.php | 12 +++--- plugins/Bookmark/classes/Bookmark.php | 12 +++--- plugins/DirectMessage/classes/Message.php | 8 ++-- .../EmailReminder/classes/Email_reminder.php | 8 ++-- plugins/Event/classes/Happening.php | 16 ++++---- plugins/Event/classes/RSVP.php | 4 +- .../FacebookBridge/classes/Notice_to_item.php | 4 +- plugins/Favorite/classes/Fave.php | 4 +- plugins/GNUsocialPhoto/classes/Photo.php | 14 +++---- .../classes/gnusocialphoto.php | 12 +++--- .../classes/gnusocialphotoalbum.php | 4 +- .../GNUsocialProfileExtensionField.php | 8 ++-- plugins/GNUsocialVideo/classes/Video.php | 8 ++-- .../classes/Group_message.php | 8 ++-- plugins/NoticeTitle/classes/Notice_title.php | 4 +- plugins/OStatus/classes/FeedSub.php | 4 +- plugins/OStatus/classes/HubSub.php | 8 ++-- plugins/OStatus/classes/Ostatus_profile.php | 10 ++--- plugins/OStatus/classes/Ostatus_source.php | 2 +- plugins/Oembed/classes/File_oembed.php | 16 ++++---- plugins/OpenID/classes/User_openid.php | 8 ++-- .../OpenID/classes/User_openid_trustroot.php | 4 +- plugins/Poll/classes/Poll.php | 4 +- plugins/Poll/classes/Poll_response.php | 4 +- plugins/QnA/classes/QnA_Answer.php | 4 +- plugins/QnA/classes/QnA_Question.php | 4 +- plugins/Realtime/classes/Realtime_channel.php | 12 +++--- .../classes/Twitter_synch_status.php | 4 +- 68 files changed, 285 insertions(+), 278 deletions(-) diff --git a/classes/Attention.php b/classes/Attention.php index ef0dcb1df7..c15a118e12 100644 --- a/classes/Attention.php +++ b/classes/Attention.php @@ -22,7 +22,7 @@ class Attention extends Managed_DataObject public $__table = 'attention'; // table name public $notice_id; // int(4) primary_key not_null public $profile_id; // int(4) primary_key not_null - public $reason; // varchar(255) + public $reason; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -33,7 +33,7 @@ class Attention extends Managed_DataObject 'fields' => array( 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice_id to give attention'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile_id for feed receiver'), - 'reason' => array('type' => 'varchar', 'length' => 255, 'description' => 'Optional reason why this was brought to the attention of profile_id'), + 'reason' => array('type' => 'varchar', 'length' => 191, 'description' => 'Optional reason why this was brought to the attention of profile_id'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Avatar.php b/classes/Avatar.php index 55abc81b33..3b3317b3ef 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -15,8 +15,8 @@ class Avatar extends Managed_DataObject public $width; // int(4) primary_key not_null public $height; // int(4) primary_key not_null public $mediatype; // varchar(32) not_null - public $filename; // varchar(255) - public $url; // varchar(255) unique_key + public $filename; // varchar(191) not 255 because utf8mb4 takes more space + public $url; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -32,8 +32,8 @@ class Avatar extends Managed_DataObject 'width' => array('type' => 'int', 'not null' => true, 'description' => 'image width'), 'height' => array('type' => 'int', 'not null' => true, 'description' => 'image height'), 'mediatype' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'file type'), - 'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'local filename, if local'), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'avatar location'), + 'filename' => array('type' => 'varchar', 'length' => 191, 'description' => 'local filename, if local'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'avatar location'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Config.php b/classes/Config.php index 899396d710..2e8492849c 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -35,7 +35,7 @@ class Config extends Managed_DataObject public $__table = 'config'; // table name public $section; // varchar(32) primary_key not_null public $setting; // varchar(32) primary_key not_null - public $value; // varchar(255) + public $value; // varchar(191) not 255 because utf8mb4 takes more space /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -46,7 +46,7 @@ class Config extends Managed_DataObject 'fields' => array( 'section' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration section'), 'setting' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration setting'), - 'value' => array('type' => 'varchar', 'length' => 255, 'description' => 'configuration value'), + 'value' => array('type' => 'varchar', 'length' => 191, 'description' => 'configuration value'), ), 'primary key' => array('section', 'setting'), ); diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php index 0ed7796ad4..91a84feb77 100644 --- a/classes/Confirm_address.php +++ b/classes/Confirm_address.php @@ -12,8 +12,8 @@ class Confirm_address extends Managed_DataObject public $__table = 'confirm_address'; // table name public $code; // varchar(32) primary_key not_null public $user_id; // int(4) not_null - public $address; // varchar(255) not_null - public $address_extra; // varchar(255) not_null + public $address; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $address_extra; // varchar(191) not_null not 255 because utf8mb4 takes more space public $address_type; // varchar(8) not_null public $claimed; // datetime() public $sent; // datetime() @@ -28,8 +28,8 @@ class Confirm_address extends Managed_DataObject 'fields' => array( 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who requested confirmation'), - 'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'), - 'address_extra' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'carrier ID, for SMS'), + 'address' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'), + 'address_extra' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'carrier ID, for SMS'), 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'), 'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'), 'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'), diff --git a/classes/Consumer.php b/classes/Consumer.php index 68e973bfb0..4121938ed8 100644 --- a/classes/Consumer.php +++ b/classes/Consumer.php @@ -10,8 +10,8 @@ class Consumer extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'consumer'; // table name - public $consumer_key; // varchar(255) primary_key not_null - public $consumer_secret; // varchar(255) not_null + public $consumer_key; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space + public $consumer_secret; // varchar(191) not_null not 255 because utf8mb4 takes more space public $seed; // char(32) not_null public $created; // datetime not_null public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -24,8 +24,8 @@ class Consumer extends Managed_DataObject return array( 'description' => 'OAuth consumer record', 'fields' => array( - 'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'unique identifier, root URL'), - 'consumer_secret' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'secret value'), + 'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'), + 'consumer_secret' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'secret value'), 'seed' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), diff --git a/classes/Conversation.php b/classes/Conversation.php index 56f61c63ab..343668cc49 100644 --- a/classes/Conversation.php +++ b/classes/Conversation.php @@ -35,7 +35,7 @@ class Conversation extends Managed_DataObject { public $__table = 'conversation'; // table name public $id; // int(4) primary_key not_null - public $uri; // varchar(255) unique_key + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $created; // datetime not_null public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -44,7 +44,7 @@ class Conversation extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'should be set from root notice id (since 2014-03-01 commit)'), - 'uri' => array('type' => 'varchar', 'not null'=>true, 'length' => 255, 'description' => 'URI of the conversation'), + 'uri' => array('type' => 'varchar', 'not null'=>true, 'length' => 191, 'description' => 'URI of the conversation'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Deleted_notice.php b/classes/Deleted_notice.php index 4c17be185a..a9167f19a4 100644 --- a/classes/Deleted_notice.php +++ b/classes/Deleted_notice.php @@ -34,7 +34,7 @@ class Deleted_notice extends Managed_DataObject public $__table = 'deleted_notice'; // table name public $id; // int(4) primary_key not_null public $profile_id; // int(4) not_null - public $uri; // varchar(255) unique_key + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $deleted; // datetime() not_null @@ -47,7 +47,7 @@ class Deleted_notice extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity of notice'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'author of the notice'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'), 'deleted' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'), ), diff --git a/classes/File.php b/classes/File.php index ce2f940161..b42e1a674f 100644 --- a/classes/File.php +++ b/classes/File.php @@ -26,13 +26,13 @@ class File extends Managed_DataObject { public $__table = 'file'; // table name public $id; // int(4) primary_key not_null - public $url; // varchar(255) unique_key + public $url; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $mimetype; // varchar(50) public $size; // int(4) - public $title; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $date; // int(4) public $protected; // int(4) - public $filename; // varchar(255) + public $filename; // varchar(191) not 255 because utf8mb4 takes more space public $width; // int(4) public $height; // int(4) public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -42,13 +42,13 @@ class File extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'destination URL after following redirections'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'destination URL after following redirections'), 'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'), 'size' => array('type' => 'int', 'description' => 'size of resource when available'), - 'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of resource when available'), + 'title' => array('type' => 'varchar', 'length' => 191, 'description' => 'title of resource when available'), 'date' => array('type' => 'int', 'description' => 'date of resource according to http query'), 'protected' => array('type' => 'int', 'description' => 'true when URL is private (needs login)'), - 'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'if a local file, name of the file'), + 'filename' => array('type' => 'varchar', 'length' => 191, 'description' => 'if a local file, name of the file'), 'width' => array('type' => 'int', 'description' => 'width in pixels, if it can be described as such and data is available'), 'height' => array('type' => 'int', 'description' => 'height in pixels, if it can be described as such and data is available'), @@ -152,7 +152,7 @@ class File extends Managed_DataObject } // TODO: max field length - if ($redir_url === $given_url || strlen($redir_url) > 255 || !$followRedirects) { + if ($redir_url === $given_url || strlen($redir_url) > 191 || !$followRedirects) { // Save the File object based on our lookup trace $file = File::saveNew($redir_data, $given_url); } else { diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 0bcccc6cff..d78dc66385 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -29,7 +29,7 @@ class File_redirection extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'file_redirection'; // table name - public $url; // varchar(255) primary_key not_null + public $url; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $file_id; // int(4) public $redirections; // int(4) public $httpcode; // int(4) @@ -42,7 +42,7 @@ class File_redirection extends Managed_DataObject { return array( 'fields' => array( - 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'short URL (or any other kind of redirect) for file (id)'), + 'url' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'short URL (or any other kind of redirect) for file (id)'), 'file_id' => array('type' => 'int', 'description' => 'short URL for what URL/file'), 'redirections' => array('type' => 'int', 'description' => 'redirect count'), 'httpcode' => array('type' => 'int', 'description' => 'HTTP status code (20x, 30x, etc.)'), diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php index 6a92b07d0c..af3551028e 100644 --- a/classes/File_thumbnail.php +++ b/classes/File_thumbnail.php @@ -27,8 +27,8 @@ class File_thumbnail extends Managed_DataObject { public $__table = 'file_thumbnail'; // table name public $file_id; // int(4) primary_key not_null - public $url; // varchar(255) unique_key - public $filename; // varchar(255) + public $url; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $filename; // varchar(191) not 255 because utf8mb4 takes more space public $width; // int(4) primary_key public $height; // int(4) primary_key public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -38,8 +38,8 @@ class File_thumbnail extends Managed_DataObject return array( 'fields' => array( 'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'thumbnail for what URL/file'), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of thumbnail'), - 'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'if stored locally, filename is put here'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of thumbnail'), + 'filename' => array('type' => 'varchar', 'length' => 191, 'description' => 'if stored locally, filename is put here'), 'width' => array('type' => 'int', 'description' => 'width of thumbnail'), 'height' => array('type' => 'int', 'description' => 'height of thumbnail'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index a964d87fdd..6176ec43bc 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -13,7 +13,7 @@ class Foreign_link extends Managed_DataObject public $user_id; // int(4) primary_key not_null public $foreign_id; // bigint(8) primary_key not_null unsigned public $service; // int(4) primary_key not_null - public $credentials; // varchar(255) + public $credentials; // varchar(191) not 255 because utf8mb4 takes more space public $noticesync; // tinyint(1) not_null default_1 public $friendsync; // tinyint(1) not_null default_2 public $profilesync; // tinyint(1) not_null default_1 @@ -32,7 +32,7 @@ class Foreign_link extends Managed_DataObject 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'link to user on this system, if exists'), 'foreign_id' => array('type' => 'int', 'size' => 'big', 'unsigned' => true, 'not null' => true, 'description' => 'link to user on foreign service, if exists'), 'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'), - 'credentials' => array('type' => 'varchar', 'length' => 255, 'description' => 'authc credentials, typically a password'), + 'credentials' => array('type' => 'varchar', 'length' => 191, 'description' => 'authc credentials, typically a password'), 'noticesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies'), 'friendsync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 2, 'description' => 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'), 'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'), diff --git a/classes/Foreign_service.php b/classes/Foreign_service.php index df9fd5825d..78c1c0cee5 100644 --- a/classes/Foreign_service.php +++ b/classes/Foreign_service.php @@ -12,7 +12,7 @@ class Foreign_service extends Managed_DataObject public $__table = 'foreign_service'; // table name public $id; // int(4) primary_key not_null public $name; // varchar(32) unique_key not_null - public $description; // varchar(255) + public $description; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -25,7 +25,7 @@ class Foreign_service extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'numeric key for service'), 'name' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'), - 'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description'), + 'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php index eeaf817876..c1739d318a 100644 --- a/classes/Foreign_user.php +++ b/classes/Foreign_user.php @@ -12,8 +12,8 @@ class Foreign_user extends Managed_DataObject public $__table = 'foreign_user'; // table name public $id; // bigint(8) primary_key not_null public $service; // int(4) primary_key not_null - public $uri; // varchar(255) unique_key not_null - public $nickname; // varchar(255) + public $uri; // varchar(191) unique_key not_null not 255 because utf8mb4 takes more space + public $nickname; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -26,8 +26,8 @@ class Foreign_user extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'unique numeric key on foreign service'), 'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'identifying URI'), - 'nickname' => array('type' => 'varchar', 'length' => 255, 'description' => 'nickname on foreign service'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'identifying URI'), + 'nickname' => array('type' => 'varchar', 'length' => 191, 'description' => 'nickname on foreign service'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Group_member.php b/classes/Group_member.php index 14f417758d..392440222b 100644 --- a/classes/Group_member.php +++ b/classes/Group_member.php @@ -12,7 +12,7 @@ class Group_member extends Managed_DataObject public $group_id; // int(4) primary_key not_null public $profile_id; // int(4) primary_key not_null public $is_admin; // tinyint(1) - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -26,7 +26,7 @@ class Group_member extends Managed_DataObject 'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'), 'is_admin' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this user an admin?'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Invitation.php b/classes/Invitation.php index a40bd0f330..ca03bb7aa1 100644 --- a/classes/Invitation.php +++ b/classes/Invitation.php @@ -12,7 +12,7 @@ class Invitation extends Managed_DataObject public $__table = 'invitation'; // table name public $code; // varchar(32) primary_key not_null public $user_id; // int(4) not_null - public $address; // varchar(255) multiple_key not_null + public $address; // varchar(191) multiple_key not_null not 255 because utf8mb4 takes more space public $address_type; // varchar(8) multiple_key not_null public $registered_user_id; // int(4) not_null public $created; // datetime() not_null @@ -34,7 +34,7 @@ class Invitation extends Managed_DataObject 'fields' => array( 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'random code for an invitation'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'), - 'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'invitation sent to'), + 'address' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'invitation sent to'), 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'registered_user_id' => array('type' => 'int', 'not null' => false, 'description' => 'if the invitation is converted, who the new user is'), diff --git a/classes/Location_namespace.php b/classes/Location_namespace.php index 3690ecc044..a841473953 100644 --- a/classes/Location_namespace.php +++ b/classes/Location_namespace.php @@ -32,7 +32,7 @@ class Location_namespace extends Managed_DataObject public $__table = 'location_namespace'; // table name public $id; // int(4) primary_key not_null - public $description; // varchar(255) + public $description; // varchar(191) public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -44,7 +44,7 @@ class Location_namespace extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity for this namespace'), - 'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description of the namespace'), + 'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description of the namespace'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 2bd9581cf6..3f1945205a 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -734,7 +734,7 @@ class Memcached_DataObject extends Safe_DataObject return $string; } - // We overload so that 'SET NAMES "utf8"' is called for + // We overload so that 'SET NAMES "utf8mb4"' is called for // each connection function _connect() @@ -784,9 +784,9 @@ class Memcached_DataObject extends Safe_DataObject $conn = $DB->connection; if (!empty($conn)) { if ($DB instanceof DB_mysqli || $DB instanceof MDB2_Driver_mysqli) { - mysqli_set_charset($conn, 'utf8'); + mysqli_set_charset($conn, 'utf8mb4'); } else if ($DB instanceof DB_mysql || $DB instanceof MDB2_Driver_mysql) { - mysql_set_charset('utf8', $conn); + mysql_set_charset('utf8mb4', $conn); } } } diff --git a/classes/Nonce.php b/classes/Nonce.php index 9d8dfece04..d37aade4a8 100644 --- a/classes/Nonce.php +++ b/classes/Nonce.php @@ -10,7 +10,7 @@ class Nonce extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'nonce'; // table name - public $consumer_key; // varchar(255) primary_key not_null + public $consumer_key; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $tok; // char(32) public $nonce; // char(32) primary_key not_null public $ts; // datetime() primary_key not_null @@ -39,7 +39,7 @@ class Nonce extends Managed_DataObject return array( 'description' => 'OAuth nonce record', 'fields' => array( - 'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'unique identifier, root URL'), + 'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'), 'tok' => array('type' => 'char', 'length' => 32, 'description' => 'buggy old value, ignored'), 'nonce' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'nonce'), 'ts' => array('type' => 'datetime', 'not null' => true, 'description' => 'timestamp sent'), diff --git a/classes/Notice.php b/classes/Notice.php index a69efc45ae..3b03069f13 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -55,10 +55,10 @@ class Notice extends Managed_DataObject public $__table = 'notice'; // table name public $id; // int(4) primary_key not_null public $profile_id; // int(4) multiple_key not_null - public $uri; // varchar(255) unique_key + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $content; // text public $rendered; // text - public $url; // varchar(255) + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime multiple_key not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP public $reply_to; // int(4) @@ -70,8 +70,8 @@ class Notice extends Managed_DataObject public $location_id; // int(4) public $location_ns; // int(4) public $repeat_of; // int(4) - public $verb; // varchar(255) - public $object_type; // varchar(255) + public $verb; // varchar(191) not 255 because utf8mb4 takes more space + public $object_type; // varchar(191) not 255 because utf8mb4 takes more space public $scope; // int(4) /* the code above is auto generated do not remove the tag below */ @@ -83,10 +83,10 @@ class Notice extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'who made the update'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'), 'content' => array('type' => 'text', 'description' => 'update content', 'collate' => 'utf8_general_ci'), 'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), 'reply_to' => array('type' => 'int', 'description' => 'notice replied to (usually a guess)'), @@ -98,8 +98,8 @@ class Notice extends Managed_DataObject 'location_id' => array('type' => 'int', 'description' => 'location id if possible'), 'location_ns' => array('type' => 'int', 'description' => 'namespace for location'), 'repeat_of' => array('type' => 'int', 'description' => 'notice this is a repeat of'), - 'object_type' => array('type' => 'varchar', 'length' => 255, 'description' => 'URI representing activity streams object type', 'default' => 'http://activitystrea.ms/schema/1.0/note'), - 'verb' => array('type' => 'varchar', 'length' => 255, 'description' => 'URI representing activity streams verb', 'default' => 'http://activitystrea.ms/schema/1.0/post'), + 'object_type' => array('type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams object type', 'default' => 'http://activitystrea.ms/schema/1.0/note'), + 'verb' => array('type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams verb', 'default' => 'http://activitystrea.ms/schema/1.0/post'), 'scope' => array('type' => 'int', 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = followers; null = default'), ), diff --git a/classes/Notice_source.php b/classes/Notice_source.php index 6f3d2e5634..f31d4411ff 100644 --- a/classes/Notice_source.php +++ b/classes/Notice_source.php @@ -11,8 +11,8 @@ class Notice_source extends Managed_DataObject public $__table = 'notice_source'; // table name public $code; // varchar(32) primary_key not_null - public $name; // varchar(255) not_null - public $url; // varchar(255) not_null + public $name; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $url; // varchar(191) not_null not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -24,8 +24,8 @@ class Notice_source extends Managed_DataObject return array( 'fields' => array( 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'source code'), - 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'name of the source'), - 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'url to link to'), + 'name' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the source'), + 'url' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'url to link to'), 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'date this record was created'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php index b29fdfe41b..9cf3f5e108 100644 --- a/classes/Oauth_application.php +++ b/classes/Oauth_application.php @@ -12,14 +12,14 @@ class Oauth_application extends Managed_DataObject public $__table = 'oauth_application'; // table name public $id; // int(4) primary_key not_null public $owner; // int(4) not_null - public $consumer_key; // varchar(255) not_null - public $name; // varchar(255) not_null - public $description; // varchar(255) - public $icon; // varchar(255) not_null - public $source_url; // varchar(255) - public $organization; // varchar(255) - public $homepage; // varchar(255) - public $callback_url; // varchar(255) not_null + public $consumer_key; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $name; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $description; // varchar(191) not 255 because utf8mb4 takes more space + public $icon; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $source_url; // varchar(191) not 255 because utf8mb4 takes more space + public $organization; // varchar(191) not 255 because utf8mb4 takes more space + public $homepage; // varchar(191) not 255 because utf8mb4 takes more space + public $callback_url; // varchar(191) not_null not 255 because utf8mb4 takes more space public $type; // tinyint(1) public $access_type; // tinyint(1) public $created; // datetime not_null @@ -43,12 +43,12 @@ class Oauth_application extends Managed_DataObject static function maxDesc() { // This used to default to textlimit or allow unlimited descriptions, - // but this isn't part of a notice and the field's limited to 255 chars - // in the DB, so those seem silly. + // but this isn't part of a notice and the field's limited to 191 chars + // in the DB, so those seem silly. (utf8mb4 takes up more space, so can't use 255) // - // Now just defaulting to 255 max unless a smaller application desclimit + // Now just defaulting to 191 max unless a smaller application desclimit // is actually set. Setting to 0 will use the maximum. - $max = 255; + $max = 191; $desclimit = intval(common_config('application', 'desclimit')); if ($desclimit > 0 && $desclimit < $max) { return $desclimit; @@ -163,14 +163,14 @@ class Oauth_application extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'owner' => array('type' => 'int', 'not null' => true, 'description' => 'owner of the application'), - 'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'application consumer key'), - 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'name of the application'), - 'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description of the application'), - 'icon' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'application icon'), - 'source_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'application homepage - used for source link'), - 'organization' => array('type' => 'varchar', 'length' => 255, 'description' => 'name of the organization running the application'), - 'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'homepage for the organization'), - 'callback_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'url to redirect to after authentication'), + 'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'application consumer key'), + 'name' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the application'), + 'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description of the application'), + 'icon' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'application icon'), + 'source_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'application homepage - used for source link'), + 'organization' => array('type' => 'varchar', 'length' => 191, 'description' => 'name of the organization running the application'), + 'homepage' => array('type' => 'varchar', 'length' => 191, 'description' => 'homepage for the organization'), + 'callback_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'url to redirect to after authentication'), 'type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'type of app, 1 = browser, 2 = desktop'), 'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'default access type, bit 1 = read, bit 2 = write'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), diff --git a/classes/Oauth_application_user.php b/classes/Oauth_application_user.php index 007e4d1db6..60b2e8fa2c 100644 --- a/classes/Oauth_application_user.php +++ b/classes/Oauth_application_user.php @@ -13,7 +13,7 @@ class Oauth_application_user extends Managed_DataObject public $profile_id; // int(4) primary_key not_null public $application_id; // int(4) primary_key not_null public $access_type; // tinyint(1) - public $token; // varchar(255) + public $token; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime not_null public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -27,7 +27,7 @@ class Oauth_application_user extends Managed_DataObject 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'user of the application'), 'application_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the application'), 'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'access type, bit 1 = read, bit 2 = write'), - 'token' => array('type' => 'varchar', 'length' => 255, 'description' => 'request or access token'), + 'token' => array('type' => 'varchar', 'length' => 191, 'description' => 'request or access token'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Oauth_token_association.php b/classes/Oauth_token_association.php index ec5eae3064..83bc0d8054 100644 --- a/classes/Oauth_token_association.php +++ b/classes/Oauth_token_association.php @@ -12,7 +12,7 @@ class Oauth_token_association extends Managed_DataObject public $__table = 'oauth_token_association'; // table name public $profile_id; // int(4) primary_key not_null public $application_id; // int(4) primary_key not_null - public $token; // varchar(255) primary key not null + public $token; // varchar(191) primary key not null not 255 because utf8mb4 takes more space public $created; // datetime not_null public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -43,7 +43,7 @@ class Oauth_token_association extends Managed_DataObject 'fields' => array( 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'associated user'), 'application_id' => array('type' => 'int', 'not null' => true, 'description' => 'the application'), - 'token' => array('type' => 'varchar', 'length' => '255', 'not null' => true, 'description' => 'token used for this association'), + 'token' => array('type' => 'varchar', 'length' => '191', 'not null' => true, 'description' => 'token used for this association'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Profile.php b/classes/Profile.php index 0b608fbb24..b1c29041df 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -30,11 +30,11 @@ class Profile extends Managed_DataObject public $__table = 'profile'; // table name public $id; // int(4) primary_key not_null public $nickname; // varchar(64) multiple_key not_null - public $fullname; // varchar(255) multiple_key - public $profileurl; // varchar(255) - public $homepage; // varchar(255) multiple_key + public $fullname; // varchar(191) multiple_key not 255 because utf8mb4 takes more space + public $profileurl; // varchar(191) not 255 because utf8mb4 takes more space + public $homepage; // varchar(191) multiple_key not 255 because utf8mb4 takes more space public $bio; // text() multiple_key - public $location; // varchar(255) multiple_key + public $location; // varchar(191) multiple_key not 255 because utf8mb4 takes more space public $lat; // decimal(10,7) public $lon; // decimal(10,7) public $location_id; // int(4) @@ -49,11 +49,11 @@ class Profile extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'nickname' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username', 'collate' => 'utf8_general_ci'), - 'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name', 'collate' => 'utf8_general_ci'), - 'profileurl' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL, cached so we dont regenerate'), - 'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'identifying URL', 'collate' => 'utf8_general_ci'), + 'fullname' => array('type' => 'varchar', 'length' => 191, 'description' => 'display name', 'collate' => 'utf8_general_ci'), + 'profileurl' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'), + 'homepage' => array('type' => 'varchar', 'length' => 191, 'description' => 'identifying URL', 'collate' => 'utf8_general_ci'), 'bio' => array('type' => 'text', 'description' => 'descriptive biography', 'collate' => 'utf8_general_ci'), - 'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'physical location', 'collate' => 'utf8_general_ci'), + 'location' => array('type' => 'varchar', 'length' => 191, 'description' => 'physical location', 'collate' => 'utf8_general_ci'), 'lat' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'), 'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'), 'location_id' => array('type' => 'int', 'description' => 'location id if possible'), diff --git a/classes/Profile_list.php b/classes/Profile_list.php index 0ad8106e31..2b3d2aa5ad 100644 --- a/classes/Profile_list.php +++ b/classes/Profile_list.php @@ -43,8 +43,8 @@ class Profile_list extends Managed_DataObject public $private; // tinyint(1) public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP - public $uri; // varchar(255) unique_key - public $mainpage; // varchar(255) + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $mainpage; // varchar(191) not 255 because utf8mb4 takes more space public $tagged_count; // smallint public $subscriber_count; // smallint @@ -64,8 +64,8 @@ class Profile_list extends Managed_DataObject 'created' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'), - 'mainpage' => array('type' => 'varchar', 'length' => 255, 'description' => 'page to link to'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'), + 'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page to link to'), 'tagged_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of people tagged with this tag by this user'), 'subscriber_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of subscribers to this tag'), ), diff --git a/classes/Profile_prefs.php b/classes/Profile_prefs.php index ee0fa0e27c..27034390f8 100644 --- a/classes/Profile_prefs.php +++ b/classes/Profile_prefs.php @@ -31,8 +31,8 @@ class Profile_prefs extends Managed_DataObject { public $__table = 'profile_prefs'; // table name public $profile_id; // int(4) primary_key not_null - public $namespace; // varchar(255) not_null - public $topic; // varchar(255) not_null + public $namespace; // varchar(191) not_null + public $topic; // varchar(191) not_null public $data; // text public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP @@ -42,8 +42,8 @@ class Profile_prefs extends Managed_DataObject return array( 'fields' => array( 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'), - 'namespace' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'namespace, like pluginname or category'), - 'topic' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'preference key, i.e. description, age...'), + 'namespace' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'namespace, like pluginname or category'), + 'topic' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'preference key, i.e. description, age...'), 'data' => array('type' => 'blob', 'description' => 'topic data, may be anything'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/classes/Sms_carrier.php b/classes/Sms_carrier.php index 7d3a5fc0ca..d37cf42d97 100644 --- a/classes/Sms_carrier.php +++ b/classes/Sms_carrier.php @@ -12,7 +12,7 @@ class Sms_carrier extends Managed_DataObject public $__table = 'sms_carrier'; // table name public $id; // int(4) primary_key not_null public $name; // varchar(64) unique_key - public $email_pattern; // varchar(255) not_null + public $email_pattern; // varchar(191) not_null not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -30,7 +30,7 @@ class Sms_carrier extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'primary key for SMS carrier'), 'name' => array('type' => 'varchar', 'length' => 64, 'description' => 'name of the carrier'), - 'email_pattern' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'), + 'email_pattern' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Status_network.php b/classes/Status_network.php index ffbf9d5a3c..3498b4bd24 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -29,15 +29,15 @@ class Status_network extends Safe_DataObject public $__table = 'status_network'; // table name public $site_id; // int(4) primary_key not_null public $nickname; // varchar(64) unique_key not_null - public $hostname; // varchar(255) unique_key - public $pathname; // varchar(255) unique_key - public $dbhost; // varchar(255) - public $dbuser; // varchar(255) - public $dbpass; // varchar(255) - public $dbname; // varchar(255) - public $sitename; // varchar(255) - public $theme; // varchar(255) - public $logo; // varchar(255) + public $hostname; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $pathname; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $dbhost; // varchar(191) not 255 because utf8mb4 takes more space + public $dbuser; // varchar(191) not 255 because utf8mb4 takes more space + public $dbpass; // varchar(191) not 255 because utf8mb4 takes more space + public $dbname; // varchar(191) not 255 because utf8mb4 takes more space + public $sitename; // varchar(191) not 255 because utf8mb4 takes more space + public $theme; // varchar(191) not 255 because utf8mb4 takes more space + public $logo; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/classes/Subscription.php b/classes/Subscription.php index 4d7eb524dc..9ef19e2f66 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -32,9 +32,9 @@ class Subscription extends Managed_DataObject public $subscribed; // int(4) primary_key not_null public $jabber; // tinyint(1) default_1 public $sms; // tinyint(1) default_1 - public $token; // varchar(255) - public $secret; // varchar(255) - public $uri; // varchar(255) + public $token; // varchar(191) not 255 because utf8mb4 takes more space + public $secret; // varchar(191) not 255 because utf8mb4 takes more space + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -46,9 +46,9 @@ class Subscription extends Managed_DataObject 'subscribed' => array('type' => 'int', 'not null' => true, 'description' => 'profile being listened to'), 'jabber' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'deliver jabber messages'), 'sms' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'deliver sms messages'), - 'token' => array('type' => 'varchar', 'length' => 255, 'description' => 'authorization token'), - 'secret' => array('type' => 'varchar', 'length' => 255, 'description' => 'token secret'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier'), + 'token' => array('type' => 'varchar', 'length' => 191, 'description' => 'authorization token'), + 'secret' => array('type' => 'varchar', 'length' => 191, 'description' => 'token secret'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/classes/Token.php b/classes/Token.php index 8d8a4d1c11..89b3f4ecf1 100644 --- a/classes/Token.php +++ b/classes/Token.php @@ -10,13 +10,13 @@ class Token extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'token'; // table name - public $consumer_key; // varchar(255) primary_key not_null + public $consumer_key; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $tok; // char(32) primary_key not_null public $secret; // char(32) not_null public $type; // tinyint(1) not_null public $state; // tinyint(1) - public $verifier; // varchar(255) - public $verified_callback; // varchar(255) + public $verifier; // varchar(191) not 255 because utf8mb4 takes more space + public $verified_callback; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -27,13 +27,13 @@ class Token extends Managed_DataObject return array( 'description' => 'OAuth token record', 'fields' => array( - 'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'unique identifier, root URL'), + 'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'), 'tok' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'identifying value'), 'secret' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'secret value'), 'type' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'request or access'), 'state' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'for requests, 0 = initial, 1 = authorized, 2 = used'), - 'verifier' => array('type' => 'varchar', 'length' => 255, 'description' => 'verifier string for OAuth 1.0a'), - 'verified_callback' => array('type' => 'varchar', 'length' => 255, 'description' => 'verified callback URL for OAuth 1.0a'), + 'verifier' => array('type' => 'varchar', 'length' => 191, 'description' => 'verifier string for OAuth 1.0a'), + 'verified_callback' => array('type' => 'varchar', 'length' => 191, 'description' => 'verified callback URL for OAuth 1.0a'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/classes/User.php b/classes/User.php index 7a19ae3a0a..a719bec8ef 100644 --- a/classes/User.php +++ b/classes/User.php @@ -34,9 +34,9 @@ class User extends Managed_DataObject public $__table = 'user'; // table name public $id; // int(4) primary_key not_null public $nickname; // varchar(64) unique_key - public $password; // varchar(255) - public $email; // varchar(255) unique_key - public $incomingemail; // varchar(255) unique_key + public $password; // varchar(191) not 255 because utf8mb4 takes more space + public $email; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $incomingemail; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $emailnotifysub; // tinyint(1) default_1 public $emailnotifyfav; // tinyint(1) default_1 public $emailnotifynudge; // tinyint(1) default_1 @@ -50,8 +50,8 @@ class User extends Managed_DataObject public $carrier; // int(4) public $smsnotify; // tinyint(1) public $smsreplies; // tinyint(1) - public $smsemail; // varchar(255) - public $uri; // varchar(255) unique_key + public $smsemail; // varchar(191) not 255 because utf8mb4 takes more space + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $autosubscribe; // tinyint(1) public $subscribe_policy; // tinyint(1) public $urlshorteningservice; // varchar(50) default_ur1.ca @@ -69,9 +69,9 @@ class User extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'), 'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'), - 'password' => array('type' => 'varchar', 'length' => 255, 'description' => 'salted password, can be null for OpenID users'), - 'email' => array('type' => 'varchar', 'length' => 255, 'description' => 'email address for password recovery etc.'), - 'incomingemail' => array('type' => 'varchar', 'length' => 255, 'description' => 'email address for post-by-email'), + 'password' => array('type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for OpenID users'), + 'email' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery etc.'), + 'incomingemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'), 'emailnotifysub' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of subscriptions'), 'emailnotifyfav' => array('type' => 'int', 'size' => 'tiny', 'default' => null, 'description' => 'Notify by email of favorites'), 'emailnotifynudge' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of nudges'), @@ -85,8 +85,8 @@ class User extends Managed_DataObject 'carrier' => array('type' => 'int', 'description' => 'foreign key to sms_carrier'), 'smsnotify' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to send notices to SMS'), 'smsreplies' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to send notices to SMS on replies'), - 'smsemail' => array('type' => 'varchar', 'length' => 255, 'description' => 'built from sms and carrier'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'), + 'smsemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'), 'autosubscribe' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'automatically subscribe to users who subscribe to us'), 'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'), 'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'), diff --git a/classes/User_group.php b/classes/User_group.php index 875f5d650e..3dc5fd4b2d 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -15,18 +15,18 @@ class User_group extends Managed_DataObject public $__table = 'user_group'; // table name public $id; // int(4) primary_key not_null public $nickname; // varchar(64) - public $fullname; // varchar(255) - public $homepage; // varchar(255) + public $fullname; // varchar(191) not 255 because utf8mb4 takes more space + public $homepage; // varchar(191) not 255 because utf8mb4 takes more space public $description; // text - public $location; // varchar(255) - public $original_logo; // varchar(255) - public $homepage_logo; // varchar(255) - public $stream_logo; // varchar(255) - public $mini_logo; // varchar(255) + public $location; // varchar(191) not 255 because utf8mb4 takes more space + public $original_logo; // varchar(191) not 255 because utf8mb4 takes more space + public $homepage_logo; // varchar(191) not 255 because utf8mb4 takes more space + public $stream_logo; // varchar(191) not 255 because utf8mb4 takes more space + public $mini_logo; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP - public $uri; // varchar(255) unique_key - public $mainpage; // varchar(255) + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space + public $mainpage; // varchar(191) not 255 because utf8mb4 takes more space public $join_policy; // tinyint public $force_scope; // tinyint @@ -41,21 +41,21 @@ class User_group extends Managed_DataObject 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'), 'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'nickname for addressing'), - 'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name'), - 'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL, cached so we dont regenerate'), + 'fullname' => array('type' => 'varchar', 'length' => 191, 'description' => 'display name'), + 'homepage' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'), 'description' => array('type' => 'text', 'description' => 'group description'), - 'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'related physical location, if any'), + 'location' => array('type' => 'varchar', 'length' => 191, 'description' => 'related physical location, if any'), - 'original_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'original size logo'), - 'homepage_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'homepage (profile) size logo'), - 'stream_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'stream-sized logo'), - 'mini_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'mini logo'), + 'original_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'original size logo'), + 'homepage_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'homepage (profile) size logo'), + 'stream_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'stream-sized logo'), + 'mini_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'mini logo'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'), - 'mainpage' => array('type' => 'varchar', 'length' => 255, 'description' => 'page for group info to link to'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'), + 'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page for group info to link to'), 'join_policy' => array('type' => 'int', 'size' => 'tiny', 'description' => '0=open; 1=requires admin approval'), 'force_scope' => array('type' => 'int', 'size' => 'tiny', 'description' => '0=never,1=sometimes,-1=always'), ), diff --git a/classes/User_im_prefs.php b/classes/User_im_prefs.php index cba91ea252..16fd030bb4 100644 --- a/classes/User_im_prefs.php +++ b/classes/User_im_prefs.php @@ -36,8 +36,8 @@ class User_im_prefs extends Managed_DataObject public $__table = 'user_im_prefs'; // table name public $user_id; // int(4) primary_key not_null - public $screenname; // varchar(255) not_null - public $transport; // varchar(255) not_null + public $screenname; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $transport; // varchar(191) not_null not 255 because utf8mb4 takes more space public $notify; // tinyint(1) public $replies; // tinyint(1) public $microid; // tinyint(1) @@ -53,8 +53,8 @@ class User_im_prefs extends Managed_DataObject return array( 'fields' => array( 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'), - 'screenname' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'screenname on this service'), - 'transport' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'), + 'screenname' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'screenname on this service'), + 'transport' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'), 'notify' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Notify when a new notice is sent'), 'replies' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to'), 'microid' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'Publish a MicroID'), diff --git a/classes/User_username.php b/classes/User_username.php index b252ee3156..0173a6efc4 100644 --- a/classes/User_username.php +++ b/classes/User_username.php @@ -11,8 +11,8 @@ class User_username extends Managed_DataObject public $__table = 'user_username'; // table name public $user_id; // int(4) not_null - public $provider_name; // varchar(255) primary_key not_null - public $username; // varchar(255) primary_key not_null + public $provider_name; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space + public $username; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -23,8 +23,8 @@ class User_username extends Managed_DataObject { return array( 'fields' => array( - 'provider_name' => array('type' => 'varchar', 'length' => 255, 'description' => 'provider name'), - 'username' => array('type' => 'varchar', 'length' => 255, 'description' => 'username'), + 'provider_name' => array('type' => 'varchar', 'length' => 191, 'description' => 'provider name'), + 'username' => array('type' => 'varchar', 'length' => 191, 'description' => 'username'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/db/site.sql b/db/site.sql index c630a83d52..5e9693f5f7 100644 --- a/db/site.sql +++ b/db/site.sql @@ -21,7 +21,7 @@ create table status_network ( created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified' -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; +) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; create table status_network_tag ( site_id integer comment 'unique id', @@ -30,5 +30,5 @@ create table status_network_tag ( constraint primary key (site_id, tag), index status_network_tag_tag_idx (tag) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; +) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; diff --git a/extlib/DB.php b/extlib/DB.php index a511979e67..75ed028c0c 100644 --- a/extlib/DB.php +++ b/extlib/DB.php @@ -961,6 +961,7 @@ class DB_Error extends PEAR_Error function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) { + common_debug(var_export($debuginfo,true)); if (is_int($code)) { $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo); diff --git a/lib/event.php b/lib/event.php index aa52fa361c..e6bb41091e 100644 --- a/lib/event.php +++ b/lib/event.php @@ -139,6 +139,11 @@ class Event { return false; } + public static function getHandlers($name) + { + return Event::$_handlers[$name]; + } + /** * Disables any and all handlers that have been set up so far; * use only if you know it's safe to reinitialize all plugins. diff --git a/lib/mysqlschema.php b/lib/mysqlschema.php index 435ba4e3a9..f1fc0f46ec 100644 --- a/lib/mysqlschema.php +++ b/lib/mysqlschema.php @@ -271,7 +271,7 @@ class MysqlSchema extends Schema function endCreateTable($name, array $def) { $engine = $this->preferredEngine($def); - return ") ENGINE=$engine CHARACTER SET utf8 COLLATE utf8_bin"; + return ") ENGINE=$engine CHARACTER SET utf8mb4 COLLATE utf8mb4_bin"; } function preferredEngine($def) @@ -335,9 +335,10 @@ class MysqlSchema extends Schema if (strtolower($oldProps['ENGINE']) != strtolower($engine)) { $phrase[] = "ENGINE=$engine"; } - if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8_bin') { - $phrase[] = 'DEFAULT CHARSET=utf8'; - $phrase[] = 'COLLATE=utf8_bin'; + if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8mb4_bin') { + $phrase[] = 'CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin'; + $phrase[] = 'DEFAULT CHARACTER SET = utf8mb4'; + $phrase[] = 'DEFAULT COLLATE = utf8mb4_bin'; } } diff --git a/plugins/Blacklist/classes/Homepage_blacklist.php b/plugins/Blacklist/classes/Homepage_blacklist.php index fb2712f565..fe357941c0 100644 --- a/plugins/Blacklist/classes/Homepage_blacklist.php +++ b/plugins/Blacklist/classes/Homepage_blacklist.php @@ -47,7 +47,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; class Homepage_blacklist extends Managed_DataObject { public $__table = 'homepage_blacklist'; // table name - public $pattern; // varchar(255) pattern + public $pattern; // varchar(191) pattern not 255 because utf8mb4 takes more space public $created; // datetime not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -55,7 +55,7 @@ class Homepage_blacklist extends Managed_DataObject { return array( 'fields' => array( - 'pattern' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'blacklist pattern'), + 'pattern' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'blacklist pattern'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/plugins/Blacklist/classes/Nickname_blacklist.php b/plugins/Blacklist/classes/Nickname_blacklist.php index f4f387a2e0..b045fd17ce 100644 --- a/plugins/Blacklist/classes/Nickname_blacklist.php +++ b/plugins/Blacklist/classes/Nickname_blacklist.php @@ -47,7 +47,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; class Nickname_blacklist extends Managed_DataObject { public $__table = 'nickname_blacklist'; // table name - public $pattern; // varchar(255) pattern + public $pattern; // varchar(191) pattern not 255 because utf8mb4 takes more space public $created; // datetime not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -55,7 +55,7 @@ class Nickname_blacklist extends Managed_DataObject { return array( 'fields' => array( - 'pattern' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'blacklist pattern'), + 'pattern' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'blacklist pattern'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/plugins/Blog/classes/Blog_entry.php b/plugins/Blog/classes/Blog_entry.php index 1f585dce4f..557e50759b 100644 --- a/plugins/Blog/classes/Blog_entry.php +++ b/plugins/Blog/classes/Blog_entry.php @@ -51,11 +51,11 @@ class Blog_entry extends Managed_DataObject public $id; // UUID public $profile_id; // int - public $title; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $summary; // text public $content; // text - public $uri; // text - public $url; // text + public $uri; // varchar(191) not 255 because utf8mb4 takes more space + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime public $modified; // datetime @@ -74,17 +74,17 @@ class Blog_entry extends Managed_DataObject 'not null' => true, 'description' => 'Author profile ID'), 'title' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'description' => 'title of the entry'), 'summary' => array('type' => 'text', 'description' => 'initial summary'), 'content' => array('type' => 'text', 'description' => 'HTML content of the entry'), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'description' => 'URI (probably http://) for this entry'), 'url' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'description' => 'URL (probably http://) for this entry'), 'created' => array('type' => 'datetime', 'not null' => true, diff --git a/plugins/Bookmark/classes/Bookmark.php b/plugins/Bookmark/classes/Bookmark.php index a99df87ee3..ade6b4fa7b 100644 --- a/plugins/Bookmark/classes/Bookmark.php +++ b/plugins/Bookmark/classes/Bookmark.php @@ -47,10 +47,10 @@ class Bookmark extends Managed_DataObject public $__table = 'bookmark'; // table name public $id; // char(36) primary_key not_null public $profile_id; // int(4) not_null - public $url; // varchar(255) not_null - public $title; // varchar(255) + public $url; // varchar(191) not_null not 255 because utf8mb4 takes more space + public $title; // varchar(191) not 255 because utf8mb4 takes more space + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $description; // text - public $uri; // varchar(255) public $created; // datetime public static function schemaDef() @@ -62,12 +62,12 @@ class Bookmark extends Managed_DataObject 'not null' => true), 'profile_id' => array('type' => 'int', 'not null' => true), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'url' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), - 'title' => array('type' => 'varchar', 'length' => 255), + 'title' => array('type' => 'varchar', 'length' => 191), 'description' => array('type' => 'text'), 'created' => array('type' => 'datetime', 'not null' => true), ), diff --git a/plugins/DirectMessage/classes/Message.php b/plugins/DirectMessage/classes/Message.php index 3818a38f48..5f8d27b4f1 100644 --- a/plugins/DirectMessage/classes/Message.php +++ b/plugins/DirectMessage/classes/Message.php @@ -13,12 +13,12 @@ class Message extends Managed_DataObject public $__table = 'message'; // table name public $id; // int(4) primary_key not_null - public $uri; // varchar(255) unique_key + public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $from_profile; // int(4) not_null public $to_profile; // int(4) not_null public $content; // text() public $rendered; // text() - public $url; // varchar(255) + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP public $source; // varchar(32) @@ -31,12 +31,12 @@ class Message extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'), 'from_profile' => array('type' => 'int', 'not null' => true, 'description' => 'who the message is from'), 'to_profile' => array('type' => 'int', 'not null' => true, 'description' => 'who the message is to'), 'content' => array('type' => 'text', 'description' => 'message content'), 'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), 'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'), diff --git a/plugins/EmailReminder/classes/Email_reminder.php b/plugins/EmailReminder/classes/Email_reminder.php index 235305f047..7af2cdf5e6 100644 --- a/plugins/EmailReminder/classes/Email_reminder.php +++ b/plugins/EmailReminder/classes/Email_reminder.php @@ -30,8 +30,8 @@ class Email_reminder extends Managed_DataObject { public $__table = 'email_reminder'; - public $type; // type of reminder - public $code; // confirmation code + public $type; // type of reminder varchar(191) not 255 because utf8mb4 takes more space + public $code; // confirmation code varchar(191) not 255 because utf8mb4 takes more space public $days; // number of days after code was created public $sent; // timestamp public $created; // timestamp @@ -102,14 +102,14 @@ class Email_reminder extends Managed_DataObject 'fields' => array( 'type' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true, 'description' => 'type of reminder' ), 'code' => array( 'type' => 'varchar', 'not null' => 'true', - 'length' => 255, + 'length' => 191, 'description' => 'confirmation code' ), 'days' => array( diff --git a/plugins/Event/classes/Happening.php b/plugins/Event/classes/Happening.php index 3a094ece6c..733235655c 100644 --- a/plugins/Event/classes/Happening.php +++ b/plugins/Event/classes/Happening.php @@ -53,13 +53,13 @@ class Happening extends Managed_DataObject public $__table = 'happening'; // table name public $id; // varchar(36) UUID - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int public $start_time; // datetime public $end_time; // datetime - public $title; // varchar(255) - public $location; // varchar(255) - public $url; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space + public $location; // varchar(191) not 255 because utf8mb4 takes more space + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $description; // text public $created; // datetime @@ -76,18 +76,18 @@ class Happening extends Managed_DataObject 'not null' => true, 'description' => 'UUID'), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int', 'not null' => true), 'start_time' => array('type' => 'datetime', 'not null' => true), 'end_time' => array('type' => 'datetime', 'not null' => true), 'title' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'location' => array('type' => 'varchar', - 'length' => 255), + 'length' => 191), 'url' => array('type' => 'varchar', - 'length' => 255), + 'length' => 191), 'description' => array('type' => 'text'), 'created' => array('type' => 'datetime', 'not null' => true), diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php index 7266ea7493..3e0efc689a 100644 --- a/plugins/Event/classes/RSVP.php +++ b/plugins/Event/classes/RSVP.php @@ -50,7 +50,7 @@ class RSVP extends Managed_DataObject public $__table = 'rsvp'; // table name public $id; // varchar(36) UUID - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int public $event_id; // varchar(36) UUID public $response; // tinyint @@ -83,7 +83,7 @@ class RSVP extends Managed_DataObject 'not null' => true, 'description' => 'UUID'), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int'), 'event_id' => array('type' => 'char', diff --git a/plugins/FacebookBridge/classes/Notice_to_item.php b/plugins/FacebookBridge/classes/Notice_to_item.php index a7cf5a13aa..1f77bb1b4f 100644 --- a/plugins/FacebookBridge/classes/Notice_to_item.php +++ b/plugins/FacebookBridge/classes/Notice_to_item.php @@ -52,7 +52,7 @@ class Notice_to_item extends Managed_DataObject { public $__table = 'notice_to_item'; // table name public $notice_id; // int(4) primary_key not_null - public $item_id; // varchar(255) not null + public $item_id; // varchar(191) not null not 255 because utf8mb4 takes more space public $created; // datetime /** @@ -76,7 +76,7 @@ class Notice_to_item extends Managed_DataObject { return array( new ColumnDef('notice_id', 'integer', null, false, 'PRI'), - new ColumnDef('item_id', 'varchar', 255, false, 'UNI'), + new ColumnDef('item_id', 'varchar', 191, false, 'UNI'), new ColumnDef('created', 'datetime', null, false) ); } diff --git a/plugins/Favorite/classes/Fave.php b/plugins/Favorite/classes/Fave.php index 68c36dfaef..094b65feaa 100644 --- a/plugins/Favorite/classes/Fave.php +++ b/plugins/Favorite/classes/Fave.php @@ -8,7 +8,7 @@ class Fave extends Managed_DataObject public $__table = 'fave'; // table name public $notice_id; // int(4) primary_key not_null public $user_id; // int(4) primary_key not_null - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space not 255 because utf8mb4 takes more space public $created; // datetime multiple_key not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -18,7 +18,7 @@ class Fave extends Managed_DataObject 'fields' => array( 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the favorite'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who likes this notice'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/plugins/GNUsocialPhoto/classes/Photo.php b/plugins/GNUsocialPhoto/classes/Photo.php index a6e01a8c1b..4e4ee69c97 100644 --- a/plugins/GNUsocialPhoto/classes/Photo.php +++ b/plugins/GNUsocialPhoto/classes/Photo.php @@ -39,10 +39,10 @@ class Photo extends Managed_DataObject public $__table = 'photo'; // table name public $id; // char (36) // UUID - public $uri; // varchar (255) // This is the corresponding notice's uri. - public $photo_uri; // varchar (255) - public $thumb_uri; // varchar (255) - public $title; // varchar (255) + public $uri; // varchar (191) // This is the corresponding notice's uri. not 255 because utf8mb4 takes more space + public $photo_uri; // varchar (191) not 255 because utf8mb4 takes more space + public $thumb_uri; // varchar (191) not 255 because utf8mb4 takes more space + public $title; // varchar (191) not 255 because utf8mb4 takes more space public $description; // text public $profile_id; // int @@ -66,13 +66,13 @@ class Photo extends Managed_DataObject 'not null' => true, 'description' => 'UUID'), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'photo_uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'photo_uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int', 'not null' => true), ), diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php index 4f4e5fbfe4..5b14e006da 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php @@ -38,9 +38,9 @@ class GNUsocialPhoto extends Managed_DataObject public $id; // int(11) public $notice_id; // int(11) public $album_id; // int(11) - public $uri; // varchar(255) - public $thumb_uri; // varchar(255) - public $title; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space + public $thumb_uri; // varchar(191) not 255 because utf8mb4 takes more space + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $photo_description; // text public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -63,9 +63,9 @@ class GNUsocialPhoto extends Managed_DataObject 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique ID for Photo'), 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'Notice ID for the related notice'), 'album_id' => array('type' => 'int', 'not null' => true, 'description' => 'The parent album ID'), - 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'unique address for this photo'), - 'thumb_uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'unique address for this photo thumbnail'), - 'title' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'The Photo title'), + 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'unique address for this photo'), + 'thumb_uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'unique address for this photo thumbnail'), + 'title' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'The Photo title'), 'photo_description' => array('type' => 'text', 'not null' => true, 'description' => 'A description for this photo'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php index 8b8c1dbf5a..acf509a22a 100644 --- a/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php +++ b/plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php @@ -38,7 +38,7 @@ class GNUsocialPhotoAlbum extends Managed_DataObject public $__table = 'GNUsocialPhotoAlbum'; public $album_id; // int(11) -- Unique identifier for the album public $profile_id; // int(11) -- Profile ID for the owner of the album - public $album_name; // varchar(255) -- Title for this album + public $album_name; // varchar(191) -- Title for this album not 255 because utf8mb4 takes more space public $album_description; // text -- A description of the album public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -50,7 +50,7 @@ class GNUsocialPhotoAlbum extends Managed_DataObject 'fields' => array( 'album_id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique identifier for the album'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'Profile ID for the owner of the album'), - 'album_name' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'Title for this album'), + 'album_name' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'Title for this album'), 'album_description' => array('type' => 'text', 'not null' => true, 'description' => 'A description for this album'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php index 564ddce875..5a9b8de0cb 100644 --- a/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php +++ b/plugins/GNUsocialProfileExtensions/classes/GNUsocialProfileExtensionField.php @@ -37,9 +37,9 @@ class GNUsocialProfileExtensionField extends Managed_DataObject public $__table = 'gnusocialprofileextensionfield'; public $id; // int(11) public $systemname; // varchar(64) - public $title; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $description; // text - public $type; // varchar(255) + public $type; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -49,9 +49,9 @@ class GNUsocialProfileExtensionField extends Managed_DataObject 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique ID for extension field'), 'systemname' => array('type' => 'varchar', 'not null' => true, 'length' => 64, 'description' => 'field systemname'), - 'title' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'field title'), + 'title' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'field title'), 'description' => array('type' => 'text', 'not null' => true, 'description' => 'field description'), - 'type' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'field type'), + 'type' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'field type'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), diff --git a/plugins/GNUsocialVideo/classes/Video.php b/plugins/GNUsocialVideo/classes/Video.php index d2dd0469a1..09c1f6b844 100644 --- a/plugins/GNUsocialVideo/classes/Video.php +++ b/plugins/GNUsocialVideo/classes/Video.php @@ -39,8 +39,8 @@ class Video extends Managed_DataObject public $__table = 'video'; // table name public $id; // char (36) // UUID - public $uri; // varchar (255) // This is the corresponding notice's uri. - public $url; // varchar (255) + public $uri; // varchar (191) This is the corresponding notice's uri. not 255 because utf8mb4 takes more space + public $url; // varchar (191) not 255 because utf8mb4 takes more space public $profile_id; // int public static function getByNotice($notice) @@ -63,10 +63,10 @@ class Video extends Managed_DataObject 'not null' => true, 'description' => 'UUID'), 'uri' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'url' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int', 'not null' => true), ), diff --git a/plugins/GroupPrivateMessage/classes/Group_message.php b/plugins/GroupPrivateMessage/classes/Group_message.php index 7e825d416d..e4e9f5f624 100644 --- a/plugins/GroupPrivateMessage/classes/Group_message.php +++ b/plugins/GroupPrivateMessage/classes/Group_message.php @@ -48,12 +48,12 @@ class Group_message extends Managed_DataObject { public $__table = 'group_message'; // table name public $id; // char(36) primary_key not_null - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $from_profile; // int public $to_group; // int public $content; public $rendered; - public $url; + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -62,8 +62,8 @@ class Group_message extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'char', 'not null' => true, 'length' => 36, 'description' => 'message uuid'), - 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'message uri'), - 'url' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'representation url'), + 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'message uri'), + 'url' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'representation url'), 'from_profile' => array('type' => 'int', 'not null' => true, 'description' => 'sending profile ID'), 'to_group' => array('type' => 'int', 'not null' => true, 'description' => 'receiving group ID'), 'content' => array('type' => 'text', 'not null' => true, 'description' => 'message content'), diff --git a/plugins/NoticeTitle/classes/Notice_title.php b/plugins/NoticeTitle/classes/Notice_title.php index 610e32fca7..f88ab70087 100644 --- a/plugins/NoticeTitle/classes/Notice_title.php +++ b/plugins/NoticeTitle/classes/Notice_title.php @@ -46,11 +46,11 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; */ class Notice_title extends Managed_DataObject { - const MAXCHARS = 255; + const MAXCHARS = 191; // not 255 because utf8mb4 takes more space public $__table = 'notice_title'; // table name public $notice_id; // int(11) primary_key not_null - public $title; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index adc1aa11be..d0ac83b56d 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -62,7 +62,7 @@ class FeedSub extends Managed_DataObject public $__table = 'feedsub'; public $id; - public $uri; + public $uri; // varchar(191) not 255 because utf8mb4 takes more space // PuSH subscription data public $huburi; @@ -80,7 +80,7 @@ class FeedSub extends Managed_DataObject return array( 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'FeedSub local unique id'), - 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'FeedSub uri'), + 'uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'FeedSub uri'), 'huburi' => array('type' => 'text', 'description' => 'FeedSub hub-uri'), 'secret' => array('type' => 'text', 'description' => 'FeedSub stored secret'), 'sub_state' => array('type' => 'enum("subscribe","active","unsubscribe","inactive","nohub")', 'not null' => true, 'description' => 'subscription state'), diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php index 96c6986cdf..c9d65c56a7 100644 --- a/plugins/OStatus/classes/HubSub.php +++ b/plugins/OStatus/classes/HubSub.php @@ -31,8 +31,8 @@ class HubSub extends Managed_DataObject public $__table = 'hubsub'; public $hashkey; // sha1(topic . '|' . $callback); (topic, callback) key is too long for myisam in utf8 - public $topic; - public $callback; + public $topic; // varchar(191) not 255 because utf8mb4 takes more space + public $callback; // varchar(191) not 255 because utf8mb4 takes more space public $secret; public $lease; public $sub_start; @@ -55,8 +55,8 @@ class HubSub extends Managed_DataObject return array( 'fields' => array( 'hashkey' => array('type' => 'char', 'not null' => true, 'length' => 40, 'description' => 'HubSub hashkey'), - 'topic' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'HubSub topic'), - 'callback' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'HubSub callback'), + 'topic' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'HubSub topic'), + 'callback' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'HubSub callback'), 'secret' => array('type' => 'text', 'description' => 'HubSub stored secret'), 'lease' => array('type' => 'int', 'description' => 'HubSub leasetime'), 'sub_start' => array('type' => 'datetime', 'description' => 'subscription start'), diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 79098c6404..959aeef6bd 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -51,12 +51,12 @@ class Ostatus_profile extends Managed_DataObject { return array( 'fields' => array( - 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true), + 'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'integer'), 'group_id' => array('type' => 'integer'), 'peopletag_id' => array('type' => 'integer'), - 'feeduri' => array('type' => 'varchar', 'length' => 255), - 'salmonuri' => array('type' => 'varchar', 'length' => 255), + 'feeduri' => array('type' => 'varchar', 'length' => 191), + 'salmonuri' => array('type' => 'varchar', 'length' => 191), 'avatar' => array('type' => 'text'), 'created' => array('type' => 'datetime', 'not null' => true), 'modified' => array('type' => 'datetime', 'not null' => true), @@ -1806,8 +1806,8 @@ class Ostatus_profile extends Managed_DataObject } if (!empty($location)) { - if (mb_strlen($location) > 255) { - $location = mb_substr($note, 0, 255 - 3) . ' … '; + if (mb_strlen($location) > 191) { // not 255 because utf8mb4 takes more space + $location = mb_substr($note, 0, 191 - 3) . ' … '; } } diff --git a/plugins/OStatus/classes/Ostatus_source.php b/plugins/OStatus/classes/Ostatus_source.php index 6cecc323e0..88a6a58383 100644 --- a/plugins/OStatus/classes/Ostatus_source.php +++ b/plugins/OStatus/classes/Ostatus_source.php @@ -40,7 +40,7 @@ class Ostatus_source extends Managed_DataObject return array( 'fields' => array( 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'Notice ID relation'), - 'profile_uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'Profile URI'), + 'profile_uri' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'Profile URI'), 'method' => array('type' => 'enum("push","salmon")', 'not null' => true, 'description' => 'source method'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/plugins/Oembed/classes/File_oembed.php b/plugins/Oembed/classes/File_oembed.php index fda1636837..3fc655e170 100644 --- a/plugins/Oembed/classes/File_oembed.php +++ b/plugins/Oembed/classes/File_oembed.php @@ -31,14 +31,14 @@ class File_oembed extends Managed_DataObject public $type; // varchar(20) public $mimetype; // varchar(50) public $provider; // varchar(50) - public $provider_url; // varchar(255) + public $provider_url; // varchar(191) not 255 because utf8mb4 takes more space public $width; // int(4) public $height; // int(4) public $html; // text() - public $title; // varchar(255) + public $title; // varchar(191) not 255 because utf8mb4 takes more space public $author_name; // varchar(50) - public $author_url; // varchar(255) - public $url; // varchar(255) + public $author_url; // varchar(191) not 255 because utf8mb4 takes more space + public $url; // varchar(191) not 255 because utf8mb4 takes more space public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP public static function schemaDef() @@ -50,14 +50,14 @@ class File_oembed extends Managed_DataObject 'type' => array('type' => 'varchar', 'length' => 20, 'description' => 'oEmbed type: photo, video, link, rich'), 'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'), 'provider' => array('type' => 'varchar', 'length' => 50, 'description' => 'name of this oEmbed provider'), - 'provider_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of this oEmbed provider'), + 'provider_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of this oEmbed provider'), 'width' => array('type' => 'int', 'description' => 'width of oEmbed resource when available'), 'height' => array('type' => 'int', 'description' => 'height of oEmbed resource when available'), 'html' => array('type' => 'text', 'description' => 'html representation of this oEmbed resource when applicable'), - 'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of oEmbed resource when available'), + 'title' => array('type' => 'varchar', 'length' => 191, 'description' => 'title of oEmbed resource when available'), 'author_name' => array('type' => 'varchar', 'length' => 50, 'description' => 'author name for this oEmbed resource'), - 'author_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'author URL for this oEmbed resource'), - 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL for this oEmbed resource when applicable (photo, link)'), + 'author_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'author URL for this oEmbed resource'), + 'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL for this oEmbed resource when applicable (photo, link)'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('file_id'), diff --git a/plugins/OpenID/classes/User_openid.php b/plugins/OpenID/classes/User_openid.php index baff5cd7f9..7e53d8ec95 100644 --- a/plugins/OpenID/classes/User_openid.php +++ b/plugins/OpenID/classes/User_openid.php @@ -13,8 +13,8 @@ class User_openid extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'user_openid'; // table name - public $canonical; // varchar(255) primary_key not_null - public $display; // varchar(255) unique_key not_null + public $canonical; // varchar(191) primary_key not_null + public $display; // varchar(191) unique_key not_null public $user_id; // int(4) not_null public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -26,8 +26,8 @@ class User_openid extends Managed_DataObject { return array( 'fields' => array( - 'canonical' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'OpenID canonical string'), - 'display' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'OpenID display string'), + 'canonical' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'OpenID canonical string'), + 'display' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'OpenID display string'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'User ID for OpenID owner'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/plugins/OpenID/classes/User_openid_trustroot.php b/plugins/OpenID/classes/User_openid_trustroot.php index ec09e179e4..575854c332 100644 --- a/plugins/OpenID/classes/User_openid_trustroot.php +++ b/plugins/OpenID/classes/User_openid_trustroot.php @@ -13,7 +13,7 @@ class User_openid_trustroot extends Managed_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'user_openid_trustroot'; // table name - public $trustroot; // varchar(255) primary_key not_null + public $trustroot; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $user_id; // int(4) primary_key not_null public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -25,7 +25,7 @@ class User_openid_trustroot extends Managed_DataObject { return array( 'fields' => array( - 'trustroot' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'OpenID trustroot string'), + 'trustroot' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'OpenID trustroot string'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'User ID for OpenID trustroot owner'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), diff --git a/plugins/Poll/classes/Poll.php b/plugins/Poll/classes/Poll.php index fe51c667d5..59161704a9 100644 --- a/plugins/Poll/classes/Poll.php +++ b/plugins/Poll/classes/Poll.php @@ -47,7 +47,7 @@ class Poll extends Managed_DataObject { public $__table = 'poll'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int -> profile.id public $question; // text public $options; // text; newline(?)-delimited @@ -62,7 +62,7 @@ class Poll extends Managed_DataObject 'description' => 'Per-notice poll data for Poll plugin', 'fields' => array( 'id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true), + 'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int'), 'question' => array('type' => 'text'), 'options' => array('type' => 'text'), diff --git a/plugins/Poll/classes/Poll_response.php b/plugins/Poll/classes/Poll_response.php index 20b7700147..78aec7ea05 100644 --- a/plugins/Poll/classes/Poll_response.php +++ b/plugins/Poll/classes/Poll_response.php @@ -46,7 +46,7 @@ class Poll_response extends Managed_DataObject { public $__table = 'poll_response'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $poll_id; // char(36) -> poll.id UUID public $profile_id; // int -> profile.id public $selection; // int -> choice # @@ -61,7 +61,7 @@ class Poll_response extends Managed_DataObject 'description' => 'Record of responses to polls', 'fields' => array( 'id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID of the response'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'UUID to the response notice'), + 'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'UUID to the response notice'), 'poll_id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID of poll being responded to'), 'profile_id' => array('type' => 'int'), 'selection' => array('type' => 'int'), diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index f4bf7a9d41..2aa69cf5a3 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -48,7 +48,7 @@ class QnA_Answer extends Managed_DataObject public $__table = 'qna_answer'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; // varchar(255) + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $question_id; // char(36) -> question.id UUID public $profile_id; // int -> question.id public $best; // (boolean) int -> whether the question asker has marked this as the best answer @@ -71,7 +71,7 @@ class QnA_Answer extends Managed_DataObject ), 'uri' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true, 'description' => 'UUID to the answer notice', ), diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index b421b0aed1..b531838677 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -48,7 +48,7 @@ class QnA_Question extends Managed_DataObject public $__table = 'qna_question'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int -> profile.id public $title; // text public $description; // text @@ -71,7 +71,7 @@ class QnA_Question extends Managed_DataObject ), 'uri' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true ), 'profile_id' => array('type' => 'int'), diff --git a/plugins/Realtime/classes/Realtime_channel.php b/plugins/Realtime/classes/Realtime_channel.php index 5d6f0ff99a..7541593433 100644 --- a/plugins/Realtime/classes/Realtime_channel.php +++ b/plugins/Realtime/classes/Realtime_channel.php @@ -53,9 +53,9 @@ class Realtime_channel extends Managed_DataObject public $__table = 'realtime_channel'; // table name public $user_id; // int -> user.id, can be null - public $action; // string - public $arg1; // argument - public $arg2; // argument, usually null + public $action; // varchar(191) not 255 because utf8mb4 takes more space + public $arg1; // varchar(191) argument not 255 because utf8mb4 takes more space + public $arg2; // varchar(191) usually null not 255 because utf8mb4 takes more space public $channel_key; // 128-bit shared secret key public $audience; // listener count public $created; // created date @@ -73,15 +73,15 @@ class Realtime_channel extends Managed_DataObject 'not null' => false, 'description' => 'user viewing page; can be null'), 'action' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true, 'description' => 'page being viewed'), 'arg1' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => false, 'description' => 'page argument, like username or tag'), 'arg2' => array('type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => false, 'description' => 'second page argument, like tag for showstream'), 'channel_key' => array('type' => 'varchar', diff --git a/plugins/TwitterBridge/classes/Twitter_synch_status.php b/plugins/TwitterBridge/classes/Twitter_synch_status.php index 9a20536147..28f60b9b3e 100644 --- a/plugins/TwitterBridge/classes/Twitter_synch_status.php +++ b/plugins/TwitterBridge/classes/Twitter_synch_status.php @@ -52,7 +52,7 @@ class Twitter_synch_status extends Managed_DataObject { public $__table = 'twitter_synch_status'; // table name public $foreign_id; // bigint primary_key not_null - public $timeline; // varchar(255) primary_key not_null + public $timeline; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space public $last_id; // bigint not_null public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -62,7 +62,7 @@ class Twitter_synch_status extends Managed_DataObject return array( 'fields' => array( 'foreign_id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'Foreign message ID'), - 'timeline' => array('type' => 'varchar', 'length' => 255, 'description' => 'timeline name'), + 'timeline' => array('type' => 'varchar', 'length' => 191, 'description' => 'timeline name'), 'last_id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'last id fetched'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),