From 139c24c51eb6f8f8d76ad8cbc954967dbe075949 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 7 Aug 2017 14:52:39 +0200 Subject: [PATCH] Added generic identifier for media providers --- com.woltlab.wcf/package.xml | 2 +- com.woltlab.wcf/update_3.1.sql | 4 ++++ .../acp/form/BBCodeMediaProviderAddForm.class.php | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index be787ba280..55660ec4eb 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -44,7 +44,7 @@ acp/post_install.php - + diff --git a/com.woltlab.wcf/update_3.1.sql b/com.woltlab.wcf/update_3.1.sql index 083b888189..f9d8815648 100644 --- a/com.woltlab.wcf/update_3.1.sql +++ b/com.woltlab.wcf/update_3.1.sql @@ -6,6 +6,10 @@ ALTER TABLE wcf1_article_content ADD COLUMN teaserImageID INT(10); ALTER TABLE wcf1_bbcode_media_provider ADD COLUMN name VARCHAR(80) NOT NULL; ALTER TABLE wcf1_bbcode_media_provider ADD COLUMN packageID INT(10) NOT NULL; ALTER TABLE wcf1_bbcode_media_provider ADD COLUMN className varchar(255) NOT NULL DEFAULT ''; + +-- remove default media providers (they'll be re-added later during the upgrade) +DELETE FROM wcf1_bbcode_media_provider WHERE title IN ('YouTube', 'YouTube Playlist', 'Vimeo', 'Clipfish', 'Veoh', 'DailyMotion', 'github gist', 'Soundcloud', 'Soundcloud set'); +UPDATE wcf1_bbcode_media_provider SET name = CONCAT('com.woltlab.wcf.generic', providerID); ALTER TABLE wcf1_bbcode_media_provider ADD UNIQUE KEY name (name, packageID); ALTER TABLE wcf1_box ADD COLUMN lastUpdateTime INT(10) NOT NULL DEFAULT 0; diff --git a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php index 810c7a62f7..5cf2eefa86 100644 --- a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php @@ -1,6 +1,8 @@ objectAction = new BBCodeMediaProviderAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, @@ -108,9 +112,15 @@ class BBCodeMediaProviderAddForm extends AbstractForm { 'html' => $this->html, 'className' => $this->className ])]); - $this->objectAction->executeAction(); + $returnValues = $this->objectAction->executeAction(); $this->saved(); + /** @var BBCodeMediaProvider $provider */ + $provider = $returnValues['returnValues']; + (new BBCodeMediaProviderEditor($provider))->update([ + 'name' => 'com.woltlab.wcf.generic' . $provider->providerID + ]); + // reset values $this->title = $this->regex = $this->html = $this->className = ''; -- 2.20.1