[SCHEMA] Improve timestamp storage
Avoid the use of deprecated MariaDB "zero dates" globally. If they're present as attribute defaults somewhere, they will be replaced with NULL implicitly. The existing "zero dates" in MariaDB storage will be left intact and this should not present any issues. The "timestamp" type in table definitions now corresponds to DATETIME in MariaDB with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", which should be close enough to the original behaviour for compatibility purposes. It is now the recommended type for "modified" attributes, because of the update trigger on MariaDB. But there is no such trigger implemented on PostgreSQL as of this moment.
This commit is contained in:
parent
eb993df072
commit
26115482ef
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Data class for counting greetings
|
||||
*
|
||||
* @package GNU social
|
||||
* @package GNUsocial
|
||||
* @author Brion Vibber <brionv@status.net>
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
|
||||
@ -36,7 +36,7 @@ defined('GNUSOCIAL') || die();
|
||||
* and other bits of good functionality to StatusNet-specific data classes.
|
||||
*
|
||||
* @category Action
|
||||
* @package GNU social
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
@ -48,8 +48,8 @@ class User_greeting_count extends Managed_DataObject
|
||||
public $__table = 'user_greeting_count'; // table name
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $greeting_count; // int(4)
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -57,8 +57,8 @@ class User_greeting_count extends Managed_DataObject
|
||||
'fields' => [
|
||||
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user id'],
|
||||
'greeting_count' => ['type' => 'int', 'not null' => true, 'description' => 'the greeting count'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['user_id'],
|
||||
'foreign keys' => [
|
||||
|
@ -1,30 +1,38 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* GNU social - a federating social network
|
||||
* Copyright (C) 2014, Free Software Foundation, Inc.
|
||||
* Data class for Attentions
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @category Data
|
||||
* @package GNUsocial
|
||||
* @copyright 2014 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
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(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $reason; // varchar(191)
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -34,8 +42,8 @@ class Attention extends Managed_DataObject
|
||||
'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' => 191, 'description' => 'Optional reason why this was brought to the attention of profile_id'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'profile_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -29,8 +29,8 @@ class Avatar extends Managed_DataObject
|
||||
public $height; // int(4) primary_key not_null
|
||||
public $mediatype; // varchar(32) not_null
|
||||
public $filename; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -42,8 +42,8 @@ class Avatar extends Managed_DataObject
|
||||
'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' => 191, 'description' => 'local filename, if local'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'width', 'height'),
|
||||
'unique keys' => array(
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for confirm_address
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Confirm_address extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'confirm_address'; // table name
|
||||
@ -13,7 +30,7 @@ class Confirm_address extends Managed_DataObject
|
||||
public $address_type; // varchar(8) not_null
|
||||
public $claimed; // datetime()
|
||||
public $sent; // datetime()
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -26,7 +43,7 @@ class Confirm_address extends Managed_DataObject
|
||||
'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'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
'foreign keys' => array(
|
||||
@ -35,7 +52,7 @@ class Confirm_address extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function getByAddress($address, $addressType)
|
||||
public static function getByAddress($address, $addressType)
|
||||
{
|
||||
$ca = new Confirm_address();
|
||||
|
||||
@ -49,7 +66,7 @@ class Confirm_address extends Managed_DataObject
|
||||
return $ca;
|
||||
}
|
||||
|
||||
static function saveNew($user, $address, $addressType, $extra=null)
|
||||
public static function saveNew($user, $address, $addressType, $extra = null)
|
||||
{
|
||||
$ca = new Confirm_address();
|
||||
|
||||
@ -99,12 +116,12 @@ class Confirm_address extends Managed_DataObject
|
||||
* sitename Name we sign the email with (defaults to sitename, but can be any string)
|
||||
* url The confirmation address URL.
|
||||
*/
|
||||
public function sendConfirmation(array $args=array())
|
||||
public function sendConfirmation(array $args = [])
|
||||
{
|
||||
common_debug('Sending confirmation URL for user '._ve($this->user_id).' using '._ve($this->address_type));
|
||||
|
||||
$defaults = [
|
||||
'headers' => array(),
|
||||
'headers' => [],
|
||||
'nickname' => $this->getProfile()->getNickname(),
|
||||
'sitename' => common_config('site', 'name'),
|
||||
'url' => $this->getUrl(),
|
||||
@ -124,7 +141,7 @@ class Confirm_address extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
public function sendEmailConfirmation(array $args=array())
|
||||
public function sendEmailConfirmation(array $args = [])
|
||||
{
|
||||
// TRANS: Subject for address confirmation email.
|
||||
$subject = _('Email address confirmation');
|
||||
@ -132,7 +149,8 @@ class Confirm_address extends Managed_DataObject
|
||||
// TRANS: Body for address confirmation email.
|
||||
// TRANS: %1$s is the addressed user's nickname, %2$s is the StatusNet sitename,
|
||||
// TRANS: %3$s is the URL to confirm at.
|
||||
$body = sprintf(_("Hey, %1\$s.\n\n".
|
||||
$body = sprintf(
|
||||
_("Hey, %1\$s.\n\n" .
|
||||
"Someone just entered this email address on %2\$s.\n\n" .
|
||||
"If it was you, and you want to confirm your entry, ".
|
||||
"use the URL below:\n\n\t%3\$s\n\n" .
|
||||
@ -140,13 +158,14 @@ class Confirm_address extends Managed_DataObject
|
||||
"Thanks for your time, \n%2\$s\n"),
|
||||
$args['nickname'],
|
||||
$args['sitename'],
|
||||
$args['url']);
|
||||
$args['url']
|
||||
);
|
||||
|
||||
require_once INSTALLDIR . '/lib/util/mail.php';
|
||||
return mail_to_user($this->getProfile()->getUser(), $subject, $body, $args['headers'], $this->getAddress());
|
||||
}
|
||||
|
||||
public function delete($useWhere=false)
|
||||
public function delete($useWhere = false)
|
||||
{
|
||||
$result = parent::delete($useWhere);
|
||||
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for consumer
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Consumer extends Managed_DataObject
|
||||
{
|
||||
@ -13,8 +29,8 @@ class Consumer extends Managed_DataObject
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -27,14 +43,14 @@ class Consumer extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key'),
|
||||
);
|
||||
}
|
||||
|
||||
static function generateNew()
|
||||
public static function generateNew()
|
||||
{
|
||||
$cons = new Consumer();
|
||||
$rand = common_random_hexstr(16);
|
||||
@ -53,24 +69,24 @@ class Consumer extends Managed_DataObject
|
||||
* XXX: Should this happen in an OAuthDataStore instead?
|
||||
*
|
||||
*/
|
||||
function delete($useWhere=false)
|
||||
public function delete($useWhere = false)
|
||||
{
|
||||
// XXX: Is there any reason NOT to do this kind of cleanup?
|
||||
|
||||
$this->_deleteTokens();
|
||||
$this->_deleteNonces();
|
||||
$this->deleteTokens();
|
||||
$this->deleteNonces();
|
||||
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteTokens()
|
||||
private function deleteTokens()
|
||||
{
|
||||
$token = new Token();
|
||||
$token->consumer_key = $this->consumer_key;
|
||||
$token->delete();
|
||||
}
|
||||
|
||||
function _deleteNonces()
|
||||
private function deleteNonces()
|
||||
{
|
||||
$nonce = new Nonce();
|
||||
$nonce->consumer_key = $this->consumer_key;
|
||||
|
@ -34,8 +34,8 @@ class Conversation extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null auto_increment
|
||||
public $uri; // varchar(191) unique_key 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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -44,8 +44,8 @@ class Conversation extends Managed_DataObject
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique identifier, (again) unrelated to notice id since 2016-01-06'),
|
||||
'uri' => array('type' => 'varchar', 'not null'=>true, 'length' => 191, 'description' => 'URI of the conversation'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'Resolvable URL, preferrably remote (local can be generated on the fly)'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -43,7 +43,7 @@ class File extends Managed_DataObject
|
||||
public $filename; // text()
|
||||
public $width; // int(4)
|
||||
public $height; // int(4)
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
const URLHASH_ALG = 'sha256';
|
||||
const FILEHASH_ALG = 'sha256';
|
||||
@ -64,7 +64,7 @@ class File extends Managed_DataObject
|
||||
'filename' => array('type' => 'text', 'description' => 'if file is stored locally (too) this is the filename'),
|
||||
'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'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -30,7 +30,7 @@ class File_redirection extends Managed_DataObject
|
||||
public $file_id; // int(4)
|
||||
public $redirections; // int(4)
|
||||
public $httpcode; // int(4)
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -46,7 +46,7 @@ class File_redirection extends Managed_DataObject
|
||||
'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.)'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('urlhash'),
|
||||
'foreign keys' => array(
|
||||
|
@ -33,7 +33,7 @@ class File_thumbnail extends Managed_DataObject
|
||||
public $filename; // text
|
||||
public $width; // int(4) primary_key
|
||||
public $height; // int(4) primary_key
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
const URLHASH_ALG = 'sha256';
|
||||
|
||||
@ -47,7 +47,7 @@ class File_thumbnail extends Managed_DataObject
|
||||
'filename' => array('type' => 'text', 'description' => 'if stored locally, filename is put here'),
|
||||
'width' => array('type' => 'int', 'not null' => true, 'description' => 'width of thumbnail'),
|
||||
'height' => array('type' => 'int', 'not null' => true, 'description' => 'height of thumbnail'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('file_id', 'width', 'height'),
|
||||
'indexes' => array(
|
||||
|
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for file_to_post
|
||||
*
|
||||
* @copyright 2008, 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class File_to_post extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -31,7 +31,7 @@ class File_to_post extends Managed_DataObject
|
||||
public $__table = 'file_to_post'; // table name
|
||||
public $file_id; // int(4) primary_key not_null
|
||||
public $post_id; // int(4) primary_key not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -42,7 +42,7 @@ class File_to_post extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of URL/file'),
|
||||
'post_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the notice it belongs to'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('file_id', 'post_id'),
|
||||
'foreign keys' => array(
|
||||
@ -56,7 +56,8 @@ class File_to_post extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function processNew(File $file, Notice $notice) {
|
||||
public static function processNew(File $file, Notice $notice)
|
||||
{
|
||||
static $seen = array();
|
||||
|
||||
$file_id = $file->getID();
|
||||
@ -82,7 +83,7 @@ class File_to_post extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function getNoticeIDsByFile(File $file)
|
||||
public static function getNoticeIDsByFile(File $file)
|
||||
{
|
||||
$f2p = new File_to_post();
|
||||
|
||||
@ -100,7 +101,7 @@ class File_to_post extends Managed_DataObject
|
||||
return $f2p->fetchAll('post_id');
|
||||
}
|
||||
|
||||
function delete($useWhere=false)
|
||||
public function delete($useWhere = false)
|
||||
{
|
||||
try {
|
||||
$f = File::getByID($this->file_id);
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for foreign_link
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Foreign_link extends Managed_DataObject
|
||||
{
|
||||
@ -19,8 +35,8 @@ class Foreign_link extends Managed_DataObject
|
||||
public $profilesync; // tinyint(1) not_null default_1
|
||||
public $last_noticesync; // datetime()
|
||||
public $last_friendsync; // datetime()
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -38,8 +54,8 @@ class Foreign_link extends Managed_DataObject
|
||||
'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),
|
||||
'last_noticesync' => array('type' => 'datetime', 'description' => 'last time notices were imported'),
|
||||
'last_friendsync' => array('type' => 'datetime', 'description' => 'last time friends were imported'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id', 'foreign_id', 'service'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for foreign_service
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Foreign_service extends Managed_DataObject
|
||||
{
|
||||
@ -13,8 +29,8 @@ class Foreign_service extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $name; // varchar(32) unique_key not_null
|
||||
public $description; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -26,8 +42,8 @@ class Foreign_service extends Managed_DataObject
|
||||
'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' => 191, 'description' => 'description'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for foreign_subscription
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Foreign_subscription extends Managed_DataObject
|
||||
{
|
||||
@ -13,7 +29,7 @@ class Foreign_subscription extends Managed_DataObject
|
||||
public $service; // int(4) primary_key not_null
|
||||
public $subscriber; // int(4) primary_key not_null
|
||||
public $subscribed; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -26,7 +42,7 @@ class Foreign_subscription extends Managed_DataObject
|
||||
'service' => array('type' => 'int', 'not null' => true, 'description' => 'service where relationship happens'),
|
||||
'subscriber' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscriber on foreign service'),
|
||||
'subscribed' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscribed user'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('service', 'subscriber', 'subscribed'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for foreign_user
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Foreign_user extends Managed_DataObject
|
||||
{
|
||||
@ -14,8 +30,8 @@ class Foreign_user extends Managed_DataObject
|
||||
public $service; // int(4) primary_key not_null
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -28,8 +44,8 @@ class Foreign_user extends Managed_DataObject
|
||||
'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to 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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id', 'service'),
|
||||
'foreign keys' => array(
|
||||
@ -41,7 +57,7 @@ class Foreign_user extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function getForeignUser($id, $service)
|
||||
public static function getForeignUser($id, $service)
|
||||
{
|
||||
if (empty($id) || empty($service)) {
|
||||
throw new ServerException('Empty foreign user id or service for Foreign_user::getForeignUser');
|
||||
@ -59,7 +75,7 @@ class Foreign_user extends Managed_DataObject
|
||||
return $fuser;
|
||||
}
|
||||
|
||||
static function getByNickname($nickname, $service)
|
||||
public static function getByNickname($nickname, $service)
|
||||
{
|
||||
if (empty($nickname) || empty($service)) {
|
||||
throw new ServerException('Empty nickname or service for Foreign_user::getByNickname');
|
||||
|
@ -1,27 +1,27 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for group_alias
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Group_alias extends Managed_DataObject
|
||||
{
|
||||
@ -31,7 +31,7 @@ class Group_alias extends Managed_DataObject
|
||||
public $__table = 'group_alias'; // table name
|
||||
public $alias; // varchar(64) primary_key not_null
|
||||
public $group_id; // int(4) not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -42,7 +42,7 @@ class Group_alias extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'alias' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'),
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date alias was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'),
|
||||
),
|
||||
'primary key' => array('alias'),
|
||||
'foreign keys' => array(
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Group_block extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -36,7 +34,7 @@ class Group_block extends Managed_DataObject
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $blocked; // int(4) primary_key not_null
|
||||
public $blocker; // int(4) not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -48,7 +46,7 @@ class Group_block extends Managed_DataObject
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
|
||||
'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
|
||||
'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
|
||||
),
|
||||
'primary key' => array('group_id', 'blocked'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for group_inbox
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Group_inbox extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -11,7 +28,7 @@ class Group_inbox extends Managed_DataObject
|
||||
public $__table = 'group_inbox'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -23,7 +40,7 @@ class Group_inbox extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group receiving the message'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice received'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the notice was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date the notice was created'),
|
||||
),
|
||||
'primary key' => array('group_id', 'notice_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -14,12 +14,11 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Table Definition for request_queue
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Group_join_queue extends Managed_DataObject
|
||||
{
|
||||
@ -41,7 +40,7 @@ class Group_join_queue extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'),
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local group to join, if any'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'group_id'),
|
||||
'indexes' => array(
|
||||
|
@ -30,8 +30,8 @@ class Group_member extends Managed_DataObject
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $is_admin; // bool default_false
|
||||
public $uri; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -44,8 +44,8 @@ class Group_member extends Managed_DataObject
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
'is_admin' => array('type' => 'bool', 'default' => false, 'description' => 'is this user an admin?'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('group_id', 'profile_id'),
|
||||
'unique keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for invitation
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Invitation extends Managed_DataObject
|
||||
{
|
||||
@ -15,12 +31,12 @@ class Invitation extends Managed_DataObject
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function convert($user)
|
||||
public function convert($user)
|
||||
{
|
||||
$orig = clone($this);
|
||||
$this->registered_user_id = $user->id;
|
||||
@ -36,7 +52,7 @@ class Invitation extends Managed_DataObject
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'),
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', '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'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for local_group
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Local_group extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -11,8 +28,8 @@ class Local_group extends Managed_DataObject
|
||||
public $__table = 'local_group'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $nickname; // varchar(64) unique_key
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -24,8 +41,8 @@ class Local_group extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group represented'),
|
||||
'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'group represented'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('group_id'),
|
||||
'foreign keys' => array(
|
||||
@ -54,7 +71,7 @@ class Local_group extends Managed_DataObject
|
||||
return $group;
|
||||
}
|
||||
|
||||
function setNickname($nickname)
|
||||
public function setNickname($nickname)
|
||||
{
|
||||
$this->decache();
|
||||
$qry = 'UPDATE local_group set nickname = "'.$this->escape($nickname).'" where group_id = ' . $this->group_id;
|
||||
|
@ -1,29 +1,27 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Table Definition for location_namespace
|
||||
*
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Location_namespace extends Managed_DataObject
|
||||
{
|
||||
@ -33,8 +31,8 @@ class Location_namespace extends Managed_DataObject
|
||||
public $__table = 'location_namespace'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $description; // varchar(191)
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -45,8 +43,8 @@ class Location_namespace extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity for this namespace'),
|
||||
'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description of the namespace'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date the record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
);
|
||||
|
@ -1,27 +1,27 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for login_token
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Login_token extends Managed_DataObject
|
||||
{
|
||||
@ -31,8 +31,8 @@ class Login_token extends Managed_DataObject
|
||||
public $__table = 'login_token'; // table name
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $token; // char(32) not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -43,8 +43,8 @@ class Login_token extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user owning this token'),
|
||||
'token' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'token useable for logging in'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
@ -55,7 +55,7 @@ class Login_token extends Managed_DataObject
|
||||
|
||||
const TIMEOUT = 120; // seconds after which to timeout the token
|
||||
|
||||
function makeNew($user)
|
||||
public function makeNew($user)
|
||||
{
|
||||
$login_token = Login_token::getKV('user_id', $user->id);
|
||||
|
||||
@ -75,8 +75,10 @@ class Login_token extends Managed_DataObject
|
||||
common_log_db_error($login_token, 'INSERT', __FILE__);
|
||||
// TRANS: Exception thrown when trying creating a login token failed.
|
||||
// TRANS: %s is the user nickname for which token creation failed.
|
||||
throw new Exception(sprintf(_('Could not create login token for %s'),
|
||||
$user->nickname));
|
||||
throw new Exception(sprintf(
|
||||
_('Could not create login token for %s'),
|
||||
$user->nickname
|
||||
));
|
||||
}
|
||||
|
||||
return $login_token;
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for nonce
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Nonce extends Managed_DataObject
|
||||
{
|
||||
@ -14,8 +30,8 @@ class Nonce extends Managed_DataObject
|
||||
public $tok; // char(32)
|
||||
public $nonce; // char(32) primary_key not_null
|
||||
public $ts; // datetime() primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -29,7 +45,7 @@ class Nonce extends Managed_DataObject
|
||||
* @return array
|
||||
* @access public
|
||||
*/
|
||||
function links()
|
||||
public function links()
|
||||
{
|
||||
return array('consumer_key,token' => 'token:consumer_key,token');
|
||||
}
|
||||
@ -43,8 +59,8 @@ class Nonce extends Managed_DataObject
|
||||
'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'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key', 'ts', 'nonce'),
|
||||
);
|
||||
|
@ -58,8 +58,8 @@ class Notice extends Managed_DataObject
|
||||
public $content; // text
|
||||
public $rendered; // text
|
||||
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; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() multiple_key
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $reply_to; // int(4)
|
||||
public $is_local; // int(4)
|
||||
public $source; // varchar(32)
|
||||
@ -82,8 +82,8 @@ class Notice extends Managed_DataObject
|
||||
'content' => array('type' => 'text', 'description' => 'update content', 'collate' => 'utf8mb4_general_ci'),
|
||||
'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', '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)'),
|
||||
'is_local' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'notice was generated by a user'),
|
||||
'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'),
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for notice_location
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Notice_location extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'notice_location'; // table name
|
||||
@ -11,7 +28,7 @@ class Notice_location extends Managed_DataObject
|
||||
public $lon; // decimal(10,7)
|
||||
public $location_id; // int(4)
|
||||
public $location_ns; // int(4)
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -22,7 +39,7 @@ class Notice_location extends Managed_DataObject
|
||||
'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'),
|
||||
'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
|
||||
'location_ns' => array('type' => 'int', 'description' => 'namespace for location'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id'),
|
||||
'foreign keys' => array(
|
||||
@ -34,7 +51,7 @@ class Notice_location extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function locFromStored(Notice $stored)
|
||||
public static function locFromStored(Notice $stored)
|
||||
{
|
||||
$loc = new Notice_location();
|
||||
$loc->notice_id = $stored->getID();
|
||||
@ -44,7 +61,7 @@ class Notice_location extends Managed_DataObject
|
||||
return $loc->asLocation();
|
||||
}
|
||||
|
||||
static function fromLocation(Location $location)
|
||||
public static function fromLocation(Location $location)
|
||||
{
|
||||
$notloc = new Notice_location();
|
||||
$notloc->lat = $location->lat;
|
||||
|
@ -34,8 +34,8 @@ class Notice_prefs extends Managed_DataObject
|
||||
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; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -45,8 +45,8 @@ class Notice_prefs extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'namespace', 'topic'),
|
||||
'foreign keys' => array(
|
||||
|
@ -14,13 +14,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Table Definition for notice_source
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Notice_source extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -30,8 +29,8 @@ class Notice_source extends Managed_DataObject
|
||||
public $code; // varchar(32) primary_key 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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -43,9 +42,9 @@ class Notice_source extends Managed_DataObject
|
||||
'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'source code'),
|
||||
'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, 'default' => 0, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'default' => 0, 'description' => 'notice id'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
);
|
||||
|
@ -1,23 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2008, 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Notice_tag extends Managed_DataObject
|
||||
{
|
||||
@ -27,7 +29,7 @@ class Notice_tag extends Managed_DataObject
|
||||
public $__table = 'notice_tag'; // table name
|
||||
public $tag; // varchar(64) primary_key not_null
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -39,7 +41,7 @@ class Notice_tag extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice tagged'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('tag', 'notice_id'),
|
||||
'foreign keys' => array(
|
||||
@ -53,15 +55,20 @@ class Notice_tag extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function getStream($tag, $offset=0, $limit=20, $sinceId=0, $maxId=0)
|
||||
{
|
||||
public static function getStream(
|
||||
$tag,
|
||||
$offset = 0,
|
||||
$limit = 20,
|
||||
$sinceId = 0,
|
||||
$maxId = 0
|
||||
) {
|
||||
// FIXME: Get the Profile::current value some other way
|
||||
// to avoid confusino between queue processing and session.
|
||||
$stream = new TagNoticeStream($tag, Profile::current());
|
||||
return $stream;
|
||||
}
|
||||
|
||||
function blowCache($blowLast=false)
|
||||
public function blowCache($blowLast = false)
|
||||
{
|
||||
self::blow('notice_tag:notice_ids:%s', Cache::keyize($this->tag));
|
||||
if ($blowLast) {
|
||||
@ -69,16 +76,20 @@ class Notice_tag extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function url($tag)
|
||||
public static function url($tag)
|
||||
{
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
// regular TagAction isn't set up in 1user mode
|
||||
// Regular TagAction isn't set up in 1user mode
|
||||
$nickname = User::singleUserNickname();
|
||||
$url = common_local_url('showstream',
|
||||
array('nickname' => $nickname,
|
||||
'tag' => $tag));
|
||||
$url = common_local_url(
|
||||
'showstream',
|
||||
[
|
||||
'nickname' => $nickname,
|
||||
'tag' => $tag,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$url = common_local_url('tag', array('tag' => $tag));
|
||||
$url = common_local_url('tag', ['tag' => $tag]);
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for oauth_application
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Oauth_application extends Managed_DataObject
|
||||
{
|
||||
@ -22,8 +38,8 @@ class Oauth_application extends Managed_DataObject
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -35,12 +51,12 @@ class Oauth_application extends Managed_DataObject
|
||||
public static $browser = 1;
|
||||
public static $desktop = 2;
|
||||
|
||||
function getConsumer()
|
||||
public function getConsumer()
|
||||
{
|
||||
return Consumer::getKV('consumer_key', $this->consumer_key);
|
||||
}
|
||||
|
||||
static function maxDesc()
|
||||
public 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 191 chars
|
||||
@ -57,13 +73,13 @@ class Oauth_application extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function descriptionTooLong($desc)
|
||||
public static function descriptionTooLong($desc)
|
||||
{
|
||||
$desclimit = self::maxDesc();
|
||||
return ($desclimit > 0 && !empty($desc) && (mb_strlen($desc) > $desclimit));
|
||||
}
|
||||
|
||||
function setAccessFlags($read, $write)
|
||||
public function setAccessFlags($read, $write)
|
||||
{
|
||||
if ($read) {
|
||||
$this->access_type |= self::$readAccess;
|
||||
@ -78,7 +94,7 @@ class Oauth_application extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
function setOriginal($filename)
|
||||
public function setOriginal($filename)
|
||||
{
|
||||
$imagefile = new ImageFile(null, Avatar::path($filename));
|
||||
|
||||
@ -91,7 +107,7 @@ class Oauth_application extends Managed_DataObject
|
||||
return $this->update($orig);
|
||||
}
|
||||
|
||||
static function getByConsumerKey($key)
|
||||
public static function getByConsumerKey($key)
|
||||
{
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
@ -113,11 +129,9 @@ class Oauth_application extends Managed_DataObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function uploadLogo()
|
||||
public function uploadLogo()
|
||||
{
|
||||
if ($_FILES['app_icon']['error'] ==
|
||||
UPLOAD_ERR_OK) {
|
||||
|
||||
if ($_FILES['app_icon']['error'] == UPLOAD_ERR_OK) {
|
||||
try {
|
||||
$imagefile = ImageFile::fromUpload('app_icon');
|
||||
} catch (Exception $e) {
|
||||
@ -126,10 +140,12 @@ class Oauth_application extends Managed_DataObject
|
||||
return;
|
||||
}
|
||||
|
||||
$filename = Avatar::filename($this->id,
|
||||
$filename = Avatar::filename(
|
||||
$this->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
null,
|
||||
'oauth-app-icon-'.common_timestamp());
|
||||
'oauth-app-icon-' . common_timestamp()
|
||||
);
|
||||
|
||||
$filepath = Avatar::path($filename);
|
||||
|
||||
@ -139,9 +155,9 @@ class Oauth_application extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
function delete($useWhere=false)
|
||||
public function delete($useWhere = false)
|
||||
{
|
||||
$this->_deleteAppUsers();
|
||||
$this->deleteAppUsers();
|
||||
|
||||
$consumer = $this->getConsumer();
|
||||
$consumer->delete();
|
||||
@ -149,7 +165,7 @@ class Oauth_application extends Managed_DataObject
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteAppUsers()
|
||||
private function deleteAppUsers()
|
||||
{
|
||||
$oauser = new Oauth_application_user();
|
||||
$oauser->application_id = $this->id;
|
||||
@ -173,8 +189,8 @@ class Oauth_application extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -14,13 +14,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Table Definition for oauth_application_user
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Oauth_application_user extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -31,8 +30,8 @@ class Oauth_application_user extends Managed_DataObject
|
||||
public $application_id; // int(4) primary_key not_null
|
||||
public $access_type; // tinyint(1)
|
||||
public $token; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -45,8 +44,8 @@ class Oauth_application_user extends Managed_DataObject
|
||||
'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' => 191, 'description' => 'request or access token'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'application_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -14,13 +14,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Table Definition for oauth_association
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Oauth_token_association extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -30,8 +29,8 @@ class Oauth_token_association extends Managed_DataObject
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $application_id; // int(4) primary_key not_null
|
||||
public $token; // varchar(191) primary key not null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -61,8 +60,8 @@ class Oauth_token_association extends Managed_DataObject
|
||||
'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' => '191', 'not null' => true, 'description' => 'token used for this association'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'application_id', 'token'),
|
||||
'foreign keys' => array(
|
||||
|
@ -57,8 +57,8 @@ class Old_school_prefs extends Managed_DataObject
|
||||
'stream_nicknames' => array('type' => 'bool',
|
||||
'default' => true,
|
||||
'description' => 'Show nicknames for authors and addressees in streams'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -15,15 +15,14 @@
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for profile
|
||||
*
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Table Definition for profile
|
||||
*/
|
||||
class Profile extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'profile'; // table name
|
||||
@ -38,8 +37,8 @@ class Profile extends Managed_DataObject
|
||||
public $lon; // decimal(10,7)
|
||||
public $location_id; // int(4)
|
||||
public $location_ns; // int(4)
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -57,8 +56,8 @@ class Profile extends Managed_DataObject
|
||||
'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'),
|
||||
'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
|
||||
'location_ns' => array('type' => 'int', 'description' => 'namespace for location'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'indexes' => array(
|
||||
|
@ -1,29 +1,27 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Table Definition for profile_block
|
||||
*
|
||||
* @copyright 2008, 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Profile_block extends Managed_DataObject
|
||||
{
|
||||
@ -44,7 +42,7 @@ class Profile_block extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
|
||||
'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'profile_block_blocker_fkey' => array('user', array('blocker' => 'id')),
|
||||
@ -54,7 +52,7 @@ class Profile_block extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function exists(Profile $blocker, Profile $blocked)
|
||||
public static function exists(Profile $blocker, Profile $blocked)
|
||||
{
|
||||
return Profile_block::pkeyGet(array('blocker' => $blocker->id,
|
||||
'blocked' => $blocked->id));
|
||||
|
@ -32,8 +32,8 @@ class Profile_list extends Managed_DataObject
|
||||
public $tag; // varchar(64)
|
||||
public $description; // text
|
||||
public $private; // bool default_false
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
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
|
||||
@ -49,8 +49,8 @@ class Profile_list extends Managed_DataObject
|
||||
'description' => array('type' => 'text', 'description' => 'description of the people tag'),
|
||||
'private' => array('type' => 'bool', 'default' => false, 'description' => 'is this tag private'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'),
|
||||
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page to link to'),
|
||||
|
@ -33,8 +33,8 @@ class Profile_prefs extends Managed_DataObject
|
||||
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; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -44,8 +44,8 @@ class Profile_prefs extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'namespace', 'topic'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,31 +1,27 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Table Definition for profile_role
|
||||
*
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Profile_role extends Managed_DataObject
|
||||
{
|
||||
@ -35,7 +31,7 @@ class Profile_role extends Managed_DataObject
|
||||
public $__table = 'profile_role'; // table name
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $role; // varchar(32) primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -46,7 +42,7 @@ class Profile_role extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'account having the role'),
|
||||
'role' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'string representing the role'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the role was granted'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date the role was granted'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'role'),
|
||||
'foreign keys' => array(
|
||||
|
@ -25,7 +25,7 @@ class Profile_tag extends Managed_DataObject
|
||||
public $tagger; // int(4) primary_key not_null
|
||||
public $tagged; // int(4) primary_key not_null
|
||||
public $tag; // varchar(64) primary_key not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -35,7 +35,7 @@ class Profile_tag extends Managed_DataObject
|
||||
'tagger' => array('type' => 'int', 'not null' => true, 'description' => 'user making the tag'),
|
||||
'tagged' => array('type' => 'int', 'not null' => true, 'description' => 'profile tagged'),
|
||||
'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'),
|
||||
),
|
||||
'primary key' => array('tagger', 'tagged', 'tag'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for profile_tag_subscription
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Profile_tag_subscription extends Managed_DataObject
|
||||
{
|
||||
@ -12,8 +28,8 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
public $__table = 'profile_tag_subscription'; // table name
|
||||
public $profile_tag_id; // int(4) not_null
|
||||
public $profile_id; // int(4) not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -25,8 +41,8 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
'profile_tag_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile_tag'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_tag_id', 'profile_id'),
|
||||
'foreign keys' => array(
|
||||
@ -41,7 +57,7 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function add($peopletag, $profile)
|
||||
public static function add($peopletag, $profile)
|
||||
{
|
||||
if ($peopletag->private) {
|
||||
return false;
|
||||
@ -51,7 +67,7 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
$args = array('profile_tag_id' => $peopletag->id,
|
||||
'profile_id' => $profile->id);
|
||||
$existing = Profile_tag_subscription::pkeyGet($args);
|
||||
if(!empty($existing)) {
|
||||
if (!empty($existing)) {
|
||||
return $existing;
|
||||
}
|
||||
|
||||
@ -76,7 +92,7 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function remove($peopletag, $profile)
|
||||
public static function remove($peopletag, $profile)
|
||||
{
|
||||
$sub = Profile_tag_subscription::pkeyGet(array('profile_tag_id' => $peopletag->id,
|
||||
'profile_id' => $profile->id));
|
||||
@ -103,12 +119,13 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
}
|
||||
|
||||
// called if a tag gets deleted / made private
|
||||
static function cleanup($profile_list) {
|
||||
public static function cleanup($profile_list)
|
||||
{
|
||||
$subs = new self();
|
||||
$subs->profile_tag_id = $profile_list->id;
|
||||
$subs->find();
|
||||
|
||||
while($subs->fetch()) {
|
||||
while ($subs->fetch()) {
|
||||
$profile = Profile::getKV('id', $subs->profile_id);
|
||||
Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
|
||||
// Delete anyway
|
||||
@ -117,22 +134,26 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
function insert()
|
||||
public function insert()
|
||||
{
|
||||
$result = parent::insert();
|
||||
if ($result) {
|
||||
self::blow('profile_list:subscriber_count:%d',
|
||||
$this->profile_tag_id);
|
||||
self::blow(
|
||||
'profile_list:subscriber_count:%d',
|
||||
$this->profile_tag_id
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function delete($useWhere=false)
|
||||
public function delete($useWhere = false)
|
||||
{
|
||||
$result = parent::delete($useWhere);
|
||||
if ($result !== false) {
|
||||
self::blow('profile_list:subscriber_count:%d',
|
||||
$this->profile_tag_id);
|
||||
self::blow(
|
||||
'profile_list:subscriber_count:%d',
|
||||
$this->profile_tag_id
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for queue_item
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Queue_item extends Managed_DataObject
|
||||
{
|
||||
@ -13,7 +29,7 @@ class Queue_item extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $frame; // blob not_null
|
||||
public $transport; // varchar(32)
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
public $claimed; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
@ -26,7 +42,7 @@ class Queue_item extends Managed_DataObject
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
|
||||
'frame' => array('type' => 'blob', 'not null' => true, 'description' => 'data: object reference or opaque string'),
|
||||
'transport' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'queue for what? "email", "xmpp", "sms", "irc", ...'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'claimed' => array('type' => 'datetime', 'description' => 'date this item was claimed'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
@ -40,8 +56,8 @@ class Queue_item extends Managed_DataObject
|
||||
* @param mixed $transports name of a single queue or array of queues to pull from
|
||||
* If not specified, checks all queues in the system.
|
||||
*/
|
||||
static function top($transports=null, array $ignored_transports=array()) {
|
||||
|
||||
public static function top($transports = null, array $ignored_transports = [])
|
||||
{
|
||||
$qi = new Queue_item();
|
||||
if ($transports) {
|
||||
if (is_array($transports)) {
|
||||
@ -86,7 +102,7 @@ class Queue_item extends Managed_DataObject
|
||||
/**
|
||||
* Release a claimed item.
|
||||
*/
|
||||
function releaseClaim()
|
||||
public function releaseClaim()
|
||||
{
|
||||
// DB_DataObject doesn't let us save nulls right now
|
||||
$sql = sprintf("UPDATE queue_item SET claimed=NULL WHERE id=%d", $this->getID());
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for related_group
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Related_group extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -11,7 +28,7 @@ class Related_group extends Managed_DataObject
|
||||
public $__table = 'related_group'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $related_group_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -23,7 +40,7 @@ class Related_group extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'),
|
||||
'related_group_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('group_id', 'related_group_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for remember_me
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Remember_me extends Managed_DataObject
|
||||
{
|
||||
@ -12,7 +28,7 @@ class Remember_me extends Managed_DataObject
|
||||
public $__table = 'remember_me'; // table name
|
||||
public $code; // varchar(32) primary_key not_null
|
||||
public $user_id; // int(4) not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -23,7 +39,7 @@ class Remember_me 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 is logged in'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for reply
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Reply extends Managed_DataObject
|
||||
{
|
||||
@ -12,7 +28,7 @@ class Reply extends Managed_DataObject
|
||||
public $__table = 'reply'; // table name
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $replied_id; // int(4)
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
@ -24,7 +40,7 @@ class Reply extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the reply'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile replied to'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'replied_id' => array('type' => 'int', 'description' => 'notice replied to (not used, see notice.reply_to)'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'profile_id'),
|
||||
@ -44,7 +60,7 @@ class Reply extends Managed_DataObject
|
||||
/**
|
||||
* Wrapper for record insertion to update related caches
|
||||
*/
|
||||
function insert()
|
||||
public function insert()
|
||||
{
|
||||
$result = parent::insert();
|
||||
|
||||
@ -55,8 +71,13 @@ class Reply extends Managed_DataObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0)
|
||||
{
|
||||
public static function stream(
|
||||
$user_id,
|
||||
$offset = 0,
|
||||
$limit = NOTICES_PER_PAGE,
|
||||
$since_id = 0,
|
||||
$max_id = 0
|
||||
) {
|
||||
// FIXME: Use some other method to get Profile::current() in order
|
||||
// to avoid confusion between background processing and session user.
|
||||
$stream = new ReplyNoticeStream($user_id, Profile::current());
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for schema_version
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Schema_version extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -11,7 +28,7 @@ class Schema_version extends Managed_DataObject
|
||||
public $__table = 'schema_version'; // table name
|
||||
public $table_name; // varchar(64) primary_key not_null
|
||||
public $checksum; // varchar(64) not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -23,7 +40,7 @@ class Schema_version extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'table_name' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Table name'),
|
||||
'checksum' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Checksum of schema array; a mismatch indicates we should check the table more thoroughly.'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('table_name'),
|
||||
);
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Superclass representing a saved session as it exists in the database.
|
||||
*
|
||||
@ -45,8 +43,8 @@ class Session extends Managed_DataObject
|
||||
public $__table = 'session'; // table name
|
||||
public $id; // varchar(32) primary_key not_null
|
||||
public $session_data; // text()
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -62,8 +60,8 @@ class Session extends Managed_DataObject
|
||||
'fields' => [
|
||||
'id' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'session ID'],
|
||||
'session_data' => ['type' => 'text', 'description' => 'session data'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'indexes' => [
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for sms_carrier
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Sms_carrier extends Managed_DataObject
|
||||
{
|
||||
@ -13,13 +29,13 @@ class Sms_carrier extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $name; // varchar(64) unique_key
|
||||
public $email_pattern; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function toEmailAddress($sms)
|
||||
public function toEmailAddress($sms)
|
||||
{
|
||||
return sprintf($this->email_pattern, $sms);
|
||||
}
|
||||
@ -31,8 +47,8 @@ class Sms_carrier extends Managed_DataObject
|
||||
'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' => 191, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -37,8 +37,8 @@ class Subscription extends Managed_DataObject
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -51,8 +51,8 @@ class Subscription extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('subscriber', 'subscribed'),
|
||||
'unique keys' => array(
|
||||
|
@ -1,11 +1,25 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for subscription_queue
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Subscription_queue extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'subscription_queue'; // table name
|
||||
@ -20,7 +34,7 @@ class Subscription_queue extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'subscriber' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'),
|
||||
'subscribed' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile being subscribed to'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('subscriber', 'subscribed'),
|
||||
'indexes' => array(
|
||||
@ -47,14 +61,14 @@ class Subscription_queue extends Managed_DataObject
|
||||
return $rq;
|
||||
}
|
||||
|
||||
static function exists(Profile $subscriber, Profile $other)
|
||||
public static function exists(Profile $subscriber, Profile $other)
|
||||
{
|
||||
$sub = Subscription_queue::pkeyGet(array('subscriber' => $subscriber->getID(),
|
||||
'subscribed' => $other->getID()));
|
||||
return ($sub instanceof Subscription_queue);
|
||||
}
|
||||
|
||||
static function getSubQueue(Profile $subscriber, Profile $other)
|
||||
public static function getSubQueue(Profile $subscriber, Profile $other)
|
||||
{
|
||||
// This is essentially a pkeyGet but we have an object to return in NoResultException
|
||||
$sub = new Subscription_queue();
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for token
|
||||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Token extends Managed_DataObject
|
||||
{
|
||||
@ -17,8 +33,8 @@ class Token extends Managed_DataObject
|
||||
public $state; // tinyint(1)
|
||||
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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -34,8 +50,8 @@ class Token extends Managed_DataObject
|
||||
'state' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'for requests, 0 = initial, 1 = authorized, 2 = used'),
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key', 'tok'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,54 +1,48 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Data class for unavailable status networks
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Data
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Keeps a list of unavailable status network names
|
||||
*
|
||||
* @category Data
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see Managed_DataObject
|
||||
*/
|
||||
|
||||
class Unavailable_status_network extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'unavailable_status_network'; // table name
|
||||
|
||||
public $nickname; // varchar(64) UUID
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
|
||||
/**
|
||||
* The One True Thingy that must be defined and declared.
|
||||
@ -61,8 +55,7 @@ class Unavailable_status_network extends Managed_DataObject
|
||||
'nickname' => array('type' => 'varchar',
|
||||
'length' => 64,
|
||||
'not null' => true, 'description' => 'nickname not to use'),
|
||||
'created' => array('type' => 'datetime',
|
||||
'not null' => true, 'default' => '0000-00-00 00:00:00'),
|
||||
'created' => array('type' => 'datetime'),
|
||||
),
|
||||
'primary key' => array('nickname'),
|
||||
);
|
||||
|
@ -52,8 +52,8 @@ class User extends Managed_DataObject
|
||||
public $subscribe_policy; // tinyint(1)
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $private_stream; // bool default_false
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -86,8 +86,8 @@ class User extends Managed_DataObject
|
||||
'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'),
|
||||
'private_stream' => array('type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@ -40,8 +40,8 @@ class User_group extends Managed_DataObject
|
||||
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; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
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
|
||||
@ -74,8 +74,8 @@ class User_group extends Managed_DataObject
|
||||
'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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page for group info to link to'),
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class User_im_prefs extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -40,8 +38,8 @@ class User_im_prefs extends Managed_DataObject
|
||||
public $notify; // bool not_null default_false
|
||||
public $replies; // bool not_null default_false
|
||||
public $updatefrompresence; // bool not_null default_false
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -56,8 +54,8 @@ class User_im_prefs extends Managed_DataObject
|
||||
'notify' => array('type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify when a new notice is sent'),
|
||||
'replies' => array('type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Send replies from people not subscribed to'),
|
||||
'updatefrompresence' => array('type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Update from presence.'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id', 'transport'),
|
||||
'unique keys' => array(
|
||||
|
@ -24,7 +24,7 @@
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class User_location_prefs extends Managed_DataObject
|
||||
{
|
||||
@ -34,8 +34,8 @@ class User_location_prefs extends Managed_DataObject
|
||||
public $__table = 'user_location_prefs'; // table name
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $share_location; // bool default_true
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -46,8 +46,8 @@ class User_location_prefs extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who has the preference'),
|
||||
'share_location' => array('type' => 'bool', 'default' => true, 'description' => 'Whether to share location data'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@ -1,25 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class User_urlshortener_prefs extends Managed_DataObject
|
||||
{
|
||||
@ -31,8 +31,8 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $maxurllength; // int(4) not_null
|
||||
public $maxnoticelength; // int(4) not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -45,8 +45,8 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'maxurllength' => array('type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'),
|
||||
'maxnoticelength' => array('type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, -1 = only if notice text is longer than max allowed'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
@ -55,7 +55,7 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
);
|
||||
}
|
||||
|
||||
static function maxUrlLength($user)
|
||||
public static function maxUrlLength($user)
|
||||
{
|
||||
$def = common_config('url', 'maxurllength');
|
||||
|
||||
@ -68,7 +68,7 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function maxNoticeLength($user)
|
||||
public static function maxNoticeLength($user)
|
||||
{
|
||||
$def = common_config('url', 'maxnoticelength');
|
||||
|
||||
@ -90,7 +90,7 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function urlShorteningService($user)
|
||||
public static function urlShorteningService($user)
|
||||
{
|
||||
$def = common_config('url', 'shortener');
|
||||
|
||||
@ -107,7 +107,7 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
static function getPrefs($user)
|
||||
public static function getPrefs($user)
|
||||
{
|
||||
if (empty($user)) {
|
||||
return null;
|
||||
|
@ -14,13 +14,12 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Table Definition for user_username
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class User_username extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
@ -30,8 +29,8 @@ class User_username extends Managed_DataObject
|
||||
public $user_id; // int(4) 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 default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -43,8 +42,8 @@ class User_username extends Managed_DataObject
|
||||
'provider_name' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'provider name'),
|
||||
'username' => array('type' => 'varchar', 'not null' => true, '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, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('provider_name', 'username'),
|
||||
'indexes' => array(
|
||||
|
@ -145,8 +145,12 @@ class MysqlSchema extends Schema
|
||||
if (preg_match('/(^|\s)auto_increment(\s|$)/i', $extra)) {
|
||||
$field['auto_increment'] = true;
|
||||
}
|
||||
// $row['EXTRA'] may contain 'on update CURRENT_TIMESTAMP'
|
||||
// ^ ...... how to specify?
|
||||
if (preg_match(
|
||||
'/(^|\s)on update CURRENT_TIMESTAMP(\(\))?(\s|$)/i',
|
||||
$extra
|
||||
)) {
|
||||
$field['auto_update_timestamp'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$table_props = $this->getTableProperties($table, ['TABLE_COLLATION']);
|
||||
@ -457,13 +461,17 @@ class MysqlSchema extends Schema
|
||||
$line = [];
|
||||
$line[] = parent::columnSql($name, $cd);
|
||||
|
||||
// This'll have been added from our transform of 'serial' type
|
||||
// This'll have been added from our transform of "serial" type
|
||||
if (!empty($cd['auto_increment'])) {
|
||||
$line[] = 'auto_increment';
|
||||
$line[] = 'AUTO_INCREMENT';
|
||||
}
|
||||
// This'll have been added from our transform of "timestamp" type
|
||||
if (!empty($cd['auto_update_timestamp'])) {
|
||||
$line[] = 'ON UPDATE CURRENT_TIMESTAMP';
|
||||
}
|
||||
|
||||
if (!empty($cd['description'])) {
|
||||
$line[] = 'comment';
|
||||
$line[] = 'COMMENT';
|
||||
$line[] = $this->quoteValue($cd['description']);
|
||||
}
|
||||
|
||||
|
@ -413,24 +413,9 @@ class PgsqlSchema extends Schema
|
||||
// No convenient support for field descriptions
|
||||
unset($col['description']);
|
||||
|
||||
switch ($col['type']) {
|
||||
case 'serial':
|
||||
if ($col['type'] === 'serial') {
|
||||
$col['type'] = 'int';
|
||||
$col['auto_increment'] = true;
|
||||
break;
|
||||
case 'timestamp':
|
||||
// FIXME: ON UPDATE CURRENT_TIMESTAMP
|
||||
if (!array_key_exists('default', $col)) {
|
||||
$col['default'] = 'CURRENT_TIMESTAMP';
|
||||
}
|
||||
// no break
|
||||
case 'datetime':
|
||||
// Replace archaic MySQL-specific zero dates with NULL
|
||||
if (($col['default'] ?? null) === '0000-00-00 00:00:00') {
|
||||
$col['default'] = null;
|
||||
$col['not null'] = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$col['type'] = $this->mapType($col);
|
||||
|
@ -999,6 +999,23 @@ class Schema
|
||||
public function filterDef(string $tableName, array $tableDef)
|
||||
{
|
||||
foreach ($tableDef['fields'] as $name => &$col) {
|
||||
switch ($col['type']) {
|
||||
case 'timestamp':
|
||||
$col['type'] = 'datetime';
|
||||
if (!array_key_exists('default', $col)) {
|
||||
$col['default'] = 'CURRENT_TIMESTAMP';
|
||||
// FIXME: PostgreSQL support.
|
||||
$col['auto_update_timestamp'] = true;
|
||||
}
|
||||
// no break
|
||||
case 'datetime':
|
||||
// Replace archaic MariaDB-specific "zero dates" with NULL
|
||||
if (($col['default'] ?? null) === '0000-00-00 00:00:00') {
|
||||
$col['default'] = null;
|
||||
$col['not null'] = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (array_key_exists('default', $col) && is_null($col['default'])) {
|
||||
unset($col['default']);
|
||||
}
|
||||
|
@ -1,8 +1,25 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Table Definition for fave
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class Fave extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'fave'; // table name
|
||||
@ -19,7 +36,7 @@ class Fave extends Managed_DataObject
|
||||
'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' => 191, 'description' => 'universally unique identifier, usually a tag URI'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'user_id'),
|
||||
@ -47,7 +64,8 @@ class Fave extends Managed_DataObject
|
||||
* @return Fave record on success
|
||||
* @throws Exception on failure
|
||||
*/
|
||||
static function addNew(Profile $actor, Notice $target) {
|
||||
public static function addNew(Profile $actor, Notice $target)
|
||||
{
|
||||
if (self::existsForProfile($target, $actor)) {
|
||||
// TRANS: Client error displayed when trying to mark a notice as favorite that already is a favorite.
|
||||
throw new AlreadyFulfilledException(_('You have already favorited this!'));
|
||||
@ -61,9 +79,12 @@ class Fave extends Managed_DataObject
|
||||
$act->title = _("Favor");
|
||||
// TRANS: Message that is the "content" of a favorite (%1$s is the actor's nickname, %2$ is the favorited
|
||||
// notice's nickname and %3$s is the content of the favorited notice.)
|
||||
$act->content = sprintf(_('%1$s favorited something by %2$s: %3$s'),
|
||||
$actor->getNickname(), $target->getProfile()->getNickname(),
|
||||
$target->getRendered());
|
||||
$act->content = sprintf(
|
||||
_('%1$s favorited something by %2$s: %3$s'),
|
||||
$actor->getNickname(),
|
||||
$target->getProfile()->getNickname(),
|
||||
$target->getRendered()
|
||||
);
|
||||
$act->actor = $actor->asActivityObject();
|
||||
$act->target = $target->asActivityObject();
|
||||
$act->objects = array(clone($act->target));
|
||||
@ -79,7 +100,7 @@ class Fave extends Managed_DataObject
|
||||
return $stored;
|
||||
}
|
||||
|
||||
static function removeEntry(Profile $actor, Notice $target)
|
||||
public static function removeEntry(Profile $actor, Notice $target)
|
||||
{
|
||||
$fave = new Fave();
|
||||
$fave->user_id = $actor->getID();
|
||||
@ -121,14 +142,12 @@ class Fave extends Managed_DataObject
|
||||
$notice = $this->getTarget();
|
||||
|
||||
if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) {
|
||||
|
||||
$result = parent::delete($useWhere);
|
||||
|
||||
if ($result !== false) {
|
||||
Event::handle('EndDisfavorNotice', array($profile, $notice));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (NoResultException $e) {
|
||||
// In case there's some inconsistency where the profile or notice was deleted without losing the fave db entry
|
||||
common_log(LOG_INFO, '"'.get_class($e->obj).'" with id=='.var_export($e->obj->id, true).' object not found when deleting favorite, ignoring...');
|
||||
@ -152,27 +171,41 @@ class Fave extends Managed_DataObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
// FIXME: Instead of $own, send the scoped Profile so we can pass it along directly to FaveNoticeStream
|
||||
// and preferrably we should get a Profile instead of $user_id
|
||||
static function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
|
||||
{
|
||||
// FIXME: Instead of $own, send the scoped Profile so we can pass it along
|
||||
// directly to FaveNoticeStream and preferrably we should get a Profile
|
||||
// instead of $user_id
|
||||
public static function stream(
|
||||
$user_id,
|
||||
$offset = 0,
|
||||
$limit = NOTICES_PER_PAGE,
|
||||
$own = false,
|
||||
$since_id = 0,
|
||||
$max_id = 0
|
||||
) {
|
||||
$target = Profile::getByID($user_id);
|
||||
$stream = new FaveNoticeStream($target, ($own ? $target : null));
|
||||
|
||||
return $stream->getNotices($offset, $limit, $since_id, $max_id);
|
||||
}
|
||||
|
||||
// FIXME: Instead of $own, send the scoped Profile so we can pass it along directly to FaveNoticeStream
|
||||
// and preferrably we should get a Profile instead of $user_id
|
||||
function idStream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
|
||||
{
|
||||
// FIXME: Instead of $own, send the scoped Profile so we can pass it along
|
||||
// directly to FaveNoticeStream and preferrably we should get a Profile
|
||||
// instead of $user_id
|
||||
public function idStream(
|
||||
$user_id,
|
||||
$offset = 0,
|
||||
$limit = NOTICES_PER_PAGE,
|
||||
$own = false,
|
||||
$since_id = 0,
|
||||
$max_id = 0
|
||||
) {
|
||||
$target = Profile::getByID($user_id);
|
||||
$stream = new FaveNoticeStream($target, ($own ? $target : null));
|
||||
|
||||
return $stream->getNoticeIds($offset, $limit, $since_id, $max_id);
|
||||
}
|
||||
|
||||
function asActivity()
|
||||
public function asActivity()
|
||||
{
|
||||
$target = $this->getTarget();
|
||||
$actor = $this->getActor();
|
||||
@ -190,9 +223,12 @@ class Fave extends Managed_DataObject
|
||||
$act->title = _("Favor");
|
||||
// TRANS: Message that is the "content" of a favorite (%1$s is the actor's nickname, %2$ is the favorited
|
||||
// notice's nickname and %3$s is the content of the favorited notice.)
|
||||
$act->content = sprintf(_('%1$s favorited something by %2$s: %3$s'),
|
||||
$actor->getNickname(), $target->getProfile()->getNickname(),
|
||||
$target->getRendered());
|
||||
$act->content = sprintf(
|
||||
_('%1$s favorited something by %2$s: %3$s'),
|
||||
$actor->getNickname(),
|
||||
$target->getProfile()->getNickname(),
|
||||
$target->getRendered()
|
||||
);
|
||||
$act->context = new ActivityContext();
|
||||
$act->context->replyToID = $target->getUri();
|
||||
try {
|
||||
@ -205,9 +241,13 @@ class Fave extends Managed_DataObject
|
||||
$act->target = $target->asActivityObject();
|
||||
$act->objects = array(clone($act->target));
|
||||
|
||||
$url = common_local_url('AtomPubShowFavorite',
|
||||
array('profile' => $actor->id,
|
||||
'notice' => $target->id));
|
||||
$url = common_local_url(
|
||||
'AtomPubShowFavorite',
|
||||
[
|
||||
'profile' => $actor->id,
|
||||
'notice' => $target->id,
|
||||
]
|
||||
);
|
||||
|
||||
$act->selfLink = $url;
|
||||
$act->editLink = $url;
|
||||
@ -215,7 +255,7 @@ class Fave extends Managed_DataObject
|
||||
return $act;
|
||||
}
|
||||
|
||||
static function existsForProfile($notice, Profile $scoped)
|
||||
public static function existsForProfile($notice, Profile $scoped)
|
||||
{
|
||||
$fave = self::pkeyGet(array('user_id'=>$scoped->id, 'notice_id'=>$notice->id));
|
||||
|
||||
@ -235,7 +275,7 @@ class Fave extends Managed_DataObject
|
||||
* @todo integrate with Fave::stream()
|
||||
*/
|
||||
|
||||
static function byProfile($profileId, $offset, $limit)
|
||||
public static function byProfile($profileId, $offset, $limit)
|
||||
{
|
||||
$fav = new Fave();
|
||||
|
||||
@ -250,7 +290,7 @@ class Fave extends Managed_DataObject
|
||||
return $fav;
|
||||
}
|
||||
|
||||
static function countByProfile(Profile $profile)
|
||||
public static function countByProfile(Profile $profile)
|
||||
{
|
||||
$c = Cache::instance();
|
||||
if (!empty($c)) {
|
||||
@ -271,7 +311,7 @@ class Fave extends Managed_DataObject
|
||||
return $cnt;
|
||||
}
|
||||
|
||||
static protected $_faves = array();
|
||||
protected static $_faves = [];
|
||||
|
||||
/**
|
||||
* All faves of this notice
|
||||
@ -280,7 +320,7 @@ class Fave extends Managed_DataObject
|
||||
*
|
||||
* @return array Array of Fave objects
|
||||
*/
|
||||
static public function byNotice($notice)
|
||||
public static function byNotice($notice)
|
||||
{
|
||||
if (!isset(self::$_faves[$notice->id])) {
|
||||
self::fillFaves(array($notice->id));
|
||||
@ -288,13 +328,13 @@ class Fave extends Managed_DataObject
|
||||
return self::$_faves[$notice->id];
|
||||
}
|
||||
|
||||
static public function fillFaves(array $notice_ids)
|
||||
public static function fillFaves(array $notice_ids)
|
||||
{
|
||||
$faveMap = Fave::listGet('notice_id', $notice_ids);
|
||||
self::$_faves = array_replace(self::$_faves, $faveMap);
|
||||
}
|
||||
|
||||
static public function blowCacheForProfileId($profile_id)
|
||||
public static function blowCacheForProfileId($profile_id)
|
||||
{
|
||||
$cache = Cache::instance();
|
||||
if ($cache) {
|
||||
@ -307,7 +347,7 @@ class Fave extends Managed_DataObject
|
||||
$cache->delete(Cache::key('fave:count_by_profile:'.$profile_id));
|
||||
}
|
||||
}
|
||||
static public function blowCacheForNoticeId($notice_id)
|
||||
public static function blowCacheForNoticeId($notice_id)
|
||||
{
|
||||
$cache = Cache::instance();
|
||||
if ($cache) {
|
||||
@ -317,7 +357,7 @@ class Fave extends Managed_DataObject
|
||||
|
||||
// Remember that we want the _activity_ notice here, not faves applied
|
||||
// to the supplied Notice (as with byNotice)!
|
||||
static public function fromStored(Notice $stored)
|
||||
public static function fromStored(Notice $stored)
|
||||
{
|
||||
$class = get_called_class();
|
||||
$object = new $class;
|
||||
@ -336,12 +376,12 @@ class Fave extends Managed_DataObject
|
||||
*
|
||||
* @throws NoResultException when it can't find what it's looking for.
|
||||
*/
|
||||
static public function getTargetFromStored(Notice $stored)
|
||||
public static function getTargetFromStored(Notice $stored)
|
||||
{
|
||||
return self::fromStored($stored)->getTarget();
|
||||
}
|
||||
|
||||
static public function getObjectType()
|
||||
public static function getObjectType()
|
||||
{
|
||||
return ActivityObject::ACTIVITY;
|
||||
}
|
||||
@ -364,7 +404,7 @@ class Fave extends Managed_DataObject
|
||||
* @param ActivityObject $actobj The _favored_ notice (which we're "in-reply-to")
|
||||
* @param Notice $stored The _activity_ notice, i.e. the favor itself.
|
||||
*/
|
||||
static public function parseActivityObject(ActivityObject $actobj, Notice $stored)
|
||||
public static function parseActivityObject(ActivityObject $actobj, Notice $stored)
|
||||
{
|
||||
// throws exception if nothing was found, but it could also be a non-Notice...
|
||||
// FIXME: This should only test _one_ URI (and not the links etc.) though a function like this could be useful in other cases
|
||||
@ -384,8 +424,11 @@ class Fave extends Managed_DataObject
|
||||
return $object;
|
||||
}
|
||||
|
||||
static public function extendActivity(Notice $stored, Activity $act, Profile $scoped=null)
|
||||
{
|
||||
public static function extendActivity(
|
||||
Notice $stored,
|
||||
Activity $act,
|
||||
Profile $scoped = null
|
||||
) {
|
||||
$target = self::getTargetFromStored($stored);
|
||||
|
||||
// The following logic was copied from StatusNet's Activity plugin
|
||||
@ -402,7 +445,7 @@ class Fave extends Managed_DataObject
|
||||
$act->title = ActivityUtils::verbToTitle($act->verb);
|
||||
}
|
||||
|
||||
static function saveActivityObject(ActivityObject $actobj, Notice $stored)
|
||||
public static function saveActivityObject(ActivityObject $actobj, Notice $stored)
|
||||
{
|
||||
$object = self::parseActivityObject($actobj, $stored);
|
||||
$object->insert(); // exception throwing in Fave's case!
|
||||
|
@ -47,8 +47,8 @@ class Activitypub_profile extends Managed_DataObject
|
||||
public $homepage; // text()
|
||||
public $bio; // text() multiple_key
|
||||
public $location; // text()
|
||||
public $created; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/**
|
||||
* Return table definition for Schema setup and DB_DataObject usage.
|
||||
@ -64,8 +64,8 @@ class Activitypub_profile extends Managed_DataObject
|
||||
'profile_id' => ['type' => 'int', 'not null' => true],
|
||||
'inboxuri' => ['type' => 'text', 'not null' => true],
|
||||
'sharedInboxuri' => ['type' => 'text'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['profile_id'],
|
||||
'foreign keys' => [
|
||||
|
@ -40,8 +40,8 @@ class Activitypub_rsa extends Managed_DataObject
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $private_key; // text() not_null
|
||||
public $public_key; // text() not_null
|
||||
public $created; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/**
|
||||
* Return table definition for Schema setup and DB_DataObject usage.
|
||||
@ -56,8 +56,8 @@ class Activitypub_rsa extends Managed_DataObject
|
||||
'profile_id' => ['type' => 'int', 'not null' => true],
|
||||
'private_key' => ['type' => 'text'],
|
||||
'public_key' => ['type' => 'text', 'not null' => true],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['profile_id'],
|
||||
'foreign keys' => [
|
||||
|
@ -1,37 +1,30 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Data class for favorites talley
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Data
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Data class for favorites tally
|
||||
@ -39,10 +32,10 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
* A class representing a total number of times a notice has been favored
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Fave_tally extends Managed_DataObject
|
||||
{
|
||||
@ -52,8 +45,8 @@ class Fave_tally extends Managed_DataObject
|
||||
public $__table = 'fave_tally'; // table name
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $count; // int(4) not_null
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -64,7 +57,7 @@ class Fave_tally extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id'),
|
||||
'count' => array('type' => 'int', 'not null' => true, 'description' => 'the fave tally count'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id'),
|
||||
@ -81,7 +74,7 @@ class Fave_tally extends Managed_DataObject
|
||||
*
|
||||
* @return Fave_tally $tally the tally data object
|
||||
*/
|
||||
static function increment($noticeID)
|
||||
public static function increment($noticeID)
|
||||
{
|
||||
$tally = Fave_tally::ensureTally($noticeID);
|
||||
|
||||
@ -109,7 +102,7 @@ class Fave_tally extends Managed_DataObject
|
||||
*
|
||||
* @return Fave_tally $tally the tally data object
|
||||
*/
|
||||
static function decrement($noticeID)
|
||||
public static function decrement($noticeID)
|
||||
{
|
||||
$tally = Fave_tally::ensureTally($noticeID);
|
||||
|
||||
@ -140,7 +133,7 @@ class Fave_tally extends Managed_DataObject
|
||||
*
|
||||
* @return Fave_tally the tally data object
|
||||
*/
|
||||
static function ensureTally($noticeID)
|
||||
public static function ensureTally($noticeID)
|
||||
{
|
||||
$tally = Fave_tally::getKV('notice_id', $noticeID);
|
||||
|
||||
@ -172,7 +165,7 @@ class Fave_tally extends Managed_DataObject
|
||||
*
|
||||
* @return integer $total total number of time the notice has been favored
|
||||
*/
|
||||
static function countExistingFaves($noticeID)
|
||||
public static function countExistingFaves($noticeID)
|
||||
{
|
||||
$fave = new Fave();
|
||||
$fave->notice_id = $noticeID;
|
||||
|
@ -20,21 +20,19 @@
|
||||
* @category Data
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Data class for email summaries
|
||||
*
|
||||
* Email summary information for users
|
||||
*
|
||||
* @category Action
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see DB_DataObject
|
||||
@ -55,7 +53,7 @@ class Email_summary_status extends Managed_DataObject
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user id'),
|
||||
'send_summary' => array('type' => 'bool', 'default' => true, 'not null' => true, 'description' => 'whether to send a summary or not'),
|
||||
'last_summary_id' => array('type' => 'int', 'description' => 'last summary id'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Allows administrators to define additional profile fields for the users of a GNU social installation.
|
||||
*
|
||||
* @category Widget
|
||||
* @package GNU social
|
||||
* @package GNUsocial
|
||||
* @author Max Shinn <trombonechamp@gmail.com>
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @copyright 2011-2019 Free Software Foundation, Inc http://www.fsf.org
|
||||
@ -35,8 +35,8 @@ class GNUsocialProfileExtensionField extends Managed_DataObject
|
||||
public $title; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $description; // text
|
||||
public $type; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
@ -47,8 +47,8 @@ class GNUsocialProfileExtensionField extends Managed_DataObject
|
||||
'title' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'field title'],
|
||||
'description' => ['type' => 'text', 'not null' => true, 'description' => 'field description'],
|
||||
'type' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'field type'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'indexes' => [
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Allows administrators to define additional profile fields for the users of a GNU social installation.
|
||||
*
|
||||
* @category Widget
|
||||
* @package GNU social
|
||||
* @package GNUsocial
|
||||
* @author Max Shinn <trombonechamp@gmail.com>
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @copyright 2011-2019 Free Software Foundation, Inc http://www.fsf.org
|
||||
@ -34,8 +34,8 @@ class GNUsocialProfileExtensionResponse extends Managed_DataObject
|
||||
public $extension_id; // int(11)
|
||||
public $profile_id; // int(11)
|
||||
public $value; // text
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
@ -45,8 +45,8 @@ class GNUsocialProfileExtensionResponse extends Managed_DataObject
|
||||
'extension_id' => ['type' => 'int', 'not null' => true, 'description' => 'The extension field ID'],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'Profile id that made the response'],
|
||||
'value' => ['type' => 'text', 'not null' => true, 'description' => 'response entry'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
// Syntax: foreign_key_name => [remote_table, local_key => remote_key]]
|
||||
|
@ -36,7 +36,7 @@ class Usage_stats extends Managed_DataObject
|
||||
public $__table = 'usage_stats'; // table name
|
||||
public $type; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $count; // int(4)
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/**
|
||||
* Table Definition for usage_stats
|
||||
@ -50,7 +50,7 @@ class Usage_stats extends Managed_DataObject
|
||||
'fields' => [
|
||||
'type' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'Type of countable entity'],
|
||||
'count' => ['type' => 'int', 'size' => 'int', 'default' => 0, 'description' => 'Number of entities of this type'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['type'],
|
||||
'indexes' => [
|
||||
|
@ -63,8 +63,8 @@ class Ostatus_profile extends Managed_DataObject
|
||||
'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),
|
||||
'created' => array('type' => 'datetime'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true),
|
||||
),
|
||||
'primary key' => array('uri'),
|
||||
'unique keys' => array(
|
||||
|
@ -20,14 +20,12 @@
|
||||
* @category Data
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Data class for counting notices by date
|
||||
*
|
||||
@ -38,7 +36,7 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
* of notices posted on that day. Since, after the end of the day,
|
||||
* this number doesn't change, it's a good candidate for persistent caching.
|
||||
*
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see DB_DataObject
|
||||
@ -49,8 +47,8 @@ class Sitemap_notice_count extends Managed_DataObject
|
||||
|
||||
public $notice_date; // date primary_key not_null
|
||||
public $notice_count; // int(4)
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -58,7 +56,7 @@ class Sitemap_notice_count extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'notice_date' => array('type' => 'date', 'not null' => true, 'description' => 'record date'),
|
||||
'notice_count' => array('type' => 'int', 'not null' => true, 'description' => 'the notice count'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_date'),
|
||||
|
@ -20,21 +20,19 @@
|
||||
* @category Data
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
/**
|
||||
* Data class for counting users by date
|
||||
*
|
||||
* We make a separate sitemap for each user registered by date.
|
||||
* To save ourselves some processing effort, we cache this data
|
||||
*
|
||||
* @copyright 2010, StatusNet, Inc.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see DB_DataObject
|
||||
@ -45,8 +43,8 @@ class Sitemap_user_count extends Managed_DataObject
|
||||
|
||||
public $registration_date; // date primary_key not_null
|
||||
public $user_count; // int(4)
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -54,7 +52,7 @@ class Sitemap_user_count extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'registration_date' => array('type' => 'date', 'not null' => true, 'description' => 'record date'),
|
||||
'user_count' => array('type' => 'int', 'not null' => true, 'description' => 'the user count of the recorded date'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('registration_date'),
|
||||
|
@ -1,43 +1,36 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Data class for remembering notice-to-status mappings
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Data
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Data class for mapping notices to statuses
|
||||
*
|
||||
* Notices flow back and forth between Twitter and StatusNet. We use this
|
||||
* table to remember which StatusNet notice corresponds to which Twitter
|
||||
* Notices flow back and forth between Twitter and GNU social. We use this
|
||||
* table to remember which GNU social notice corresponds to which Twitter
|
||||
* status.
|
||||
*
|
||||
* Note that notice_id is unique only within a single database; if you
|
||||
@ -45,21 +38,20 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
* that instead, since it's universally unique.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see DB_DataObject
|
||||
*/
|
||||
|
||||
class Notice_to_status extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'notice_to_status'; // table name
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $status_id; // bigint not_null
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@ -67,7 +59,7 @@ class Notice_to_status extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'local notice id'),
|
||||
'status_id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'twitter status id'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id'),
|
||||
@ -89,7 +81,7 @@ class Notice_to_status extends Managed_DataObject
|
||||
*
|
||||
* @return Notice_to_status new object for this value
|
||||
*/
|
||||
static function saveNew($notice_id, $status_id)
|
||||
public static function saveNew($notice_id, $status_id)
|
||||
{
|
||||
if (empty($notice_id)) {
|
||||
throw new Exception("Invalid notice_id $notice_id");
|
||||
|
@ -1,37 +1,30 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Data class for profile flags
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Data
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Data class for profile flags
|
||||
@ -39,10 +32,10 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
* A class representing a user flagging another profile for review.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class User_flag_profile extends Managed_DataObject
|
||||
{
|
||||
@ -52,9 +45,9 @@ class User_flag_profile extends Managed_DataObject
|
||||
public $__table = 'user_flag_profile'; // table name
|
||||
public $profile_id; // int(11) primary_key not_null
|
||||
public $user_id; // int(11) primary_key not_null
|
||||
public $cleared; // datetime default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $cleared; // datetime()
|
||||
public $created; // datetime()
|
||||
public $modified; // timestamp() not_null
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@ -66,7 +59,7 @@ class User_flag_profile extends Managed_DataObject
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile id flagged'),
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user id of the actor'),
|
||||
'cleared' => array('type' => 'datetime', 'description' => 'when flag was removed'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'user_id'),
|
||||
@ -85,7 +78,7 @@ class User_flag_profile extends Managed_DataObject
|
||||
*
|
||||
* @return boolean true if exists, else false
|
||||
*/
|
||||
static function exists($profile_id, $user_id)
|
||||
public static function exists($profile_id, $user_id)
|
||||
{
|
||||
$ufp = User_flag_profile::pkeyGet(array('profile_id' => $profile_id,
|
||||
'user_id' => $user_id));
|
||||
@ -101,7 +94,7 @@ class User_flag_profile extends Managed_DataObject
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
static function create($user_id, $profile_id)
|
||||
public static function create($user_id, $profile_id)
|
||||
{
|
||||
$ufp = new User_flag_profile();
|
||||
|
||||
@ -112,8 +105,10 @@ class User_flag_profile extends Managed_DataObject
|
||||
if (!$ufp->insert()) {
|
||||
// TRANS: Server exception.
|
||||
// TRANS: %d is a profile ID (number).
|
||||
$msg = sprintf(_m('Could not flag profile "%d" for review.'),
|
||||
$profile_id);
|
||||
$msg = sprintf(
|
||||
_m('Could not flag profile "%d" for review.'),
|
||||
$profile_id
|
||||
);
|
||||
throw new ServerException($msg);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user