GNU Social extensions fixes (please read note)

These extensions are not considered secure nor stable right now, so don't
use them for a while.
This commit is contained in:
Mikael Nordfeldth 2013-08-21 14:12:18 +02:00
parent 0bbcfa7bdf
commit 4fab7a9d8b
4 changed files with 11 additions and 20 deletions

View File

@ -60,7 +60,7 @@ class GNUsocialPhoto extends Managed_DataObject
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'Unique ID for Photo'),
'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'),
@ -72,7 +72,8 @@ class GNUsocialPhoto extends Managed_DataObject
),
'primary key' => array('id'),
'unique keys' => array(
'gnusocialphoto_uri' => array('uri'),
'gnusocialphoto_id_key' => array('notice_id'),
'gnusocialphoto_uri_key' => array('uri'),
),
'foreign keys' => array(
'gnusocialphoto_notice_id_fkey' => array('notice', array('notice_id' => 'id')),

View File

@ -48,7 +48,7 @@ class GNUsocialPhotoAlbum extends Managed_DataObject
{
return array(
'fields' => array(
'album_id' => array('type' => 'int', 'not null' => true, 'description' => 'Unique identifier for the album'),
'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_description' => array('type' => 'text', 'not null' => true, 'description' => 'A description for this album'),

View File

@ -34,7 +34,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
class GNUsocialProfileExtensionField extends Managed_DataObject
{
public $__table = 'GNUsocialProfileExtensionField';
public $__table = 'gnusocialprofileextensionfield';
public $id; // int(11)
public $systemname; // varchar(64)
public $title; // varchar(255)
@ -47,7 +47,7 @@ class GNUsocialProfileExtensionField extends Managed_DataObject
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'Unique ID for extension field'),
'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'),
'description' => array('type' => 'text', 'not null' => true, 'description' => 'field description'),
@ -62,16 +62,6 @@ class GNUsocialProfileExtensionField extends Managed_DataObject
);
}
function keyTypes()
{
return array('id' => 'K');
}
function sequenceKey()
{
return array(false, false, false);
}
static function newField($title, $description=null, $type='str', $systemname=null)
{
$field = new GNUsocialProfileExtensionField();

View File

@ -34,7 +34,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
class GNUsocialProfileExtensionResponse extends Managed_DataObject
{
public $__table = 'GNUsocialProfileExtensionResponse';
public $__table = 'gnusocialprofileextensionresponse';
public $id; // int(11)
public $extension_id; // int(11)
public $profile_id; // int(11)
@ -46,7 +46,7 @@ class GNUsocialProfileExtensionResponse extends Managed_DataObject
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'Unique ID for extension response'),
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique ID for extension response'),
'extension_id' => array('type' => 'int', 'not null' => true, 'description' => 'The extension field ID'),
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'Profile id that made the response'),
'value' => array('type' => 'text', 'not null' => true, 'description' => 'response entry'),
@ -56,7 +56,7 @@ class GNUsocialProfileExtensionResponse extends Managed_DataObject
'primary key' => array('id'),
'foreign keys' => array(
'gnusocialprofileextensionresponse_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
'gnusocialprofileextensionresponse_extension_id_fkey' => array('GNUsocialProfileExtensionField', array('extension_id' => 'id')),
'gnusocialprofileextensionresponse_extension_id_fkey' => array('gnusocialprofileextensionfield', array('extension_id' => 'id')),
),
'indexes' => array(
'gnusocialprofileextensionresponse_extension_id_idx' => array('extension_id'),
@ -82,8 +82,8 @@ class GNUsocialProfileExtensionResponse extends Managed_DataObject
static function findResponsesByProfile($id)
{
$extf = 'GNUsocialProfileExtensionField';
$extr = 'GNUsocialProfileExtensionResponse';
$extf = 'gnusocialprofileextensionfield';
$extr = 'gnusocialprofileextensionresponse';
$sql = "SELECT $extr.*, $extf.title, $extf.description, $extf.type, $extf.systemname FROM $extr JOIN $extf ON $extr.extension_id=$extf.id WHERE $extr.profile_id = $id";
$response = new GNUsocialProfileExtensionResponse();
$response->query($sql);