minor fixes related to postgres development

This commit is contained in:
friendica 2013-05-05 19:34:56 -07:00
parent ef07b71bc7
commit 6f04a7e070
7 changed files with 1094 additions and 1094 deletions

View File

@ -38,10 +38,10 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/BaseObject.php'); require_once('include/BaseObject.php');
require_once('include/features.php'); require_once('include/features.php');
define ( 'RED_PLATFORM', 'Red'); define ( 'RED_PLATFORM', 'Red' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1040 ); define ( 'DB_UPDATE_VERSION', 1041 );
define ( 'EOL', '<br />' . "\r\n" ); define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -107,6 +107,7 @@ function create_account($arr) {
$parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 ); $parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 );
$flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK); $flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK);
$roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 ); $roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 );
$expires = ((x($arr,'expires')) ? intval($arr['expires']) : '0000-00-00 00:00:00');
$default_service_class = get_config('system','default_service_class'); $default_service_class = get_config('system','default_service_class');
if($default_service_class === false) if($default_service_class === false)

View File

@ -6,12 +6,12 @@
$session_exists = 0; $session_exists = 0;
$session_expire = 180000; $session_expire = 180000;
if(! function_exists('ref_session_open')) {
function ref_session_open ($s,$n) { function ref_session_open ($s,$n) {
return true; return true;
}} }
if(! function_exists('ref_session_read')) {
function ref_session_read ($id) { function ref_session_read ($id) {
global $session_exists; global $session_exists;
if(x($id)) if(x($id))
@ -21,9 +21,9 @@ function ref_session_read ($id) {
return $r[0]['data']; return $r[0]['data'];
} }
return ''; return '';
}} }
if(! function_exists('ref_session_write')) {
function ref_session_write ($id,$data) { function ref_session_write ($id,$data) {
global $session_exists, $session_expire; global $session_exists, $session_expire;
if(! $id || ! $data) { if(! $id || ! $data) {
@ -44,25 +44,25 @@ function ref_session_write ($id,$data) {
dbesc($id), dbesc($default_expire), dbesc($data)); dbesc($id), dbesc($default_expire), dbesc($data));
return true; return true;
}} }
if(! function_exists('ref_session_close')) {
function ref_session_close() { function ref_session_close() {
return true; return true;
}} }
if(! function_exists('ref_session_destroy')) {
function ref_session_destroy ($id) { function ref_session_destroy ($id) {
q("DELETE FROM `session` WHERE `sid` = '%s'", dbesc($id)); q("DELETE FROM `session` WHERE `sid` = '%s'", dbesc($id));
return true; return true;
}} }
if(! function_exists('ref_session_gc')) {
function ref_session_gc($expire) { function ref_session_gc($expire) {
q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time())); q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time()));
q("OPTIMIZE TABLE `sess_data`"); q("OPTIMIZE TABLE `sess_data`");
return true; return true;
}} }
$gc_probability = 50; $gc_probability = 50;
@ -71,6 +71,4 @@ ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', 1); ini_set('session.cookie_httponly', 1);
session_set_save_handler ('ref_session_open', 'ref_session_close', session_set_save_handler ('ref_session_open', 'ref_session_close', 'ref_session_read', 'ref_session_write', 'ref_session_destroy', 'ref_session_gc');
'ref_session_read', 'ref_session_write',
'ref_session_destroy', 'ref_session_gc');

View File

@ -768,7 +768,7 @@ CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sid` char(255) NOT NULL, `sid` char(255) NOT NULL,
`data` text NOT NULL, `data` text NOT NULL,
`expire` int(10) unsigned NOT NULL, `expire` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `sid` (`sid`), KEY `sid` (`sid`),
KEY `expire` (`expire`) KEY `expire` (`expire`)
@ -832,7 +832,7 @@ CREATE TABLE IF NOT EXISTS `tokens` (
`id` varchar(40) NOT NULL, `id` varchar(40) NOT NULL,
`secret` text NOT NULL, `secret` text NOT NULL,
`client_id` varchar(20) NOT NULL, `client_id` varchar(20) NOT NULL,
`expires` int(11) NOT NULL, `expires` bigint(20) unsigned NOT NULL,
`scope` varchar(200) NOT NULL, `scope` varchar(200) NOT NULL,
`uid` int(11) NOT NULL, `uid` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1040 ); define( 'UPDATE_VERSION' , 1041 );
/** /**
* *
@ -513,3 +513,13 @@ function update_r1039() {
return UPDATE_FAILED; return UPDATE_FAILED;
} }
function update_r1040() {
$r = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL,
ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
2013-05-02.301 2013-05-05.304