block duplicate channels

This commit is contained in:
friendica 2013-07-17 21:38:37 -07:00
parent 15a614e158
commit fc265a8e3a
3 changed files with 12 additions and 2 deletions

View File

@ -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' );

View File

@ -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`),

View File

@ -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;
}