aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-07-17 21:38:37 -0700
committerfriendica <info@friendica.com>2013-07-17 21:38:37 -0700
commitfc265a8e3a1c6b2f5098b6e9b8243492b706222f (patch)
treed828248191dc9a7e28942cb0e0f296abe4e2abc3
parent15a614e1583db8ea5fab8f51172ed23f666ac235 (diff)
downloadvolse-hubzilla-fc265a8e3a1c6b2f5098b6e9b8243492b706222f.tar.gz
volse-hubzilla-fc265a8e3a1c6b2f5098b6e9b8243492b706222f.tar.bz2
volse-hubzilla-fc265a8e3a1c6b2f5098b6e9b8243492b706222f.zip
block duplicate channels
-rwxr-xr-xboot.php2
-rw-r--r--install/database.sql1
-rw-r--r--install/update.php11
3 files changed, 12 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index 9eb2bf3dd..af9fa6cfa 100755
--- a/boot.php
+++ b/boot.php
@@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1052 );
+define ( 'DB_UPDATE_VERSION', 1053 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/install/database.sql b/install/database.sql
index 2a31ce0cf..acafabde8 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -182,6 +182,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128',
`channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128',
PRIMARY KEY (`channel_id`),
+ UNIQUE KEY `channel_address_unique` (`channel_address`),
KEY `channel_account_id` (`channel_account_id`),
KEY `channel_primary` (`channel_primary`),
KEY `channel_name` (`channel_name`),
diff --git a/install/update.php b/install/update.php
index 160d94a4d..8bc629f71 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1052 );
+define( 'UPDATE_VERSION' , 1053 );
/**
*
@@ -626,3 +626,12 @@ function update_r1051() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+
+function update_r1052() {
+ $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+